From 3097dd37362dee5471fa13951bcc2b9086e3e5b7 Mon Sep 17 00:00:00 2001 From: LoveEevee Date: Sat, 29 Feb 2020 18:56:59 +0300 Subject: [PATCH] [PATCH] Add Easier Big Notes setting --- public/src/js/controller.js | 6 +++++- public/src/js/game.js | 15 +++++++++++---- public/src/js/keyboard.js | 7 +++---- public/src/js/settings.js | 4 ++++ public/src/js/strings.js | 15 +++++++++++++++ 5 files changed, 38 insertions(+), 9 deletions(-) diff --git a/public/src/js/controller.js b/public/src/js/controller.js index 3ac679e..ca7e0c3 100644 --- a/public/src/js/controller.js +++ b/public/src/js/controller.js @@ -60,7 +60,11 @@ class Controller{ this.view = new View(this) this.mekadon = new Mekadon(this, this.game) this.keyboard = new GameInput(this) - this.TaikoForceLv5 = this.keyboard.keyboard.TaikoForceLv5 && !autoPlayEnabled && (this.multiplayer !== 2); + if(!autoPlayEnabled && this.multiplayer !== 2){ + this.easierBigNotes = settings.getItem("easierBigNotes") || this.keyboard.keyboard.TaikoForceLv5 + }else{ + this.easierBigNotes = false + } this.drumSounds = settings.getItem("latency").drumSounds this.playedSounds = {} diff --git a/public/src/js/game.js b/public/src/js/game.js index e58b238..3b038a1 100644 --- a/public/src/js/game.js +++ b/public/src/js/game.js @@ -31,6 +31,7 @@ class Game{ this.branchNames = ["normal", "advanced", "master"] this.resetSection() this.gameLagSync = !this.controller.touchEnabled && !(/Firefox/.test(navigator.userAgent)) + this.lastPressedKeys = [false, false, false, false] assets.songs.forEach(song => { if(song.id == selectedSong.folder){ @@ -264,6 +265,11 @@ class Game{ var don_r = keys["don_r"] && !this.controller.isWaiting("don_r", "score") var ka_l = keys["ka_l"] && !this.controller.isWaiting("ka_l", "score") var ka_r = keys["ka_r"] && !this.controller.isWaiting("ka_r", "score") + if(don_l || don_r || ka_l || ka_r){ + this.lastPressedKeys = [don_l, don_r, ka_l, ka_r] + }else{ + [don_l, don_r, ka_l, ka_r] = this.lastPressedKeys + } var checkDon = () => { if(don_l && don_r){ @@ -330,10 +336,11 @@ class Game{ } var score = 0 if(keysDon && typeDon || keysKa && typeKa){ - if (typeDai && !keyDai) { - if (this.controller.TaikoForceLv5) { // Taiko Force Lv5 can't hit both Dons at the same time, so dai offered - keyDai = true; - } else if(!circle.daiFailed){ + if(typeDai && !keyDai){ + if(this.controller.easierBigNotes){ + // Taiko Force Lv5 can't hit both Dons at the same time, so dai offered + keyDai = true + }else if(!circle.daiFailed){ circle.daiFailed = ms return false }else if(ms < circle.daiFailed + this.rules.daiLeniency){ diff --git a/public/src/js/keyboard.js b/public/src/js/keyboard.js index 4df67ea..d13ab7a 100644 --- a/public/src/js/keyboard.js +++ b/public/src/js/keyboard.js @@ -19,14 +19,13 @@ class Keyboard{ pageEvents.keyAdd(this, "all", "both", this.keyEvent.bind(this)) pageEvents.blurAdd(this, this.blurEvent.bind(this)) } - isTaikoForceLv5(kbdSettings) { // the key of Taiko Force Lv5's PC module looks like this - //console.log(kbdSettings); + isTaikoForceLv5(kbdSettings){ + // the key of Taiko Force Lv5's PC module looks like this return (kbdSettings.ka_l[0] === "f") && (kbdSettings.ka_r[0] === "e") && (kbdSettings.don_l[0] === "i") && (kbdSettings.don_r[0] === "j"); } update(){ var kbdSettings = settings.getItem("keyboardSettings") - this.TaikoForceLv5 = this.isTaikoForceLv5(kbdSettings); - //console.log("Taiko Force Lv5", this.TaikoForceLv5); + this.TaikoForceLv5 = this.isTaikoForceLv5(kbdSettings) var drumKeys = {} for(var name in kbdSettings){ var keys = kbdSettings[name] diff --git a/public/src/js/settings.js b/public/src/js/settings.js index b2deaef..c52dcd1 100644 --- a/public/src/js/settings.js +++ b/public/src/js/settings.js @@ -46,6 +46,10 @@ class Settings{ "video": 0, "drumSounds": true } + }, + easierBigNotes: { + type: "toggle", + default: false } } diff --git a/public/src/js/strings.js b/public/src/js/strings.js index 4ff9367..f7089c6 100644 --- a/public/src/js/strings.js +++ b/public/src/js/strings.js @@ -151,6 +151,9 @@ video: "Video", drumSounds: "Drum Sounds" }, + easierBigNotes: { + name: "大きな音符を簡単にする" + }, on: "オン", off: "オフ", default: "既定値にリセット", @@ -343,6 +346,9 @@ function StringsEn(){ video: "Video", drumSounds: "Drum Sounds" }, + easierBigNotes: { + name: "Easier Big Notes" + }, on: "On", off: "Off", default: "Reset to Defaults", @@ -535,6 +541,9 @@ function StringsCn(){ video: "Video", drumSounds: "Drum Sounds" }, + easierBigNotes: { + name: "使大音符变得容易" + }, on: "开", off: "关", default: "重置为默认值", @@ -727,6 +736,9 @@ function StringsTw(){ video: "Video", drumSounds: "Drum Sounds" }, + easierBigNotes: { + name: "使大音符變得容易" + }, on: "開", off: "關", default: "重置為默認值", @@ -919,6 +931,9 @@ function StringsKo(){ video: "Video", drumSounds: "Drum Sounds" }, + easierBigNotes: { + name: "쉬운 큰 음표" + }, on: "온", off: "오프", default: "기본값으로 재설정",