improve category jump

This commit is contained in:
Bui 2020-02-22 13:09:07 +00:00
parent 34d0bd01d4
commit 750dc66245
5 changed files with 20 additions and 8 deletions

2
.gitignore vendored
View File

@ -35,6 +35,8 @@ $RECYCLE.BIN/
.Spotlight-V100
.Trashes
.vscode
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop

2
app.py
View File

@ -86,7 +86,7 @@ def route_index():
@app.route('/api/preview')
@app.cache.cached(timeout=15)
@app.cache.cached(timeout=15, query_string=True)
def route_api_preview():
song_id = request.args.get('id', None)
if not song_id or not re.match('^[0-9]+$', song_id):

View File

@ -307,15 +307,15 @@ class SongSelect{
this.gamepad = new Gamepad({
confirm: ["b", "start", "ls", "rs"],
back: ["a"],
left: ["l", "lsl"],
right: ["r", "lsr"],
left: ["l", "lsl", "lt"],
right: ["r", "lsr", "rt"],
up: ["u", "lsu"],
down: ["d", "lsd"],
session: ["back"],
ctrl: ["y"],
shift: ["x"],
jump_left: ["lb", "lt"],
jump_right: ["rb", "rt"]
jump_left: ["lb"],
jump_right: ["rb"]
}, this.keyPress.bind(this))
if(!assets.customSongs){
@ -588,6 +588,10 @@ class SongSelect{
}
categoryJump(moveBy){
if(this.state.locked === 1){
return
}
this.state.catJump = true
this.state.move = moveBy;
this.state.locked = 1
@ -1010,7 +1014,7 @@ class SongSelect{
var resize2 = changeSpeed - resize
var scroll = resize2 - resize - scrollDelay * 2
var elapsed = ms - this.state.moveMS
if(this.state.move && ms > this.state.moveMS + resize2 - scrollDelay){
if(this.state.catJump || (this.state.move && ms > this.state.moveMS + resize2 - scrollDelay)){
var isJump = this.state.catJump
var previousSelectedSong = this.selectedSong
@ -1020,6 +1024,7 @@ class SongSelect{
}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){

View File

@ -80,6 +80,7 @@
otherControls: "他のコントロール",
otherTutorial: [
"%sはゲームを一時停止します",
"曲をえらぶしながら%sか%sキーを押してジャンルをスキップします",
"むずかしさをえらぶしながら%sキーを押しながらオートモードを有効",
"むずかしさをえらぶしながら%sキーを押しながらネットプレイモードを有効"
],
@ -224,6 +225,7 @@ function StringsEn(){
otherControls: "Other controls",
otherTutorial: [
"%s \u2014 pause game",
'%s and %s while selecting song \u2014 navigate categories',
"%s while selecting difficulty \u2014 enable autoplay mode",
"%s while selecting difficulty \u2014 enable 2P mode"
],
@ -368,6 +370,7 @@ function StringsCn(){
otherControls: "其他控制",
otherTutorial: [
"%s暂停游戏",
'%s and %s while selecting song \u2014 navigate categories',
"选择难度时按住%s以启用自动模式",
"选择难度时按住%s以启用网络对战模式"
],
@ -512,6 +515,7 @@ function StringsTw(){
otherControls: "其他控制",
otherTutorial: [
"%s暫停遊戲",
'%s and %s while selecting song \u2014 navigate categories',
"選擇難度時按住%s以啟用自動模式",
"選擇難度時按住%s以啟用網上對打模式"
],
@ -656,6 +660,7 @@ function StringsKo(){
otherControls: "기타 컨트롤",
otherTutorial: [
"%s \u2014 게임을 일시 중지합니다",
'%s and %s while selecting song \u2014 navigate categories',
"난이도 선택 동안 %s 홀드 \u2014 오토 모드 활성화",
"난이도 선택 동안 %s 홀드 \u2014 넷 플레이 모드 활성화"
],

View File

@ -59,13 +59,13 @@ class Tutorial{
this.endButton.setAttribute("alt", strings.tutorial.ok)
this.tutorialDiv.innerHTML = ""
var kbdSettings = settings.getItem("keyboardSettings")
var pauseKey = pageEvents.kbd.indexOf("q") === -1 ? "Q" : "ESC"
var pauseKey = "ESC"
var keys = [
kbdSettings.don_l[0].toUpperCase(),
kbdSettings.don_r[0].toUpperCase(),
kbdSettings.ka_l[0].toUpperCase(),
kbdSettings.ka_r[0].toUpperCase(),
pauseKey, "SHIFT", "CTRL"
pauseKey, "SHIFT+LEFT", "SHIFT+RIGHT", "SHIFT", "CTRL"
]
var keyIndex = 0
strings.tutorial.basics.forEach(string => {