mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-26 17:29:30 +02:00
parent
5afbedd27e
commit
1b8d44956e
@ -888,7 +888,7 @@ export interface PokeData {
|
|||||||
*/
|
*/
|
||||||
export function exportPokemon(pokemon: Pokemon, encounterRarity?: string): PokeData {
|
export function exportPokemon(pokemon: Pokemon, encounterRarity?: string): PokeData {
|
||||||
return {
|
return {
|
||||||
id: Utils.getEnumValues(Species).indexOf(pokemon.species.speciesId),
|
id: pokemon.species.speciesId,
|
||||||
name: pokemon.species.getName(),
|
name: pokemon.species.getName(),
|
||||||
ability: pokemon.getAbility().name,
|
ability: pokemon.getAbility().name,
|
||||||
isHiddenAbility: pokemon.hasAbility(pokemon.species.abilityHidden),
|
isHiddenAbility: pokemon.hasAbility(pokemon.species.abilityHidden),
|
||||||
@ -1388,51 +1388,6 @@ export function generateEditHandler(scene: BattleScene, logId: string, callback:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Generates a UI option to save a log to your device.
|
|
||||||
* @param i The slot number. Corresponds to an index in `logs`.
|
|
||||||
* @param saves Your session data. Used to label logs if they match one of your save slots.
|
|
||||||
* @returns A UI option.
|
|
||||||
*/
|
|
||||||
export function generateEditHandlerForLog(scene: BattleScene, i: integer, callback: Function) {
|
|
||||||
return (): boolean => {
|
|
||||||
rarityslot[1] = logs[i][1]
|
|
||||||
//scene.phaseQueue[0].end()
|
|
||||||
scene.ui.setMode(Mode.NAME_LOG, {
|
|
||||||
autofillfields: [
|
|
||||||
(JSON.parse(localStorage.getItem(logs[i][1])) as DRPD).title,
|
|
||||||
(JSON.parse(localStorage.getItem(logs[i][1])) as DRPD).authors.join(", "),
|
|
||||||
(JSON.parse(localStorage.getItem(logs[i][1])) as DRPD).label,
|
|
||||||
],
|
|
||||||
buttonActions: [
|
|
||||||
() => {
|
|
||||||
console.log("Rename")
|
|
||||||
scene.ui.playSelect();
|
|
||||||
callback()
|
|
||||||
},
|
|
||||||
() => {
|
|
||||||
console.log("Export")
|
|
||||||
scene.ui.playSelect();
|
|
||||||
downloadLogByID(i)
|
|
||||||
callback()
|
|
||||||
},
|
|
||||||
() => {
|
|
||||||
console.log("Export to Sheets")
|
|
||||||
scene.ui.playSelect();
|
|
||||||
downloadLogByIDToSheet(i)
|
|
||||||
callback()
|
|
||||||
},
|
|
||||||
() => {
|
|
||||||
console.log("Delete")
|
|
||||||
scene.ui.playSelect();
|
|
||||||
localStorage.removeItem(logs[i][1])
|
|
||||||
callback()
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
@ -702,20 +702,19 @@ export class TitlePhase extends Phase {
|
|||||||
label: "Manage Logs",
|
label: "Manage Logs",
|
||||||
handler: () => {
|
handler: () => {
|
||||||
this.scene.biomeChangeMode = false
|
this.scene.biomeChangeMode = false
|
||||||
//return this.logRenameMenu()
|
return this.logRenameMenu()
|
||||||
//
|
/*
|
||||||
this.scene.ui.setOverlayMode(Mode.LOG_HANDLER,
|
this.scene.ui.setOverlayMode(Mode.LOG_HANDLER,
|
||||||
(k: string) => {
|
(k: string) => {
|
||||||
if (k === undefined) {
|
if (k === undefined) {
|
||||||
return this.showOptions();
|
return this.showOptions();
|
||||||
}
|
}
|
||||||
console.log(k)
|
console.log(k)
|
||||||
this.showOptions();
|
|
||||||
}, () => {
|
}, () => {
|
||||||
this.showOptions();
|
this.showOptions();
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
//
|
*/
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
options.push({
|
options.push({
|
||||||
|
@ -54,23 +54,22 @@ export default class LogNameFormUiHandler extends FormModalUiHandler {
|
|||||||
//const label = addTextObject(this.scene, 10, 87, "Clicking Export or ExSheets does NOT save any text you entered\nPress \"Rename\", then reopen this menu and click Export", TextStyle.TOOLTIP_CONTENT, { fontSize: "42px" });
|
//const label = addTextObject(this.scene, 10, 87, "Clicking Export or ExSheets does NOT save any text you entered\nPress \"Rename\", then reopen this menu and click Export", TextStyle.TOOLTIP_CONTENT, { fontSize: "42px" });
|
||||||
//this.modalContainer.add(label);
|
//this.modalContainer.add(label);
|
||||||
|
|
||||||
this.inputs[0].maxLength = 99;
|
this.inputs[0].maxLength = 99
|
||||||
this.inputs[1].maxLength = 200;
|
this.inputs[1].maxLength = 200
|
||||||
}
|
}
|
||||||
|
|
||||||
show(args: any[]): boolean {
|
show(args: any[]): boolean {
|
||||||
console.log(args)
|
this.name = args[0].autofillfields[0]
|
||||||
this.name = args[0].autofillfields[0];
|
|
||||||
if (super.show(args)) {
|
if (super.show(args)) {
|
||||||
const config = args[0] as ModalConfig;
|
const config = args[0] as ModalConfig;
|
||||||
console.log("Shown", args);
|
console.log("Shown", args)
|
||||||
|
|
||||||
const originalLoginAction = this.submitAction;
|
const originalLoginAction = this.submitAction;
|
||||||
this.inputs[0].setText(args[0].autofillfields[0]);
|
this.inputs[0].setText(args[0].autofillfields[0])
|
||||||
this.inputs[1].setText(args[0].autofillfields[1]);
|
this.inputs[1].setText(args[0].autofillfields[1])
|
||||||
this.inputs[2].setText(args[0].autofillfields[2]);
|
this.inputs[2].setText(args[0].autofillfields[2])
|
||||||
this.submitAction = (_) => {
|
this.submitAction = (_) => {
|
||||||
console.log("submitAction");
|
console.log("submitAction")
|
||||||
// Prevent overlapping overrides on action modification
|
// Prevent overlapping overrides on action modification
|
||||||
this.submitAction = originalLoginAction;
|
this.submitAction = originalLoginAction;
|
||||||
this.sanitizeInputs();
|
this.sanitizeInputs();
|
||||||
@ -82,21 +81,21 @@ export default class LogNameFormUiHandler extends FormModalUiHandler {
|
|||||||
if (!this.inputs[0].text) {
|
if (!this.inputs[0].text) {
|
||||||
//return onFail(i18next.t("menu:emptyUsername"));
|
//return onFail(i18next.t("menu:emptyUsername"));
|
||||||
}
|
}
|
||||||
console.log(`Calling LoggerTools.setFileInfo(${this.inputs[0].text}, ${this.inputs[1].text.split(",")})`);
|
console.log(`Calling LoggerTools.setFileInfo(${this.inputs[0].text}, ${this.inputs[1].text.split(",")})`)
|
||||||
LoggerTools.setFileInfo(this.inputs[0].text, this.inputs[1].text.split(","));
|
LoggerTools.setFileInfo(this.inputs[0].text, this.inputs[1].text.split(","))
|
||||||
console.log("Calling originalLoginAction()");
|
console.log(`Calling originalLoginAction()`)
|
||||||
originalLoginAction();
|
originalLoginAction()
|
||||||
};
|
};
|
||||||
const exportaction1 = config.buttonActions[1];
|
const exportaction1 = config.buttonActions[1]
|
||||||
config.buttonActions[1] = (_) => {
|
config.buttonActions[1] = (_) => {
|
||||||
LoggerTools.setFileInfo(this.inputs[0].text, this.inputs[1].text.split(","));
|
LoggerTools.setFileInfo(this.inputs[0].text, this.inputs[1].text.split(","))
|
||||||
exportaction1();
|
exportaction1()
|
||||||
};
|
}
|
||||||
const exportaction2 = config.buttonActions[2];
|
const exportaction2 = config.buttonActions[2]
|
||||||
config.buttonActions[2] = (_) => {
|
config.buttonActions[2] = (_) => {
|
||||||
LoggerTools.setFileInfo(this.inputs[0].text, this.inputs[1].text.split(","));
|
LoggerTools.setFileInfo(this.inputs[0].text, this.inputs[1].text.split(","))
|
||||||
exportaction2();
|
exportaction2()
|
||||||
};
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -15,10 +15,9 @@ import { loggedInUser } from "#app/account.js";
|
|||||||
import { allpanels, biomePanelIDs } from "../loading-scene"
|
import { allpanels, biomePanelIDs } from "../loading-scene"
|
||||||
import { getBiomeName } from "#app/data/biomes.js";
|
import { getBiomeName } from "#app/data/biomes.js";
|
||||||
import { Species } from "#app/enums/species.js";
|
import { Species } from "#app/enums/species.js";
|
||||||
import { allSpecies, getPokemonSpecies, getPokemonSpeciesForm } from "#app/data/pokemon-species.js";
|
import { getPokemonSpecies, getPokemonSpeciesForm } from "#app/data/pokemon-species.js";
|
||||||
|
|
||||||
const sessionSlotCount = 5;
|
const sessionSlotCount = 5;
|
||||||
const gap = 20;
|
|
||||||
|
|
||||||
export type LogSelectCallback = (key: string) => void;
|
export type LogSelectCallback = (key: string) => void;
|
||||||
|
|
||||||
@ -31,7 +30,6 @@ export default class LogSelectUiHandler extends MessageUiHandler {
|
|||||||
private sessionSlots: SessionSlot[];
|
private sessionSlots: SessionSlot[];
|
||||||
|
|
||||||
private selectCallback: LogSelectCallback;
|
private selectCallback: LogSelectCallback;
|
||||||
private quitCallback: LogSelectCallback;
|
|
||||||
|
|
||||||
private scrollCursor: integer = 0;
|
private scrollCursor: integer = 0;
|
||||||
|
|
||||||
@ -39,8 +37,6 @@ export default class LogSelectUiHandler extends MessageUiHandler {
|
|||||||
|
|
||||||
private sessionSlotsContainerInitialY: number;
|
private sessionSlotsContainerInitialY: number;
|
||||||
|
|
||||||
private extrasLabel: Phaser.GameObjects.Text
|
|
||||||
|
|
||||||
constructor(scene: BattleScene) {
|
constructor(scene: BattleScene) {
|
||||||
super(scene, Mode.LOG_HANDLER);
|
super(scene, Mode.LOG_HANDLER);
|
||||||
}
|
}
|
||||||
@ -73,10 +69,6 @@ export default class LogSelectUiHandler extends MessageUiHandler {
|
|||||||
this.message.setOrigin(0, 0);
|
this.message.setOrigin(0, 0);
|
||||||
this.saveSlotSelectMessageBoxContainer.add(this.message);
|
this.saveSlotSelectMessageBoxContainer.add(this.message);
|
||||||
|
|
||||||
this.extrasLabel = addTextObject(this.scene, 40, 56 * 5 + 5, "Other Files", TextStyle.WINDOW);
|
|
||||||
this.extrasLabel.setAlign("center");
|
|
||||||
this.sessionSlotsContainer.add(this.extrasLabel);
|
|
||||||
|
|
||||||
this.sessionSlots = [];
|
this.sessionSlots = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,9 +80,6 @@ export default class LogSelectUiHandler extends MessageUiHandler {
|
|||||||
super.show(args);
|
super.show(args);
|
||||||
|
|
||||||
this.selectCallback = args[0] as LogSelectCallback;
|
this.selectCallback = args[0] as LogSelectCallback;
|
||||||
this.quitCallback = args[1] as LogSelectCallback;
|
|
||||||
|
|
||||||
console.log(this.selectCallback)
|
|
||||||
|
|
||||||
this.saveSlotSelectContainer.setVisible(true);
|
this.saveSlotSelectContainer.setVisible(true);
|
||||||
this.populateSessionSlots();
|
this.populateSessionSlots();
|
||||||
@ -106,19 +95,18 @@ export default class LogSelectUiHandler extends MessageUiHandler {
|
|||||||
let success = false;
|
let success = false;
|
||||||
let error = false;
|
let error = false;
|
||||||
|
|
||||||
if (button === Button.ACTION) {
|
if (button === Button.ACTION || button === Button.CANCEL) {
|
||||||
const originalCallback = this.selectCallback;
|
const originalCallback = this.selectCallback;
|
||||||
const cursor = this.cursor + this.scrollCursor;
|
if (button === Button.ACTION) {
|
||||||
var k = this.sessionSlots[cursor].key
|
const cursor = this.cursor + this.scrollCursor;
|
||||||
var file = JSON.parse(localStorage.getItem(k)) as LoggerTools.DRPD;
|
|
||||||
console.log(k, file)
|
|
||||||
LoggerTools.generateEditHandlerForLog(this.scene, this.sessionSlots[cursor].logIndex, () => {
|
|
||||||
this.selectCallback = null;
|
this.selectCallback = null;
|
||||||
originalCallback(k)
|
originalCallback(this.sessionSlots[cursor].key);
|
||||||
})()
|
success = true;
|
||||||
success = true;
|
} else {
|
||||||
} else if (button === Button.CANCEL) {
|
this.selectCallback = null;
|
||||||
this.quitCallback(undefined);
|
originalCallback(undefined);
|
||||||
|
success = true;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (button) {
|
switch (button) {
|
||||||
case Button.UP:
|
case Button.UP:
|
||||||
@ -159,7 +147,6 @@ export default class LogSelectUiHandler extends MessageUiHandler {
|
|||||||
const sessionSlot = new SessionSlot(this.scene, s, ypos);
|
const sessionSlot = new SessionSlot(this.scene, s, ypos);
|
||||||
ypos++
|
ypos++
|
||||||
sessionSlot.load(LoggerTools.logs[i][1]);
|
sessionSlot.load(LoggerTools.logs[i][1]);
|
||||||
sessionSlot.logIndex = i
|
|
||||||
this.scene.add.existing(sessionSlot);
|
this.scene.add.existing(sessionSlot);
|
||||||
this.sessionSlotsContainer.add(sessionSlot);
|
this.sessionSlotsContainer.add(sessionSlot);
|
||||||
this.sessionSlots.push(sessionSlot);
|
this.sessionSlots.push(sessionSlot);
|
||||||
@ -167,11 +154,11 @@ export default class LogSelectUiHandler extends MessageUiHandler {
|
|||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
const sessionSlot = new SessionSlot(this.scene, s, ypos);
|
const sessionSlot = new SessionSlot(this.scene, s, ypos);
|
||||||
ypos++
|
ypos++
|
||||||
sessionSlot.load(undefined);
|
sessionSlot.load(undefined);
|
||||||
this.scene.add.existing(sessionSlot);
|
this.scene.add.existing(sessionSlot);
|
||||||
this.sessionSlotsContainer.add(sessionSlot);
|
this.sessionSlotsContainer.add(sessionSlot);
|
||||||
this.sessionSlots.push(sessionSlot);
|
this.sessionSlots.push(sessionSlot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (var i = 0; i < LoggerTools.logs.length; i++) {
|
for (var i = 0; i < LoggerTools.logs.length; i++) {
|
||||||
@ -179,7 +166,6 @@ export default class LogSelectUiHandler extends MessageUiHandler {
|
|||||||
const sessionSlot = new SessionSlot(this.scene, undefined, ypos);
|
const sessionSlot = new SessionSlot(this.scene, undefined, ypos);
|
||||||
ypos++
|
ypos++
|
||||||
sessionSlot.load(LoggerTools.logs[i][1]);
|
sessionSlot.load(LoggerTools.logs[i][1]);
|
||||||
sessionSlot.logIndex = i
|
|
||||||
this.scene.add.existing(sessionSlot);
|
this.scene.add.existing(sessionSlot);
|
||||||
this.sessionSlotsContainer.add(sessionSlot);
|
this.sessionSlotsContainer.add(sessionSlot);
|
||||||
this.sessionSlots.push(sessionSlot);
|
this.sessionSlots.push(sessionSlot);
|
||||||
@ -209,7 +195,7 @@ export default class LogSelectUiHandler extends MessageUiHandler {
|
|||||||
this.cursorObj.setOrigin(0, 0);
|
this.cursorObj.setOrigin(0, 0);
|
||||||
this.sessionSlotsContainer.add(this.cursorObj);
|
this.sessionSlotsContainer.add(this.cursorObj);
|
||||||
}
|
}
|
||||||
this.cursorObj.setPosition(4, 4 + (cursor + this.scrollCursor) * 56 + ((cursor + this.scrollCursor) > 4 ? gap : 0));
|
this.cursorObj.setPosition(4, 4 + (cursor + this.scrollCursor) * 56);
|
||||||
|
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
@ -222,7 +208,7 @@ export default class LogSelectUiHandler extends MessageUiHandler {
|
|||||||
this.setCursor(this.cursor);
|
this.setCursor(this.cursor);
|
||||||
this.scene.tweens.add({
|
this.scene.tweens.add({
|
||||||
targets: this.sessionSlotsContainer,
|
targets: this.sessionSlotsContainer,
|
||||||
y: this.sessionSlotsContainerInitialY - 56 * scrollCursor - ((this.cursor + this.scrollCursor) > 4 ? gap : 0),
|
y: this.sessionSlotsContainerInitialY - 56 * scrollCursor,
|
||||||
duration: Utils.fixedInt(325),
|
duration: Utils.fixedInt(325),
|
||||||
ease: "Sine.easeInOut"
|
ease: "Sine.easeInOut"
|
||||||
});
|
});
|
||||||
@ -259,10 +245,9 @@ class SessionSlot extends Phaser.GameObjects.Container {
|
|||||||
public wv: integer;
|
public wv: integer;
|
||||||
public key: string;
|
public key: string;
|
||||||
private loadingLabel: Phaser.GameObjects.Text;
|
private loadingLabel: Phaser.GameObjects.Text;
|
||||||
public logIndex: integer;
|
|
||||||
|
|
||||||
constructor(scene: BattleScene, slotId: integer = undefined, ypos: integer, autoSlot?: integer) {
|
constructor(scene: BattleScene, slotId: integer = undefined, ypos: integer, autoSlot?: integer) {
|
||||||
super(scene, 0, ypos * 56 + (ypos > 4 ? gap : 0));
|
super(scene, 0, ypos * 56);
|
||||||
|
|
||||||
this.slotId = slotId;
|
this.slotId = slotId;
|
||||||
this.autoSlot = autoSlot
|
this.autoSlot = autoSlot
|
||||||
@ -284,7 +269,7 @@ class SessionSlot extends Phaser.GameObjects.Container {
|
|||||||
var lbl = `???`
|
var lbl = `???`
|
||||||
lbl = data.title
|
lbl = data.title
|
||||||
if (this.slotId) {
|
if (this.slotId) {
|
||||||
lbl = `[${this.slotId + 1}] ${lbl}`
|
lbl = `[${this.slotId}] ${lbl}`
|
||||||
}
|
}
|
||||||
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);
|
||||||
@ -293,14 +278,9 @@ class SessionSlot extends Phaser.GameObjects.Container {
|
|||||||
const timestampLabel = addTextObject(this.scene, 8, 19, data.date, TextStyle.WINDOW);
|
const timestampLabel = addTextObject(this.scene, 8, 19, data.date, TextStyle.WINDOW);
|
||||||
this.add(timestampLabel);
|
this.add(timestampLabel);
|
||||||
|
|
||||||
const playTimeLabel = addTextObject(this.scene, 8, 33, data.version + " / Path: " + (data.label || ""), TextStyle.WINDOW);
|
const playTimeLabel = addTextObject(this.scene, 8, 33, data.version + " / " + (data.label || "") + " / " + (data.uuid || ""), TextStyle.WINDOW);
|
||||||
this.add(playTimeLabel);
|
this.add(playTimeLabel);
|
||||||
|
|
||||||
if (data.starters[0] == null) {
|
|
||||||
const timestampLabel = addTextObject(this.scene, 144, 10, "No Starter data", TextStyle.WINDOW);
|
|
||||||
this.add(timestampLabel);
|
|
||||||
}
|
|
||||||
|
|
||||||
const pokemonIconsContainer = this.scene.add.container(144, 4);
|
const pokemonIconsContainer = this.scene.add.container(144, 4);
|
||||||
if (false || data.starters)
|
if (false || data.starters)
|
||||||
data.starters.forEach((p: LoggerTools.PokeData, i: integer) => {
|
data.starters.forEach((p: LoggerTools.PokeData, i: integer) => {
|
||||||
@ -308,17 +288,16 @@ class SessionSlot extends Phaser.GameObjects.Container {
|
|||||||
return;
|
return;
|
||||||
const iconContainer = this.scene.add.container(26 * i, 0);
|
const iconContainer = this.scene.add.container(26 * i, 0);
|
||||||
iconContainer.setScale(0.75);
|
iconContainer.setScale(0.75);
|
||||||
console.log(p.id, Utils.getEnumKeys(Species)[Utils.getEnumValues(Species).indexOf(p.id)])
|
|
||||||
|
|
||||||
//if (Utils.getEnumValues(Species)[p.id] == undefined)
|
if (Utils.getEnumValues(Species)[p.id] == undefined)
|
||||||
//return;
|
return;
|
||||||
|
|
||||||
//if (getPokemonSpecies(Utils.getEnumValues(Species)[p.id]) == undefined)
|
if (getPokemonSpecies(Utils.getEnumValues(Species)[p.id]) == undefined)
|
||||||
//return;
|
return;
|
||||||
|
|
||||||
const icon = this.scene.addPkIcon(allSpecies[Utils.getEnumValues(Species).indexOf(p.id)], 0, 0, 0, 0, 0);
|
const icon = this.scene.addPkIcon(getPokemonSpecies(Utils.getEnumValues(Species)[p.id]), 0, 0, 0, 0, 0);
|
||||||
|
|
||||||
const text = addTextObject(this.scene, 32, 20, ``, TextStyle.PARTY, { fontSize: "54px", color: "#f8f8f8" });
|
const text = addTextObject(this.scene, 32, 20, `${i18next.t("saveSlotSelectUiHandler:lv")}${Utils.formatLargeNumber(p.level, 1000)}`, TextStyle.PARTY, { fontSize: "54px", color: "#f8f8f8" });
|
||||||
text.setShadow(0, 0, null);
|
text.setShadow(0, 0, null);
|
||||||
text.setStroke("#424242", 14);
|
text.setStroke("#424242", 14);
|
||||||
text.setOrigin(1, 0);
|
text.setOrigin(1, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user