From 0bd45cb2cae3af05adaad3f38d129bb67c3e0ec0 Mon Sep 17 00:00:00 2001 From: Minteck Date: Wed, 18 May 2022 18:50:12 +0200 Subject: Add Kartik --- kartik/views/.DS_Store | Bin 0 -> 8196 bytes kartik/views/background.jpg | Bin 0 -> 28626 bytes kartik/views/common/blur.css | 3 + kartik/views/common/bold.ttf | Bin 0 -> 58416 bytes kartik/views/common/compatibilityMode.css | 8 + kartik/views/common/fonts.css | 23 + kartik/views/common/index.css | 29 + kartik/views/common/light.ttf | Bin 0 -> 58584 bytes kartik/views/common/load-channel.otf | Bin 0 -> 59108 bytes kartik/views/common/load-new.ttf | Bin 0 -> 50172 bytes kartik/views/common/load-version.otf | Bin 0 -> 63240 bytes kartik/views/common/mouse.css | 3 + kartik/views/common/race.svg | 1 + kartik/views/common/regular.ttf | Bin 0 -> 58548 bytes kartik/views/credits.html | 201 ++ kartik/views/game.css | 152 ++ kartik/views/game.html | 154 ++ kartik/views/hero.svg | 3 + kartik/views/intro.css | 33 + kartik/views/intro.html | 36 + kartik/views/intro.mp4 | Bin 0 -> 317055 bytes kartik/views/load.html | 52 + kartik/views/loader.html | 46 + kartik/views/menu.css | 248 +++ kartik/views/menu.html | 109 ++ kartik/views/menu.jpg | Bin 0 -> 155471 bytes kartik/views/online.html | 40 + kartik/views/rain/snow.js | 666 +++++++ kartik/views/script/client_fullscreen.js | 9 + kartik/views/script/core_chart.js | 74 + kartik/views/script/core_compatlayer.js | 0 kartik/views/script/core_crash.js | 15 + kartik/views/script/core_fullscreen.js | 0 kartik/views/script/core_head.js | 31 + kartik/views/script/core_music.js | 35 + kartik/views/script/core_notification.js | 12 + kartik/views/script/core_viewer.js | 33 + kartik/views/script/credits_global.js | 54 + kartik/views/script/credits_libs.js | 0 kartik/views/script/credits_music.js | 2 + kartik/views/script/credits_technical.js | 12 + kartik/views/script/game_debug.js | 138 ++ kartik/views/script/game_global.js | 45 + kartik/views/script/game_music.js | 8 + kartik/views/script/game_online.js | 9 + kartik/views/script/game_select.js | 131 ++ kartik/views/script/global_compatlayer.js | 0 kartik/views/script/global_levelsapi.js | 47 + kartik/views/script/intro_global.js | 21 + kartik/views/script/intro_media.js | 2 + kartik/views/script/intro_message.js | 7 + kartik/views/script/loader_global.js | 132 ++ kartik/views/script/menu_copyright.js | 5 + kartik/views/script/menu_global.js | 127 ++ kartik/views/script/menu_gpuinfo.js | 0 kartik/views/script/menu_login.js | 1 + kartik/views/script/menu_music.js | 5 + kartik/views/script/menu_system.js | 33 + kartik/views/script/online_play.js | 2 + kartik/views/script/settings_global.js | 104 ++ kartik/views/script/settings_load.js | 10 + kartik/views/script/win_global.js | 22 + kartik/views/script/win_message.js | 9 + kartik/views/script/win_music.js | 2 + kartik/views/script/win_play.js | 0 kartik/views/script/win_quit.js | 0 kartik/views/settings.html | 49 + kartik/views/splash.svg | 2831 +++++++++++++++++++++++++++++ kartik/views/stats.html | 66 + kartik/views/win.html | 40 + 70 files changed, 5930 insertions(+) create mode 100644 kartik/views/.DS_Store create mode 100755 kartik/views/background.jpg create mode 100755 kartik/views/common/blur.css create mode 100755 kartik/views/common/bold.ttf create mode 100755 kartik/views/common/compatibilityMode.css create mode 100755 kartik/views/common/fonts.css create mode 100755 kartik/views/common/index.css create mode 100755 kartik/views/common/light.ttf create mode 100755 kartik/views/common/load-channel.otf create mode 100755 kartik/views/common/load-new.ttf create mode 100755 kartik/views/common/load-version.otf create mode 100755 kartik/views/common/mouse.css create mode 100755 kartik/views/common/race.svg create mode 100755 kartik/views/common/regular.ttf create mode 100755 kartik/views/credits.html create mode 100755 kartik/views/game.css create mode 100755 kartik/views/game.html create mode 100755 kartik/views/hero.svg create mode 100755 kartik/views/intro.css create mode 100755 kartik/views/intro.html create mode 100755 kartik/views/intro.mp4 create mode 100755 kartik/views/load.html create mode 100755 kartik/views/loader.html create mode 100755 kartik/views/menu.css create mode 100755 kartik/views/menu.html create mode 100755 kartik/views/menu.jpg create mode 100755 kartik/views/online.html create mode 100755 kartik/views/rain/snow.js create mode 100755 kartik/views/script/client_fullscreen.js create mode 100755 kartik/views/script/core_chart.js create mode 100755 kartik/views/script/core_compatlayer.js create mode 100755 kartik/views/script/core_crash.js create mode 100755 kartik/views/script/core_fullscreen.js create mode 100755 kartik/views/script/core_head.js create mode 100755 kartik/views/script/core_music.js create mode 100755 kartik/views/script/core_notification.js create mode 100755 kartik/views/script/core_viewer.js create mode 100755 kartik/views/script/credits_global.js create mode 100755 kartik/views/script/credits_libs.js create mode 100755 kartik/views/script/credits_music.js create mode 100755 kartik/views/script/credits_technical.js create mode 100755 kartik/views/script/game_debug.js create mode 100755 kartik/views/script/game_global.js create mode 100755 kartik/views/script/game_music.js create mode 100755 kartik/views/script/game_online.js create mode 100755 kartik/views/script/game_select.js create mode 100755 kartik/views/script/global_compatlayer.js create mode 100755 kartik/views/script/global_levelsapi.js create mode 100755 kartik/views/script/intro_global.js create mode 100755 kartik/views/script/intro_media.js create mode 100755 kartik/views/script/intro_message.js create mode 100755 kartik/views/script/loader_global.js create mode 100755 kartik/views/script/menu_copyright.js create mode 100755 kartik/views/script/menu_global.js create mode 100755 kartik/views/script/menu_gpuinfo.js create mode 100755 kartik/views/script/menu_login.js create mode 100755 kartik/views/script/menu_music.js create mode 100755 kartik/views/script/menu_system.js create mode 100755 kartik/views/script/online_play.js create mode 100755 kartik/views/script/settings_global.js create mode 100755 kartik/views/script/settings_load.js create mode 100755 kartik/views/script/win_global.js create mode 100755 kartik/views/script/win_message.js create mode 100755 kartik/views/script/win_music.js create mode 100755 kartik/views/script/win_play.js create mode 100755 kartik/views/script/win_quit.js create mode 100755 kartik/views/settings.html create mode 100755 kartik/views/splash.svg create mode 100755 kartik/views/stats.html create mode 100755 kartik/views/win.html (limited to 'kartik/views') diff --git a/kartik/views/.DS_Store b/kartik/views/.DS_Store new file mode 100644 index 0000000..a0a897c Binary files /dev/null and b/kartik/views/.DS_Store differ diff --git a/kartik/views/background.jpg b/kartik/views/background.jpg new file mode 100755 index 0000000..1129efc Binary files /dev/null and b/kartik/views/background.jpg differ diff --git a/kartik/views/common/blur.css b/kartik/views/common/blur.css new file mode 100755 index 0000000..f904c12 --- /dev/null +++ b/kartik/views/common/blur.css @@ -0,0 +1,3 @@ +#intro, #laps-inner-car0, #laps-inner-car1, #paused, #credits, #gpuinfo, #warning { + backdrop-filter: blur(10px); +} \ No newline at end of file diff --git a/kartik/views/common/bold.ttf b/kartik/views/common/bold.ttf new file mode 100755 index 0000000..a7e7b1e Binary files /dev/null and b/kartik/views/common/bold.ttf differ diff --git a/kartik/views/common/compatibilityMode.css b/kartik/views/common/compatibilityMode.css new file mode 100755 index 0000000..60c28a2 --- /dev/null +++ b/kartik/views/common/compatibilityMode.css @@ -0,0 +1,8 @@ +*:not(#gpuinfo-outer):not(#gpuinfo-inner) { + backdrop-filter: none !important; + opacity: 1 !important; +} + +.rain { + display: none !important; +} \ No newline at end of file diff --git a/kartik/views/common/fonts.css b/kartik/views/common/fonts.css new file mode 100755 index 0000000..af3ecab --- /dev/null +++ b/kartik/views/common/fonts.css @@ -0,0 +1,23 @@ +@font-face { + font-family: "Comfortaa"; + src: url("regular.ttf"); + font-weight: normal; +} + +@font-face { + font-family: "Comfortaa"; + src: url("bold.ttf"); + font-weight: bold; +} + +*, body, html, div { + font-family: "Comfortaa", -apple-system, sans-serif; +} + +#gpuinfo-inner, #gpuinfo-inner * { + font-family: monospace !important; +} + +* { + cursor: default !important; +} \ No newline at end of file diff --git a/kartik/views/common/index.css b/kartik/views/common/index.css new file mode 100755 index 0000000..f9ff24e --- /dev/null +++ b/kartik/views/common/index.css @@ -0,0 +1,29 @@ +#titlebar-minimize, #titlebar-close { + background-color: transparent; + transition: background-color 200ms; + border-radius: 10px; +} + +#titlebar-minimize:hover { + background-color: rgba(99, 99, 99, .5); +} + +#titlebar-minimize:focus, #titlebar-minimize:active { + background-color: rgba(99, 99, 99, .75); +} + +#titlebar-close:hover { + background-color: rgba(255, 0, 0, .5); +} + +#titlebar-close:focus, #titlebar-close:active { + background-color: rgba(255, 0, 0, .75); +} + +*::selection { + background-color: transparent; +} + +*::inactive-selection { + background-color: transparent; +} \ No newline at end of file diff --git a/kartik/views/common/light.ttf b/kartik/views/common/light.ttf new file mode 100755 index 0000000..5e4bfc7 Binary files /dev/null and b/kartik/views/common/light.ttf differ diff --git a/kartik/views/common/load-channel.otf b/kartik/views/common/load-channel.otf new file mode 100755 index 0000000..1968a8e Binary files /dev/null and b/kartik/views/common/load-channel.otf differ diff --git a/kartik/views/common/load-new.ttf b/kartik/views/common/load-new.ttf new file mode 100755 index 0000000..d2a94dc Binary files /dev/null and b/kartik/views/common/load-new.ttf differ diff --git a/kartik/views/common/load-version.otf b/kartik/views/common/load-version.otf new file mode 100755 index 0000000..d112022 Binary files /dev/null and b/kartik/views/common/load-version.otf differ diff --git a/kartik/views/common/mouse.css b/kartik/views/common/mouse.css new file mode 100755 index 0000000..7670e90 --- /dev/null +++ b/kartik/views/common/mouse.css @@ -0,0 +1,3 @@ +*::selection { + background: none; +} \ No newline at end of file diff --git a/kartik/views/common/race.svg b/kartik/views/common/race.svg new file mode 100755 index 0000000..197387b --- /dev/null +++ b/kartik/views/common/race.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/kartik/views/common/regular.ttf b/kartik/views/common/regular.ttf new file mode 100755 index 0000000..89d36f8 Binary files /dev/null and b/kartik/views/common/regular.ttf differ diff --git a/kartik/views/credits.html b/kartik/views/credits.html new file mode 100755 index 0000000..1862f50 --- /dev/null +++ b/kartik/views/credits.html @@ -0,0 +1,201 @@ + + + + + + + + + + + Kartik + + + + + + + + + + +
+ + + +

