Title screen setting

Can change how the quick-load button on the title screen appears

Changed grunts' title to "Grunt"
This commit is contained in:
RedstonewolfX 2024-07-18 15:17:40 -04:00
parent ff40f56992
commit e93b84cef5
3 changed files with 75 additions and 24 deletions

View File

@ -229,6 +229,7 @@ export default class Trainer extends Phaser.GameObjects.Container {
let title = true && this.config.title ? this.config.title : null; let title = true && this.config.title ? this.config.title : null;
if (this.name === "" && name.toLowerCase().includes("grunt")) { if (this.name === "" && name.toLowerCase().includes("grunt")) {
return "Grunt";
// This is a evil team grunt so we localize it by only using the "name" as the title // This is a evil team grunt so we localize it by only using the "name" as the title
title = i18next.t(`trainerClasses:${name.toLowerCase().replace(/\s/g, "_")}`); title = i18next.t(`trainerClasses:${name.toLowerCase().replace(/\s/g, "_")}`);
console.log("Localized grunt name: " + title); console.log("Localized grunt name: " + title);

View File

@ -403,12 +403,12 @@ export class TitlePhase extends Phase {
}); });
} }
getLastSave(log?: boolean, dailyOnly?: boolean): SessionSaveData { getLastSave(log?: boolean, dailyOnly?: boolean, noDaily?: boolean): SessionSaveData {
var saves: Array<Array<any>> = []; var saves: Array<Array<any>> = [];
for (var i = 0; i < 5; i++) { for (var i = 0; i < 5; i++) {
var s = parseSlotData(i); var s = parseSlotData(i);
if (s != undefined) { if (s != undefined) {
if (!dailyOnly || s.gameMode == GameModes.DAILY) { if ((!noDaily && !dailyOnly) || (s.gameMode == GameModes.DAILY && dailyOnly) || (s.gameMode != GameModes.DAILY && noDaily)) {
saves.push([i, s, s.timestamp]); saves.push([i, s, s.timestamp]);
} }
} }
@ -419,6 +419,36 @@ export class TitlePhase extends Phase {
if (saves[0] == undefined) return undefined; if (saves[0] == undefined) return undefined;
return saves[0][1] return saves[0][1]
} }
getLastSavesOfEach(log?: boolean): SessionSaveData[] {
var saves: Array<Array<any>> = [];
for (var i = 0; i < 5; i++) {
var s = parseSlotData(i);
if (s != undefined) {
saves.push([i, s, s.timestamp]);
}
}
saves.sort((a, b): integer => {return b[2] - a[2]})
if (log) console.log(saves)
if (saves == undefined) return undefined;
if (saves[0] == undefined) return undefined;
var validSaves = []
var hasNormal = false;
var hasDaily = false;
for (var i = 0; i < saves.length; i++) {
if (saves[i][1].gameMode == GameModes.DAILY && !hasDaily) {
hasDaily = true;
validSaves.push(saves[i])
}
if (saves[i][1].gameMode != GameModes.DAILY && !hasNormal) {
hasNormal = true;
validSaves.push(saves[i])
}
}
console.log(saves, validSaves)
if (validSaves.length == 0)
return undefined;
return validSaves.map(f => f[1]);
}
getSaves(log?: boolean, dailyOnly?: boolean): SessionSaveData[] { getSaves(log?: boolean, dailyOnly?: boolean): SessionSaveData[] {
var saves: Array<Array<any>> = []; var saves: Array<Array<any>> = [];
for (var i = 0; i < 5; i++) { for (var i = 0; i < 5; i++) {
@ -549,10 +579,32 @@ export class TitlePhase extends Phase {
// Replaces 'Continue' with all Daily Run saves, sorted by when they last saved // Replaces 'Continue' with all Daily Run saves, sorted by when they last saved
// If there are no daily runs, it instead shows the most recently saved run // If there are no daily runs, it instead shows the most recently saved run
// If this fails too, there are no saves, and the option does not appear // If this fails too, there are no saves, and the option does not appear
var lastsaves = this.getSaves(false, true); var lastsaves = this.getSaves(false, true); // Gets all Daily Runs sorted by last play time
//lastsaves = this.getSavesUnsorted() var lastsave = this.getLastSave(); // Gets the last save you played
if (lastsaves != undefined && lastsaves.length > 0) { var ls1 = this.getLastSave(false, true)
lastsaves.forEach(lastsave => { var ls2 = this.getLastSavesOfEach()
switch (true) {
case (this.scene.quickloadDisplayMode == "Daily" && this.getLastSave(false, true) != undefined):
options.push({
label: (ls1.description ? ls1.description : "[???]"),
handler: () => {
this.loadSaveSlot(ls1.slot);
return true;
}
})
break;
case this.scene.quickloadDisplayMode == "Dailies" && this.getLastSave(false, true) != undefined:
lastsaves.forEach(lastsave1 => {
options.push({
label: (lastsave1.description ? lastsave1.description : "[???]"),
handler: () => {
this.loadSaveSlot(lastsave1.slot);
return true;
}
})
})
break;
case lastsave != undefined && (this.scene.quickloadDisplayMode == "Latest" || ((this.scene.quickloadDisplayMode == "Daily" || this.scene.quickloadDisplayMode == "Dailies") && this.getLastSave(false, true) == undefined)):
options.push({ options.push({
label: (lastsave.description ? lastsave.description : "[???]"), label: (lastsave.description ? lastsave.description : "[???]"),
handler: () => { handler: () => {
@ -560,20 +612,19 @@ export class TitlePhase extends Phase {
return true; return true;
} }
}) })
}) break;
} else { case this.scene.quickloadDisplayMode == "Both" && ls2 != undefined:
var lastsave = this.getLastSave(false); ls2.forEach(lastsave2 => {
if (lastsave != undefined) { options.push({
options.push({ label: (lastsave2.description ? lastsave2.description : "[???]"),
label: (lastsave.description ? lastsave.description : "[???]"), handler: () => {
handler: () => { this.loadSaveSlot(lastsave2.slot);
this.loadSaveSlot(lastsave.slot); return true;
return true; }
} })
}) })
} else { break;
console.log("Failed to get last save") default: // If set to "Off" or all above conditions failed
this.getLastSave(true)
if (loggedInUser.lastSessionSlot > -1) { if (loggedInUser.lastSessionSlot > -1) {
options.push({ options.push({
label: i18next.t("continue", null, { ns: "menu"}), label: i18next.t("continue", null, { ns: "menu"}),
@ -583,7 +634,7 @@ export class TitlePhase extends Phase {
} }
}); });
} }
} break;
} }
options.push({ options.push({
label: i18next.t("menu:newGame"), label: i18next.t("menu:newGame"),

View File

@ -105,8 +105,7 @@ export const SettingKeys = {
ShowAutosaves: "SHOW_AUTOSAVES", ShowAutosaves: "SHOW_AUTOSAVES",
TitleScreenContinueMode: "TITLE_SCREEN_QUICKLOAD", TitleScreenContinueMode: "TITLE_SCREEN_QUICKLOAD",
BiomePanels: "BIOME_PANELS", BiomePanels: "BIOME_PANELS",
DailyShinyLuck: "DAILY_LUCK", DailyShinyLuck: "DAILY_LUCK"
QuickloadDisplay: "QUICKLOAD_MODE"
}; };
/** /**
@ -214,7 +213,7 @@ export const Setting: Array<Setting> = [
label: "Both", label: "Both",
value: "Both" // Shows the last run and the last Daily Run, or only the last played game if it is a Daily Run value: "Both" // Shows the last run and the last Daily Run, or only the last played game if it is a Daily Run
}], }],
default: 2, default: 1,
type: SettingType.GENERAL, type: SettingType.GENERAL,
}, },
{ {
@ -722,7 +721,7 @@ export function setSetting(scene: BattleScene, setting: string, value: integer):
scene.doBiomePanels = Setting[index].options[value].value == "On" scene.doBiomePanels = Setting[index].options[value].value == "On"
case SettingKeys.DailyShinyLuck: case SettingKeys.DailyShinyLuck:
scene.disableDailyShinies = Setting[index].options[value].value == "Off" scene.disableDailyShinies = Setting[index].options[value].value == "Off"
case SettingKeys.QuickloadDisplay: case SettingKeys.TitleScreenContinueMode:
scene.quickloadDisplayMode = Setting[index].options[value].value; scene.quickloadDisplayMode = Setting[index].options[value].value;
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";