From 02c377e9cf4dc9b7069a59a08ec40c3ca9f6db0c Mon Sep 17 00:00:00 2001 From: purerosefallen <78877@qq.com> Date: Mon, 4 Nov 2019 20:59:13 +0800 Subject: [PATCH 1/2] update the words below the notes --- public/src/js/parsetja.js | 53 ++++++++++++++++++++++++-- public/src/js/strings.js | 80 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 129 insertions(+), 4 deletions(-) diff --git a/public/src/js/parsetja.js b/public/src/js/parsetja.js index 31bc67e..ef0dcaf 100644 --- a/public/src/js/parsetja.js +++ b/public/src/js/parsetja.js @@ -24,6 +24,7 @@ "A": {name: "daiDon", txt: strings.note.daiDon}, "B": {name: "daiKa", txt: strings.note.daiKa} } + this.noteTypes_ex = strings.ex_note; this.courseTypes = { "0": "easy", "1": "normal", @@ -152,7 +153,32 @@ var circles = [] var circleID = 0 var regexAZ = /[A-Z]/ - + var isAllDon = (note_chain, start_pos) => { + for (var i = start_pos; i < note_chain.length; ++i) { + var note = note_chain[i]; + if (note && note.type !== "don" && note.type !== "daiDon") { + return false; + } + } + return true; + } + var checkChain = (note_chain, measure_length, is_last) => { + //console.log(note_chain, measure_length, is_last); + /*if (measure_length >= 24) { + for (var note of note_chain) { + note.text = this.noteTypes_ex[note.type][0]; + } + } else { */ + var alldon_pos = null; + for (var i = 0; i < note_chain.length - (is_last ? 1 : 0); ++i) { + var note = note_chain[i]; + if (alldon_pos === null && is_last && isAllDon(note_chain, i)) { + alldon_pos = i; + } + note.text = this.noteTypes_ex[note.type][alldon_pos != null ? (i - alldon_pos) % 2 : 0]; + } + //} + } var pushMeasure = () => { var note = currentMeasure[0] if(note){ @@ -187,9 +213,11 @@ var msPerMeasure = 60000 * measure / note.bpm ms += msPerMeasure / currentMeasure.length } - for(var i = 0; i < currentMeasure.length; i++){ + var note_chain = []; + for (var i = 0; i < currentMeasure.length; i++){ + //console.log(note_chain.length); var note = currentMeasure[i] - if(note.type){ + if (note.type) { circleID++ var circleObj = new Circle({ id: circleID, @@ -204,13 +232,30 @@ branch: currentBranch, section: note.section }) - if(lastDrumroll === note){ + if (note.type === "don" || note.type === "ka" || note.type === "daiDon" || note.type === "daiKa") { + note_chain.push(circleObj); + } else { + if (note_chain.length > 1 && currentMeasure.length >= 8) { + checkChain(note_chain, currentMeasure.length, false); + } + note_chain = []; + } + if (lastDrumroll === note) { lastDrumroll = circleObj } circles.push(circleObj) + } else if (!(currentMeasure.length >= 24 && (!currentMeasure[i + 1] || currentMeasure[i + 1].type)) + && !(currentMeasure.length >= 48 && (!currentMeasure[i + 2] || currentMeasure[i + 2].type || !currentMeasure[i + 3] || currentMeasure[i + 3].type))) { + if (note_chain.length > 1 && currentMeasure.length >= 8) { + checkChain(note_chain, currentMeasure.length, true); + } + note_chain = []; } } + if (note_chain.length > 1 && currentMeasure.length >= 8) { + checkChain(note_chain, currentMeasure.length, false); + } }else{ var msPerMeasure = 60000 * measure / bpm ms += msPerMeasure diff --git a/public/src/js/strings.js b/public/src/js/strings.js index eb77015..64b0ea4 100644 --- a/public/src/js/strings.js +++ b/public/src/js/strings.js @@ -50,6 +50,22 @@ daiDrumroll: "連打(大)ーっ!!", balloon: "ふうせん" } + this.ex_note = { + don: [ + "ド", + "コ" + ], + ka: [ + "カ" + ], + daiDon: [ + "ドン(大)", + "ドン(大)" + ], + daiKa: [ + "カッ(大)" + ] + } this.combo = "コンボ" this.clear = "クリア" this.good = "良" @@ -190,6 +206,22 @@ function StringsEn(){ daiDrumroll: "DRUM ROLLー!!", balloon: "Balloon" } + this.ex_note = { + don: [ + "Don", + "Don" + ], + ka: [ + "Ka" + ], + daiDon: [ + "DON", + "DON" + ], + daiKa: [ + "KA" + ] + } this.combo = "Combo" this.clear = "Clear" this.good = "GOOD" @@ -330,6 +362,22 @@ function StringsCn(){ daiDrumroll: "连打(大)ー!!", balloon: "气球" } + this.ex_note = { + don: [ + "咚", + "咚" + ], + ka: [ + "咔" + ], + daiDon: [ + "咚(大)", + "咚(大)" + ], + daiKa: [ + "咔(大)" + ] + } this.combo = "连段" this.clear = "通关" this.good = "良" @@ -470,6 +518,22 @@ function StringsTw(){ daiDrumroll: "連打(大)ー!!", balloon: "氣球" } + this.ex_note = { + don: [ + "咚", + "咚" + ], + ka: [ + "咔" + ], + daiDon: [ + "咚(大)", + "咚(大)" + ], + daiKa: [ + "咔(大)" + ] + } this.combo = "連段" this.clear = "通關" this.good = "良" @@ -610,6 +674,22 @@ function StringsKo(){ daiDrumroll: "연타(대)ー!!", balloon: "풍선" } + this.ex_note = { + don: [ + "쿵", + "쿵" + ], + ka: [ + "딱" + ], + daiDon: [ + "쿵(대)", + "쿵(대)" + ], + daiKa: [ + "딱(대)" + ] + } this.combo = "콤보" this.clear = "클리어" this.good = "얼쑤" From 4c80505de58d43b952d57e5236a043b45e4655aa Mon Sep 17 00:00:00 2001 From: purerosefallen <78877@qq.com> Date: Tue, 5 Nov 2019 10:01:13 +0800 Subject: [PATCH 2/2] fix --- public/src/js/strings.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/public/src/js/strings.js b/public/src/js/strings.js index 64b0ea4..fc4d752 100644 --- a/public/src/js/strings.js +++ b/public/src/js/strings.js @@ -208,8 +208,8 @@ function StringsEn(){ } this.ex_note = { don: [ - "Don", - "Don" + "Do", + "Do" ], ka: [ "Ka" @@ -676,8 +676,8 @@ function StringsKo(){ } this.ex_note = { don: [ - "쿵", - "쿵" + "쿠", + "쿠" ], ka: [ "딱"