Use stars on song select for score level

This commit is contained in:
LoveEevee 2019-11-04 17:20:44 +03:00
parent 84377f62b0
commit 1bb3359784
5 changed files with 12 additions and 9 deletions

View File

@ -12,9 +12,9 @@ class Controller{
} }
if(selectedSong.type === "tja"){ if(selectedSong.type === "tja"){
this.parsedSongData = new ParseTja(songData, selectedSong.difficulty, selectedSong.offset) this.parsedSongData = new ParseTja(songData, selectedSong.difficulty, selectedSong.stars, selectedSong.offset)
}else{ }else{
this.parsedSongData = new ParseOsu(songData, selectedSong.difficulty, selectedSong.offset) this.parsedSongData = new ParseOsu(songData, selectedSong.difficulty, selectedSong.stars, selectedSong.offset)
} }
this.offset = this.parsedSongData.soundOffset this.offset = this.parsedSongData.soundOffset

View File

@ -199,7 +199,7 @@
var reader = new FileReader() var reader = new FileReader()
var promise = pageEvents.load(reader).then(event => { var promise = pageEvents.load(reader).then(event => {
var data = event.target.result.replace(/\0/g, "").split("\n") var data = event.target.result.replace(/\0/g, "").split("\n")
var tja = new ParseTja(data, "oni", 0, true) var tja = new ParseTja(data, "oni", 0, 0, true)
var songObj = { var songObj = {
id: index + 1, id: index + 1,
type: "tja", type: "tja",
@ -283,7 +283,7 @@
var reader = new FileReader() var reader = new FileReader()
var promise = pageEvents.load(reader).then(event => { var promise = pageEvents.load(reader).then(event => {
var data = event.target.result.replace(/\0/g, "").split("\n") var data = event.target.result.replace(/\0/g, "").split("\n")
var osu = new ParseOsu(data, "oni", 0, true); var osu = new ParseOsu(data, "oni", 0, 0, true);
var dir = file.webkitRelativePath.toLowerCase() var dir = file.webkitRelativePath.toLowerCase()
dir = dir.slice(0, dir.lastIndexOf("/") + 1) dir = dir.slice(0, dir.lastIndexOf("/") + 1)
var songObj = { var songObj = {

View File

@ -1,5 +1,5 @@
class ParseOsu{ class ParseOsu{
constructor(fileContent, difficulty, offset, metaOnly){ constructor(fileContent, difficulty, stars, offset, metaOnly){
this.osu = { this.osu = {
OFFSET: 0, OFFSET: 0,
MSPERBEAT: 1, MSPERBEAT: 1,
@ -53,6 +53,7 @@ class ParseOsu{
this.editor = this.parseEditor() this.editor = this.parseEditor()
this.difficulty = this.parseDifficulty() this.difficulty = this.parseDifficulty()
this._difficulty = difficulty; this._difficulty = difficulty;
this.stars = stars
if(!metaOnly){ if(!metaOnly){
this.timingPoints = this.parseTiming() this.timingPoints = this.parseTiming()
this.circles = this.parseCircles() this.circles = this.parseCircles()
@ -356,7 +357,7 @@ class ParseOsu{
} }
} }
this.scoremode = 2; this.scoremode = 2;
var autoscore = new AutoScore(this._difficulty, parseInt(this.difficulty.overallDifficulty) * 2, 2, circles); var autoscore = new AutoScore(this._difficulty, this.stars, 2, circles);
this.scoreinit = autoscore.ScoreInit; this.scoreinit = autoscore.ScoreInit;
this.scorediff = autoscore.ScoreDiff; this.scorediff = autoscore.ScoreDiff;
return circles return circles

View File

@ -1,5 +1,5 @@
class ParseTja{ class ParseTja{
constructor(file, difficulty, offset, metaOnly){ constructor(file, difficulty, stars, offset, metaOnly){
this.data = [] this.data = []
for(let line of file){ for(let line of file){
line = line.replace(/\/\/.*/, "").trim() line = line.replace(/\/\/.*/, "").trim()
@ -8,6 +8,7 @@
} }
} }
this.difficulty = difficulty this.difficulty = difficulty
this.stars = stars
this.offset = (offset || 0) * -1000 this.offset = (offset || 0) * -1000
this.soundOffset = 0 this.soundOffset = 0
this.noteTypes = { this.noteTypes = {
@ -454,7 +455,7 @@
this.scoremode = meta.scoremode || 1; this.scoremode = meta.scoremode || 1;
} else { } else {
this.scoremode = meta.scoremode || 2; this.scoremode = meta.scoremode || 2;
var autoscore = new AutoScore(this.difficulty, meta.level, this.scoremode, circles); var autoscore = new AutoScore(this.difficulty, this.stars, this.scoremode, circles);
this.scoreinit = autoscore.ScoreInit; this.scoreinit = autoscore.ScoreInit;
this.scorediff = autoscore.ScoreDiff; this.scorediff = autoscore.ScoreDiff;
} }

View File

@ -687,7 +687,8 @@ class SongSelect{
"category": selectedSong.category, "category": selectedSong.category,
"type": selectedSong.type, "type": selectedSong.type,
"offset": selectedSong.offset, "offset": selectedSong.offset,
"songSkin": selectedSong.songSkin "songSkin": selectedSong.songSkin,
"stars": selectedSong.stars[difficulty]
}, autoplay, multiplayer, touch) }, autoplay, multiplayer, touch)
} }
toOptions(moveBy){ toOptions(moveBy){