blob: 92a78a62e3579a3a2b7c067b315093155a64dd24 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
global.quitting = false;
startHooks.push(() => {
global.pause = (stat) => {
if (stat) {
if (location.search === "?sp") {
require('@electron/remote').getCurrentWindow().dstate = lang.discord.game[3];
require('@electron/remote').getCurrentWindow().ddetails = lang.discord.game[1];
} else {
require('@electron/remote').getCurrentWindow().dstate = lang.discord.game[3];
require('@electron/remote').getCurrentWindow().ddetails = lang.discord.game[2];
}
warn("Suspend", "Game paused");
Sound.pause();
if (require('@electron/remote').getCurrentWindow().music) {
shouldMusicPlay = false;
require('electron').ipcRenderer.send('prefademusic', "");
}
if (typeof e !== "undefined") {
if (e.currentTime < e.duration) {
e.pause();
}
}
if (typeof b !== "undefined") {
b.pause();
}
paused = true;
document.getElementById('box').classList.add('paused');
$("#paused").show();
} else {
if (location.search === "?sp") {
require('@electron/remote').getCurrentWindow().dstate = lang.discord.game[0];
require('@electron/remote').getCurrentWindow().ddetails = lang.discord.game[1];
} else {
require('@electron/remote').getCurrentWindow().dstate = lang.discord.game[0];
require('@electron/remote').getCurrentWindow().ddetails = lang.discord.game[2];
}
warn("Suspend", "Game resumed");
Sound.pause();
if (require('@electron/remote').getCurrentWindow().music) {
shouldMusicPlay = true;
require('electron').ipcRenderer.send('preunfademusic', "");
}
if (typeof me !== "undefined") {
if (me.currentTime < me.duration) {
me.play();
}
}
if (typeof b !== "undefined") {
b.play();
}
paused = false;
document.getElementById('box').classList.remove('paused');
$("#paused").hide();
}
}
global.selectOption = () => {
item = document.querySelector(".selected a").id;
Sound.click();
switch (item) {
case 'continue':
pause(false);
break;
case 'hitboxes':
if (hitshow) {
hitshow = false;
document.getElementById("circuit").classList.remove("hitboxes");
document.getElementById('hitboxes').innerText = lang.game.gpause.showhb;
info("GameWindow", "Hitboxes hidden");
} else {
hitshow = true;
document.getElementById("circuit").classList.add("hitboxes");
document.getElementById('hitboxes').innerText = lang.game.gpause.hidehb;
info("GameWindow", "Hitboxes shown");
}
break;
case 'quit':
if (online) {
global.quitting = true;
clientWriter(JSON.stringify({
_type: "ipc",
action: "abort",
message: null
}) + "|")
}
keysEnabled = false;
require('electron').ipcRenderer.send('prefademusic', "");
$("#box").fadeOut(500);
$("#bg").fadeOut(500);
$("#paused").fadeOut(500);
setTimeout(() => {
info("GameWindow", "Switching control to MenuWindow");
location.href = "menu.html?back";
}, 1000)
break;
}
}
})
|