未验证 提交 aad38f96 编写于 作者: G GitSquared

🔊 Add some more FX & 'extraAudio' setting

don't blow your ears fellas
上级 788a8453
......@@ -62,7 +62,8 @@ if (!fs.existsSync(settingsFile)) {
cwd: electron.app.getPath("userData"),
keyboard: "en-US",
theme: "tron",
audio: false
audio: true,
extraAudio: false
}, 4));
}
......
......@@ -270,6 +270,7 @@ function initUI() {
</section>`;
setTimeout(() => {
window.audioManager.scan.play();
document.getElementById("main_shell").setAttribute("style", "height:0%;margin-bottom:30vh;");
setTimeout(() => {
document.getElementById("main_shell").setAttribute("style", "margin-bottom: 30vh;");
......@@ -455,8 +456,8 @@ window.remakeKeyboard = (layout) => {
};
window.focusShellTab = (number) => {
window.audioManager.beep3.play();
window.audioManager.beep2.play();
if (number !== window.currentTerm && window.term[number]) {
window.currentTerm = number;
......
......@@ -3,32 +3,65 @@ class AudioManager {
const path = require("path");
const {Howl, Howler} = require("howler");
// Load sounds
this.beep1 = new Howl({
src: [path.join(__dirname, "assets", "audio", "beep1.wav")]
});
this.beep2 = new Howl({
src: [path.join(__dirname, "assets", "audio", "beep2.wav")]
});
this.beep3 = new Howl({
src: [path.join(__dirname, "assets", "audio", "beep3.wav")]
});
this.beep4 = new Howl({
src: [path.join(__dirname, "assets", "audio", "beep4.wav")]
});
this.intro = new Howl({
src: [path.join(__dirname, "assets", "audio", "intro.wav")]
});
this.dismiss = new Howl({
src: [path.join(__dirname, "assets", "audio", "dismiss.wav")]
});
this.alarm = new Howl({
src: [path.join(__dirname, "assets", "audio", "alarm.wav")]
});
if (window.settings.audio !== true) {
if (window.settings.audio === true) {
this.beep1 = new Howl({
src: [path.join(__dirname, "assets", "audio", "beep1.wav")]
});
this.beep2 = new Howl({
src: [path.join(__dirname, "assets", "audio", "beep2.wav")]
});
this.beep3 = new Howl({
src: [path.join(__dirname, "assets", "audio", "beep3.wav")],
volume: 0.6
});
this.beep4 = new Howl({
src: [path.join(__dirname, "assets", "audio", "beep4.wav")]
});
this.dismiss = new Howl({
src: [path.join(__dirname, "assets", "audio", "dismiss.wav")]
});
this.alarm = new Howl({
src: [path.join(__dirname, "assets", "audio", "alarm.wav")]
});
this.info = new Howl({
src: [path.join(__dirname, "assets", "audio", "info.wav")]
});
} else {
Howler.volume(0.0);
}
if (window.settings.extraAudio === true) {
this.beep5 = new Howl({
src: [path.join(__dirname, "assets", "audio", "beep5.wav")]
});
this.intro = new Howl({
src: [path.join(__dirname, "assets", "audio", "intro.wav")]
});
this.scan = new Howl({
src: [path.join(__dirname, "assets", "audio", "scan.wav")]
});
this.ping = new Howl({
src: [path.join(__dirname, "assets", "audio", "ping.wav")],
volume: 0.02
});
this.pingFailed = new Howl({
src: [path.join(__dirname, "assets", "audio", "pingFailed.wav")],
volume: 0.02
});
}
// Return a proxy to avoid errors if sounds aren't loaded
return new Proxy(this, {
get: (target, sound) => {
if (sound in target) {
return target[sound];
} else {
return {
play: () => {return true;}
}
}
}
});
}
}
......
......@@ -8,6 +8,8 @@ class Clock {
<h1 id="mod_clock_text"><span>?</span><span>?</span><span>:</span><span>?</span><span>?</span><span>:</span><span>?</span><span>?</span></h1>
</div>`;
this.lastTime = new Date();
this.updateClock();
this.updater = setInterval(() => {
this.updateClock();
......@@ -16,6 +18,11 @@ class Clock {
updateClock() {
let time = new Date();
let array = [time.getHours(), time.getMinutes(), time.getSeconds()];
if (this.lastTime.getMinutes() !== array[1]) {
window.audioManager.beep5.play();
}
array.forEach((e, i) => {
if (e.toString().length !== 2) {
array[i] = "0"+e;
......@@ -29,6 +36,7 @@ class Clock {
else clockString += "<span>"+e+"</span>";
});
document.getElementById("mod_clock_text").innerHTML = clockString;
this.lastTime = time;
}
}
......
......@@ -919,6 +919,7 @@ class Keyboard {
// Keep focus on the terminal
window.term[window.currentTerm].term.focus();
window.audioManager.beep2.play();
e.preventDefault();
};
key.onmouseup = () => {
......@@ -959,6 +960,7 @@ class Keyboard {
// Keep focus on the terminal
window.term[window.currentTerm].term.focus();
window.audioManager.beep3.play();
e.preventDefault();
};
key.onmouseup = (e) => {
......@@ -1072,6 +1074,7 @@ class Keyboard {
} else {
key.setAttribute("class", "keyboard_key active");
}
window.audioManager.beep3.play();
};
document.onkeyup = (e) => {
......@@ -1092,6 +1095,10 @@ class Keyboard {
key.setAttribute("class", "keyboard_key");
}, 100);
}
if (e.key === "Enter") {
window.audioManager.beep2.play();
}
};
}
}
......
......@@ -67,7 +67,7 @@ class Modal {
window.audioManager.alarm.play();
break;
default:
window.audioManager.beep2.play();
window.audioManager.info.play();
break;
}
window.modals[this.id] = this;
......
......@@ -102,8 +102,10 @@ class Netstat {
if (data === -1) {
ping = "--ms";
offline = true;
window.audioManager.pingFailed.play();
} else {
ping = Math.round(data)+"ms";
window.audioManager.ping.play();
}
this.offline = offline;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册