diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0fbb298..79d9aad 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -46,7 +46,6 @@ jobs: cp -r assets/ tauri/src/ cp -r styles/ tauri/src/ cp -r src/ tauri/src/ - cp -r lib/ tauri/src/ cd tauri npm install diff --git a/src/data/data.js b/src/data/data.js index b01804d..6bb4917 100644 --- a/src/data/data.js +++ b/src/data/data.js @@ -96,7 +96,7 @@ export const resultSuffix = { } export const statDecimals = { - 0: ["clearlines", "pieceCount", "score", "pcs", "quads", "allspins", "level", "attack", "cleargarbage", "sent", "recieved", "combo", "maxCombo", "btbCount", "maxBTB", "tpE", "ipE", "inputs", "holds", "rotates", "ppb",], + 0: ["clearlines", "pieceCount", "score", "pcs", "quads", "allspins", "level", "attack", "cleargarbage", "sent", "recieved", "combo", "maxCombo", "btbCount", "maxBTB", "tpE", "ipE", "inputs", "holds", "rotates", "ppb", "altitude"], 1: ["time", "vs", "chzind", "garbeff",], 2: ["pps", "apm", "lpm", "app", "apl", "appw", "dss", "dsp", "vsOnApm", "kps", "kpp"] } diff --git a/src/display/renderer.js b/src/display/renderer.js index a97b508..0a1492d 100644 --- a/src/display/renderer.js +++ b/src/display/renderer.js @@ -127,7 +127,7 @@ export class Renderer { // sidebar constants this.sidebarStats = this.game.settings.game.sidebar; - this.sidebarFixed = this.sidebarStats.map(stat => this.createReverseLookup(statDecimals)[stat]); + this.sidebarFixed = this.sidebarStats.map(stat => reverseLookup(statDecimals)[stat]); this.sidebarSecondary = this.sidebarStats.map(stat => statsSecondaries[stat] ?? "None"); this.sidebarStats.forEach((stat, index) => { @@ -156,16 +156,6 @@ export class Renderer { }) } - createReverseLookup(obj) { - const reverseLookup = {} - for (const [key, array] of Object.entries(obj)) { - array.forEach(item => { - reverseLookup[item] = key; - }); - } - return reverseLookup - } - formatTime(s, d) { const minutes = Math.floor(s / 60); const seconds = (s - minutes * 60).toFixed(d) @@ -196,3 +186,13 @@ export class Renderer { this.game.boardeffects.rotate(forces[type]); } } + +export function reverseLookup(obj) { + const reverseLookup = {} + for (const [key, array] of Object.entries(obj)) { + array.forEach(item => { + reverseLookup[item] = key; + }); + } + return reverseLookup +} diff --git a/src/features/modes.js b/src/features/modes.js index 6dbafa4..7b79da7 100644 --- a/src/features/modes.js +++ b/src/features/modes.js @@ -1,6 +1,7 @@ import { Game } from "../game.js"; import gamemodeJSON from "../data/gamemodes.json" with { type: "json" }; -import { gameoverResultText, gameoverText, resultSuffix } from "../data/data.js"; +import { gameoverResultText, gameoverText, resultSuffix, statDecimals } from "../data/data.js"; +import { reverseLookup } from "../display/renderer.js"; export class Modes { modeJSON; @@ -38,7 +39,7 @@ export class Modes { stat = stats.score; goal = undefined } - this.setObjectiveText(stat, goal); + this.setObjectiveText(this.modeJSON.goalstat, stat, goal); } statText(stat, value, result, resultvalue) { @@ -47,8 +48,8 @@ export class Modes { return front + back; } - setObjectiveText(statValue, resultValue) { - if (statValue != undefined) statValue = Math.round(statValue * 1000) / 1000 + setObjectiveText(stat, statValue, resultValue) { + if (statValue != undefined) statValue = statValue.toFixed(reverseLookup(statDecimals)[stat]) let modetext = (statValue == undefined ? '' : statValue) + (resultValue == undefined ? '' : `/${resultValue}`) this.game.pixi.objectiveTexts[0].text = modetext;