mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2024-11-11 01:15:49 +08:00
✨ preview click sounds in the command line (#2260) by tackyunicorn
This commit is contained in:
parent
e808139604
commit
b58344f012
2 changed files with 27 additions and 0 deletions
|
@ -929,6 +929,9 @@ let commandsSoundOnClick = {
|
|||
id: "setSoundOnClick1",
|
||||
display: "click",
|
||||
configValue: "1",
|
||||
hover: () => {
|
||||
Sound.previewClick("1");
|
||||
},
|
||||
exec: () => {
|
||||
UpdateConfig.setPlaySoundOnClick("1");
|
||||
Sound.playClick(Config.playSoundOnClick);
|
||||
|
@ -938,6 +941,9 @@ let commandsSoundOnClick = {
|
|||
id: "setSoundOnClick2",
|
||||
display: "beep",
|
||||
configValue: "2",
|
||||
hover: () => {
|
||||
Sound.previewClick("2");
|
||||
},
|
||||
exec: () => {
|
||||
UpdateConfig.setPlaySoundOnClick("2");
|
||||
Sound.playClick(Config.playSoundOnClick);
|
||||
|
@ -947,6 +953,9 @@ let commandsSoundOnClick = {
|
|||
id: "setSoundOnClick3",
|
||||
display: "pop",
|
||||
configValue: "3",
|
||||
hover: () => {
|
||||
Sound.previewClick("3");
|
||||
},
|
||||
exec: () => {
|
||||
UpdateConfig.setPlaySoundOnClick("3");
|
||||
Sound.playClick(Config.playSoundOnClick);
|
||||
|
@ -956,6 +965,9 @@ let commandsSoundOnClick = {
|
|||
id: "setSoundOnClick4",
|
||||
display: "nk creams",
|
||||
configValue: "4",
|
||||
hover: () => {
|
||||
Sound.previewClick("4");
|
||||
},
|
||||
exec: () => {
|
||||
UpdateConfig.setPlaySoundOnClick("4");
|
||||
Sound.playClick(Config.playSoundOnClick);
|
||||
|
@ -965,6 +977,9 @@ let commandsSoundOnClick = {
|
|||
id: "setSoundOnClick5",
|
||||
display: "typewriter",
|
||||
configValue: "5",
|
||||
hover: () => {
|
||||
Sound.previewClick("5");
|
||||
},
|
||||
exec: () => {
|
||||
UpdateConfig.setPlaySoundOnClick("5");
|
||||
Sound.playClick(Config.playSoundOnClick);
|
||||
|
@ -974,6 +989,9 @@ let commandsSoundOnClick = {
|
|||
id: "setSoundOnClick6",
|
||||
display: "osu",
|
||||
configValue: "6",
|
||||
hover: () => {
|
||||
Sound.previewClick("6");
|
||||
},
|
||||
exec: () => {
|
||||
UpdateConfig.setPlaySoundOnClick("6");
|
||||
Sound.playClick(Config.playSoundOnClick);
|
||||
|
@ -983,6 +1001,9 @@ let commandsSoundOnClick = {
|
|||
id: "setSoundOnClick7",
|
||||
display: "hitmarker",
|
||||
configValue: "7",
|
||||
hover: () => {
|
||||
Sound.previewClick("7");
|
||||
},
|
||||
exec: () => {
|
||||
UpdateConfig.setPlaySoundOnClick("7");
|
||||
Sound.playClick(Config.playSoundOnClick);
|
||||
|
|
|
@ -218,6 +218,12 @@ export function init() {
|
|||
};
|
||||
}
|
||||
|
||||
export function previewClick(val) {
|
||||
if (clickSounds === null) init();
|
||||
clickSounds[val][0].sounds[0].seek(0);
|
||||
clickSounds[val][0].sounds[0].play();
|
||||
}
|
||||
|
||||
export function playClick() {
|
||||
if (Config.playSoundOnClick === "off") return;
|
||||
if (clickSounds === null) init();
|
||||
|
|
Loading…
Reference in a new issue