Lots of bug fixes

- Toggling autoplay checkbox in debug now disallows saving the score
- Fix crown of the song that was previously selected rendering above the genre
- Outline of empty crowns is slightly darker
- Fix rendering when there is a crown on oni and no crown on ura
- Fix crowns overlapping the netplay 2P icon
- Fix gauge in latency calibration
- Fix debug to work on mobile, can be toggled with ctrl+alt+`;` on hacker's keyboard with permanent notification
- Fix being unable to scroll the settings list without toggling something
- Handle KeyboardInterrupt in server.py
- Fix category jumping not working in session mode
- Fix mouse cursor being hidden at results screen in session mode
- Make "Issues" on the about screen and "An error occurred, please refresh" on loading screens translateable
- CanvasCache uses integer increments for comparison instead of Date.now()
- For imported songs, exclude song titles from genre comparisons if they appear in the name of the folder
- Fix tja files with spaces in the notation
- Fix second player's score on the results screen to have upside down appearance
- Add fixed chinese strings
This commit is contained in:
LoveEevee
2020-03-09 15:36:57 +03:00
parent 5a1be53e21
commit 9248a52194
21 changed files with 459 additions and 211 deletions

View File

@@ -11,60 +11,62 @@ class PageEvents{
this.add(window, "blur", this.blurEvent.bind(this))
this.kbd = []
}
add(target, type, callback){
add(target, type, callback, symbol){
if(Array.isArray(type)){
type.forEach(type => this.add(target, type, callback))
type.forEach(type => this.add(target, type, callback, symbol))
return
}
this.remove(target, type)
var addedEvent = this.allEvents.get(target)
var addedEvent = this.allEvents.get(symbol || target)
if(!addedEvent){
addedEvent = new Map()
this.allEvents.set(target, addedEvent)
this.allEvents.set(symbol || target, addedEvent)
}
addedEvent.set(type, callback)
return target.addEventListener(type, callback)
}
remove(target, type){
remove(target, type, symbol){
if(Array.isArray(type)){
type.forEach(type => this.remove(target, type))
type.forEach(type => this.remove(target, type, symbol))
return
}
var addedEvent = this.allEvents.get(target)
var addedEvent = this.allEvents.get(symbol || target)
if(addedEvent){
var callback = addedEvent.get(type)
if(callback){
target.removeEventListener(type, callback)
addedEvent.delete(type)
if(addedEvent.size == 0){
return this.allEvents.delete(target)
return this.allEvents.delete(symbol || target)
}
}
}
}
once(target, type){
once(target, type, symbol){
return new Promise(resolve => {
this.add(target, type, event => {
this.remove(target, type)
return resolve(event)
})
}, symbol)
})
}
race(){
var symbols = []
var target = arguments[0]
return new Promise(resolve => {
for(var i = 1;i < arguments.length; i++){
symbols[i] = Symbol()
let type = arguments[i]
this.add(target, type, event => {
resolve({
type: type,
event: event
})
})
}, symbols[i])
}
}).then(response => {
for(var i = 1;i < arguments.length; i++){
this.remove(target, arguments[i])
this.remove(target, arguments[i], symbols[i])
}
return response
})