diff options
-rw-r--r-- | app.js | 9 | ||||
-rw-r--r-- | index.html | 3 | ||||
-rw-r--r-- | kartik.bat | 2 | ||||
-rw-r--r-- | online/server.json | 2 | ||||
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | views/credits.html | 9 | ||||
-rw-r--r-- | views/menu.html | 2 | ||||
-rw-r--r-- | views/script/core_chart.js | 26 | ||||
-rw-r--r-- | views/script/core_music.js | 89 | ||||
-rw-r--r-- | views/script/credits_libs.js | 6 |
10 files changed, 82 insertions, 68 deletions
@@ -217,7 +217,7 @@ const { app, BrowserWindow } = require('electron'); }) global.shouldExitIfClosed = true; - win.hide(); + console.log(" * Starting IPC engine"); win.pwidth = Math.round(720 * scale); @@ -241,12 +241,7 @@ const { app, BrowserWindow } = require('electron'); win.music = fs.readFileSync(homedir + "/.kartik/config/music.txt").toString().trim() === "1"; win.voice = fs.readFileSync(homedir + "/.kartik/config/voice.txt").toString().trim() === "2"; - // TODO: Enable online mode when stable - if (dimga === "stable") { - win.online = false; - } else { - win.online = fs.readFileSync(homedir + "/.kartik/config/online.txt").toString().trim() === "1"; - } + win.online = fs.readFileSync(homedir + "/.kartik/config/online.txt").toString().trim() === "1"; win.resources = resources; global.currentSongValue = null; @@ -86,9 +86,8 @@ <script> document.write(`<webview id="wb" src="views/loader.html" style="border: 0;z-index:2;top:0;left:0;right:0;bottom:0;position:fixed;" nodeintegration disablewebsecurity allowpopups webpreferences="nodeIntegration,contextIsolation=no"></webview>`); if (require('@electron/remote').getCurrentWindow().update !== "stable") { - document.write(`<div style="position: fixed;top: 0;left: 0;right: 0;height: auto;font-family: sans-serif;font-size: 12px;background: red;z-index: 9;text-align: center;">EXPERIMENTAL BUILD, NOT FOR PRODUCTION —${require('@electron/remote').getCurrentWindow().channel}${require('./package.json').version} — ${require('./package.json').serial} — <span style="font-family:sans-serif;font-size:12px;" id="experimental-ramusage">NaN</span> MiB</div>`); + document.write(`<div style="position: fixed;top: 10px;left: 10px;right: 10px;height: auto;font-size: 10px;background: rgba(255, 0, 0, .5);z-index: 9;text-align: center;color: white;border-radius: 999px;">Experimental Build:${require('@electron/remote').getCurrentWindow().channel}${require('./package.json').version}, do not use in production | SKU: <span style="font-family:monospace;font-size:12px;" id="experimental-sku">KRTK-1@${require('./package.json').serial}</span> | Mem: <span style="font-family:monospace;font-size:12px;" id="experimental-ramusage">NaN</span> MiB</div>`); } - //document.write(`<webview id="wb" src="about:blank" style="border: 0;z-index:2;top:0;left:0;right:0;bottom:0;position:fixed;" nodeintegration disablewebsecurity allowpopups webpreferences="nodeIntegration,contextIsolation=no"></webview>`); </script> </div> <script src="./views/script/core_chart.js"></script> @@ -1,2 +1,2 @@ @echo off -bin\win32\kartik-core.exe app.js
\ No newline at end of file +bin\win32\kartik-core.exe app.js diff --git a/online/server.json b/online/server.json index 19726bf..905621c 100644 --- a/online/server.json +++ b/online/server.json @@ -1,4 +1,4 @@ { - "hostname": "192.168.1.51", + "hostname": "kartik.hopto.org", "port": 8448 } diff --git a/package.json b/package.json index f1485c6..d797f9d 100644 --- a/package.json +++ b/package.json @@ -1 +1 @@ -{"name":"kartik","version":"634dc4c","channel":"git","description":"A multiplatform 2D karting game","main":"app.js","dependencies":{"@electron/remote":"^1.0.4","discord-rpc":"^3.2.0","electron":"^12.0.1","ini":"^1.3.8","jquery":"^3.6.0","os-locale":"^5.0.0","uuid":"^8.3.2","yaml":"^1.10.2"},"scripts":{"test":"node_modules\\electron\\dist\\electron.exe app.js"},"author":"Minteck Projects","license":"GPL-3.0-or-later","serial":"XXX99999999999"}
\ No newline at end of file +{"name":"kartik","version":"3e62534","channel":"git","description":"A multiplatform 2D karting game","main":"app.js","dependencies":{"@electron/remote":"^1.0.4","discord-rpc":"^3.2.0","electron":"^12.0.1","ini":"^1.3.8","jquery":"^3.6.0","os-locale":"^5.0.0","uuid":"^8.3.2","yaml":"^1.10.2"},"scripts":{"test":"node_modules\\electron\\dist\\electron.exe app.js"},"author":"Minteck Projects","license":"GPL-3.0-or-later","serial":"XXX99999999999"}
\ No newline at end of file diff --git a/views/credits.html b/views/credits.html index e3ff9f9..46978b6 100644 --- a/views/credits.html +++ b/views/credits.html @@ -39,10 +39,13 @@ <!-- START credits --> - <h2>Kartik, a 2D car race game</h2> - <p>© Minteck Projects. All assets are licensed under their original license rather than Kartik's license.</p> + <h2>Kartik, a 2D car racing game</h2> + <p>© Minteck Projects/Cutefox Studios. All assets are licensed under their original license rather than Kartik's license.</p> <p class="technical"><script src="./script/credits_technical.js"></script></p> + made by<br> + <img id="banner" src="common/banner.gif" style="width:380px;"> + <p class="cred-title">Lead</p> <p class="cred-content">Minteck</p> @@ -184,7 +187,7 @@ <p class="cred-content">Minteck<br>Romain<br>Redman 054<br>Oxymillion</p> <p class="cred-title">Libraries</p> - <p class="cred-content"><script src="./script/credits_libs.js"></script></p> + <div class="cred-content" style="display:grid;grid-template-columns: 1fr 1fr 1fr; text-align:center;"><script src="./script/credits_libs.js"></script></div> <!-- END credits --> diff --git a/views/menu.html b/views/menu.html index 0c6849f..661d397 100644 --- a/views/menu.html +++ b/views/menu.html @@ -41,7 +41,7 @@ <script id="prefill"> if (require('@electron/remote').getCurrentWindow().online) { document.write(`<li><span class="item"><a href="#" id="play"><img class="item-icon" src="../icons/local.svg"> ${lang.online.menu.local}</a></span></li>`) - document.write(`<li><span class="item"><a href="#" id="online"><img class="item-icon" src="../icons/online.svg"> ${lang.online.menu.online} <span style="font-size: 10px;vertical-align: middle;display: inline-block;border-radius: 999px;padding: 2px 5px;background: #9c6500;">BETA</span></a></span></li>`); + document.write(`<li><span class="item"><a href="#" id="online"><img class="item-icon" src="../icons/online.svg"> ${lang.online.menu.online}</a></span></li>`); document.write(`<li><span class="item"><a href="#" id="settings"><img class="item-icon" src="../icons/settings.svg"> ${lang.menu.titles[2]}</a></span></li>`); } else { document.write(`<li><span class="item"><a href="#" id="play"><img class="item-icon" src="../icons/local.svg"> ${lang.online.menu.local}</a></span></li>`) diff --git a/views/script/core_chart.js b/views/script/core_chart.js index 179dd82..d34ce21 100644 --- a/views/script/core_chart.js +++ b/views/script/core_chart.js @@ -8,33 +8,42 @@ setInterval(() => { file = webview.getURL().split("/")[webview.getURL().split("/").length - 1]; activity = lang.discord.game[0]; - enableActivity = true; + enableActivity = false; eaid = ""; switch (file) { case "game.html?online": + enableActivity = true; activity = lang.online.discord; break; case "game.html?sp": + enableActivity = true; activity = lang.discord.game[1]; break; case "game.html": + enableActivity = true; activity = lang.discord.game[2]; break; case "intro.html": + enableActivity = true; activity = lang.discord.intro[1]; break; case "settings.html": + case "stats.html": + enableActivity = true; activity = lang.discord.settings[1]; break; case "credits.html": + enableActivity = true; activity = lang.discord.credits[1]; break; case "online.html": + enableActivity = true; activity = lang.online.discord2; break; case "menu.html": case "win.html": + enableActivity = true; activity = lang.discord.credits[0]; break; case "loader.html": @@ -53,11 +62,20 @@ setInterval(() => { } if (require('./package.json').channel === "git") { - document.getElementById('experimental-ramusage').innerText = currentMemoryMib; - document.title="Kartik Trunk " +require('./package.json').version + eaid; + if (currentMemory < 100) { + document.getElementById('experimental-ramusage').innerText = "0" + currentMemoryMib; + } else { + document.getElementById('experimental-ramusage').innerText = currentMemoryMib; + } + buff = Buffer.from(activity, 'utf-8').toString("hex"); + document.title="Kartik Trunk " +require('./package.json').version + "-" + require('./package.json').serial.toLowerCase() + "-debugkeys - <Debugging On>"; } else { if (require('./package.json').channel !== "stable") { - document.getElementById('experimental-ramusage').innerText = currentMemoryMib; + if (currentMemory < 100) { + document.getElementById('experimental-ramusage').innerText = "0" + currentMemoryMib; + } else { + document.getElementById('experimental-ramusage').innerText = currentMemoryMib; + } document.title="Kartik"+require('@electron/remote').getCurrentWindow().channel+require('./package.json').version + eaid; } else { document.title="Kartik"+require('@electron/remote').getCurrentWindow().channel+require('./package.json').version + eaid; diff --git a/views/script/core_music.js b/views/script/core_music.js index adb0ae2..4b85ebb 100644 --- a/views/script/core_music.js +++ b/views/script/core_music.js @@ -1,11 +1,34 @@ -global.csng = null; +/*global.csng = null; global.csp1 = null; global.csp2 = null; -global.cspn = 1; +global.cspn = 1;*/ +global.musicElement = new Audio(); const musicIpc = require('electron').ipcRenderer; musicIpc.on('setmusic', (event, args) => { - try { csp1.volume = 0; } catch (e) {} + if (!musicElement.paused) { + csi1 = setInterval(() => { + if (musicElement.volume <= 0.05) { + clearInterval(csi1); + musicElement.src = args; + musicElement.play(); + musicElement.volume = 0; + csi2 = setInterval(() => { + if (musicElement.volume >= 0.95) { + clearInterval(csi2); + return; + } + musicElement.volume = musicElement.volume + 0.05; + }, 100) + return; + } + musicElement.volume = musicElement.volume - 0.05; + }, 100) + } else { + musicElement.src = args; + musicElement.play(); + } + /*try { csp1.volume = 0; } catch (e) {} try { csp2.volume = 0; } catch (e) {} song = args; @@ -61,53 +84,29 @@ musicIpc.on('setmusic', (event, args) => { csng = song; cspn = 1; } - } + }*/ }) musicIpc.on('fademusic', (event) => { - if (cspn === 1) { - if (csp1 !== null) { - csi1 = setInterval(() => { - if (csp1.volume <= 0.05) { - clearInterval(csi1); - return; - } - csp1.volume = csp1.volume - 0.05; - }, 100) - } - } else { - if (csp2 !== null) { - csi2 = setInterval(() => { - if (csp2.volume <= 0.05) { - clearInterval(csi2); - return; - } - csp2.volume = csp2.volume - 0.05; - }, 100) - } + if (!musicElement.paused) { + csi1 = setInterval(() => { + if (musicElement.volume <= 0.3) { + clearInterval(csi1); + return; + } + musicElement.volume = musicElement.volume - 0.05; + }, 100) } }) musicIpc.on('unfademusic', (event) => { - if (cspn === 1) { - if (csp1 !== null) { - csi1 = setInterval(() => { - if (csp1.volume >= 0.95) { - clearInterval(csi1); - return; - } - csp1.volume = csp1.volume + 0.05; - }, 100) - } - } else { - if (csp2 !== null) { - csi2 = setInterval(() => { - if (csp2.volume >= 0.95) { - clearInterval(csi2); - return; - } - csp2.volume = csp2.volume + 0.05; - }, 100) - } + if (!musicElement.paused) { + csi1 = setInterval(() => { + if (musicElement.volume >= 0.95) { + clearInterval(csi1); + return; + } + musicElement.volume = musicElement.volume + 0.05; + }, 100) } -})
\ No newline at end of file +}) diff --git a/views/script/credits_libs.js b/views/script/credits_libs.js index 9e2f21a..26ee36b 100644 --- a/views/script/credits_libs.js +++ b/views/script/credits_libs.js @@ -1,15 +1,15 @@ Object.keys(process.versions).forEach((e) => { v = process.versions[e]; - document.write(e.substr(0, 1).toUpperCase() + e.substr(1) + " contributors<br>"); + document.write("<div>" + e.substr(0, 1).toUpperCase() + e.substr(1) + " contributors</div>"); }) dirs = require('fs').readdirSync("./node_modules"); dirs.forEach((dir) => { if (!dir.startsWith(".") && !dir.startsWith("@") && dir !== "electron") { j = JSON.parse(require('fs').readFileSync("./node_modules/" + dir + "/package.json").toString()); if (typeof j.author === "string") { - document.write(j.author + "<br>"); + document.write("<div>" + j.author + "</div>"); } else { - document.write(j.name.substr(0, 1).toUpperCase() + j.name.substr(1) + " authors<br>"); + document.write("<div>" + j.name.substr(0, 1).toUpperCase() + j.name.substr(1) + " authors</div>"); } } })
\ No newline at end of file |