SongSelect: Add Settings

- Resolution can be adjusted, as well as touch drum animation on mobile
- A translation text file "songtitle.txt" can be imported
  - Titles and translated titles are each on their own line, if a line begins with a language code, it will translate the song title that is above
  - An example file can be found here: https://gist.github.com/LoveEevee/65fe66f0b54c0536f96fd2f4862984d4
- The page will fail to load if version on the page does not match /api/config
- Disabled Tab key while playing, before hitting it would focus the version link
- Fix forcing branches in debug not working
- Fixed not being able to click on songs that do not have oni but have ura
- Fix unexpected category being used as a fallback
- Fix verticalText and layeredText not accepting anything except strings
This commit is contained in:
LoveEevee
2019-04-04 23:40:11 +03:00
parent 7411022b14
commit cb64777012
20 changed files with 527 additions and 86 deletions

View File

@@ -38,7 +38,15 @@ class Loader{
document.head.appendChild(script)
})
this.addPromise(new Promise(resolve => {
this.addPromise(new Promise((resolve, reject) => {
if(
versionLink.href !== gameConfig._version.url &&
gameConfig._version.commit &&
versionLink.href.indexOf(gameConfig._version.commit) === -1
){
// Version in the config does not match version on the page
reject()
}
var cssCount = document.styleSheets.length + assets.css.length
assets.css.forEach(name => {
var stylesheet = document.createElement("link")
@@ -195,6 +203,8 @@ class Loader{
p2.hash("")
}
settings = new Settings()
Promise.all(this.promises).then(() => {
this.canvasTest.drawAllImages().then(result => {
perf.allImg = result
@@ -212,7 +222,7 @@ class Loader{
}
addPromise(promise){
this.promises.push(promise)
promise.then(this.assetLoaded.bind(this))
promise.then(this.assetLoaded.bind(this), this.errorMsg.bind(this))
}
loadSound(name, gain){
var id = this.getFilename(name)
@@ -258,7 +268,9 @@ class Loader{
}
clean(){
var fontDetectDiv = document.getElementById("fontdetectHelper")
fontDetectDiv.parentNode.removeChild(fontDetectDiv)
if(fontDetectDiv){
fontDetectDiv.parentNode.removeChild(fontDetectDiv)
}
delete this.loaderPercentage
delete this.loaderProgress
delete this.promises