mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-26 17:29:30 +02:00
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:
parent
ff40f56992
commit
e93b84cef5
@ -229,6 +229,7 @@ export default class Trainer extends Phaser.GameObjects.Container {
|
||||
let title = true && this.config.title ? this.config.title : null;
|
||||
|
||||
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
|
||||
title = i18next.t(`trainerClasses:${name.toLowerCase().replace(/\s/g, "_")}`);
|
||||
console.log("Localized grunt name: " + title);
|
||||
|
@ -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>> = [];
|
||||
for (var i = 0; i < 5; i++) {
|
||||
var s = parseSlotData(i);
|
||||
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]);
|
||||
}
|
||||
}
|
||||
@ -419,6 +419,36 @@ export class TitlePhase extends Phase {
|
||||
if (saves[0] == undefined) return undefined;
|
||||
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[] {
|
||||
var saves: Array<Array<any>> = [];
|
||||
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
|
||||
// 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
|
||||
var lastsaves = this.getSaves(false, true);
|
||||
//lastsaves = this.getSavesUnsorted()
|
||||
if (lastsaves != undefined && lastsaves.length > 0) {
|
||||
lastsaves.forEach(lastsave => {
|
||||
var lastsaves = this.getSaves(false, true); // Gets all Daily Runs sorted by last play time
|
||||
var lastsave = this.getLastSave(); // Gets the last save you played
|
||||
var ls1 = this.getLastSave(false, true)
|
||||
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({
|
||||
label: (lastsave.description ? lastsave.description : "[???]"),
|
||||
handler: () => {
|
||||
@ -560,20 +612,19 @@ export class TitlePhase extends Phase {
|
||||
return true;
|
||||
}
|
||||
})
|
||||
})
|
||||
} else {
|
||||
var lastsave = this.getLastSave(false);
|
||||
if (lastsave != undefined) {
|
||||
options.push({
|
||||
label: (lastsave.description ? lastsave.description : "[???]"),
|
||||
handler: () => {
|
||||
this.loadSaveSlot(lastsave.slot);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case this.scene.quickloadDisplayMode == "Both" && ls2 != undefined:
|
||||
ls2.forEach(lastsave2 => {
|
||||
options.push({
|
||||
label: (lastsave2.description ? lastsave2.description : "[???]"),
|
||||
handler: () => {
|
||||
this.loadSaveSlot(lastsave2.slot);
|
||||
return true;
|
||||
}
|
||||
})
|
||||
})
|
||||
} else {
|
||||
console.log("Failed to get last save")
|
||||
this.getLastSave(true)
|
||||
break;
|
||||
default: // If set to "Off" or all above conditions failed
|
||||
if (loggedInUser.lastSessionSlot > -1) {
|
||||
options.push({
|
||||
label: i18next.t("continue", null, { ns: "menu"}),
|
||||
@ -583,7 +634,7 @@ export class TitlePhase extends Phase {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
options.push({
|
||||
label: i18next.t("menu:newGame"),
|
||||
|
@ -105,8 +105,7 @@ export const SettingKeys = {
|
||||
ShowAutosaves: "SHOW_AUTOSAVES",
|
||||
TitleScreenContinueMode: "TITLE_SCREEN_QUICKLOAD",
|
||||
BiomePanels: "BIOME_PANELS",
|
||||
DailyShinyLuck: "DAILY_LUCK",
|
||||
QuickloadDisplay: "QUICKLOAD_MODE"
|
||||
DailyShinyLuck: "DAILY_LUCK"
|
||||
};
|
||||
|
||||
/**
|
||||
@ -214,7 +213,7 @@ export const Setting: Array<Setting> = [
|
||||
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
|
||||
}],
|
||||
default: 2,
|
||||
default: 1,
|
||||
type: SettingType.GENERAL,
|
||||
},
|
||||
{
|
||||
@ -722,7 +721,7 @@ export function setSetting(scene: BattleScene, setting: string, value: integer):
|
||||
scene.doBiomePanels = Setting[index].options[value].value == "On"
|
||||
case SettingKeys.DailyShinyLuck:
|
||||
scene.disableDailyShinies = Setting[index].options[value].value == "Off"
|
||||
case SettingKeys.QuickloadDisplay:
|
||||
case SettingKeys.TitleScreenContinueMode:
|
||||
scene.quickloadDisplayMode = Setting[index].options[value].value;
|
||||
case SettingKeys.Skip_Seen_Dialogues:
|
||||
scene.skipSeenDialogues = Setting[index].options[value].value === "On";
|
||||
|
Loading…
Reference in New Issue
Block a user