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:
@@ -28,6 +28,7 @@ class Keyboard{
|
||||
"don": -Infinity,
|
||||
"ka": -Infinity
|
||||
}
|
||||
this.keyboardEvents = 0
|
||||
|
||||
var gameBtn = {}
|
||||
gameBtn[this.kbd["don_l"]] = ["u", "d", "l", "r", "ls"]
|
||||
@@ -66,8 +67,19 @@ class Keyboard{
|
||||
if(key && !event.repeat && this.buttonEnabled(key)){
|
||||
var ms = this.game.getAccurateTime()
|
||||
this.setKey(key, event.type === "keydown", ms)
|
||||
if(event.type === "keydown"){
|
||||
this.keyboardEvents++
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
if(controller.multiplayer === 1){
|
||||
pageEvents.add(window, "beforeunload", event => {
|
||||
if(p2.otherConnected){
|
||||
pageEvents.send("p2-abandoned", event)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
getBindings(){
|
||||
return this.kbd
|
||||
@@ -165,8 +177,9 @@ class Keyboard{
|
||||
}
|
||||
if(this.controller.multiplayer !== 2){
|
||||
this.checkKey(this.kbd["back"], "menu", () => {
|
||||
if(this.controller.multiplayer === 1){
|
||||
if(this.controller.multiplayer === 1 && p2.otherConnected){
|
||||
p2.send("gameend")
|
||||
pageEvents.send("p2-abandoned")
|
||||
}
|
||||
this.controller.togglePause()
|
||||
this.controller.songSelection()
|
||||
@@ -243,5 +256,14 @@ class Keyboard{
|
||||
clean(){
|
||||
pageEvents.keyRemove(this, "all")
|
||||
clearInterval(this.gamepadInterval)
|
||||
if(this.controller.multiplayer === 1){
|
||||
pageEvents.remove(window, "beforeunload")
|
||||
}
|
||||
if(this.controller.multiplayer !== 2){
|
||||
pageEvents.send("key-events", {
|
||||
keyboard: this.keyboardEvents,
|
||||
gamepad: this.gamepad.gamepadEvents
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user