Skip to content

Commit

Permalink
* HttpSiraStatus の currentSongTime に対応
Browse files Browse the repository at this point in the history
* オプション配列にex_beatmapEventを追加
  • Loading branch information
rynan4818 committed Oct 10, 2021
1 parent 5e1ea0d commit 88ab2f4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ modifiersフォルダにCSSファイルを追加すると、CSSファイル名
| ex_pause | (data) | HTTP Status の pause イベント時に呼び出されます |
| ex_resume | (data) | HTTP Status の resume イベント時に呼び出されます |
| ex_menu | (data) | HTTP Status の menu イベント時に呼び出されます |
| ex_beatmapEvent | (data) | HTTP Status の beatmapEvent イベント時に呼び出されます |

| 引数 | 説明 |
----|----
Expand Down
10 changes: 10 additions & 0 deletions js/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@ const events = {
ex_energyChanged.forEach(ex => ex(data));
},

beatmapEvent(data) {
if (typeof data.status.performance !== "undefined") {
var song_time = data.status.performance.currentSongTime;
if (typeof song_time !== "undefined") {
ui.timer.song_time_update(song_time);
}
}
ex_beatmapEvent.forEach(ex => ex(data));
},

pause(data) {
var ip = query.get("ip");
var diff_time = 0;
Expand Down
1 change: 1 addition & 0 deletions js/startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ let ex_energyChanged = [];
let ex_pause = [];
let ex_resume = [];
let ex_menu = [];
let ex_beatmapEvent = [];
5 changes: 5 additions & 0 deletions js/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@ const ui = (() => {
active = false;
began = undefined;
duration = undefined;
},

song_time_update(song_time) {
began = Date.now() - Math.floor(song_time * 1000 / song_speed);
update();
}
}
})();
Expand Down

0 comments on commit 88ab2f4

Please sign in to comment.