SongSelect: Add crowns

- Improve the soul gauge to fill properly. The algorithm is different for each difficulty.
- Saves score to localStorage, the whole score is correct now.
- Adds crowns to song selection screen.

The scores would take a lot of space if stored as readable objects so they are stored compressed. If you need to edit your scores, you can do so by opening dev console and entering `scoreStorage.get()`. Expand to the song and double click on values that you need to edit. When you are done editing, do not forget to save your scores with `scoreStorage.save()`. Adding new scores can be done with `scoreStorage.add`, first get a template with `obj=scoreStorage.template(),obj` and after editing, add it with `scoreStorage.add("song name", "oni", obj)`. To remove a score use `scoreStorage.remove("song name"[, "oni"])`.
This commit is contained in:
LoveEevee
2020-03-06 20:52:22 +03:00
parent 21259abdda
commit 0221c977c8
3 changed files with 171 additions and 117 deletions

View File

@@ -678,6 +678,7 @@ class Scoresheet{
y: 218,
scale: crownScale,
shine: shine,
whiteOutline: true,
ratio: ratio
})
@@ -865,10 +866,14 @@ class Scoresheet{
var difficulty = this.resultsObj.difficulty
var oldScore = scoreStorage.get(title, difficulty)
if(!oldScore || oldScore.points <= this.resultsObj.points){
this.resultsObj.crown = ""
var crown = ""
if(this.controller.game.rules.clearReached(this.resultsObj.gauge)){
this.resultsObj.crown = this.resultsObj.bad === 0 ? "gold" : "silver"
crown = this.resultsObj.bad === 0 ? "gold" : "silver"
}
if(oldScore && (oldScore.crown === "gold" || oldScore.crown === "silver" && !crown)){
crown = oldScore.crown
}
this.resultsObj.crown = crown
delete this.resultsObj.title
delete this.resultsObj.difficulty
delete this.resultsObj.gauge