[Bug] fixed wrong stacking of move info overlay issues (#1888)

* fixed wrongly stacking overlay issues

- starter selection
 - IVs are now behind the overlay
 - the overlay should clear when exiting it via controller (requires tests as i don't have a controller)
- TM
 - will prevent C/Shift from showing the overlay until the next item selection, when selecting a TM as item reward.
 - will prevent C/Shift from showing the overlay when canceling item selection

* removed reference to previously deleted resource

* fixed override
This commit is contained in:
prime 2024-06-07 22:45:49 +02:00 committed by GitHub
parent 97dde2d1f3
commit f5f98ec537
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 22 additions and 10 deletions

View File

@ -135,7 +135,6 @@ export class LoadingScene extends SceneBase {
this.loadImage("summary_stats_overlay_exp", "ui");
this.loadImage("summary_moves", "ui");
this.loadImage("summary_moves_effect", "ui");
this.loadImage("summary_moves_effect_type", "ui");
this.loadImage("summary_moves_overlay_row", "ui");
this.loadImage("summary_moves_overlay_pp", "ui");
this.loadAtlas("summary_moves_cursor", "ui");

View File

@ -20,6 +20,7 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
private rerollCostText: Phaser.GameObjects.Text;
private lockRarityButtonText: Phaser.GameObjects.Text;
private moveInfoOverlay : MoveInfoOverlay;
private moveInfoOverlayActive : boolean = false;
private rowCursor: integer = 0;
private player: boolean;
@ -99,6 +100,7 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
this.awaitingActionInput = true;
this.onActionInput = args[2];
}
this.moveInfoOverlay.active = this.moveInfoOverlayActive;
return false;
}
@ -242,6 +244,10 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
if (!originalOnActionInput(this.rowCursor, this.cursor)) {
this.awaitingActionInput = true;
this.onActionInput = originalOnActionInput;
} else {
this.moveInfoOverlayActive = this.moveInfoOverlay.active;
this.moveInfoOverlay.setVisible(false);
this.moveInfoOverlay.active = false; // this is likely unnecessary, but it should help future prove the UI
}
}
} else if (button === Button.CANCEL) {
@ -252,6 +258,9 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
this.awaitingActionInput = false;
this.onActionInput = null;
originalOnActionInput(-1);
this.moveInfoOverlayActive = this.moveInfoOverlay.active;
this.moveInfoOverlay.setVisible(false);
this.moveInfoOverlay.active = false; // don't clear here as we might need to restore the UI in case the user cancels the action
}
}
} else {
@ -403,6 +412,8 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
clear() {
super.clear();
this.moveInfoOverlay.clear();
this.moveInfoOverlayActive = false;
this.awaitingActionInput = false;
this.onActionInput = null;
this.getUi().clearText();

View File

@ -663,15 +663,6 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
this.message.setOrigin(0, 0);
this.starterSelectMessageBoxContainer.add(this.message);
const overlayScale = 1; // scale for the move info. "2/3" might be another good option...
this.moveInfoOverlay = new MoveInfoOverlay(this.scene, {
scale: overlayScale,
top: true,
x: 1,
y: this.scene.game.canvas.height / 6 - MoveInfoOverlay.getHeight(overlayScale) - 29,
});
this.starterSelectContainer.add(this.moveInfoOverlay);
const date = new Date();
date.setUTCHours(0, 0, 0, 0);
@ -716,12 +707,23 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
this.starterSelectContainer.add(this.statsContainer);
// add the info overlay last to be the top most ui element and prevent the IVs from overlaying this
const overlayScale = 1;
this.moveInfoOverlay = new MoveInfoOverlay(this.scene, {
scale: overlayScale,
top: true,
x: 1,
y: this.scene.game.canvas.height / 6 - MoveInfoOverlay.getHeight(overlayScale) - 29,
});
this.starterSelectContainer.add(this.moveInfoOverlay);
this.scene.eventTarget.addEventListener(BattleSceneEventType.CANDY_UPGRADE_NOTIFICATION_CHANGED, (e) => this.onCandyUpgradeDisplayChanged(e));
this.updateInstructions();
}
show(args: any[]): boolean {
this.moveInfoOverlay.clear(); // clear this when removing a menu; the cancel button doesn't seem to trigger this automatically on controllers
if (args.length >= 2 && args[0] instanceof Function && typeof args[1] === "number") {
super.show(args);
this.starterSelectCallback = args[0] as StarterSelectCallback;