From 427a16733ae445c8b5953d4dd250f522e74acea2 Mon Sep 17 00:00:00 2001 From: yuuki <> Date: Sun, 8 Dec 2024 17:48:11 +0900 Subject: [PATCH] =?UTF-8?q?=E3=81=B0=E3=81=84=E3=81=9D=E3=81=8F=E3=82=92?= =?UTF-8?q?=E8=A8=AD=E5=AE=9A=E3=81=A7=E5=A4=89=E6=9B=B4=E3=81=A7=E3=81=8D?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/src/js/controller.js | 9 ++++---- public/src/js/loadsong.js | 9 ++++---- public/src/js/songselect.js | 41 +++++++++++++++++++++---------------- public/src/js/view.js | 13 ++++++------ 4 files changed, 37 insertions(+), 35 deletions(-) diff --git a/public/src/js/controller.js b/public/src/js/controller.js index b2978ac..7482c25 100644 --- a/public/src/js/controller.js +++ b/public/src/js/controller.js @@ -2,14 +2,13 @@ class Controller{ constructor(...args){ this.init(...args) } - init(selectedSong, songData, autoPlayEnabled, multiplayer, touchEnabled, baisoku = 1){ + init(selectedSong, songData, autoPlayEnabled, multiplayer, touchEnabled){ this.selectedSong = selectedSong this.songData = songData this.autoPlayEnabled = autoPlayEnabled this.saveScore = !autoPlayEnabled this.multiplayer = multiplayer this.touchEnabled = touchEnabled - this.baisoku = baisoku if(multiplayer === 2){ this.snd = p2.player === 2 ? "_p1" : "_p2" this.don = p2.don || defaultDon @@ -83,8 +82,8 @@ class Controller{ } this.game = new Game(this, this.selectedSong, this.parsedSongData) - this.view = new View(this, baisoku) - if (this.view.baisoku > 1) { + this.view = new View(this) + if (parseFloat(localStorage.getItem("baisoku") ?? "1", 10) !== 1) { this.saveScore = false; } this.mekadon = new Mekadon(this, this.game) @@ -280,7 +279,7 @@ class Controller{ Promise.all(promises).then(resolve) } }).then(() => { - var taikoGame = new Controller(this.selectedSong, this.songData, this.autoPlayEnabled, false, this.touchEnabled, this.baisoku) + var taikoGame = new Controller(this.selectedSong, this.songData, this.autoPlayEnabled, false, this.touchEnabled) taikoGame.run() }) } diff --git a/public/src/js/loadsong.js b/public/src/js/loadsong.js index 1166862..ec127e1 100644 --- a/public/src/js/loadsong.js +++ b/public/src/js/loadsong.js @@ -2,12 +2,11 @@ class LoadSong{ constructor(...args){ this.init(...args) } - init(selectedSong, autoPlayEnabled, multiplayer, touchEnabled, baisoku = 1){ + init(selectedSong, autoPlayEnabled, multiplayer, touchEnabled){ this.selectedSong = selectedSong this.autoPlayEnabled = autoPlayEnabled this.multiplayer = multiplayer this.touchEnabled = touchEnabled - this.baisoku = baisoku var resolution = settings.getItem("resolution") this.imgScale = 1 if(resolution === "medium"){ @@ -319,8 +318,8 @@ class LoadSong{ }else if(event.type === "gamestart"){ this.clean() p2.clearMessage("songsel") - var taikoGame1 = new Controller(song, this.songData, false, 1, this.touchEnabled, this.baisoku) - var taikoGame2 = new Controller(this.selectedSong2, this.song2Data, true, 2, this.touchEnabled, this.baisoku) + var taikoGame1 = new Controller(song, this.songData, false, 1, this.touchEnabled) + var taikoGame2 = new Controller(this.selectedSong2, this.song2Data, true, 2, this.touchEnabled) taikoGame1.run(taikoGame2) pageEvents.send("load-song-player2", this.selectedSong2) }else if(event.type === "left" || event.type === "gameend"){ @@ -336,7 +335,7 @@ class LoadSong{ }) }else{ this.clean() - var taikoGame = new Controller(song, this.songData, this.autoPlayEnabled, false, this.touchEnabled, this.baisoku) + var taikoGame = new Controller(song, this.songData, this.autoPlayEnabled, false, this.touchEnabled) taikoGame.run() } } diff --git a/public/src/js/songselect.js b/public/src/js/songselect.js index 5b6d021..f213554 100644 --- a/public/src/js/songselect.js +++ b/public/src/js/songselect.js @@ -238,6 +238,11 @@ class SongSelect{ action: "songSelectingSpeed", }); + this.songs.push({ + title: "ばいそく", + skin: this.songSkin.customSettings, + action: "baisoku", + }); this.songs.push({ title: strings.back, skin: this.songSkin.back, @@ -282,7 +287,7 @@ class SongSelect{ iconFill: "#111111", letterSpacing: 4 }] - this.optionsList = [strings.none, strings.auto, strings.netplay, "ばいそく", "さんばい", "よんばい", "ばいそく+オート", "さんばい+オート", "よんばい+オート"] + this.optionsList = [strings.none, strings.auto, strings.netplay] this.draw = new CanvasDraw(noSmoothing) this.songTitleCache = new CanvasCache(noSmoothing) @@ -375,7 +380,7 @@ class SongSelect{ waitPreview: 0 } this.songSelecting = { - speed: parseInt(localStorage.getItem("sss") ?? "400", 10), + speed: parseFloat(localStorage.getItem("sss") ?? "400", 10), resize: 0.3, scrollDelay: 0.1 } @@ -901,6 +906,20 @@ class SongSelect{ } localStorage.setItem("sss", songSelectingSpeed.toString()); }, 100); + } else if (currentSong.action === "baisoku") { + this.playSound("se_don"); + setTimeout(() => { + let baisoku = localStorage.getItem("baisoku") ?? "1"; + const input = prompt("ばいそくの倍率を入力してね!", baisoku); + if (input === null) { + // キャンセル + } else if (input === "") { + input = "1"; + } else { + baisoku = input; + } + localStorage.setItem("baisoku", baisoku.toString()); + }, 100); } } this.pointer(false) @@ -953,21 +972,7 @@ class SongSelect{ } var autoplay = false var multiplayer = false - var baisoku = 1; - if (this.state.options >= 3 || this.state.options <= 8) { - const mapping = { - 3: 2, - 4: 3, - 5: 4, - 6: 2, - 7: 3, - 8: 4 - }; - baisoku = mapping[this.state.options]; - if (this.state.options >= 6) { - autoplay = true - } - }if(p2.session || this.state.options === 2){ + if(p2.session || this.state.options === 2){ multiplayer = true }else if(this.state.options === 1){ autoplay = true @@ -991,7 +996,7 @@ class SongSelect{ "stars": selectedSong.courses[diff].stars, "hash": selectedSong.hash, "lyrics": selectedSong.lyrics - }, autoplay, multiplayer, touch, baisoku) + }, autoplay, multiplayer, touch) } toOptions(moveBy){ if(!p2.session){ diff --git a/public/src/js/view.js b/public/src/js/view.js index ea72e35..45e2b96 100644 --- a/public/src/js/view.js +++ b/public/src/js/view.js @@ -2,9 +2,8 @@ constructor(...args){ this.init(...args) } - init(controller, baisoku = 1){ + init(controller){ this.controller = controller - this.baisoku = baisoku this.canvas = document.getElementById("canvas") this.ctx = this.canvas.getContext("2d") @@ -1488,11 +1487,11 @@ var measureH = 130 * mul measures.forEach(measure => { - var timeForDistance = this.posToMs(distanceForCircle, measure.speed * this.baisoku) + var timeForDistance = this.posToMs(distanceForCircle, measure.speed * parseFloat(localStorage.getItem("baisoku") ?? "1", 10)) var startingTime = measure.ms - timeForDistance + this.controller.videoLatency - var finishTime = measure.ms + this.posToMs(this.slotPos.x - this.slotPos.paddingLeft + 3, measure.speed * this.baisoku) + this.controller.videoLatency + var finishTime = measure.ms + this.posToMs(this.slotPos.x - this.slotPos.paddingLeft + 3, measure.speed * parseFloat(localStorage.getItem("baisoku") ?? "1", 10)) + this.controller.videoLatency if(measure.visible && (!measure.branch || measure.branch.active) && ms >= startingTime && ms <= finishTime){ - var measureX = this.slotPos.x + this.msToPos(measure.ms - ms + this.controller.videoLatency, measure.speed * this.baisoku) + var measureX = this.slotPos.x + this.msToPos(measure.ms - ms + this.controller.videoLatency, measure.speed * parseFloat(localStorage.getItem("baisoku") ?? "1", 10)) this.ctx.strokeStyle = measure.branchFirst ? "#ff0" : "#bdbdbd" this.ctx.lineWidth = 3 this.ctx.beginPath() @@ -1538,7 +1537,7 @@ for(var i = circles.length; i--;){ var circle = circles[i] - var speed = circle.speed * this.baisoku + var speed = circle.speed * parseFloat(localStorage.getItem("baisoku") ?? "1", 10) var timeForDistance = this.posToMs(distanceForCircle + this.slotPos.size / 2, speed) var startingTime = circle.ms - timeForDistance + this.controller.videoLatency @@ -1627,7 +1626,7 @@ var circleMs = circle.ms var endTime = circle.endTime var animated = circle.animating - var speed = circle.speed * this.baisoku + var speed = circle.speed * parseFloat(localStorage.getItem("baisoku") ?? "1", 10) var played = circle.isPlayed var drumroll = 0 var endX = 0