Kartik, a 2D car racing game

+

© Minteck. All assets are licensed under their original license rather than Kartik's license.

+

+ + made by
+ + +

Project Lead

+

Minteck

+ +

Base Assets

+

Minteck
redman 054

+ +

Narrator Character

+

Averi by fiddle (@fiddleafox on Twitter)

+ +

Music

+

Anuke
YonKaGor

+ +

Sound Effects and Additional Assets

+
+
Prosta4okua
+
Felix Corvus
+
Vanguard
+
Timmeey86
+
Epowerj
+
Baltazár Radics
+
Dexapnow
+
Milinai
+
키에르
+
skybldev
+
Leone25
+
Gureumi
+
VizardAlpha
+
LQ
+
Commodore64x
+
iczero
+
Krzysztof Skrzętnicki
+
Baramos666
+
theshadowknight
+
elmenda452
+
Predator127
+
Sonnicon
+
CinExPL
+
toushangyouxiang
+
xgamezs
+
William So
+
beito
+
BeefEX
+
Lorex
+
老滑稽
+
Spico The Spirit Guy
+
TunacanGamer
+
kemalinanc13
+
Zachary
+
Fenr1r
+
Jaiun Lee
+
Gab_351
+
Carter Gale
+
Jan Polák
+
JustYanns
+
BasedUser
+
BLucky-gh
+
DinoWattz
+
Jae
+
angelickite
+
ScriptHosT12
+
Senventise
+
SkeptiC
+
Deyvid67
+
Damlon
+
DaGamerFiles
+
Trigg
+
Uriel
+
VXF
+
Valen. H
+
Valentin Sonin
+
Clarence "Sparr" Risher
+
bei2
+
AceEllysium
+
Cedric L'homme
+
Michał “Neoqueto”
+
indielm
+
Ameb
+
player20033
+
Ignacy
+
J-VdS
+
Kenny
+
Franciszek Zaranowicz
+
Andreas Heiskanen
+
Doyoung Gwak
+
MMG
+
Math2128
+
Michael Plotke
+
Niko
+
Paul T
+
Dominik
+
Arkanic
+
Potion
+
Markus G
+
itskatt
+
Agent-Laevain
+
AzariasB
+
amrsoll
+
ねらひかだ
+
Draco
+
Quezler
+
killall -q
+
Alicila
+
Daniel Dusek
+
DeltaNedas
+
GioIacca9
+
SnakkiZXZ
+
sk7725
+
The Slaylord
+
ThePlayerA
+
YellOw139
+
NgLamVN
+
JINODK
+
PetrGasparik
+
LeoDog896
+
Summet
+
MEEP of Faith
+
jalastram (freesound.org)
+
newlocknew (freesound.org)
+
dsmolenaers (freesound.org)
+
Headphaze (freesound.org)
+
Nikolass
+
VolasYouKnow
+
Quick-Korx
+
Ángel Rodríguez Aguilera
+
Catchears
+
younggam
+
simba-fs
+
RedRadiation
+
Marko Zajc
+
CPX MC
+
Phinner
+
BTA_Susideur
+
nilq
+
AsgerHB
+
AzCraft
+
foo
+
Skat
+
WilloIzCitron
+
Nintendo
+
Unsplash
+
Google
+
+ +

Testing

+

Minteck
Romain
Oxymillion

+ +

Early Access Testing

+

Ayann
Retsuno
Amirus66

+ + + +
+ + + + + + + diff --git a/kartik/views/game.css b/kartik/views/game.css new file mode 100755 index 0000000..e72a786 --- /dev/null +++ b/kartik/views/game.css @@ -0,0 +1,152 @@ +#paused { + z-index: 5; + position: fixed; + inset: 0; + display: flex; + align-items: center; + justify-content: center; +} + +#paused > div { + background: #262626; + border-radius: 10px; + padding: 20px; + box-shadow: 1px 1px 12px rgba(0, 0, 0, 0.25); +} + +#paused * { + color: white; +} + +.services li { + padding: 10px; + font-size: 28px; + width: 256px; + list-style: none; + color: transparent; + margin-top: 10px; + margin-bottom: 10px; + border-radius: 10px; +} + +.services li a { + color: white !important; + text-decoration: none; + transition: color 200ms; +} + +.services li.selected a { + color: black !important; + text-decoration: none; +} + +.services li.selected { + background-color: #00ff99; +} + +.services li { + background-color: #383838; + transition: margin-left 200ms, background-color 200ms; +} + +#circuit.hitboxes, #circuit.hitboxes * { + outline: 1px dashed blue; +} + +#car0, #car1 { + transition: top 600ms, bottom 600ms, left 600ms, right 600ms, transform 500ms; +} + +#box.paused { + opacity: .5; +} + +circuit { + display: none; +} + +#credits-inner { + position: fixed; + z-index: 9; + background: #171717; + color: white; + padding: 20px; + display: grid; + font-size: 11px; + top: 200px; + left: 0; + right: 0; +} + +#credits .big { + font-size: 15px; + font-weight: bold; +} + +#credits #race, #credits #musicb { + display: grid; + grid-template-columns: 48px 1fr; +} + +#credits-inner > * > * { + vertical-align: middle; +} + +#credits img { + filter: invert(100%); +} + +#credits .cbox { + width: max-content; +} + +#laps-inner-car0 { + background: rgba(0, 0, 0, .5); + position: fixed; + bottom: 20px; + left: 20px; + z-index: 9; + border-radius: 9999px; + width: 40px; + height: 43px; + text-align: center; + color: white; + padding: 7px 10px 10px; +} + +#laps-inner-car1 { + background: rgba(0, 0, 0, .5); + position: fixed; + bottom: 20px; + right: 20px; + z-index: 9; + border-radius: 9999px; + width: 40px; + height: 43px; + text-align: center; + color: white; + padding: 7px 10px 10px; +} + +.laps-inner-sep { + margin: 5px; + border: none; + border-top: 2px solid white; +} + +#oil img { + position: fixed; + width: 32px; + z-index: 5; + opacity: .9; +} + +#credits { + background: rgba(0, 0, 0, .5); + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + z-index: 9999; +} \ No newline at end of file diff --git a/kartik/views/game.html b/kartik/views/game.html new file mode 100755 index 0000000..13dbd32 --- /dev/null +++ b/kartik/views/game.html @@ -0,0 +1,154 @@ + + + + + + + + + + + Kartik + + + + + + + + + + + + + + + + + + + + + + diff --git a/kartik/views/hero.svg b/kartik/views/hero.svg new file mode 100755 index 0000000..e19252e --- /dev/null +++ b/kartik/views/hero.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/kartik/views/intro.css b/kartik/views/intro.css new file mode 100755 index 0000000..bcda35f --- /dev/null +++ b/kartik/views/intro.css @@ -0,0 +1,33 @@ +.hero-inner { + position: fixed; + inset: 0; + background-image: url('./hero.svg'); + background-position: 100% 50%; + background-size: cover; + background-repeat: repeat; + background-attachment: scroll; + z-index: -1; +} + +.hero { + color: #fff; + background: linear-gradient(-45deg, #64f20c, #5cfbc6, #3149ff, #63f777); + background-size: auto; + background-size: 400% 400%; + animation: Gradient 10s ease infinite; + position: fixed; + inset: 0; + z-index: -2; +} + +@keyframes Gradient { + 0% { + background-position: 0 50%; + } + 50% { + background-position: 100% 50%; + } + 100% { + background-position: 0 50%; + } +} \ No newline at end of file diff --git a/kartik/views/intro.html b/kartik/views/intro.html new file mode 100755 index 0000000..45cca2a --- /dev/null +++ b/kartik/views/intro.html @@ -0,0 +1,36 @@ + + + + + + + + Kartik + + + + + + + + + + + + + + + + + + + diff --git a/kartik/views/intro.mp4 b/kartik/views/intro.mp4 new file mode 100755 index 0000000..e947f0a Binary files /dev/null and b/kartik/views/intro.mp4 differ diff --git a/kartik/views/load.html b/kartik/views/load.html new file mode 100755 index 0000000..473c1ac --- /dev/null +++ b/kartik/views/load.html @@ -0,0 +1,52 @@ + + + + + Kartik + + + + + +
+
+
+ + diff --git a/kartik/views/loader.html b/kartik/views/loader.html new file mode 100755 index 0000000..5251ad6 --- /dev/null +++ b/kartik/views/loader.html @@ -0,0 +1,46 @@ + + + + + + + + + Kartik + + + + + + + + + +

