This commit is contained in:
RedstonewolfX 2024-07-05 13:26:12 -04:00
parent 96146891dc
commit adb2f90d96
2 changed files with 45 additions and 22 deletions

View File

@ -472,12 +472,12 @@ export default class BattleScene extends SceneBase {
this.luckLabelText.setVisible(false); this.luckLabelText.setVisible(false);
this.fieldUI.add(this.luckLabelText); this.fieldUI.add(this.luckLabelText);
this.arenaFlyout = new ArenaFlyout(this);
this.fieldUI.add(this.arenaFlyout);
this.fieldUI.moveBelow<Phaser.GameObjects.GameObject>(this.arenaFlyout, this.fieldOverlay);
this.trainerBar = new TeamBar(this); this.trainerBar = new TeamBar(this);
this.fieldUI.add(this.trainerBar); this.fieldUI.add(this.trainerBar);
this.fieldUI.moveBelow<Phaser.GameObjects.GameObject>(this.trainerBar, this.fieldOverlay); this.fieldUI.moveBelow<Phaser.GameObjects.GameObject>(this.trainerBar, this.fieldOverlay);
this.arenaFlyout = new ArenaFlyout(this);
this.fieldUI.add(this.arenaFlyout);
this.fieldUI.moveBelow<Phaser.GameObjects.GameObject>(this.arenaFlyout, this.fieldOverlay);
this.updateUIPositions(); this.updateUIPositions();
@ -1400,6 +1400,11 @@ export default class BattleScene extends SceneBase {
this.fieldUI.moveBelow<any>(gameObject, this.fieldOverlay); this.fieldUI.moveBelow<any>(gameObject, this.fieldOverlay);
} }
processInfoButton(pressed: boolean): void { processInfoButton(pressed: boolean): void {
if (pressed) {
this.trainerBar.tempToggleFlyout(false)
} else {
this.trainerBar.revertFlyout()
}
this.arenaFlyout.toggleFlyout(pressed); this.arenaFlyout.toggleFlyout(pressed);
} }

View File

@ -11,28 +11,20 @@ export default class TeamBar extends Phaser.GameObjects.Container {
// Private vars // Private vars
private bg: Phaser.GameObjects.NineSlice; private bg: Phaser.GameObjects.NineSlice;
private teamIcons: Array<Phaser.GameObjects.Sprite[]>; private teamIcons: Array<Phaser.GameObjects.Sprite[]> = [];
private tween: Phaser.Tweens.Tween; private tween: Phaser.Tweens.Tween;
private components: any[] = []; private components: any[] = [];
private shown: boolean = false;
private overridden: boolean = false;
// Constructor // Constructor
constructor(scene: Phaser.Scene) { constructor(scene: Phaser.Scene) {
super(scene, -150, 0); super(scene, -200, -107);
this.gamescene = scene as BattleScene; this.gamescene = scene as BattleScene;
this.components = [this] this.components = [this]
this.bg = this.scene.add.nineslice(-5, -5, "ability_bar_left", null, 200, 100, 0, 0, 10, 10); this.bg = this.scene.add.nineslice(-5, -5, "ability_bar_left", null, 200, 70, 10, 10);
this.bg.setOrigin(0, 0); this.bg.setOrigin(0, 0);
this.add(this.bg); this.add(this.bg);
for (var i = 0; i < 1; i++) {
for (var j = 0; j < 6; j++) {
if (i == 0) this.teamIcons[j] = []
this.teamIcons[j][i] = this.scene.add.sprite(0, 0, "pb_tray_ball", "empty")
this.teamIcons[j][i].setOrigin(0, 0);
//this.teamIcons[j][i].setVisible(false);
this.add(this.teamIcons[j][i])
this.components.push(this.teamIcons[j][i])
}
}
} }
/* /*
@ -40,15 +32,41 @@ export default class TeamBar extends Phaser.GameObjects.Container {
@param {boolean} visible Whether to show or hide the BGM bar. @param {boolean} visible Whether to show or hide the BGM bar.
*/ */
public toggleFlyout(visible: boolean): void { public toggleFlyout(visible: boolean): void {
//console.log("Update team bar", visible)
if (this.overridden) return; // Don't toggle the state if it has been overridden
this.shown = visible
this.scene.tweens.add({ this.scene.tweens.add({
targets: this, targets: this,
x: visible ? 0 : -200, x: visible ? -100 : -200,
alpha: visible ? 1 : 0,
duration: 500, duration: 500,
ease: "Sine.easeInOut" ease: "Sine.easeInOut",
//onComplete: () => { onUpdate: () => {
// }
//} });
}
public tempToggleFlyout(visible: boolean): void {
this.overridden = true
//console.log("Update team bar", visible)
this.scene.tweens.add({
targets: this,
x: visible ? -100 : -200,
duration: 500,
ease: "Sine.easeInOut",
onUpdate: () => {
}
});
}
public revertFlyout(): void {
var visible = this.shown
this.overridden = false
//console.log("Update team bar", visible)
this.scene.tweens.add({
targets: this,
x: visible ? -100 : -200,
duration: 500,
ease: "Sine.easeInOut",
onUpdate: () => {
}
}); });
} }
} }