From 750dc6624596e94d43b68a1ed87846b0359513b5 Mon Sep 17 00:00:00 2001 From: Bui Date: Sat, 22 Feb 2020 13:09:07 +0000 Subject: [PATCH] improve category jump --- .gitignore | 2 ++ app.py | 2 +- public/src/js/songselect.js | 15 ++++++++++----- public/src/js/strings.js | 5 +++++ public/src/js/tutorial.js | 4 ++-- 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 994f1e6..6d44399 100644 --- a/.gitignore +++ b/.gitignore @@ -35,6 +35,8 @@ $RECYCLE.BIN/ .Spotlight-V100 .Trashes +.vscode + # Directories potentially created on remote AFP share .AppleDB .AppleDesktop diff --git a/app.py b/app.py index 11c4b44..d288d98 100644 --- a/app.py +++ b/app.py @@ -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): diff --git a/public/src/js/songselect.js b/public/src/js/songselect.js index 6fd15f8..ad48015 100644 --- a/public/src/js/songselect.js +++ b/public/src/js/songselect.js @@ -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){ diff --git a/public/src/js/strings.js b/public/src/js/strings.js index 5bed612..02e3dcf 100644 --- a/public/src/js/strings.js +++ b/public/src/js/strings.js @@ -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 넷 플레이 모드 활성화" ], diff --git a/public/src/js/tutorial.js b/public/src/js/tutorial.js index 2d1302c..b753ede 100644 --- a/public/src/js/tutorial.js +++ b/public/src/js/tutorial.js @@ -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 => {