+ + + + + + + diff --git a/kartik/views/menu.css b/kartik/views/menu.css new file mode 100755 index 0000000..f9697a7 --- /dev/null +++ b/kartik/views/menu.css @@ -0,0 +1,248 @@ +.services li .item { + padding: 4px; + font-size: 20px; + width: 300px; + border-color: transparent; + margin-right: auto !important; + display: block; + text-align: left; + border-left-width: 3px; + border-left-style: solid; + border-color: transparent; +} + +.services { + position: fixed; + left: 0; + bottom: 0; + right: 0; + top: 150px; + padding-top: 50px; +} + +.services li { + color: transparent; + margin-top: 5px; + margin-bottom: 5px; +} + +.services li .item a { + color: white !important; + text-decoration: none; + transition: color 200ms; +} + +.services li.selected .item a { + text-decoration: none; +} + +.services:not(.services-settings) li.selected .item { + background-color: rgba(0, 255, 153, 0.25); + backdrop-filter: blur(10px); + border-radius: 10px; + animation-direction: alternate-reverse; + position: relative; + z-index: 9999999999; + animation-duration: 3s; + animation-name: border-overlay; + animation-fill-mode: both; + animation-iteration-count: infinite; +} + +.services.services-settings li.selected .item { + border-color: #00ff99; + background-color: rgba(0, 255, 153, 0.25); + animation-direction: alternate-reverse; + animation-duration: 3s; + animation-name: border-overlay2; + animation-fill-mode: both; + animation-iteration-count: infinite; + border-top-right-radius: 10px; + border-bottom-right-radius: 10px; +} + +@keyframes border-overlay { + 0% { + background-color: rgba(0, 255, 102, 0.25); + } + 100% { + background-color: rgba(0, 204, 255, 0.25); + } +} + +@keyframes border-overlay2 { + 0% { + border-color: #00ff66; + background-color: rgba(0, 255, 102, 0.25); + } + 100% { + border-color: #00ccff; + background-color: rgba(0, 204, 255, 0.25); + } +} + +.services li .item { + margin-left: 12.5px; + transition: margin-left 200ms, background-color 200ms, border 200ms; +} + +.services li .help { + color: white; + margin-left: 5px; + display: inline-block; + font-size: 12px; + position: relative; + top: -2.5px; + opacity: 0; + transition: opacity 200ms; +} + +.services li .help.exit { + color: #ff6969; +} + +.services li.selected .help { + opacity: 1; +} + +#copyright { + color: rgba(255, 255, 255, .5); + position: fixed; + bottom: 30px; + right: 30px; + text-align: right; + font-size: 12px; +} + +.setting-status { + float: right; +} + +#notice { + color: white; + position: fixed; + top: 20px; + right: 20px; + width: 180px; + text-align: right; + font-size: 14px; +} + +#scroll { + display: block; + text-align: center; + color: white; + padding-top: 100vh; + padding-bottom: 100vh; +} + +.cred-title { + color: yellow; +} + +.cred-content { + color: white; +} + +.technical { + color: cyan; +} + +.item-icon { + filter: invert(1); + vertical-align: middle; + display: inline-block; + margin-top: 3px; + margin-bottom: -1px; +} + +div.services.home { + top: 115px; + padding: 0; + display: flex; + align-items: center; + bottom: 70px; + z-index: 9999; +} + +div.services.home > div.items > ul > li > span.item { + width: 216px; + border-radius: 0; +} + +div.services.home > div.items > ul > li > span.item > a { + margin-left: 10px; + margin-right: 10px; + width: 100%; + display: inline-block; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; +} + +div.services.home > div.items { + width: 256px; +} + +div.services.home > div.items > ul { + padding: 0; +} + +div.services.home > div.items > ul > li { + list-style: none; +} + +div.services.home > div.items > ul > li > span.item { + margin-left: 10vw; + transition: none; +} + +img[alt="full-logo"] { + margin-left: calc(10vw + 37.5px) !important; + margin-top: 55px !important; + height: 56px !important; + z-index: 99999; + position: fixed; +} + +span#copyright { + bottom: 46px; + left: 10vw; + z-index: 9999; + color: rgba(255, 255, 255, 0.75); + right: unset; + width: 227px; + text-align: center; +} + +#services-background { + position: fixed; + top: 0; + bottom: 0; + width: 227px; + z-index: 9; + backdrop-filter: blur(10px); + background: rgba(0, 0, 0, 0.5); + left: 10vw; +} + +.item-text { + vertical-align: middle; + margin-top: 8px; + display: inline-block; +} + +@media (max-height: 600px) { + img[alt="full-logo"][src="../logo/full.png"].full-logo { + margin-top: 16px !important; + } + + span#copyright.copyright { + bottom: 14px !important; + } +} + +body { + height: calc(100vh / 1.2); + overflow: hidden; +} \ No newline at end of file diff --git a/kartik/views/menu.html b/kartik/views/menu.html new file mode 100755 index 0000000..c5874bf --- /dev/null +++ b/kartik/views/menu.html @@ -0,0 +1,109 @@ + + + + + + + + + + + Kartik + + + + + + + + + + + + + + + + diff --git a/kartik/views/menu.jpg b/kartik/views/menu.jpg new file mode 100755 index 0000000..ade8fdd Binary files /dev/null and b/kartik/views/menu.jpg differ diff --git a/kartik/views/online.html b/kartik/views/online.html new file mode 100755 index 0000000..b9553bf --- /dev/null +++ b/kartik/views/online.html @@ -0,0 +1,40 @@ + + + + + + + + Kartik + + + + + + + + + + + + + + + + + + diff --git a/kartik/views/rain/snow.js b/kartik/views/rain/snow.js new file mode 100755 index 0000000..95b937b --- /dev/null +++ b/kartik/views/rain/snow.js @@ -0,0 +1,666 @@ +/** @license + * DHTML Snowstorm! JavaScript-based snow for webinit pages + * Making it snow on the internets since 2003. You're welcome. + * ----------------------------------------------------------- + * Version 1.44.20131208 (Previous rev: 1.44.20131125) + * Copyright (c) 2007, Scott Schiller. All rights reserved. + * Code provided under the BSD License + * http://schillmania.com/projects/snowstorm/license.txt + */ + +/*jslint nomen: true, plusplus: true, sloppy: true, vars: true, white: true */ +/*global window, document, navigator, clearInterval, setInterval */ + +var snowStorm = (function(window, document) { + + // --- common properties --- + + this.autoStart = true; // Whether the snow should start automatically or not. + this.excludeMobile = true; // Snow is likely to be bad news for mobile phones' CPUs (and batteries.) Enable at your own risk. + this.flakesMax = 128; // Limit total amount of snow made (falling + sticking) + this.flakesMaxActive = 64; // Limit amount of snow falling at once (less = lower CPU use) + this.animationInterval = 33; // Theoretical "miliseconds per frame" measurement. 20 = fast + smooth, but high CPU use. 50 = more conservative, but slower + this.useGPU = true; // Enable transform-based hardware acceleration, reduce CPU load. + this.className = null; // CSS class name for further customization on snow elements + this.excludeMobile = true; // Snow is likely to be bad news for mobile phones' CPUs (and batteries.) By default, be nice. + this.flakeBottom = null; // Integer for Y axis snow limit, 0 or null for "full-screen" snow effect + this.followMouse = true; // Snow movement can respond to the user's mouse + this.snowColor = '#fff'; // Don't eat (or use?) yellow snow. + this.snowCharacter = '•'; // • = bullet, · is square on some systems etc. + this.snowStick = true; // Whether or not snow should "stick" at the bottom. When off, will never collect. + this.targetElement = null; // element which snow will be appended to (null = document.body) - can be an element ID eg. 'myDiv', or a DOM node reference + this.useMeltEffect = true; // When recycling fallen snow (or rarely, when falling), have it "melt" and fade out if browser supports it + this.useTwinkleEffect = false; // Allow snow to randomly "flicker" in and out of view while falling + this.usePositionFixed = false; // true = snow does not shift vertically when scrolling. May increase CPU load, disabled by default - if enabled, used only where supported + this.usePixelPosition = false; // Whether to use pixel values for snow top/left vs. percentages. Auto-enabled if body is position:relative or targetElement is specified. + + // --- less-used bits --- + + this.freezeOnBlur = true; // Only snow when the window is in focus (foreground.) Saves CPU. + this.flakeLeftOffset = 0; // Left margin/gutter space on edge of container (eg. browser window.) Bump up these values if seeing horizontal scrollbars. + this.flakeRightOffset = 0; // Right margin/gutter space on edge of container + this.flakeWidth = 8; // Max pixel width reserved for snow element + this.flakeHeight = 8; // Max pixel height reserved for snow element + this.vMaxX = 5; // Maximum X velocity range for snow + this.vMaxY = 4; // Maximum Y velocity range for snow + this.zIndex = 0; // CSS stacking order applied to each snowflake + + // --- "No user-serviceable parts inside" past this point, yadda yadda --- + + var storm = this, + features, + // UA sniffing and backCompat rendering mode checks for fixed position, etc. + isIE = navigator.userAgent.match(/msie/i), + isIE6 = navigator.userAgent.match(/msie 6/i), + isMobile = navigator.userAgent.match(/mobile|opera m(ob|in)/i), + isBackCompatIE = (isIE && document.compatMode === 'BackCompat'), + noFixed = (isBackCompatIE || isIE6), + screenX = null, screenX2 = null, screenY = null, scrollY = null, docHeight = null, vRndX = null, vRndY = null, + windOffset = 1, + windMultiplier = 2, + flakeTypes = 6, + fixedForEverything = false, + targetElementIsRelative = false, + opacitySupported = (function(){ + try { + document.createElement('div').style.opacity = '0.5'; + } catch(e) { + return false; + } + return true; + }()), + didInit = false, + docFrag = document.createDocumentFragment(); + + features = (function() { + + var getAnimationFrame; + + /** + * hat tip: paul irish + * http://paulirish.com/2011/requestanimationframe-for-smart-animating/ + * https://gist.github.com/838785 + */ + + function timeoutShim(callback) { + window.setTimeout(callback, 1000/(storm.animationInterval || 20)); + } + + var _animationFrame = (window.requestAnimationFrame || + window.webkitRequestAnimationFrame || + window.mozRequestAnimationFrame || + window.oRequestAnimationFrame || + window.msRequestAnimationFrame || + timeoutShim); + + // apply to window, avoid "illegal invocation" errors in Chrome + getAnimationFrame = _animationFrame ? function() { + return _animationFrame.apply(window, arguments); + } : null; + + var testDiv; + + testDiv = document.createElement('div'); + + function has(prop) { + + // test for feature support + var result = testDiv.style[prop]; + return (result !== undefined ? prop : null); + + } + + // note local scope. + var localFeatures = { + + transform: { + ie: has('-ms-transform'), + moz: has('MozTransform'), + opera: has('OTransform'), + webkit: has('webkitTransform'), + w3: has('transform'), + prop: null // the normalized property value + }, + + getAnimationFrame: getAnimationFrame + + }; + + localFeatures.transform.prop = ( + localFeatures.transform.w3 || + localFeatures.transform.moz || + localFeatures.transform.webkit || + localFeatures.transform.ie || + localFeatures.transform.opera + ); + + testDiv = null; + + return localFeatures; + + }()); + + this.timer = null; + this.flakes = []; + this.disabled = false; + this.active = false; + this.meltFrameCount = 20; + this.meltFrames = []; + + this.setXY = function(o, x, y) { + + if (!o) { + return false; + } + + if (storm.usePixelPosition || targetElementIsRelative) { + + o.style.left = (x - storm.flakeWidth) + 'px'; + o.style.top = (y - storm.flakeHeight) + 'px'; + + } else if (noFixed) { + + o.style.right = (100-(x/screenX*100)) + '%'; + // avoid creating vertical scrollbars + o.style.top = (Math.min(y, docHeight-storm.flakeHeight)) + 'px'; + + } else { + + if (!storm.flakeBottom) { + + // if not using a fixed bottom coordinate... + o.style.right = (100-(x/screenX*100)) + '%'; + o.style.bottom = (100-(y/screenY*100)) + '%'; + + } else { + + // absolute top. + o.style.right = (100-(x/screenX*100)) + '%'; + o.style.top = (Math.min(y, docHeight-storm.flakeHeight)) + 'px'; + + } + + } + + }; + + this.events = (function() { + + var old = (!window.addEventListener && window.attachEvent), slice = Array.prototype.slice, + evt = { + add: (old?'attachEvent':'addEventListener'), + remove: (old?'detachEvent':'removeEventListener') + }; + + function getArgs(oArgs) { + var args = slice.call(oArgs), len = args.length; + if (old) { + args[1] = 'on' + args[1]; // prefix + if (len > 3) { + args.pop(); // no capture + } + } else if (len === 3) { + args.push(false); + } + return args; + } + + function apply(args, sType) { + var element = args.shift(), + method = [evt[sType]]; + if (old) { + element[method](args[0], args[1]); + } else { + element[method].apply(element, args); + } + } + + function addEvent() { + apply(getArgs(arguments), 'add'); + } + + function removeEvent() { + apply(getArgs(arguments), 'remove'); + } + + return { + add: addEvent, + remove: removeEvent + }; + + }()); + + function rnd(n,min) { + if (isNaN(min)) { + min = 0; + } + return (Math.random()*n)+min; + } + + function plusMinus(n) { + return (parseInt(rnd(2),10)===1?n*-1:n); + } + + this.randomizeWind = function() { + var i; + vRndX = plusMinus(rnd(storm.vMaxX,0.2)); + vRndY = rnd(storm.vMaxY,0.2); + if (this.flakes) { + for (i=0; i=0 && s.vX<0.2) { + s.vX = 0.2; + } else if (s.vX<0 && s.vX>-0.2) { + s.vX = -0.2; + } + if (s.vY>=0 && s.vY<0.2) { + s.vY = 0.2; + } + }; + + this.move = function() { + var vX = s.vX*windOffset, yDiff; + s.x += vX; + s.y += (s.vY*s.vAmp); + if (s.x >= screenX || screenX-s.x < storm.flakeWidth) { // X-axis scroll check + s.x = 0; + } else if (vX < 0 && s.x-storm.flakeLeftOffset < -storm.flakeWidth) { + s.x = screenX-storm.flakeWidth-1; // flakeWidth; + } + s.refresh(); + yDiff = screenY+scrollY-s.y+storm.flakeHeight; + if (yDiff0.998) { + // ~1/1000 chance of melting mid-air, with each frame + s.melting = true; + s.melt(); + // only incrementally melt one frame + // s.melting = false; + } + if (storm.useTwinkleEffect) { + if (s.twinkleFrame < 0) { + if (Math.random() > 0.97) { + s.twinkleFrame = parseInt(Math.random() * 8, 10); + } + } else { + s.twinkleFrame--; + if (!opacitySupported) { + s.o.style.visibility = (s.twinkleFrame && s.twinkleFrame % 2 === 0 ? 'hidden' : 'visible'); + } else { + s.o.style.opacity = (s.twinkleFrame && s.twinkleFrame % 2 === 0 ? 0 : 1); + } + } + } + } + }; + + this.animate = function() { + // main animation loop + // move, check status, die etc. + s.move(); + }; + + this.setVelocities = function() { + s.vX = vRndX+rnd(storm.vMaxX*0.12,0.1); + s.vY = vRndY+rnd(storm.vMaxY*0.12,0.1); + }; + + this.setOpacity = function(o,opacity) { + if (!opacitySupported) { + return false; + } + o.style.opacity = opacity; + }; + + this.melt = function() { + if (!storm.useMeltEffect || !s.melting) { + s.recycle(); + } else { + if (s.meltFrame < s.meltFrameCount) { + s.setOpacity(s.o,s.meltFrames[s.meltFrame]); + s.o.style.fontSize = s.fontSize-(s.fontSize*(s.meltFrame/s.meltFrameCount))+'px'; + s.o.style.lineHeight = storm.flakeHeight+2+(storm.flakeHeight*0.75*(s.meltFrame/s.meltFrameCount))+'px'; + s.meltFrame++; + } else { + s.recycle(); + } + } + }; + + this.recycle = function() { + s.o.style.display = 'none'; + s.o.style.position = (fixedForEverything?'fixed':'absolute'); + s.o.style.bottom = 'auto'; + s.setVelocities(); + s.vCheck(); + s.meltFrame = 0; + s.melting = false; + s.setOpacity(s.o,1); + s.o.style.padding = '0px'; + s.o.style.margin = '0px'; + s.o.style.fontSize = s.fontSize+'px'; + s.o.style.lineHeight = (storm.flakeHeight+2)+'px'; + s.o.style.textAlign = 'center'; + s.o.style.verticalAlign = 'baseline'; + s.x = parseInt(rnd(screenX-storm.flakeWidth-20),10); + s.y = parseInt(rnd(screenY)*-1,10)-storm.flakeHeight; + s.refresh(); + s.o.style.display = 'block'; + s.active = 1; + }; + + this.recycle(); // set up x/y coords etc. + this.refresh(); + + }; + + this.snow = function() { + var active = 0, flake = null, i, j; + for (i=0, j=storm.flakes.length; istorm.flakesMaxActive) { + storm.flakes[storm.flakes.length-1].active = -1; + } + } + storm.targetElement.appendChild(docFrag); + }; + + this.timerInit = function() { + storm.timer = true; + storm.snow(); + }; + + this.init = function() { + var i; + for (i=0; i { + try { + currentMemory = process.memoryUsage().rss; + currentMemoryMib = (((currentMemory)/1024)/1024).toFixed(2); + if ((((currentMemory)/1024)/1024) > ((require('os').totalmem() / 1000000) / 4)) { + throw new Error("Out of memory"); + } + + file = webview.getURL().split("/")[webview.getURL().split("/").length - 1]; + activity = lang.discord.game[0]; + 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": + enableActivity = false; + break; + } + + if (file.includes("online.html")) { + activity = lang.online.discord2; + } + + if (enableActivity) { + eaid = " - " + activity; + } else { + eaid = ""; + } + + if (require('./package.json').channel === "git") { + document.title="Kartik Trunk " +require('./package.json').version; + } else { + document.title="Kartik"+require('@electron/remote').getCurrentWindow().channel+require('./package.json').version + eaid; + } + } catch (e) { + if (e.message === "Out of memory") { + throw e; + } + } +}, 1000) \ No newline at end of file diff --git a/kartik/views/script/core_compatlayer.js b/kartik/views/script/core_compatlayer.js new file mode 100755 index 0000000..e69de29 diff --git a/kartik/views/script/core_crash.js b/kartik/views/script/core_crash.js new file mode 100755 index 0000000..cc68b18 --- /dev/null +++ b/kartik/views/script/core_crash.js @@ -0,0 +1,15 @@ +global.gameCrashed = false; +crashSound = new Audio("./sfx/gamecrash.wav"); + +function destroy() { + global.gameCrashed = true; + crashSound.play(); + document.getElementById("wb").outerHTML = ""; + try { musicElement.pause(); } catch (e) {} +} + +function spawnError(crashReport) { + document.getElementById("error-outer").style.display = "flex"; + document.getElementById("crash-dump").value = crashReport; + destroy(); +} \ No newline at end of file diff --git a/kartik/views/script/core_fullscreen.js b/kartik/views/script/core_fullscreen.js new file mode 100755 index 0000000..e69de29 diff --git a/kartik/views/script/core_head.js b/kartik/views/script/core_head.js new file mode 100755 index 0000000..be27c87 --- /dev/null +++ b/kartik/views/script/core_head.js @@ -0,0 +1,31 @@ +if (native) {global.$ = require('jquery');} else {var script = document.createElement('script');script.src = './webinit/jquery.js';script.type = 'text/javascript';document.getElementsByTagName('head')[0].appendChild(script);} + +if (native && require('@electron/remote').getCurrentWindow().debug) { + document.write(''); +} + +if (native) { + var ipcRenderer = require('electron').ipcRenderer; + ipcRenderer.on('scenario', function (event,obj) { + try { + console.log(kresources.scenario.voice[obj.lang] + "/" + obj.namespace + obj.id + ".mp3"); + a = new Audio(kresources.scenario.voice[obj.lang] + "/" + obj.namespace + obj.id + ".mp3"); + a.onended = () => { + setTimeout(() => { + $("#message").fadeOut(200); + if (typeof obj.cb == "function") { + obj.cb(); + } + }, 3000) + } + a.play(); + } catch (e) { + console.error(e); + obj.cb(); + } + + document.getElementById('message-text').innerText = obj.message; + document.getElementById('message-character-inner').src = kresources.scenario.averi[obj.emote]; + $("#message").fadeIn(200); + }); +} diff --git a/kartik/views/script/core_music.js b/kartik/views/script/core_music.js new file mode 100755 index 0000000..b35f5db --- /dev/null +++ b/kartik/views/script/core_music.js @@ -0,0 +1,35 @@ +if (location.hash === "#ready") { + global.musicElement = new Audio(); + + global.musicManager = { + setMusic: (args) => { + musicElement.src = args; + musicElement.play(); + musicElement.volume = 1; + musicElement.loop = true; + }, + fadeMusic: () => { + if (!musicElement.paused) { + csi1 = setInterval(() => { + if (musicElement.volume <= 0.3) { + clearInterval(csi1); + return; + } + musicElement.volume = musicElement.volume - 0.05; + }, 100) + } + }, + unfadeMusic: () => { + 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/kartik/views/script/core_notification.js b/kartik/views/script/core_notification.js new file mode 100755 index 0000000..e720006 --- /dev/null +++ b/kartik/views/script/core_notification.js @@ -0,0 +1,12 @@ +global.notification = (data) => { + document.getElementById("notification-title").innerText = data.title; + document.getElementById("notification-message").innerText = data.message; + document.getElementById("notification").style.right = "20px"; + document.getElementById("notification").style.opacity = "1"; + new Audio("./sfx/notification.mp3").play(); + + setTimeout(() => { + document.getElementById("notification").style.right = "-300px"; + document.getElementById("notification").style.opacity = "0"; + }, 5000) +}; \ No newline at end of file diff --git a/kartik/views/script/core_viewer.js b/kartik/views/script/core_viewer.js new file mode 100755 index 0000000..a538b99 --- /dev/null +++ b/kartik/views/script/core_viewer.js @@ -0,0 +1,33 @@ +const webview = document.getElementById('wb'); + +try { + webview.addEventListener('dom-ready', () => { + setTimeout(() => { + document.getElementById('dummyloader').style.display = "none"; + }, 5000) + require('@electron/remote').getCurrentWindow().log(" * " + webview.getURL()); + require('@electron/remote').getCurrentWindow().focus(); + if (location.hash === "#ready") { + require('@electron/remote').webContents.fromId(webview.getWebContentsId()).send("ready", true); + } + webview.focus(); + try { + if (require('@electron/remote').getCurrentWindow().debug) { + info("MainWindow", "Opening debugging tools..."); + webview.openDevTools(); + } + } catch (e) {} + }) + + webview.addEventListener('dom-ready', () => { + setInterval(() => { + try { + if (webview.isCrashed() && !gameCrashed) { + require('@electron/remote').getCurrentWindow().log(" * Compositing engine crashed!"); + error("MainWindow", "Subcontainer crashed"); + crash(new Error("Webview crashed")); + } + } catch (e) {} + }, 2000) + }) +} catch (e) {} \ No newline at end of file diff --git a/kartik/views/script/credits_global.js b/kartik/views/script/credits_global.js new file mode 100755 index 0000000..393293d --- /dev/null +++ b/kartik/views/script/credits_global.js @@ -0,0 +1,54 @@ +let menuOpen = true; + +if (native) {global.$ = require('jquery');} else {var script = document.createElement('script');script.src = '../webinit/jquery.js';script.type = 'text/javascript';document.getElementsByTagName('head')[0].appendChild(script);} + +keysEnabled = true; +$(document).keydown(function(e) { + if (keysEnabled) { + if (e.keyCode === 13 || e.keyCode === 88 || e.keyCode === 32 || e.keyCode === 27 || e.keyCode === 8 || e.keyCode === 16) { // enter/esc + keysEnabled = false; + Sound.click(); + window.parent.musicManager.fadeMusic(); + $("#box").fadeOut(500); + setTimeout(() => { + info("GWinWindow", "Switching control to MenuWindow"); + location.href = "menu.html"; + }, 1000) + } + } +}) + +var currentpos=0,alt=1,curpos1=0,curpos2=-1 +function initialize(){ + $("#box").fadeIn(500); + startit() +} +function scrollwindow(){ + if (document.all) + temp=document.body.scrollTop + else + temp=window.pageYOffset + if (alt===0) + alt=1 + else + alt=0 + if (alt===0) + curpos1=temp + else + curpos2=temp + if (curpos1!==curpos2){ + if (document.all) + currentpos=document.body.scrollTop+1 + else + currentpos=window.pageYOffset+1 + window.scroll(0,currentpos) + } + else{ + currentpos=0 + window.scroll(0,currentpos) + } +} +function startit(){ + setInterval("scrollwindow()",20) +} +window.onload=initialize diff --git a/kartik/views/script/credits_libs.js b/kartik/views/script/credits_libs.js new file mode 100755 index 0000000..e69de29 diff --git a/kartik/views/script/credits_music.js b/kartik/views/script/credits_music.js new file mode 100755 index 0000000..7d2f69c --- /dev/null +++ b/kartik/views/script/credits_music.js @@ -0,0 +1,2 @@ +info("MusicMgr", "Playing settings.mp3"); +window.parent.musicManager.setMusic(kresources.music['credits'].file); \ No newline at end of file diff --git a/kartik/views/script/credits_technical.js b/kartik/views/script/credits_technical.js new file mode 100755 index 0000000..fda1998 --- /dev/null +++ b/kartik/views/script/credits_technical.js @@ -0,0 +1,12 @@ +document.write("Kartik: A New Start"); +document.write(" on " + navigator.userAgent + "
") +if (navigator.hardwareConcurrency > 1 || navigator.hardwareConcurrency === 0) { + document.write(navigator.hardwareConcurrency + " processors, "); +} else { + document.write(navigator.hardwareConcurrency + " processor, "); +} +if (navigator.maxTouchPoints > 1 || navigator.maxTouchPoints === 0) { + document.write(navigator.maxTouchPoints + " touch points
"); +} else { + document.write(navigator.maxTouchPoints + " touch point
"); +} \ No newline at end of file diff --git a/kartik/views/script/game_debug.js b/kartik/views/script/game_debug.js new file mode 100755 index 0000000..9d311b3 --- /dev/null +++ b/kartik/views/script/game_debug.js @@ -0,0 +1,138 @@ +global.debugshow = false; + +function oil(id) { + return "\nO" + id +": " + document.getElementById('oil' + id + '').style.left.split("px")[0] + " " + document.getElementById('oil' + id + '').style.top.split("px")[0] + " / " + document.getElementById('oil' + id + '').style.transform.split("rotate(")[1].split("deg)")[0]; +} + +$(document).keydown((e) => { + if (e.keyCode === 114) { // F3 + if (debugshow) { + global.debugshow = false; + document.getElementById("debug").style.display = "none"; + } else { + global.debugshow = true; + document.getElementById("debug").style.display = ""; + } + } +}) + +gpuperct = 100; + +pubver = "prod"; +pvpart = pubver.split("."); +if (pvpart.length === 3) { + intver = pvpart[0] + "." + pvpart[1]; +} else { + intver = "unknown"; +} + +release = "official"; + +if (gpuperct < 25) { + perf = "fast"; +} else if (gpuperct < 50) { + perf = "fancy"; +} else { + perf = "fabulous"; +} + +if (location.search === "") { + game = "Local multiplayer game"; +} else if (location.search === "?sp") { + game = "Singleplayer game"; +} else if (location.search === "?online") { + game = "Online multiplayer game"; +} + +tps = -1; +cping = -1; +changedDataLeft = "playing: %false%" +changedDataRight = "" +immutableDataLeft = "Kartik " + pubver + " (" + intver + "/trunk+" + release + ")\n%tps% tps T:" + perf + ";vsync\n" + game + " @ %ping% ms ticks"; +immutableDataRight = "Browser: " + navigator.userAgent; + +credits = "Debug: start runtime with debug argument\nFor help: https://arcade.minteck.org/kartik" + +setInterval(() => { + if (!debugshow) { return; } + + + leftparts = (immutableDataLeft + "\n" + changedDataLeft + "\n\n" + credits).split("\n"); + lefttext = "" + leftparts.join("
") + ""; + + rightparts = (immutableDataRight + "\n" + changedDataRight).split("\n"); + righttext = "" + rightparts.join("
") + ""; + + document.getElementById("debug-left").innerHTML = lefttext.replaceAll("%tps%", tps).replaceAll("%ping%", cping).replaceAll("%false%", "false").replaceAll("%true%", "true"); + document.getElementById("debug-right").innerHTML = righttext; +}, 100) + +var filterStrength = 20; +var frameTime = 0, lastLoop = new Date, thisLoop; + +setInterval(() => { + if (!debugshow) { return; } + + var thisFrameTime = (thisLoop=new Date) - lastLoop; + frameTime+= (thisFrameTime - frameTime) / filterStrength; + lastLoop = thisLoop; +}, 50) + +setInterval(() => { + if (!debugshow) { return; } + + tps = (1000/frameTime).toFixed(1); + + if (typeof ping === "number") { + cping = ping; + } else { + cping = 0; + } + + if (started) { + changedDataLeft = "playing: %true%"; + changedDataLeft += "\n\n0$: XY: " + document.getElementById('car0').style.left.split("px")[0] + " / " + document.getElementById('car0').style.top.split("px")[0] + + c0rotate = document.getElementById('car0').style.transform.split("rotate(")[1].split("deg)")[0]; + if (c0rotate === "90") { + changedDataLeft += "\n0$: Facing: south (Towards negative Y)"; + } else if (c0rotate === "-90") { + changedDataLeft += "\n0$: Facing: north (Towards negative Y)"; + } else if (c0rotate === "0") { + changedDataLeft += "\n0$: Facing: east (Towards positive X)"; + } else if (c0rotate === "180") { + changedDataLeft += "\n0$: Facing: west (Towards negative X)"; + } + + changedDataLeft += "\n0$: Speed: A: " + car0cspeed.toFixed(2) + " R: " + (car0speed - car0cspeed).toFixed(2) + " M: " + car0speed.toFixed(2); + + changedDataLeft += "\n0$: Laps: " + document.getElementById('laps-car0').innerText + "/5"; + changedDataLeft += "\n0$: Model: " + selectedModel0; + changedDataLeft += "\n0$: Collision: " + (car0collisionon ? "%true%" : "%false%"); + + changedDataLeft += "\n\n1$: XY: " + document.getElementById('car1').style.left.split("px")[0] + " / " + document.getElementById('car1').style.top.split("px")[0] + + c0rotate = document.getElementById('car1').style.transform.split("rotate(")[1].split("deg)")[0]; + if (c0rotate === "90") { + changedDataLeft += "\n1$: Facing: south (Towards negative Y)"; + } else if (c0rotate === "-90") { + changedDataLeft += "\n1$: Facing: north (Towards negative Y)"; + } else if (c0rotate === "0") { + changedDataLeft += "\n1$: Facing: east (Towards positive X)"; + } else if (c0rotate === "180") { + changedDataLeft += "\n1$: Facing: west (Towards negative X)"; + } + + changedDataLeft += "\n1$: Speed: A: " + car1cspeed.toFixed(2) + " R: " + (car1speed - car1cspeed).toFixed(2) + " M: " + car1speed.toFixed(2); + + changedDataLeft += "\n1$: Laps: " + document.getElementById('laps-car1').innerText + "/5"; + changedDataLeft += "\n1$: Model: " + selectedModel1; + changedDataLeft += "\n1$: Collision: " + (car1collisionon ? "%true%" : "%false%"); + changedDataLeft += "\n" + oil(0) + oil(1) + oil(2) + oil(3) + oil(4); + changedDataLeft += "\n\nMusic: " + i; + changedDataLeft += "\nCircuit: " + rand; + + } else { + changedDataLeft = "playing: %false%" + } +},100); \ No newline at end of file diff --git a/kartik/views/script/game_global.js b/kartik/views/script/game_global.js new file mode 100755 index 0000000..4e6de21 --- /dev/null +++ b/kartik/views/script/game_global.js @@ -0,0 +1,45 @@ +$("#box").fadeOut(0); +$("#bg").fadeOut(0); +setTimeout(() => { + $("#box").fadeIn(500); + $("#bg").fadeIn(500); +}, 200) + +global.startgame = () => { + keysEnabled = true; + $("#credits").fadeOut(200) + Sound.intro(); + + setTimeout(() => { + started = true; + }, 1700) + + setTimeout(() => { + if (location.search === "?sp") { + enableAI(); + } + }, 1200) +} + +startHooks.push(() => { + global.hitshow = false; + global.started = false; + keysEnabled = false; + + $("body").focus(); + + if (!online) { + setTimeout(startgame, 7000) + } + + if (online && role === "host") { + setTimeout(() => { + clientWriter(JSON.stringify({ + _type: "ipc", + action: "gameIsReady", + message: null + }) + "|") + startgame(); + }, 7000) + } +}) \ No newline at end of file diff --git a/kartik/views/script/game_music.js b/kartik/views/script/game_music.js new file mode 100755 index 0000000..9739cc3 --- /dev/null +++ b/kartik/views/script/game_music.js @@ -0,0 +1,8 @@ +startHooks.push(() => { + info("MusicMgr", "Playing game" + i + ".mp3"); + window.parent.musicManager.setMusic(kresources.music['game' + i].file); +}) + +if (location.search === "?online") { + window.parent.musicManager.setMusic(kresources.music['prepare'].file); +} diff --git a/kartik/views/script/game_online.js b/kartik/views/script/game_online.js new file mode 100755 index 0000000..e379708 --- /dev/null +++ b/kartik/views/script/game_online.js @@ -0,0 +1,9 @@ +if (location.search === "?online") { + document.getElementById('online-login').style.display = ""; + document.write(`<` + `script src="../online/global.js">`); +} else { + startHooks.forEach((hook) => { + hook(this); + }) + document.getElementById('ping').style.display = "none"; +} \ No newline at end of file diff --git a/kartik/views/script/game_select.js b/kartik/views/script/game_select.js new file mode 100755 index 0000000..a3896d4 --- /dev/null +++ b/kartik/views/script/game_select.js @@ -0,0 +1,131 @@ +if (native) {global.$ = require('jquery');} else {var script = document.createElement('script');script.src = '../webinit/jquery.js';script.type = 'text/javascript';document.getElementsByTagName('head')[0].appendChild(script);} + +startHooks.push(() => { + function ranint(min, max) { // min and max included + return Math.floor(Math.random() * (max - min + 1) + min); + } + + circuits = Object.keys(kresources.races); + rand = circuits[Math.floor(Math.random()*circuits.length)]; + + if (online && role === "host") { + setInterval(() => { + clientWriter(JSON.stringify({ + _type: "ipc", + action: "RaceData:circuit", + message: rand + }) + "|"); + }, 100) + } + + if (online && role === "guest") { + rand = guestInfo.circuit; + } + + info("GameWindow", "Selected circuit " + rand); + document.getElementById('circuit').style.backgroundImage = "url('." + kresources.races[rand].substr(0, kresources.races[rand].length - 5).split("'").join("\\'") + ".png')"; + document.getElementById('circuit').innerHTML = $.ajax("/kartik/" + kresources.races[rand], { async: false }).responseText.toString(); + + inf = JSON.parse(document.getElementsByTagName("circuit")[0].innerText); + if (typeof inf.name[lp] === "undefined") { + document.getElementById('race-title').innerText = inf.name.en; + } else { + document.getElementById('race-title').innerText = inf.name[lp]; + } + document.getElementById('race-author').innerText = inf.author; + + i = ranint(1, 9); + + if (online && role === "host") { + setInterval(() => { + clientWriter(JSON.stringify({ + _type: "ipc", + action: "RaceData:music", + message: i + }) + "|"); + }, 200) + } + + if (online && role === "guest") { + i = guestInfo.music; + } + + global.spreadOil = (oil) => { + rx = ranint(0, 680); + ry = ranint(0, 490); + rd = ranint(0, 360); + rh = ranint(0, 360); + + oil.style.top = ry + "px"; + oil.style.left = rx + "px"; + oil.style.transform = "rotate(" + rd + "deg)"; + oil.style.filter = "hue-rotate(" + rd + "deg)"; + } + + Array.from(document.getElementById('oil').children).forEach((item) => { + spreadOil(item); + }) + + modelsAvailable = Object.keys(kresources.cars); + + selectedModel0I = Math.floor(Math.random() * modelsAvailable.length); + selectedModel0 = modelsAvailable[selectedModel0I]; + modelsAvailable.splice(selectedModel0I, 1); + + selectedModel1I = Math.floor(Math.random() * modelsAvailable.length); + selectedModel1 = modelsAvailable[selectedModel1I]; + + if (online && role === "host") { + setInterval(() => { + clientWriter(JSON.stringify({ + _type: "ipc", + action: "RaceData:hostCar", + message: selectedModel0 + }) + "|"); + }, 300) + setInterval(() => { + clientWriter(JSON.stringify({ + _type: "ipc", + action: "RaceData:guestCar", + message: selectedModel1 + }) + "|"); + }, 400) + } + + if (online && role === "guest") { + selectedModel0 = guestInfo.guestCar; + selectedModel1 = guestInfo.hostCar; + } + + document.getElementById("car0-img").src = kresources.cars[selectedModel0]; + document.getElementById("cars-p1-inner").src = kresources.cars[selectedModel0]; + document.getElementById("car1-img").src = kresources.cars[selectedModel1]; + document.getElementById("cars-p2-inner").src = kresources.cars[selectedModel1]; +}) + +startHooks.push(() => { + setInterval(() => { + if (online) { + clientWriter(JSON.stringify({ + _type: "ipc", + action: "posTop", + message: document.getElementById("car0").style.top + }) + "|") + clientWriter(JSON.stringify({ + _type: "ipc", + action: "posLeft", + message: document.getElementById("car0").style.left + }) + "|") + clientWriter(JSON.stringify({ + _type: "ipc", + action: "posRot", + message: document.getElementById("car0").style.transform + }) + "|") + clientWriter(JSON.stringify({ + _type: "ipc", + action: "progressLaps", + message: document.getElementById("laps-car0").innerText + }) + "|") + } + }, 50) +}) diff --git a/kartik/views/script/global_compatlayer.js b/kartik/views/script/global_compatlayer.js new file mode 100755 index 0000000..e69de29 diff --git a/kartik/views/script/global_levelsapi.js b/kartik/views/script/global_levelsapi.js new file mode 100755 index 0000000..ebd969d --- /dev/null +++ b/kartik/views/script/global_levelsapi.js @@ -0,0 +1,47 @@ +module.exports = class LevelsAPI { + + associates; + + constructor() { + + let assocs_raw; + let assocs_lines; + let assocs_base; + let assocs; + let score; + let cline; + let line; + let clvl; + + assocs_raw = require('fs').readFileSync("./online/levels.txt"); + assocs_lines = assocs_raw.toString().split("\n"); + assocs_base = {}; + + for (line of assocs_lines) { + cline = line.split(":"); + assocs_base[cline[1].trim()] = cline[0].trim() - 1 + 1; + } + + assocs = {}; + + clvl = 0; + for (let c = 0; c <= 5051; c++) { + if (assocs_base[c.toString()] !== undefined) { + clvl = assocs_base[c.toString()]; + } + assocs[c.toString()] = clvl.toString() + } + + this.associates = assocs; + + } + + correspond(score, god) { + if (score <= 5051) { + return this.associates[score].toString(); + } else { + return god; + } + } + +} \ No newline at end of file diff --git a/kartik/views/script/intro_global.js b/kartik/views/script/intro_global.js new file mode 100755 index 0000000..b6bf033 --- /dev/null +++ b/kartik/views/script/intro_global.js @@ -0,0 +1,21 @@ +if (native) {global.$ = require('jquery');} else {var script = document.createElement('script');script.src = '../webinit/jquery.js';script.type = 'text/javascript';document.getElementsByTagName('head')[0].appendChild(script);} +$("#box").fadeOut(0); +window.addEventListener('load', () => { + setTimeout(() => { + $("#box").fadeIn(500); + }, 1000) +}) + +keysEnabled = true; +$(document).keydown(function(e) { + if (keysEnabled) { + if (e.keyCode === 13 || e.keyCode === 88 || e.keyCode === 32 || e.keyCode === 27 || e.keyCode === 8 || e.keyCode === 16) { // enter/esc + kesyEnabled = false; + $("#box").fadeOut(500); + setTimeout(() => { + info("GWinWindow", "Switching control to MenuWindow"); + location.href = "menu.html?noreset"; + }, 1000) + } + } +}) \ No newline at end of file diff --git a/kartik/views/script/intro_media.js b/kartik/views/script/intro_media.js new file mode 100755 index 0000000..a6be835 --- /dev/null +++ b/kartik/views/script/intro_media.js @@ -0,0 +1,2 @@ +info("MusicMgr", "Playing title.mp3"); +window.parent.musicManager.setMusic(kresources.music['title'].file); \ No newline at end of file diff --git a/kartik/views/script/intro_message.js b/kartik/views/script/intro_message.js new file mode 100755 index 0000000..6ab8d95 --- /dev/null +++ b/kartik/views/script/intro_message.js @@ -0,0 +1,7 @@ +setInterval(() => { + if (require('@electron/remote').getCurrentWindow().controllerAttached) { + document.getElementById('progress').innerText = lang.intro[1]; + } else { + document.getElementById('progress').innerText = lang.intro[0]; + } +}, 100) \ No newline at end of file diff --git a/kartik/views/script/loader_global.js b/kartik/views/script/loader_global.js new file mode 100755 index 0000000..9844f1e --- /dev/null +++ b/kartik/views/script/loader_global.js @@ -0,0 +1,132 @@ +window.addEventListener("load", () => { + document.getElementById("banner-decoration").style.display = ""; + document.getElementById("banner-outer").style.backgroundImage = ""; + document.getElementById("banner-outer").style.backgroundColor = "#042349"; + document.getElementById("banner-contrast").style.display = "none"; + + setTimeout(() => { + if (native) { + setTimeout(() => { + setTimeout(() => { + + $("#progress").fadeOut(500); + setTimeout(() => { + window.fetch("https://kartik.hopto.org/latest.php?v=" + require('@electron/remote').getCurrentWindow().update).then((data) => { + data.blob().then((a) => { + a.text().then((b) => { + if (require('@electron/remote').getCurrentWindow().update === "git") { + document.getElementById('updates').style.backgroundColor = "lightsalmon"; + document.getElementById('updates').innerText = lang.updates.git; + } else { + console.log(b); + console.log(require('../package.json').version); + if (b === require('../package.json').version) { + document.getElementById('updates').style.backgroundColor = "lightgreen"; + document.getElementById('updates').innerText = lang.updates.ok; + } else { + require('@electron/remote').getCurrentWindow().webContents.send("notification", {title: lang.updates.warn[0], message: lang.updates.warn[1]}); + document.getElementById('updates').style.backgroundColor = "lightyellow"; + document.getElementById('updates').innerText = lang.updates.available; + } + } + setTimeout(() => { + $("#banner-outer").fadeOut(200); + $("#intro-video").fadeIn(200); + setTimeout(() => { + introsfx = document.getElementById("intro-video"); + introsfx.play() + introsfx.onended = () => { + $("body").fadeOut(500); + setTimeout(() => { + info("LoadWindow", "Switching control to MenuWindow"); + location.href = "intro.html"; + }, 1000) + } + }, 200) + }, 2000) + }).catch((e) => { + console.warn(e); + document.getElementById('updates').style.backgroundColor = "lightcoral"; + document.getElementById('updates').innerText = lang.updates.error; + require('@electron/remote').getCurrentWindow().webContents.send("notification", {title: lang.polymer.updateError[0], message: lang.polymer.updateError[1]}); + setTimeout(() => { + $("#banner-outer").fadeOut(200); + $("#intro-video").fadeIn(200); + setTimeout(() => { + introsfx = document.getElementById("intro-video"); + introsfx.play() + introsfx.onended = () => { + $("body").fadeOut(500); + setTimeout(() => { + info("LoadWindow", "Switching control to MenuWindow"); + location.href = "intro.html"; + }, 1000) + } + }, 200) + }, 2000) + }); + }).catch((e) => { + console.warn(e); + document.getElementById('updates').style.backgroundColor = "lightcoral"; + document.getElementById('updates').innerText = lang.updates.error; + require('@electron/remote').getCurrentWindow().webContents.send("notification", {title: lang.polymer.updateError[0], message: lang.polymer.updateError[1]}); + setTimeout(() => { + $("#banner-outer").fadeOut(200); + $("#intro-video").fadeIn(200); + setTimeout(() => { + introsfx = document.getElementById("intro-video"); + introsfx.play() + introsfx.onended = () => { + $("body").fadeOut(500); + setTimeout(() => { + info("LoadWindow", "Switching control to MenuWindow"); + location.href = "intro.html"; + }, 1000) + } + }, 200) + }, 2000) + }); + }).catch((e) => { + console.warn(e); + document.getElementById('updates').style.backgroundColor = "lightcoral"; + document.getElementById('updates').innerText = lang.updates.error; + require('@electron/remote').getCurrentWindow().webContents.send("notification", {title: lang.polymer.updateError[0], message: lang.polymer.updateError[1]}); + setTimeout(() => { + $("#banner-outer").fadeOut(200); + $("#intro-video").fadeIn(200); + setTimeout(() => { + introsfx = document.getElementById("intro-video"); + introsfx.play() + introsfx.onended = () => { + $("body").fadeOut(500); + setTimeout(() => { + info("LoadWindow", "Switching control to MenuWindow"); + location.href = "intro.html"; + }, 1000) + } + }, 200) + }, 2000) + }); + }, 2000) + }, 3000) + }, 1000) + } else { + + setTimeout(() => { + $("#banner-outer").fadeOut(200); + $("#intro-video").fadeIn(200); + setTimeout(() => { + introsfx = document.getElementById("intro-video"); + introsfx.play() + introsfx.onended = () => { + $("body").fadeOut(500); + setTimeout(() => { + info("LoadWindow", "Switching control to MenuWindow"); + location.href = "intro.html"; + }, 1000) + } + }, 200) + }, 5000) + } + }, 2000) +}) \ No newline at end of file diff --git a/kartik/views/script/menu_copyright.js b/kartik/views/script/menu_copyright.js new file mode 100755 index 0000000..2b38844 --- /dev/null +++ b/kartik/views/script/menu_copyright.js @@ -0,0 +1,5 @@ +if (new Date().getFullYear() === 2021) { + document.write(new Date().getFullYear() + " Minteck"); +} else { + document.write("2021-" + new Date().getFullYear() + " Minteck"); +} \ No newline at end of file diff --git a/kartik/views/script/menu_global.js b/kartik/views/script/menu_global.js new file mode 100755 index 0000000..811e525 --- /dev/null +++ b/kartik/views/script/menu_global.js @@ -0,0 +1,127 @@ +let menuOpen = true; + +if (native) {global.$ = require('jquery');} else {var script = document.createElement('script');script.src = '../webinit/jquery.js';script.type = 'text/javascript';document.getElementsByTagName('head')[0].appendChild(script);} +$("#box").fadeOut(0); +window.addEventListener('load', () => { + setTimeout(() => { + $("#box").fadeIn(500); + }, 1000) +}) + +$("body").focus(); +keysEnabled = true; +$(document).keydown(function(e) { + if (loggingIn) { return; } + + if (keysEnabled) { + if (e.ctrlKey && e.keyCode === 13) { // ctrl+enter + throw new RangeError("Manually initiated crash"); + } + if (e.keyCode === 13 || e.keyCode === 88 || e.keyCode === 32) { // enter + if ($(".services").is(":visible")) { + selectOption(); + } else { + $(".services").show(); + } + menuOpen = !menuOpen; + } + if (e.keyCode === 38 || e.keyCode === 90) { // up + Sound.menu(); + var selected = $(".selected"); + $(".services li").removeClass("selected"); + if (selected.prev().length === 0) { + selected.siblings().last().addClass("selected"); + } else { + selected.prev().addClass("selected"); + } + } + if (e.keyCode === 40 || e.keyCode === 83) { // down + Sound.menu(); + var selected = $(".selected"); + $(".services li").removeClass("selected"); + if (selected.next().length === 0) { + selected.siblings().first().addClass("selected"); + } else { + selected.next().addClass("selected"); + } + } + if (e.keyCode === 27 || e.keyCode === 8) { // esc + keysEnabled = false; + Sound.click(); + setTimeout(() => { + require('@electron/remote').getCurrentWindow().close(); + }, 250) + } + } +}); + +function selectOption() { + item = document.querySelector(".selected a").id; + Sound.click(); + + switch (item) { + case 'single': + scenar("start", "happy"); + keysEnabled = false; + window.parent.musicManager.fadeMusic(); + $("#box").fadeOut(500); + setTimeout(() => { + info("MenuWindow", "Switching control to GameWindow"); + location.href = "game.html?sp"; + }, 1000) + break; + case 'online': + keysEnabled = false; + window.parent.musicManager.fadeMusic(); + $("#box").fadeOut(500); + setTimeout(() => { + info("MenuWindow", "Switching control to GameWindow"); + location.href = "game.html?online"; + }, 1000) + break; + case 'play': + keysEnabled = false; + window.parent.musicManager.fadeMusic(); + $("#box").fadeOut(500); + setTimeout(() => { + info("MenuWindow", "Switching control to GameWindow"); + location.href = "game.html"; + }, 1000) + break; + case 'settings': + keysEnabled = false; + $("#box").fadeOut(500); + setTimeout(() => { + info("MenuWindow", "Switching control to OptnWindow"); + location.href = "settings.html"; + }, 1000) + break; + case 'stats': + keysEnabled = false; + window.parent.musicManager.fadeMusic(); + $("#box").fadeOut(500); + setTimeout(() => { + info("MenuWindow", "Switching control to OptnWindow"); + location.href = "stats.html"; + }, 1000) + break; + case 'credits': + keysEnabled = false; + window.parent.musicManager.fadeMusic(); + $("#box").fadeOut(500); + setTimeout(() => { + info("MenuWindow", "Switching control to OptnWindow"); + location.href = "credits.html"; + }, 1000) + break; + case 'quit': + keysEnabled = false; + window.parent.musicManager.fadeMusic(); + info("MenuWindow", "Quitting game"); + Sound.click(); + setTimeout(() => { + window.parent.location.href = "/"; + }, 250) + break; + } +} \ No newline at end of file diff --git a/kartik/views/script/menu_gpuinfo.js b/kartik/views/script/menu_gpuinfo.js new file mode 100755 index 0000000..e69de29 diff --git a/kartik/views/script/menu_login.js b/kartik/views/script/menu_login.js new file mode 100755 index 0000000..8e071eb --- /dev/null +++ b/kartik/views/script/menu_login.js @@ -0,0 +1 @@ +global.loggingIn = false; diff --git a/kartik/views/script/menu_music.js b/kartik/views/script/menu_music.js new file mode 100755 index 0000000..5d26af0 --- /dev/null +++ b/kartik/views/script/menu_music.js @@ -0,0 +1,5 @@ +if (location.search !== "?noreset") { + console.log("back"); + window.parent.musicManager.setMusic(kresources.music['title'].file); +} +info("MenuWindow", "Menu opened"); diff --git a/kartik/views/script/menu_system.js b/kartik/views/script/menu_system.js new file mode 100755 index 0000000..947699f --- /dev/null +++ b/kartik/views/script/menu_system.js @@ -0,0 +1,33 @@ + +switch (require('os').platform()) { + case "win32": + document.write("Windows"); + break + case "aix": + document.write("AIX"); + break + case "android": + document.write("Android"); + break + case "cygwin": + document.write("Cygwin"); + break + case "darwin": + document.write("macOS"); + break + case "freebsd": + document.write("FreeBSD"); + break + case "linux": + document.write("GNU/Linux"); + break + case "netbsd": + document.write("NetBSD"); + break + case "openbsd": + document.write("OpenBSD"); + break + case "sunos": + document.write("Solaris"); + break +} diff --git a/kartik/views/script/online_play.js b/kartik/views/script/online_play.js new file mode 100755 index 0000000..0c1eb91 --- /dev/null +++ b/kartik/views/script/online_play.js @@ -0,0 +1,2 @@ +require('@electron/remote').getCurrentWindow().dstate = lang.online.discord2; +require('@electron/remote').getCurrentWindow().ddetails = lang.online.discord; \ No newline at end of file diff --git a/kartik/views/script/settings_global.js b/kartik/views/script/settings_global.js new file mode 100755 index 0000000..64c9b64 --- /dev/null +++ b/kartik/views/script/settings_global.js @@ -0,0 +1,104 @@ +let menuOpen = true; + +if (native) {global.$ = require('jquery');} else {var script = document.createElement('script');script.src = '../webinit/jquery.js';script.type = 'text/javascript';document.getElementsByTagName('head')[0].appendChild(script);} +$("#box").fadeOut(0); +setTimeout(() => { + $("#box").fadeIn(500); +}, 200) + +$("body").focus(); +keysEnabled = true; +$(document).keydown(function(e) { + if (keysEnabled) { + if (e.keyCode === 13 || e.keyCode === 88 || e.keyCode === 32) { // enter + if ($(".services").is(":visible")) { + selectOption(); + } else { + $(".services").show(); + } + } + if (e.keyCode === 38 || e.keyCode === 90) { // up + Sound.menu(); + var selected = $(".selected"); + $(".services li").removeClass("selected"); + if (selected.prev().length === 0) { + selected.siblings().last().addClass("selected"); + } else { + selected.prev().addClass("selected"); + } + } + if (e.keyCode === 40 || e.keyCode === 83) { // down + Sound.menu(); + var selected = $(".selected"); + $(".services li").removeClass("selected"); + if (selected.next().length === 0) { + selected.siblings().first().addClass("selected"); + } else { + selected.next().addClass("selected"); + } + } + if (e.keyCode === 68 || e.keyCode === 39 || e.keyCode === 81 || e.keyCode === 37) { // right/left + Sound.menu(); + var selected = $(".selected"); + var id = $(".selected")[0].children[0].children[0].id; + + if (id === "lang") { + lang = document.getElementById("setting-lang").innerText; + slng = JSON.parse($.ajax('../lang/languages.json', { async: false }).responseText); + slst = Object.keys(slng); + maxl = slst.length - 1; + + ci = -1; + ni = -1; + slst.forEach((key, index) => { + if (slng[key] === lang) { + ci = index; + if (index + 1 > maxl) { + ni = 0; + } else { + ni = index + 1; + } + } + }) + + if (ci !== -1 && ni !== -1) { + document.cookie = "kartik_lang=" + slst[ni] + "; path=/"; + document.getElementById("setting-lang").innerText = slng[slst[ni]]; + window.parent.lp = lp = slst[ni]; + } + } + } + if (e.keyCode === 27 || e.keyCode === 8) { // esc + keysEnabled = false; + Sound.click(); + $("#box").fadeOut(500); + setTimeout(() => { + info("OptnWindow", "Switching control to MenuWindow"); + location.href = "menu.html"; + }, 1000) + } + } +}); + +function selectOption() { + item = document.querySelector(".selected a").id; + Sound.click(); + + switch (item) { + case 'back': + $("#box").fadeOut(500); + setTimeout(() => { + info("OptnWindow", "Switching control to MenuWindow"); + location.href = "menu.html?noreset"; + }, 1000) + break; + case 'credits': + window.parent.musicManager.fadeMusic(); + $("#box").fadeOut(500); + setTimeout(() => { + info("OptnWindow", "Switching control to MenuWindow"); + location.href = "credits.html"; + }, 1000) + break; + } +} diff --git a/kartik/views/script/settings_load.js b/kartik/views/script/settings_load.js new file mode 100755 index 0000000..c57329f --- /dev/null +++ b/kartik/views/script/settings_load.js @@ -0,0 +1,10 @@ +info("OptnWindow", "Restoring settings..."); + +slang = lp; +langs = JSON.parse($.ajax('../lang/languages.json', { async: false }).responseText); + +if (Object.keys(langs).includes(slang)) { + document.getElementById("setting-lang").innerText = langs[slang]; +} else { + document.getElementById("setting-lang").innerText = slang; +} diff --git a/kartik/views/script/win_global.js b/kartik/views/script/win_global.js new file mode 100755 index 0000000..7448375 --- /dev/null +++ b/kartik/views/script/win_global.js @@ -0,0 +1,22 @@ +if (native) {global.$ = require('jquery');} else {var script = document.createElement('script');script.src = '../webinit/jquery.js';script.type = 'text/javascript';document.getElementsByTagName('head')[0].appendChild(script);} +$("#box").fadeOut(0); +setTimeout(() => { + $("#box").fadeIn(500); +}, 200) + +keysEnabled = true; +$(document).keydown(function(e) { + if (keysEnabled) { + if (e.keyCode === 13 || e.keyCode === 88 || e.keyCode === 32 || e.keyCode === 27 || e.keyCode === 8 || e.keyCode === 16) { // enter/esc + Sound.click(); + window.parent.musicManager.fadeMusic(); + $("#box").fadeOut(500); + setTimeout(() => { + info("GWinWindow", "Switching control to MenuWindow"); + location.href = "menu.html"; + }, 3000) + } + } +}) + +info("GWinWindow", "Rendered!"); \ No newline at end of file diff --git a/kartik/views/script/win_message.js b/kartik/views/script/win_message.js new file mode 100755 index 0000000..fd01c22 --- /dev/null +++ b/kartik/views/script/win_message.js @@ -0,0 +1,9 @@ +if (location.search === "?sp") { + if ((location.hash.substr(4) - 1 + 2) == 1) { + document.write(lang.win.solo.win); + } else { + document.write(lang.win.solo.lose); + } +} else { + document.write(lang.win.versus.replace("0", (location.hash.substr(4) - 1 + 2))); +} \ No newline at end of file diff --git a/kartik/views/script/win_music.js b/kartik/views/script/win_music.js new file mode 100755 index 0000000..6220bb8 --- /dev/null +++ b/kartik/views/script/win_music.js @@ -0,0 +1,2 @@ +info("MusicMgr", "Playing win.mp3"); +window.parent.musicManager.setMusic(kresources.music['win'].file); \ No newline at end of file diff --git a/kartik/views/script/win_play.js b/kartik/views/script/win_play.js new file mode 100755 index 0000000..e69de29 diff --git a/kartik/views/script/win_quit.js b/kartik/views/script/win_quit.js new file mode 100755 index 0000000..e69de29 diff --git a/kartik/views/settings.html b/kartik/views/settings.html new file mode 100755 index 0000000..0548e2d --- /dev/null +++ b/kartik/views/settings.html @@ -0,0 +1,49 @@ + + + + + + + + + + + Kartik + + + + + + + + + + + + + + diff --git a/kartik/views/splash.svg b/kartik/views/splash.svg new file mode 100755 index 0000000..e9bfac3 --- /dev/null +++ b/kartik/views/splash.svg @@ -0,0 +1,2831 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kartik/views/stats.html b/kartik/views/stats.html new file mode 100755 index 0000000..b457233 --- /dev/null +++ b/kartik/views/stats.html @@ -0,0 +1,66 @@ + + + + + + + + Kartik + + + + + + + + + + + + + + + + + + diff --git a/kartik/views/win.html b/kartik/views/win.html new file mode 100755 index 0000000..fbc4de6 --- /dev/null +++ b/kartik/views/win.html @@ -0,0 +1,40 @@ + + + + + + + + Kartik + + + + + + + + + + + + + + + + + + -- cgit