aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinteck <nekostarfan@gmail.com>2021-06-06 01:32:31 +0200
committerMinteck <nekostarfan@gmail.com>2021-06-06 01:32:31 +0200
commitd4caa42d3f2fbc850248e0bf06f438f77b73e5ba (patch)
tree7fe5473ace849339195e0424143a1f70136992da
parent021d2788cab7860dcdd8f2f3b81c82b85da2ea86 (diff)
downloadkartik-client-d4caa42d3f2fbc850248e0bf06f438f77b73e5ba.tar.gz
kartik-client-d4caa42d3f2fbc850248e0bf06f438f77b73e5ba.tar.bz2
kartik-client-d4caa42d3f2fbc850248e0bf06f438f77b73e5ba.zip
Commit
-rw-r--r--icons/stats.svg1
-rw-r--r--lang/en.json14
-rw-r--r--package.json2
-rw-r--r--views/menu.html1
-rw-r--r--views/script/menu_global.js9
-rw-r--r--views/stats.html68
6 files changed, 94 insertions, 1 deletions
diff --git a/icons/stats.svg b/icons/stats.svg
new file mode 100644
index 0000000..4cda1b2
--- /dev/null
+++ b/icons/stats.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zM7 10h2v7H7zm4-3h2v10h-2zm4 6h2v4h-2z"/></svg> \ No newline at end of file
diff --git a/lang/en.json b/lang/en.json
index 37feb2d..3326c55 100644
--- a/lang/en.json
+++ b/lang/en.json
@@ -187,5 +187,19 @@
"aborted": "The other player ended the game",
"car0": "Your car",
"car1": "Their car"
+ },
+ "stats": {
+ "menu": "Statistics",
+ "title": "Game Statistics",
+ "items": {
+ "times.single": "Time spent in singleplayer",
+ "times.local": "Time spent in local mode",
+ "times.online": "Time spent playing online",
+ "results.wins": "Number of games that you won",
+ "results.loses": "Number of games that you lost",
+ "ingame.walls": "Number of collisions you had",
+ "ingame.laps": "Number of laps you made",
+ "ingame.turns": "Number of rotations you made"
+ }
}
}
diff --git a/package.json b/package.json
index 69a8864..06d6104 100644
--- a/package.json
+++ b/package.json
@@ -1 +1 @@
-{"name":"kartik","version":"97ebd65","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":"UNLICENSED","serial":"XXX99999999999"} \ No newline at end of file
+{"name":"kartik","version":"021d278","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":"UNLICENSED","serial":"XXX99999999999"} \ No newline at end of file
diff --git a/views/menu.html b/views/menu.html
index 7f7256a..0c6849f 100644
--- a/views/menu.html
+++ b/views/menu.html
@@ -49,6 +49,7 @@
}
document.getElementById('prefill').outerHTML = "";
</script>
+ <li><span class="item"><a href="#" id="stats"><img class="item-icon" src="../icons/stats.svg"> <script>document.write(lang.stats.menu)</script></a></span></li>
<li><span class="item"><a href="#" id="quit"><img class="item-icon" src="../icons/exit.svg"> <script>document.write(lang.menu.titles[4])</script></a></span></li>
</ul>
</div>
diff --git a/views/script/menu_global.js b/views/script/menu_global.js
index 43937f4..3713591 100644
--- a/views/script/menu_global.js
+++ b/views/script/menu_global.js
@@ -91,6 +91,15 @@ function selectOption() {
location.href = "settings.html";
}, 1000)
break;
+ case 'stats':
+ keysEnabled = false;
+ require('electron').ipcRenderer.send('prefademusic', "");
+ $("#box").fadeOut(500);
+ setTimeout(() => {
+ info("MenuWindow", "Switching control to OptnWindow");
+ location.href = "stats.html";
+ }, 1000)
+ break;
case 'credits':
keysEnabled = false;
require('electron').ipcRenderer.send('prefademusic', "");
diff --git a/views/stats.html b/views/stats.html
new file mode 100644
index 0000000..4d6d01c
--- /dev/null
+++ b/views/stats.html
@@ -0,0 +1,68 @@
+<!DOCTYPE html>
+<html lang="en" style="background:#000000;margin:0;height:100%;width:100%;">
+<head>
+ <script>if (typeof require !== "undefined") {native = true;try{global.native = true;}catch(e){}} else {native = false;try{global.native = false;}catch(e){}}if (!native){global = window;}if (native){kresources=require('@electron/remote').getCurrentWindow().resources;trackEvent=require('@electron/remote').getCurrentWindow().trackEvent;}info=(_a,b)=>{console.info(b);};warn=(_a,b)=>{console.warn(b);};error=(_a,b)=>{console.error(b);};</script>
+ <script src="../lang/loader.js"></script>
+ <script src="../scenario/client.js"></script>
+ <meta charset="UTF-8">
+ <title>Kartik</title>
+ <link rel="stylesheet" href="common/fonts.css">
+ <script src="../crash/client.js"></script>
+ <script src="../sfx/sfx.js"></script>
+ <script>
+ if (!require('@electron/remote').getCurrentWindow().debug) {
+ document.write('<link rel="stylesheet" href="common/mouse.css">');
+ }
+ </script>
+ <script src="./script/win_play.js"></script>
+</head>
+<body style="background:#000000;margin:0;height:100%;width:100%;color:white;">
+ <script>info("MainWindow", "Rendering initial frame...");
+
+ if (native) {
+ scale=require('@electron/remote').getCurrentWindow().scale;document.body.style.zoom=scale;
+ }
+
+ </script>
+ <div id="box" style="display: none;background:#222;position:fixed;top:0;left:0;right:0;bottom:0;">
+ <div style="position:fixed;top:0;left:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center;">
+ <div style="text-align: center;">
+ <h2><script>const homedir = require('@electron/remote').getCurrentWindow().homedir;document.write(lang.stats.title);stats=require(homedir + "/.kartik/stats.json")</script></h2>
+
+ <div style="display:grid;grid-template-columns: 1fr 1fr;">
+ <div style="padding:10px;text-align:left;"><b><script>document.write(lang.stats.items['times.single'])</script></b></div>
+ <div style="padding:10px;text-align:right;"><script>document.write(new Date(stats.times.single * 1000).toISOString().substr(11, 8))</script></div>
+
+ <div style="padding:10px;text-align:left;"><b><script>document.write(lang.stats.items['times.local'])</script></b></div>
+ <div style="padding:10px;text-align:right;"><script>document.write(new Date(stats.times.local * 1000).toISOString().substr(11, 8))</script></div>
+
+ <div style="padding:10px;text-align:left;"><b><script>document.write(lang.stats.items['times.online'])</script></b></div>
+ <div style="padding:10px;text-align:right;"><script>document.write(new Date(stats.times.online * 1000).toISOString().substr(11, 8))</script></div>
+
+ <div style="padding:10px;text-align:left;"><b><script>document.write(lang.stats.items['results.wins'])</script></b></div>
+ <div style="padding:10px;text-align:right;"><script>document.write(stats.results.wins)</script></div>
+
+ <div style="padding:10px;text-align:left;"><b><script>document.write(lang.stats.items['results.loses'])</script></b></div>
+ <div style="padding:10px;text-align:right;"><script>document.write(stats.results.loses)</script></div>
+
+ <div style="padding:10px;text-align:left;"><b><script>document.write(lang.stats.items['ingame.walls'])</script></b></div>
+ <div style="padding:10px;text-align:right;"><script>document.write(stats.ingame.walls)</script></div>
+
+ <div style="padding:10px;text-align:left;"><b><script>document.write(lang.stats.items['ingame.laps'])</script></b></div>
+ <div style="padding:10px;text-align:right;"><script>document.write(stats.ingame.laps)</script></div>
+
+ <div style="padding:10px;text-align:left;"><b><script>document.write(lang.stats.items['ingame.turns'])</script></b></div>
+ <div style="padding:10px;text-align:right;"><script>document.write(stats.ingame.turns)</script></div>
+ </div>
+
+ <p><script>document.write(lang.win.quit[0])</script></p>
+ </div>
+ </div>
+ </div>
+
+ <script src="./script/win_music.js"></script>
+
+ <script src="./script/win_global.js"></script>
+ <script src="./script/client_fullscreen.js"></script>
+</body>
+</html>