Fix money text hidden in select modifiers

This commit is contained in:
Matthew Olker 2024-05-30 11:27:17 -04:00
parent cbca0983f3
commit c822a89878
3 changed files with 34 additions and 2 deletions

View File

@ -300,6 +300,7 @@ export default class BattleScene extends SceneBase {
this.field = field; this.field = field;
const fieldUI = this.add.container(0, this.game.canvas.height); const fieldUI = this.add.container(0, this.game.canvas.height);
fieldUI.setName("container-field-ui");
fieldUI.setDepth(1); fieldUI.setDepth(1);
fieldUI.setScale(6); fieldUI.setScale(6);
@ -323,6 +324,7 @@ export default class BattleScene extends SceneBase {
this.add.existing(transition); this.add.existing(transition);
const uiContainer = this.add.container(0, 0); const uiContainer = this.add.container(0, 0);
uiContainer.setName("container-ui");
uiContainer.setDepth(2); uiContainer.setDepth(2);
uiContainer.setScale(6); uiContainer.setScale(6);
@ -331,6 +333,7 @@ export default class BattleScene extends SceneBase {
const overlayWidth = this.game.canvas.width / 6; const overlayWidth = this.game.canvas.width / 6;
const overlayHeight = (this.game.canvas.height / 6) - 48; const overlayHeight = (this.game.canvas.height / 6) - 48;
this.fieldOverlay = this.add.rectangle(0, overlayHeight * -1 - 48, overlayWidth, overlayHeight, 0x424242); this.fieldOverlay = this.add.rectangle(0, overlayHeight * -1 - 48, overlayWidth, overlayHeight, 0x424242);
this.fieldOverlay.setName("rect-field-overlay");
this.fieldOverlay.setOrigin(0, 0); this.fieldOverlay.setOrigin(0, 0);
this.fieldOverlay.setAlpha(0); this.fieldOverlay.setAlpha(0);
this.fieldUI.add(this.fieldOverlay); this.fieldUI.add(this.fieldOverlay);
@ -339,57 +342,70 @@ export default class BattleScene extends SceneBase {
this.enemyModifiers = []; this.enemyModifiers = [];
this.modifierBar = new ModifierBar(this); this.modifierBar = new ModifierBar(this);
this.modifierBar.setName("container-modifier-bar");
this.add.existing(this.modifierBar); this.add.existing(this.modifierBar);
uiContainer.add(this.modifierBar); uiContainer.add(this.modifierBar);
this.enemyModifierBar = new ModifierBar(this, true); this.enemyModifierBar = new ModifierBar(this, true);
this.enemyModifierBar.setName("container-enemy-modifier-bar");
this.add.existing(this.enemyModifierBar); this.add.existing(this.enemyModifierBar);
uiContainer.add(this.enemyModifierBar); uiContainer.add(this.enemyModifierBar);
this.charSprite = new CharSprite(this); this.charSprite = new CharSprite(this);
this.charSprite.setName("sprite-char");
this.charSprite.setup(); this.charSprite.setup();
this.fieldUI.add(this.charSprite); this.fieldUI.add(this.charSprite);
this.pbTray = new PokeballTray(this, true); this.pbTray = new PokeballTray(this, true);
this.pbTray.setName("container-pb-tray");
this.pbTray.setup(); this.pbTray.setup();
this.pbTrayEnemy = new PokeballTray(this, false); this.pbTrayEnemy = new PokeballTray(this, false);
this.pbTrayEnemy.setName("container-enemy-pb-tray");
this.pbTrayEnemy.setup(); this.pbTrayEnemy.setup();
this.fieldUI.add(this.pbTray); this.fieldUI.add(this.pbTray);
this.fieldUI.add(this.pbTrayEnemy); this.fieldUI.add(this.pbTrayEnemy);
this.abilityBar = new AbilityBar(this); this.abilityBar = new AbilityBar(this);
this.abilityBar.setName("container-ability-bar");
this.abilityBar.setup(); this.abilityBar.setup();
this.fieldUI.add(this.abilityBar); this.fieldUI.add(this.abilityBar);
this.partyExpBar = new PartyExpBar(this); this.partyExpBar = new PartyExpBar(this);
this.partyExpBar.setName("container-party-exp-bar");
this.partyExpBar.setup(); this.partyExpBar.setup();
this.fieldUI.add(this.partyExpBar); this.fieldUI.add(this.partyExpBar);
this.candyBar = new CandyBar(this); this.candyBar = new CandyBar(this);
this.candyBar.setName("container-candy-bar");
this.candyBar.setup(); this.candyBar.setup();
this.fieldUI.add(this.candyBar); this.fieldUI.add(this.candyBar);
this.biomeWaveText = addTextObject(this, (this.game.canvas.width / 6) - 2, 0, startingWave.toString(), TextStyle.BATTLE_INFO); this.biomeWaveText = addTextObject(this, (this.game.canvas.width / 6) - 2, 0, startingWave.toString(), TextStyle.BATTLE_INFO);
this.biomeWaveText.setName("text-biome-wave");
this.biomeWaveText.setOrigin(1, 0); this.biomeWaveText.setOrigin(1, 0);
this.fieldUI.add(this.biomeWaveText); this.fieldUI.add(this.biomeWaveText);
this.moneyText = addTextObject(this, (this.game.canvas.width / 6) - 2, 0, "", TextStyle.MONEY); this.moneyText = addTextObject(this, (this.game.canvas.width / 6) - 2, 0, "", TextStyle.MONEY);
this.moneyText.setName("text-money");
this.moneyText.setOrigin(1, 0); this.moneyText.setOrigin(1, 0);
this.fieldUI.add(this.moneyText); this.fieldUI.add(this.moneyText);
this.scoreText = addTextObject(this, (this.game.canvas.width / 6) - 2, 0, "", TextStyle.PARTY, { fontSize: "54px" }); this.scoreText = addTextObject(this, (this.game.canvas.width / 6) - 2, 0, "", TextStyle.PARTY, { fontSize: "54px" });
this.scoreText.setName("text-score");
this.scoreText.setOrigin(1, 0); this.scoreText.setOrigin(1, 0);
this.fieldUI.add(this.scoreText); this.fieldUI.add(this.scoreText);
this.luckText = addTextObject(this, (this.game.canvas.width / 6) - 2, 0, "", TextStyle.PARTY, { fontSize: "54px" }); this.luckText = addTextObject(this, (this.game.canvas.width / 6) - 2, 0, "", TextStyle.PARTY, { fontSize: "54px" });
this.luckText.setName("text-luck");
this.luckText.setOrigin(1, 0); this.luckText.setOrigin(1, 0);
this.luckText.setVisible(false); this.luckText.setVisible(false);
this.fieldUI.add(this.luckText); this.fieldUI.add(this.luckText);
this.luckLabelText = addTextObject(this, (this.game.canvas.width / 6) - 2, 0, "Luck:", TextStyle.PARTY, { fontSize: "54px" }); this.luckLabelText = addTextObject(this, (this.game.canvas.width / 6) - 2, 0, "Luck:", TextStyle.PARTY, { fontSize: "54px" });
this.luckLabelText.setName("text-luck-label");
this.luckLabelText.setOrigin(1, 0); this.luckLabelText.setOrigin(1, 0);
this.luckLabelText.setVisible(false); this.luckLabelText.setVisible(false);
this.fieldUI.add(this.luckLabelText); this.fieldUI.add(this.luckLabelText);
@ -1305,7 +1321,8 @@ export default class BattleScene extends SceneBase {
this.scoreText.setVisible(this.gameMode.isDaily); this.scoreText.setVisible(this.gameMode.isDaily);
} }
updateAndShowLuckText(duration: integer): void { updateAndShowText(duration: integer): void {
this.fieldUI.moveBelow(this.moneyText, this.luckText);
const labels = [ this.luckLabelText, this.luckText ]; const labels = [ this.luckLabelText, this.luckText ];
labels.map(t => { labels.map(t => {
t.setAlpha(0); t.setAlpha(0);

View File

@ -41,22 +41,27 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
ui.add(this.modifierContainer); ui.add(this.modifierContainer);
this.transferButtonContainer = this.scene.add.container((this.scene.game.canvas.width / 6) - 1, -64); this.transferButtonContainer = this.scene.add.container((this.scene.game.canvas.width / 6) - 1, -64);
this.transferButtonContainer.setName("container-transfer-btn");
this.transferButtonContainer.setVisible(false); this.transferButtonContainer.setVisible(false);
ui.add(this.transferButtonContainer); ui.add(this.transferButtonContainer);
const transferButtonText = addTextObject(this.scene, -4, -2, "Transfer", TextStyle.PARTY); const transferButtonText = addTextObject(this.scene, -4, -2, "Transfer", TextStyle.PARTY);
transferButtonText.setName("text-transfer-btn");
transferButtonText.setOrigin(1, 0); transferButtonText.setOrigin(1, 0);
this.transferButtonContainer.add(transferButtonText); this.transferButtonContainer.add(transferButtonText);
this.rerollButtonContainer = this.scene.add.container(16, -64); this.rerollButtonContainer = this.scene.add.container(16, -64);
this.rerollButtonContainer.setName("container-reroll-brn");
this.rerollButtonContainer.setVisible(false); this.rerollButtonContainer.setVisible(false);
ui.add(this.rerollButtonContainer); ui.add(this.rerollButtonContainer);
const rerollButtonText = addTextObject(this.scene, -4, -2, "Reroll", TextStyle.PARTY); const rerollButtonText = addTextObject(this.scene, -4, -2, "Reroll", TextStyle.PARTY);
rerollButtonText.setName("text-reroll-btn");
rerollButtonText.setOrigin(0, 0); rerollButtonText.setOrigin(0, 0);
this.rerollButtonContainer.add(rerollButtonText); this.rerollButtonContainer.add(rerollButtonText);
this.rerollCostText = addTextObject(this.scene, 0, 0, "", TextStyle.MONEY); this.rerollCostText = addTextObject(this.scene, 0, 0, "", TextStyle.MONEY);
this.rerollCostText.setName("text-reroll-cost");
this.rerollCostText.setOrigin(0, 0); this.rerollCostText.setOrigin(0, 0);
this.rerollCostText.setPositionRelative(rerollButtonText, rerollButtonText.displayWidth + 5, 1); this.rerollCostText.setPositionRelative(rerollButtonText, rerollButtonText.displayWidth + 5, 1);
this.rerollButtonContainer.add(this.rerollCostText); this.rerollButtonContainer.add(this.rerollCostText);
@ -141,7 +146,7 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
const maxUpgradeCount = typeOptions.map(to => to.upgradeCount).reduce((max, current) => Math.max(current, max), 0); const maxUpgradeCount = typeOptions.map(to => to.upgradeCount).reduce((max, current) => Math.max(current, max), 0);
this.scene.showFieldOverlay(750); this.scene.showFieldOverlay(750);
this.scene.updateAndShowLuckText(750); this.scene.updateAndShowText(750);
let i = 0; let i = 0;

View File

@ -412,3 +412,13 @@ export function verifyLang(lang?: string): boolean {
return false; return false;
} }
} }
/**
* Prints the type and name of all game objects in a container for debuggin purposes
* @param container container with game objects inside it
*/
export function printContainerList(container: Phaser.GameObjects.Container): void {
console.log(container.list.map(go => {
return {type: go.type, name: go.name};
}));
}