aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinteck <nekostarfan@gmail.com>2021-06-11 18:34:28 +0200
committerMinteck <nekostarfan@gmail.com>2021-06-11 18:34:28 +0200
commitad2d1e6ca122cb9d87c6f18d9900caa490af97ef (patch)
tree2d58fc36c3d12f09c849efba6d7fc61768f05ad3
parent0596f707fdaa36892a75ba7d2b9e8f834e7f4cfe (diff)
downloadkartik-client-ad2d1e6ca122cb9d87c6f18d9900caa490af97ef.tar.gz
kartik-client-ad2d1e6ca122cb9d87c6f18d9900caa490af97ef.tar.bz2
kartik-client-ad2d1e6ca122cb9d87c6f18d9900caa490af97ef.zip
Music fixes (yes, after the game release)
-rw-r--r--app.js4
-rw-r--r--kartik.bat2
-rw-r--r--package.json2
-rw-r--r--views/script/core_music.js7
-rw-r--r--views/script/game_music.js6
5 files changed, 12 insertions, 9 deletions
diff --git a/app.js b/app.js
index 71578af..1b9ab13 100644
--- a/app.js
+++ b/app.js
@@ -265,7 +265,9 @@ const { app, BrowserWindow } = require('electron');
win.webContents.on('dom-ready', () => {
musicIpc = require('electron').ipcMain;
musicIpc.on('newmusic', (event, value) => {
- win.webContents.send('setmusic', value);
+ if (music) {
+ win.webContents.send('setmusic', value);
+ }
})
musicIpc.on('prefademusic', (event, value) => {
win.webContents.send('fademusic', value);
diff --git a/kartik.bat b/kartik.bat
index 6cf0b2f..a343c70 100644
--- a/kartik.bat
+++ b/kartik.bat
@@ -1,2 +1,2 @@
@echo off
-bin\win32\kartik-core.exe app.js
+bin\win32\kartik-core.exe app.js \ No newline at end of file
diff --git a/package.json b/package.json
index f161ed5..e9a4ccd 100644
--- a/package.json
+++ b/package.json
@@ -1 +1 @@
-{"name":"kartik","version":"dfbe847","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":"0596f70","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/script/core_music.js b/views/script/core_music.js
index 4b85ebb..a35d329 100644
--- a/views/script/core_music.js
+++ b/views/script/core_music.js
@@ -6,7 +6,10 @@ global.musicElement = new Audio();
const musicIpc = require('electron').ipcRenderer;
musicIpc.on('setmusic', (event, args) => {
- if (!musicElement.paused) {
+ musicElement.src = args;
+ musicElement.play();
+ musicElement.volume = 1;
+ /*if (!musicElement.paused) {
csi1 = setInterval(() => {
if (musicElement.volume <= 0.05) {
clearInterval(csi1);
@@ -27,7 +30,7 @@ musicIpc.on('setmusic', (event, args) => {
} else {
musicElement.src = args;
musicElement.play();
- }
+ }*/
/*try { csp1.volume = 0; } catch (e) {}
try { csp2.volume = 0; } catch (e) {}
song = args;
diff --git a/views/script/game_music.js b/views/script/game_music.js
index 29b00da..2aa7e94 100644
--- a/views/script/game_music.js
+++ b/views/script/game_music.js
@@ -1,8 +1,6 @@
startHooks.push(() => {
- if (require('@electron/remote').getCurrentWindow().music) {
- info("MusicMgr", "Playing game" + i + ".mp3");
- require('electron').ipcRenderer.send('newmusic', kresources.music['game' + i].file);
- }
+ info("MusicMgr", "Playing game" + i + ".mp3");
+ require('electron').ipcRenderer.send('newmusic', kresources.music['game' + i].file);
})
if (location.search === "?online") {