Custom scripting, #song=, translations
- A song can be linked directly by adding "#song=<id>" to the url, replace `<id>` with the id in the database, after loading it jumps immediately jumps to the difficulty selection
- Added tutorial translations
- Fixed song preview not playing
- Use text fallback for the logo when there are no vectors
- Increased combo cache by 1 pixel
- A custom javascript file can be loaded from config.json by defining "custom_js" value
- Added lots of events to help writing custom js files: `version-link, title-screen, language-change, song-select, song-select-move, song-select-difficulty, song-select-back, about, about-link, tutorial, import-songs, import-songs-default, session, session-start, session-end, debug, load-song, load-song-player2, load-song-unfocused, load-song-cancel, load-song-error, game-start, key-events, p2-game-end, p2-disconnected, p2-abandoned, pause, unpause, pause-restart, pause-song-select, game-lag, scoresheet, scoresheet-player2`
- Event syntax example:
```js
addEventListener("game-start", event => {
console.log("game-start", event.detail)
})
```
This commit is contained in:
@@ -15,6 +15,11 @@ class LoadSong{
|
||||
cancel.setAttribute("alt", strings.cancel)
|
||||
}
|
||||
this.run()
|
||||
pageEvents.send("load-song", {
|
||||
selectedSong: selectedSong,
|
||||
autoPlayEnabled: autoPlayEnabled,
|
||||
multiplayer: multiplayer
|
||||
})
|
||||
}
|
||||
run(){
|
||||
var song = this.selectedSong
|
||||
@@ -117,6 +122,7 @@ class LoadSong{
|
||||
if(Array.isArray(error) && error[1] instanceof HTMLElement){
|
||||
error = error[0] + ": " + error[1].outerHTML
|
||||
}
|
||||
pageEvents.send("load-song-error", error)
|
||||
errorMessage(new Error(error).stack)
|
||||
alert("An error occurred, please refresh")
|
||||
})
|
||||
@@ -243,6 +249,7 @@ class LoadSong{
|
||||
var taikoGame1 = new Controller(song, this.songData, false, 1, this.touchEnabled)
|
||||
var taikoGame2 = new Controller(this.selectedSong2, this.song2Data, true, 2, this.touchEnabled)
|
||||
taikoGame1.run(taikoGame2)
|
||||
pageEvents.send("load-song-player2", this.selectedSong2)
|
||||
}else if(event.type === "left" || event.type === "gameend"){
|
||||
this.clean()
|
||||
new SongSelect(false, false, this.touchEnabled)
|
||||
@@ -264,6 +271,7 @@ class LoadSong{
|
||||
}else{
|
||||
if(!repeat){
|
||||
assets.sounds["v_sanka"].play()
|
||||
pageEvents.send("load-song-unfocused")
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.startMultiplayer(true)
|
||||
@@ -281,6 +289,7 @@ class LoadSong{
|
||||
p2.send("leave")
|
||||
assets.sounds["se_don"].play()
|
||||
this.cancelButton.style.pointerEvents = "none"
|
||||
pageEvents.send("load-song-cancel")
|
||||
}
|
||||
clean(){
|
||||
pageEvents.remove(p2, "message")
|
||||
|
||||
Reference in New Issue
Block a user