[UI/UX] Moving Daily Run option (#5273)

* Position of player count on title screen is set dynamically

* Moving daily run under "New run" option
This commit is contained in:
Wlowscha 2025-02-08 04:56:17 +01:00 committed by GitHub
parent 986fbf3cf7
commit 345329a31e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 45 additions and 48 deletions

View File

@ -77,30 +77,36 @@ export class TitlePhase extends Phase {
this.end();
};
const { gameData } = globalScene;
const options: OptionSelectItem[] = [];
options.push({
label: GameMode.getModeName(GameModes.CLASSIC),
handler: () => {
setModeAndEnd(GameModes.CLASSIC);
return true;
}
});
options.push({
label: i18next.t("menu:dailyRun"),
handler: () => {
this.initDailyRun();
return true;
}
});
if (gameData.isUnlocked(Unlockables.ENDLESS_MODE)) {
const options: OptionSelectItem[] = [
{
label: GameMode.getModeName(GameModes.CLASSIC),
handler: () => {
setModeAndEnd(GameModes.CLASSIC);
return true;
}
},
{
label: GameMode.getModeName(GameModes.CHALLENGE),
handler: () => {
setModeAndEnd(GameModes.CHALLENGE);
return true;
}
},
{
label: GameMode.getModeName(GameModes.ENDLESS),
handler: () => {
setModeAndEnd(GameModes.ENDLESS);
return true;
}
options.push({
label: GameMode.getModeName(GameModes.CHALLENGE),
handler: () => {
setModeAndEnd(GameModes.CHALLENGE);
return true;
}
];
});
options.push({
label: GameMode.getModeName(GameModes.ENDLESS),
handler: () => {
setModeAndEnd(GameModes.ENDLESS);
return true;
}
});
if (gameData.isUnlocked(Unlockables.SPLICED_ENDLESS_MODE)) {
options.push({
label: GameMode.getModeName(GameModes.SPLICED_ENDLESS),
@ -110,22 +116,17 @@ export class TitlePhase extends Phase {
}
});
}
options.push({
label: i18next.t("menu:cancel"),
handler: () => {
globalScene.clearPhaseQueue();
globalScene.pushPhase(new TitlePhase());
super.end();
return true;
}
});
globalScene.ui.showText(i18next.t("menu:selectGameMode"), null, () => globalScene.ui.setOverlayMode(Mode.OPTION_SELECT, { options: options }));
} else {
this.gameMode = GameModes.CLASSIC;
globalScene.ui.setMode(Mode.MESSAGE);
globalScene.ui.clearText();
this.end();
}
options.push({
label: i18next.t("menu:cancel"),
handler: () => {
globalScene.clearPhaseQueue();
globalScene.pushPhase(new TitlePhase());
super.end();
return true;
}
});
globalScene.ui.showText(i18next.t("menu:selectGameMode"), null, () => globalScene.ui.setOverlayMode(Mode.OPTION_SELECT, { options: options }));
return true;
}
},
@ -142,14 +143,6 @@ export class TitlePhase extends Phase {
return true;
}
},
{
label: i18next.t("menu:dailyRun"),
handler: () => {
this.initDailyRun();
return true;
},
keepOpen: true
},
{
label: i18next.t("menu:runHistory"),
handler: () => {
@ -192,6 +185,7 @@ export class TitlePhase extends Phase {
}
initDailyRun(): void {
globalScene.ui.clearText();
globalScene.ui.setMode(Mode.SAVE_SLOT, SaveSlotUiMode.SAVE, (slotId: number) => {
globalScene.clearPhaseQueue();
if (slotId === -1) {

View File

@ -1,7 +1,7 @@
import OptionSelectUiHandler from "./settings/option-select-ui-handler";
import { Mode } from "./ui";
import * as Utils from "../utils";
import { TextStyle, addTextObject, getTextStyleOptions } from "./text";
import { TextStyle, addTextObject } from "./text";
import { getSplashMessages } from "../data/splash-messages";
import i18next from "i18next";
import { TimedEventDisplay } from "#app/timed-event-manager";
@ -47,8 +47,8 @@ export default class TitleUiHandler extends OptionSelectUiHandler {
}
this.playerCountLabel = addTextObject(
(globalScene.game.canvas.width / 6) - 2,
(globalScene.game.canvas.height / 6) - 13 - 576 * getTextStyleOptions(TextStyle.WINDOW, globalScene.uiTheme).scale,
// Actual y position will be determined after the title menu has been populated with options
(globalScene.game.canvas.width / 6) - 2, 0,
`? ${i18next.t("menu:playersOnline")}`,
TextStyle.MESSAGE,
{ fontSize: "54px" }
@ -96,6 +96,9 @@ export default class TitleUiHandler extends OptionSelectUiHandler {
const ret = super.show(args);
if (ret) {
// Moving player count to top of the menu
this.playerCountLabel.setY((globalScene.game.canvas.height / 6) - 13 - this.getWindowHeight());
this.splashMessage = Utils.randItem(getSplashMessages());
this.splashMessageText.setText(i18next.t(this.splashMessage, { count: TitleUiHandler.BATTLES_WON_FALLBACK }));