mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-05-04 07:23:57 +01:00
use api in title-ui-handler
This commit is contained in:
parent
a1adc40371
commit
565d80f262
@ -7,6 +7,7 @@ import { getSplashMessages } from "../data/splash-messages";
|
|||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { TimedEventDisplay } from "#app/timed-event-manager";
|
import { TimedEventDisplay } from "#app/timed-event-manager";
|
||||||
import { version } from "../../package.json";
|
import { version } from "../../package.json";
|
||||||
|
import { api } from "#app/plugins/api/api";
|
||||||
|
|
||||||
export default class TitleUiHandler extends OptionSelectUiHandler {
|
export default class TitleUiHandler extends OptionSelectUiHandler {
|
||||||
/** If the stats can not be retrieved, use this fallback value */
|
/** If the stats can not be retrieved, use this fallback value */
|
||||||
@ -78,12 +79,13 @@ export default class TitleUiHandler extends OptionSelectUiHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateTitleStats(): void {
|
updateTitleStats(): void {
|
||||||
Utils.apiFetch("game/titlestats")
|
api.getGameTitleStats()
|
||||||
.then(request => request.json())
|
|
||||||
.then(stats => {
|
.then(stats => {
|
||||||
this.playerCountLabel.setText(`${stats.playerCount} ${i18next.t("menu:playersOnline")}`);
|
if (stats) {
|
||||||
if (this.splashMessage === "splashMessages:battlesWon") {
|
this.playerCountLabel.setText(`${stats.playerCount} ${i18next.t("menu:playersOnline")}`);
|
||||||
this.splashMessageText.setText(i18next.t(this.splashMessage, { count: stats.battleCount }));
|
if (this.splashMessage === "splashMessages:battlesWon") {
|
||||||
|
this.splashMessageText.setText(i18next.t(this.splashMessage, { count: stats.battleCount }));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user