Removed debug code + fixed function casing

pull/600/head
Alessandro Bruzzese 2024-05-07 19:22:35 +02:00
parent 79ef74a875
commit ce62b1992f
2 changed files with 5 additions and 8 deletions

View File

@ -1,11 +1,11 @@
import i18next from "../plugins/i18n";
export function getbattleCountSplashMessage(): string {
export function getBattleCountSplashMessage(): string {
return `{COUNT} ${i18next.t('splashMessages:battlesWon')}`;
}
export function getSplashMessages(): string[] {
const splashMessages = Array(10).fill(getbattleCountSplashMessage());
const splashMessages = Array(10).fill(getBattleCountSplashMessage());
splashMessages.push(...[
i18next.t('splashMessages:joinTheDiscord'),
i18next.t('splashMessages:infiniteLevel'),

View File

@ -4,7 +4,7 @@ import OptionSelectUiHandler from "./option-select-ui-handler";
import { Mode } from "./ui";
import * as Utils from "../utils";
import { TextStyle, addTextObject } from "./text";
import { getbattleCountSplashMessage, getSplashMessages } from "../data/splash-messages";
import { getBattleCountSplashMessage, getSplashMessages } from "../data/splash-messages";
import i18next from "i18next";
export default class TitleUiHandler extends OptionSelectUiHandler {
@ -63,8 +63,8 @@ export default class TitleUiHandler extends OptionSelectUiHandler {
.then(request => request.json())
.then(stats => {
this.playerCountLabel.setText(`${stats.playerCount} ${i18next.t("menu:playersOnline")}`);
if (this.splashMessage === getbattleCountSplashMessage())
this.splashMessageText.setText(getbattleCountSplashMessage().replace('{COUNT}', stats.battleCount.toLocaleString('en-US')));
if (this.splashMessage === getBattleCountSplashMessage())
this.splashMessageText.setText(getBattleCountSplashMessage().replace('{COUNT}', stats.battleCount.toLocaleString('en-US')));
})
.catch(err => {
console.error("Failed to fetch title stats:\n", err);
@ -76,9 +76,6 @@ export default class TitleUiHandler extends OptionSelectUiHandler {
if (ret) {
this.splashMessage = Utils.randItem(getSplashMessages());
console.log(getSplashMessages())
console.log("------")
console.log(this.splashMessage)
this.splashMessageText.setText(this.splashMessage.replace('{COUNT}', '?'));
const ui = this.getUi();