Fancy Title Screen

Tutorials are off by default
Type Hints are on by default
Added an option to make the title screen's biome change as you navigate menus
This commit is contained in:
RedstonewolfX 2024-07-13 16:31:04 -04:00
parent 3af044de2b
commit 48ff515269
6 changed files with 57 additions and 9 deletions

View File

@ -122,6 +122,7 @@ export default class BattleScene extends SceneBase {
public enableRetries: boolean = false; public enableRetries: boolean = false;
public damageDisplay: string = "Off"; public damageDisplay: string = "Off";
public lazyReloads: boolean = false; public lazyReloads: boolean = false;
public menuChangesBiome: boolean;
/** /**
* Determines the condition for a notification should be shown for Candy Upgrades * Determines the condition for a notification should be shown for Candy Upgrades
* - 0 = 'Off' * - 0 = 'Off'
@ -256,6 +257,8 @@ export default class BattleScene extends SceneBase {
public eventManager: TimedEventManager; public eventManager: TimedEventManager;
public biomeChangeMode: boolean = false;
/** /**
* Allows subscribers to listen for events * Allows subscribers to listen for events
* *
@ -298,6 +301,7 @@ export default class BattleScene extends SceneBase {
Phaser.Math.RND.realInRange = function (min: number, max: number): number { Phaser.Math.RND.realInRange = function (min: number, max: number): number {
const ret = originalRealInRange.apply(this, [ min, max ]); const ret = originalRealInRange.apply(this, [ min, max ]);
const args = [ "RNG", ++scene.rngCounter, ret / (max - min), `min: ${min} / max: ${max}` ]; const args = [ "RNG", ++scene.rngCounter, ret / (max - min), `min: ${min} / max: ${max}` ];
scene.setScoreText("RNG: " + this.rngCounter + ")")
args.push(`seed: ${scene.rngSeedOverride || scene.waveSeed || scene.seed}`); args.push(`seed: ${scene.rngSeedOverride || scene.waveSeed || scene.seed}`);
if (scene.rngOffset) { if (scene.rngOffset) {
args.push(`offset: ${scene.rngOffset}`); args.push(`offset: ${scene.rngOffset}`);
@ -901,6 +905,7 @@ export default class BattleScene extends SceneBase {
setSeed(seed: string): void { setSeed(seed: string): void {
this.seed = seed; this.seed = seed;
this.rngCounter = 0; this.rngCounter = 0;
//this.setScoreText("RNG: 0")
this.waveCycleOffset = this.getGeneratedWaveCycleOffset(); this.waveCycleOffset = this.getGeneratedWaveCycleOffset();
this.offsetGym = this.gameMode.isClassic && this.getGeneratedOffsetGym(); this.offsetGym = this.gameMode.isClassic && this.getGeneratedOffsetGym();
} }
@ -1352,6 +1357,7 @@ export default class BattleScene extends SceneBase {
Phaser.Math.RND.sow([ this.waveSeed ]); Phaser.Math.RND.sow([ this.waveSeed ]);
console.log("Wave Seed:", this.waveSeed, wave); console.log("Wave Seed:", this.waveSeed, wave);
this.rngCounter = 0; this.rngCounter = 0;
//this.setScoreText("RNG: 0")
} }
executeWithSeedOffset(func: Function, offset: integer, seedOverride?: string): void { executeWithSeedOffset(func: Function, offset: integer, seedOverride?: string): void {
@ -1368,6 +1374,7 @@ export default class BattleScene extends SceneBase {
this.rngSeedOverride = seedOverride || ""; this.rngSeedOverride = seedOverride || "";
func(); func();
Phaser.Math.RND.state(state); Phaser.Math.RND.state(state);
this.setScoreText("RNG: " + tempRngCounter + " (Last sim: " + this.rngCounter + ")")
this.rngCounter = tempRngCounter; this.rngCounter = tempRngCounter;
this.rngOffset = tempRngOffset; this.rngOffset = tempRngOffset;
this.rngSeedOverride = tempRngSeedOverride; this.rngSeedOverride = tempRngSeedOverride;
@ -1497,10 +1504,16 @@ export default class BattleScene extends SceneBase {
} }
updateScoreText(): void { updateScoreText(): void {
this.scoreText.setText(`Score: ${this.score.toString()}`); //this.scoreText.setText(`Score: ${this.score.toString()}`);
this.scoreText.setVisible(this.gameMode.isDaily); //this.scoreText.setVisible(this.gameMode.isDaily);
} }
setScoreText(text: string): void { setScoreText(text: string): void {
if (this.scoreText == undefined)
return;
if (this.scoreText.setText == undefined)
return;
if (this.scoreText.setVisible == undefined)
return;
this.scoreText.setText(text); this.scoreText.setText(text);
this.scoreText.setVisible(true); this.scoreText.setVisible(true);
} }

View File

@ -40,6 +40,8 @@ export const logKeys: string[] = [
"d", // Debug "d", // Debug
]; ];
export const RNGState: number[] = []
export const autoCheckpoints: integer[] = [ export const autoCheckpoints: integer[] = [
1, 1,
11, 11,

View File

@ -100,7 +100,8 @@ export const SettingKeys = {
Music_Preference: "MUSIC_PREFERENCE", Music_Preference: "MUSIC_PREFERENCE",
Show_BGM_Bar: "SHOW_BGM_BAR", Show_BGM_Bar: "SHOW_BGM_BAR",
Damage_Display: "DAMAGE_DISPLAY", Damage_Display: "DAMAGE_DISPLAY",
LazyReloads: "FLAG_EVERY_RESET_AS_RELOAD" LazyReloads: "FLAG_EVERY_RESET_AS_RELOAD",
FancyBiome: "FANCY_BIOMES"
}; };
/** /**
@ -176,6 +177,19 @@ export const Setting: Array<Setting> = [
default: 0, default: 0,
type: SettingType.GENERAL, type: SettingType.GENERAL,
}, },
{
key: SettingKeys.FancyBiome,
label: "Fancy Title Screen",
options: [{
label: "Off",
value: "Off"
}, {
label: "On",
value: "On"
}],
default: 0,
type: SettingType.GENERAL,
},
{ {
key: SettingKeys.HP_Bar_Speed, key: SettingKeys.HP_Bar_Speed,
label: i18next.t("settings:hpBarSpeed"), label: i18next.t("settings:hpBarSpeed"),
@ -278,7 +292,7 @@ export const Setting: Array<Setting> = [
key: SettingKeys.Tutorials, key: SettingKeys.Tutorials,
label: i18next.t("settings:tutorials"), label: i18next.t("settings:tutorials"),
options: OFF_ON, options: OFF_ON,
default: 0, default: 1,
type: SettingType.GENERAL type: SettingType.GENERAL
}, },
{ {
@ -518,7 +532,7 @@ export const Setting: Array<Setting> = [
key: SettingKeys.Type_Hints, key: SettingKeys.Type_Hints,
label: i18next.t("settings:typeHints"), label: i18next.t("settings:typeHints"),
options: OFF_ON, options: OFF_ON,
default: 1, default: 0,
type: SettingType.DISPLAY type: SettingType.DISPLAY
}, },
{ {
@ -640,6 +654,8 @@ export function setSetting(scene: BattleScene, setting: string, value: integer):
scene.damageDisplay = Setting[index].options[value].value scene.damageDisplay = Setting[index].options[value].value
case SettingKeys.LazyReloads: case SettingKeys.LazyReloads:
scene.lazyReloads = Setting[index].options[value].value == "On" scene.lazyReloads = Setting[index].options[value].value == "On"
case SettingKeys.FancyBiome:
scene.menuChangesBiome = Setting[index].options[value].value == "On"
case SettingKeys.Skip_Seen_Dialogues: case SettingKeys.Skip_Seen_Dialogues:
scene.skipSeenDialogues = Setting[index].options[value].value === "On"; scene.skipSeenDialogues = Setting[index].options[value].value === "On";
break; break;

View File

@ -6,6 +6,8 @@ import { addWindow } from "./ui-theme";
import * as Utils from "../utils"; import * as Utils from "../utils";
import { argbFromRgba } from "@material/material-color-utilities"; import { argbFromRgba } from "@material/material-color-utilities";
import {Button} from "#enums/buttons"; import {Button} from "#enums/buttons";
import { Biome } from "#app/enums/biome.js";
import { getBiomeKey } from "#app/field/arena.js";
export interface OptionSelectConfig { export interface OptionSelectConfig {
xOffset?: number; xOffset?: number;

View File

@ -107,8 +107,20 @@ export default class SaveSlotSelectUiHandler extends MessageUiHandler {
} else { } else {
switch (this.uiMode) { switch (this.uiMode) {
case SaveSlotUiMode.LOAD: case SaveSlotUiMode.LOAD:
this.saveSlotSelectCallback = null; if (this.sessionSlots[cursor].autoSlot) {
originalCallback(this.sessionSlots[cursor].slotId, this.sessionSlots[cursor].autoSlot); ui.showText("This will revert slot " + (this.sessionSlots[cursor].slotId + 1) + " to wave " + (this.sessionSlots[cursor].wv) + ".\nIs that okay?", null, () => {
ui.setOverlayMode(Mode.CONFIRM, () => {
this.saveSlotSelectCallback = null;
originalCallback(this.sessionSlots[cursor].slotId, this.sessionSlots[cursor].autoSlot);
}, () => {
ui.revertMode();
ui.showText(null, 0);
}, false, 0, 19, 500);
});
} else {
this.saveSlotSelectCallback = null;
originalCallback(this.sessionSlots[cursor].slotId, this.sessionSlots[cursor].autoSlot);
}
break; break;
case SaveSlotUiMode.SAVE: case SaveSlotUiMode.SAVE:
const saveAndCallback = () => { const saveAndCallback = () => {
@ -279,6 +291,7 @@ class SessionSlot extends Phaser.GameObjects.Container {
public slotId: integer; public slotId: integer;
public autoSlot: integer; public autoSlot: integer;
public hasData: boolean; public hasData: boolean;
public wv: integer;
private loadingLabel: Phaser.GameObjects.Text; private loadingLabel: Phaser.GameObjects.Text;
constructor(scene: BattleScene, slotId: integer, ypos: integer, autoSlot?: integer) { constructor(scene: BattleScene, slotId: integer, ypos: integer, autoSlot?: integer) {
@ -301,9 +314,10 @@ class SessionSlot extends Phaser.GameObjects.Container {
async setupWithData(data: SessionSaveData) { async setupWithData(data: SessionSaveData) {
this.remove(this.loadingLabel, true); this.remove(this.loadingLabel, true);
var lbl = `${GameMode.getModeName(data.gameMode) || i18next.t("gameMode:unkown")} - ${i18next.t("saveSlotSelectUiHandler:wave")} ${data.waveIndex}` this.wv = data.waveIndex;
var lbl = `Slot ${this.slotId+1} (${GameMode.getModeName(data.gameMode) || i18next.t("gameMode:unkown")}) - ${i18next.t("saveSlotSelectUiHandler:wave")} ${data.waveIndex}`
if (this.autoSlot != undefined) { if (this.autoSlot != undefined) {
lbl = `Slot ${this.slotId} (Auto) - ${i18next.t("saveSlotSelectUiHandler:wave")} ${data.waveIndex}` lbl = `Slot ${this.slotId+1} (Auto) - ${i18next.t("saveSlotSelectUiHandler:wave")} ${data.waveIndex}`
} }
console.log(data, this.slotId, this.autoSlot, lbl) console.log(data, this.slotId, this.autoSlot, lbl)
const gameModeLabel = addTextObject(this.scene, 8, 5, lbl, TextStyle.WINDOW); const gameModeLabel = addTextObject(this.scene, 8, 5, lbl, TextStyle.WINDOW);

View File

@ -1,5 +1,6 @@
import i18next from "i18next"; import i18next from "i18next";
import { MoneyFormat } from "#enums/money-format"; import { MoneyFormat } from "#enums/money-format";
import * as LoggerTools from "./logger"
export const MissingTextureKey = "__MISSING"; export const MissingTextureKey = "__MISSING";