ばいそくを設定で変更できるようにする
This commit is contained in:
@@ -2,14 +2,13 @@ class Controller{
|
|||||||
constructor(...args){
|
constructor(...args){
|
||||||
this.init(...args)
|
this.init(...args)
|
||||||
}
|
}
|
||||||
init(selectedSong, songData, autoPlayEnabled, multiplayer, touchEnabled, baisoku = 1){
|
init(selectedSong, songData, autoPlayEnabled, multiplayer, touchEnabled){
|
||||||
this.selectedSong = selectedSong
|
this.selectedSong = selectedSong
|
||||||
this.songData = songData
|
this.songData = songData
|
||||||
this.autoPlayEnabled = autoPlayEnabled
|
this.autoPlayEnabled = autoPlayEnabled
|
||||||
this.saveScore = !autoPlayEnabled
|
this.saveScore = !autoPlayEnabled
|
||||||
this.multiplayer = multiplayer
|
this.multiplayer = multiplayer
|
||||||
this.touchEnabled = touchEnabled
|
this.touchEnabled = touchEnabled
|
||||||
this.baisoku = baisoku
|
|
||||||
if(multiplayer === 2){
|
if(multiplayer === 2){
|
||||||
this.snd = p2.player === 2 ? "_p1" : "_p2"
|
this.snd = p2.player === 2 ? "_p1" : "_p2"
|
||||||
this.don = p2.don || defaultDon
|
this.don = p2.don || defaultDon
|
||||||
@@ -83,8 +82,8 @@ class Controller{
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.game = new Game(this, this.selectedSong, this.parsedSongData)
|
this.game = new Game(this, this.selectedSong, this.parsedSongData)
|
||||||
this.view = new View(this, baisoku)
|
this.view = new View(this)
|
||||||
if (this.view.baisoku > 1) {
|
if (parseFloat(localStorage.getItem("baisoku") ?? "1", 10) !== 1) {
|
||||||
this.saveScore = false;
|
this.saveScore = false;
|
||||||
}
|
}
|
||||||
this.mekadon = new Mekadon(this, this.game)
|
this.mekadon = new Mekadon(this, this.game)
|
||||||
@@ -280,7 +279,7 @@ class Controller{
|
|||||||
Promise.all(promises).then(resolve)
|
Promise.all(promises).then(resolve)
|
||||||
}
|
}
|
||||||
}).then(() => {
|
}).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()
|
taikoGame.run()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,11 @@ class LoadSong{
|
|||||||
constructor(...args){
|
constructor(...args){
|
||||||
this.init(...args)
|
this.init(...args)
|
||||||
}
|
}
|
||||||
init(selectedSong, autoPlayEnabled, multiplayer, touchEnabled, baisoku = 1){
|
init(selectedSong, autoPlayEnabled, multiplayer, touchEnabled){
|
||||||
this.selectedSong = selectedSong
|
this.selectedSong = selectedSong
|
||||||
this.autoPlayEnabled = autoPlayEnabled
|
this.autoPlayEnabled = autoPlayEnabled
|
||||||
this.multiplayer = multiplayer
|
this.multiplayer = multiplayer
|
||||||
this.touchEnabled = touchEnabled
|
this.touchEnabled = touchEnabled
|
||||||
this.baisoku = baisoku
|
|
||||||
var resolution = settings.getItem("resolution")
|
var resolution = settings.getItem("resolution")
|
||||||
this.imgScale = 1
|
this.imgScale = 1
|
||||||
if(resolution === "medium"){
|
if(resolution === "medium"){
|
||||||
@@ -319,8 +318,8 @@ class LoadSong{
|
|||||||
}else if(event.type === "gamestart"){
|
}else if(event.type === "gamestart"){
|
||||||
this.clean()
|
this.clean()
|
||||||
p2.clearMessage("songsel")
|
p2.clearMessage("songsel")
|
||||||
var taikoGame1 = new Controller(song, this.songData, false, 1, 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, this.baisoku)
|
var taikoGame2 = new Controller(this.selectedSong2, this.song2Data, true, 2, this.touchEnabled)
|
||||||
taikoGame1.run(taikoGame2)
|
taikoGame1.run(taikoGame2)
|
||||||
pageEvents.send("load-song-player2", this.selectedSong2)
|
pageEvents.send("load-song-player2", this.selectedSong2)
|
||||||
}else if(event.type === "left" || event.type === "gameend"){
|
}else if(event.type === "left" || event.type === "gameend"){
|
||||||
@@ -336,7 +335,7 @@ class LoadSong{
|
|||||||
})
|
})
|
||||||
}else{
|
}else{
|
||||||
this.clean()
|
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()
|
taikoGame.run()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -238,6 +238,11 @@ class SongSelect{
|
|||||||
action: "songSelectingSpeed",
|
action: "songSelectingSpeed",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.songs.push({
|
||||||
|
title: "ばいそく",
|
||||||
|
skin: this.songSkin.customSettings,
|
||||||
|
action: "baisoku",
|
||||||
|
});
|
||||||
this.songs.push({
|
this.songs.push({
|
||||||
title: strings.back,
|
title: strings.back,
|
||||||
skin: this.songSkin.back,
|
skin: this.songSkin.back,
|
||||||
@@ -282,7 +287,7 @@ class SongSelect{
|
|||||||
iconFill: "#111111",
|
iconFill: "#111111",
|
||||||
letterSpacing: 4
|
letterSpacing: 4
|
||||||
}]
|
}]
|
||||||
this.optionsList = [strings.none, strings.auto, strings.netplay, "ばいそく", "さんばい", "よんばい", "ばいそく+オート", "さんばい+オート", "よんばい+オート"]
|
this.optionsList = [strings.none, strings.auto, strings.netplay]
|
||||||
|
|
||||||
this.draw = new CanvasDraw(noSmoothing)
|
this.draw = new CanvasDraw(noSmoothing)
|
||||||
this.songTitleCache = new CanvasCache(noSmoothing)
|
this.songTitleCache = new CanvasCache(noSmoothing)
|
||||||
@@ -375,7 +380,7 @@ class SongSelect{
|
|||||||
waitPreview: 0
|
waitPreview: 0
|
||||||
}
|
}
|
||||||
this.songSelecting = {
|
this.songSelecting = {
|
||||||
speed: parseInt(localStorage.getItem("sss") ?? "400", 10),
|
speed: parseFloat(localStorage.getItem("sss") ?? "400", 10),
|
||||||
resize: 0.3,
|
resize: 0.3,
|
||||||
scrollDelay: 0.1
|
scrollDelay: 0.1
|
||||||
}
|
}
|
||||||
@@ -901,6 +906,20 @@ class SongSelect{
|
|||||||
}
|
}
|
||||||
localStorage.setItem("sss", songSelectingSpeed.toString());
|
localStorage.setItem("sss", songSelectingSpeed.toString());
|
||||||
}, 100);
|
}, 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)
|
this.pointer(false)
|
||||||
@@ -953,21 +972,7 @@ class SongSelect{
|
|||||||
}
|
}
|
||||||
var autoplay = false
|
var autoplay = false
|
||||||
var multiplayer = false
|
var multiplayer = false
|
||||||
var baisoku = 1;
|
if(p2.session || this.state.options === 2){
|
||||||
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){
|
|
||||||
multiplayer = true
|
multiplayer = true
|
||||||
}else if(this.state.options === 1){
|
}else if(this.state.options === 1){
|
||||||
autoplay = true
|
autoplay = true
|
||||||
@@ -991,7 +996,7 @@ class SongSelect{
|
|||||||
"stars": selectedSong.courses[diff].stars,
|
"stars": selectedSong.courses[diff].stars,
|
||||||
"hash": selectedSong.hash,
|
"hash": selectedSong.hash,
|
||||||
"lyrics": selectedSong.lyrics
|
"lyrics": selectedSong.lyrics
|
||||||
}, autoplay, multiplayer, touch, baisoku)
|
}, autoplay, multiplayer, touch)
|
||||||
}
|
}
|
||||||
toOptions(moveBy){
|
toOptions(moveBy){
|
||||||
if(!p2.session){
|
if(!p2.session){
|
||||||
|
|||||||
@@ -2,9 +2,8 @@
|
|||||||
constructor(...args){
|
constructor(...args){
|
||||||
this.init(...args)
|
this.init(...args)
|
||||||
}
|
}
|
||||||
init(controller, baisoku = 1){
|
init(controller){
|
||||||
this.controller = controller
|
this.controller = controller
|
||||||
this.baisoku = baisoku
|
|
||||||
|
|
||||||
this.canvas = document.getElementById("canvas")
|
this.canvas = document.getElementById("canvas")
|
||||||
this.ctx = this.canvas.getContext("2d")
|
this.ctx = this.canvas.getContext("2d")
|
||||||
@@ -1488,11 +1487,11 @@
|
|||||||
var measureH = 130 * mul
|
var measureH = 130 * mul
|
||||||
|
|
||||||
measures.forEach(measure => {
|
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 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){
|
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.strokeStyle = measure.branchFirst ? "#ff0" : "#bdbdbd"
|
||||||
this.ctx.lineWidth = 3
|
this.ctx.lineWidth = 3
|
||||||
this.ctx.beginPath()
|
this.ctx.beginPath()
|
||||||
@@ -1538,7 +1537,7 @@
|
|||||||
|
|
||||||
for(var i = circles.length; i--;){
|
for(var i = circles.length; i--;){
|
||||||
var circle = circles[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 timeForDistance = this.posToMs(distanceForCircle + this.slotPos.size / 2, speed)
|
||||||
var startingTime = circle.ms - timeForDistance + this.controller.videoLatency
|
var startingTime = circle.ms - timeForDistance + this.controller.videoLatency
|
||||||
@@ -1627,7 +1626,7 @@
|
|||||||
var circleMs = circle.ms
|
var circleMs = circle.ms
|
||||||
var endTime = circle.endTime
|
var endTime = circle.endTime
|
||||||
var animated = circle.animating
|
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 played = circle.isPlayed
|
||||||
var drumroll = 0
|
var drumroll = 0
|
||||||
var endX = 0
|
var endX = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user