From 4e006e64e83978db3f4696b3ff6e082ff0c1a1be Mon Sep 17 00:00:00 2001 From: Florian Schmid Date: Fri, 28 Apr 2023 22:55:00 +0200 Subject: [PATCH] hotfix --- js/statistics.js | 5 +++-- src/statistics.ts | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/js/statistics.js b/js/statistics.js index fbfe6ff..317026f 100644 --- a/js/statistics.js +++ b/js/statistics.js @@ -23,16 +23,17 @@ export class Stats { } incrementScore(value = 1) { __classPrivateFieldSet(this, _Stats_score, __classPrivateFieldGet(this, _Stats_score, "f") + value, "f"); - this.checkHighScore; + this.checkHighScore(); } resetScore() { __classPrivateFieldSet(this, _Stats_score, 0, "f"); } updateScore(value) { __classPrivateFieldSet(this, _Stats_score, __classPrivateFieldGet(this, _Stats_score, "f") + value, "f"); - this.checkHighScore; + this.checkHighScore(); } checkHighScore() { + console.log("Highscore: " + __classPrivateFieldGet(this, _Stats_highScore, "f") + " | Score: " + __classPrivateFieldGet(this, _Stats_score, "f")); if (__classPrivateFieldGet(this, _Stats_highScore, "f") < __classPrivateFieldGet(this, _Stats_score, "f")) { __classPrivateFieldSet(this, _Stats_highScore, __classPrivateFieldGet(this, _Stats_score, "f"), "f"); localStorage.setItem(__classPrivateFieldGet(this, _Stats_highScoreStorageKey, "f"), __classPrivateFieldGet(this, _Stats_highScore, "f").toString()); diff --git a/src/statistics.ts b/src/statistics.ts index 54a7545..7a359bf 100644 --- a/src/statistics.ts +++ b/src/statistics.ts @@ -14,7 +14,7 @@ export class Stats { incrementScore(value = 1) { this.#score += value; - this.checkHighScore; + this.checkHighScore(); } resetScore(): void { @@ -24,10 +24,11 @@ export class Stats { updateScore(value) { this.#score += value; - this.checkHighScore; + this.checkHighScore(); } private checkHighScore() { + console.log("Highscore: " + this.#highScore + " | Score: " + this.#score) if (this.#highScore < this.#score) { this.#highScore = this.#score; localStorage.setItem(this.#highScoreStorageKey, this.#highScore.toString());