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

View File

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

View File

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

View File

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

View File

@ -107,8 +107,20 @@ export default class SaveSlotSelectUiHandler extends MessageUiHandler {
} else {
switch (this.uiMode) {
case SaveSlotUiMode.LOAD:
this.saveSlotSelectCallback = null;
originalCallback(this.sessionSlots[cursor].slotId, this.sessionSlots[cursor].autoSlot);
if (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;
case SaveSlotUiMode.SAVE:
const saveAndCallback = () => {
@ -279,6 +291,7 @@ class SessionSlot extends Phaser.GameObjects.Container {
public slotId: integer;
public autoSlot: integer;
public hasData: boolean;
public wv: integer;
private loadingLabel: Phaser.GameObjects.Text;
constructor(scene: BattleScene, slotId: integer, ypos: integer, autoSlot?: integer) {
@ -301,9 +314,10 @@ class SessionSlot extends Phaser.GameObjects.Container {
async setupWithData(data: SessionSaveData) {
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) {
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)
const gameModeLabel = addTextObject(this.scene, 8, 5, lbl, TextStyle.WINDOW);

View File

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