mirror of
https://github.com/jiojciojsioe3/a3cjroijsiojiorj.git
synced 2024-11-15 15:31:51 +08:00
SongSelect: category jumping
This commit is contained in:
parent
7a50dec558
commit
34d0bd01d4
BIN
public/assets/audio/se_jump.wav
Normal file
BIN
public/assets/audio/se_jump.wav
Normal file
Binary file not shown.
@ -90,6 +90,7 @@ var assets = {
|
|||||||
"se_don.wav",
|
"se_don.wav",
|
||||||
"se_ka.wav",
|
"se_ka.wav",
|
||||||
"se_pause.wav",
|
"se_pause.wav",
|
||||||
|
"se_jump.wav",
|
||||||
|
|
||||||
"v_combo_50_meka.wav",
|
"v_combo_50_meka.wav",
|
||||||
"v_combo_100_meka.wav",
|
"v_combo_100_meka.wav",
|
||||||
|
@ -115,7 +115,8 @@ class SongSelect{
|
|||||||
songSkin: song.song_skin || {},
|
songSkin: song.song_skin || {},
|
||||||
music: song.music,
|
music: song.music,
|
||||||
volume: song.volume,
|
volume: song.volume,
|
||||||
maker: song.maker
|
maker: song.maker,
|
||||||
|
canJump: true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.songs.sort((a, b) => {
|
this.songs.sort((a, b) => {
|
||||||
@ -136,7 +137,8 @@ class SongSelect{
|
|||||||
title: strings.randomSong,
|
title: strings.randomSong,
|
||||||
skin: this.songSkin.random,
|
skin: this.songSkin.random,
|
||||||
action: "random",
|
action: "random",
|
||||||
category: strings.random
|
category: strings.random,
|
||||||
|
canJump: true
|
||||||
})
|
})
|
||||||
if(touchEnabled){
|
if(touchEnabled){
|
||||||
if(fromTutorial === "tutorial"){
|
if(fromTutorial === "tutorial"){
|
||||||
@ -279,7 +281,8 @@ class SongSelect{
|
|||||||
locked: true,
|
locked: true,
|
||||||
hasPointer: false,
|
hasPointer: false,
|
||||||
options: 0,
|
options: 0,
|
||||||
selLock: false
|
selLock: false,
|
||||||
|
catJump: false
|
||||||
}
|
}
|
||||||
this.songSelecting = {
|
this.songSelecting = {
|
||||||
speed: 800,
|
speed: 800,
|
||||||
@ -304,13 +307,15 @@ class SongSelect{
|
|||||||
this.gamepad = new Gamepad({
|
this.gamepad = new Gamepad({
|
||||||
confirm: ["b", "start", "ls", "rs"],
|
confirm: ["b", "start", "ls", "rs"],
|
||||||
back: ["a"],
|
back: ["a"],
|
||||||
left: ["l", "lb", "lt", "lsl"],
|
left: ["l", "lsl"],
|
||||||
right: ["r", "rb", "rt", "lsr"],
|
right: ["r", "lsr"],
|
||||||
up: ["u", "lsu"],
|
up: ["u", "lsu"],
|
||||||
down: ["d", "lsd"],
|
down: ["d", "lsd"],
|
||||||
session: ["back"],
|
session: ["back"],
|
||||||
ctrl: ["y"],
|
ctrl: ["y"],
|
||||||
shift: ["x"]
|
shift: ["x"],
|
||||||
|
jump_left: ["lb", "lt"],
|
||||||
|
jump_right: ["rb", "rt"]
|
||||||
}, this.keyPress.bind(this))
|
}, this.keyPress.bind(this))
|
||||||
|
|
||||||
if(!assets.customSongs){
|
if(!assets.customSongs){
|
||||||
@ -362,10 +367,22 @@ class SongSelect{
|
|||||||
}else if(name === "session"){
|
}else if(name === "session"){
|
||||||
this.toSession()
|
this.toSession()
|
||||||
}else if(name === "left"){
|
}else if(name === "left"){
|
||||||
|
if(this.pressedKeys["shift"]){
|
||||||
|
this.categoryJump(-1)
|
||||||
|
}else{
|
||||||
this.moveToSong(-1)
|
this.moveToSong(-1)
|
||||||
|
}
|
||||||
}else if(name === "right"){
|
}else if(name === "right"){
|
||||||
|
if(this.pressedKeys["shift"]){
|
||||||
|
this.categoryJump(1)
|
||||||
|
}else{
|
||||||
this.moveToSong(1)
|
this.moveToSong(1)
|
||||||
}
|
}
|
||||||
|
}else if(name === "jump_left"){
|
||||||
|
this.categoryJump(-1)
|
||||||
|
}else if(name === "jump_right"){
|
||||||
|
this.categoryJump(1)
|
||||||
|
}
|
||||||
}else if(this.state.screen === "difficulty"){
|
}else if(this.state.screen === "difficulty"){
|
||||||
if(name === "confirm"){
|
if(name === "confirm"){
|
||||||
if(this.selectedDiff === 0){
|
if(this.selectedDiff === 0){
|
||||||
@ -569,6 +586,16 @@ class SongSelect{
|
|||||||
this.pointer(false)
|
this.pointer(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
categoryJump(moveBy){
|
||||||
|
this.state.catJump = true
|
||||||
|
this.state.move = moveBy;
|
||||||
|
this.state.locked = 1
|
||||||
|
|
||||||
|
this.endPreview()
|
||||||
|
assets.sounds["se_jump"].play()
|
||||||
|
}
|
||||||
|
|
||||||
moveToDiff(moveBy){
|
moveToDiff(moveBy){
|
||||||
if(this.state.locked !== 1){
|
if(this.state.locked !== 1){
|
||||||
this.state.move = moveBy
|
this.state.move = moveBy
|
||||||
@ -984,9 +1011,52 @@ class SongSelect{
|
|||||||
var scroll = resize2 - resize - scrollDelay * 2
|
var scroll = resize2 - resize - scrollDelay * 2
|
||||||
var elapsed = ms - this.state.moveMS
|
var elapsed = ms - this.state.moveMS
|
||||||
if(this.state.move && ms > this.state.moveMS + resize2 - scrollDelay){
|
if(this.state.move && ms > this.state.moveMS + resize2 - scrollDelay){
|
||||||
assets.sounds["se_ka"].play()
|
var isJump = this.state.catJump
|
||||||
var previousSelectedSong = this.selectedSong
|
var previousSelectedSong = this.selectedSong
|
||||||
|
|
||||||
|
if(!isJump){
|
||||||
|
assets.sounds["se_ka"].play()
|
||||||
this.selectedSong = this.mod(this.songs.length, this.selectedSong + this.state.move)
|
this.selectedSong = this.mod(this.songs.length, this.selectedSong + this.state.move)
|
||||||
|
}else{
|
||||||
|
var currentCat = this.songs[this.selectedSong].category
|
||||||
|
var currentIdx = this.mod(this.songs.length, this.selectedSong)
|
||||||
|
if(this.state.move > 0){
|
||||||
|
var nextSong = this.songs.find(song => this.mod(this.songs.length, this.songs.indexOf(song)) > currentIdx && song.category !== currentCat && song.canJump)
|
||||||
|
if(!nextSong){
|
||||||
|
nextSong = this.songs[0]
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
var isFirstInCat = this.songs.findIndex(song => song.category === currentCat) == this.selectedSong
|
||||||
|
if(!isFirstInCat){
|
||||||
|
var nextSong = this.songs.find(song => this.mod(this.songs.length, this.songs.indexOf(song)) < currentIdx && song.category === currentCat && song.canJump)
|
||||||
|
}else{
|
||||||
|
var idx = this.songs.length - 1
|
||||||
|
var nextSong
|
||||||
|
var lastCat
|
||||||
|
for(;idx>=0;idx--){
|
||||||
|
if(this.songs[idx].category !== lastCat && this.songs[idx].action !== "back"){
|
||||||
|
lastCat = this.songs[idx].category
|
||||||
|
if(nextSong){
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(lastCat !== currentCat && idx < currentIdx){
|
||||||
|
nextSong = idx
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nextSong = this.songs[nextSong]
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!nextSong){
|
||||||
|
var rev = [...this.songs].reverse()
|
||||||
|
nextSong = rev.find(song => song.canJump)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.selectedSong = this.songs.indexOf(nextSong)
|
||||||
|
this.state.catJump = false
|
||||||
|
}
|
||||||
|
|
||||||
if(previousSelectedSong !== this.selectedSong){
|
if(previousSelectedSong !== this.selectedSong){
|
||||||
pageEvents.send("song-select-move", this.songs[this.selectedSong])
|
pageEvents.send("song-select-move", this.songs[this.selectedSong])
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user