diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 1d443c0c288..4b517dc4d88 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -472,12 +472,12 @@ export default class BattleScene extends SceneBase { this.luckLabelText.setVisible(false); this.fieldUI.add(this.luckLabelText); - this.arenaFlyout = new ArenaFlyout(this); - this.fieldUI.add(this.arenaFlyout); - this.fieldUI.moveBelow(this.arenaFlyout, this.fieldOverlay); this.trainerBar = new TeamBar(this); this.fieldUI.add(this.trainerBar); this.fieldUI.moveBelow(this.trainerBar, this.fieldOverlay); + this.arenaFlyout = new ArenaFlyout(this); + this.fieldUI.add(this.arenaFlyout); + this.fieldUI.moveBelow(this.arenaFlyout, this.fieldOverlay); this.updateUIPositions(); @@ -1400,6 +1400,11 @@ export default class BattleScene extends SceneBase { this.fieldUI.moveBelow(gameObject, this.fieldOverlay); } processInfoButton(pressed: boolean): void { + if (pressed) { + this.trainerBar.tempToggleFlyout(false) + } else { + this.trainerBar.revertFlyout() + } this.arenaFlyout.toggleFlyout(pressed); } diff --git a/src/ui/trainer-team-bar.ts b/src/ui/trainer-team-bar.ts index 7051ad5434e..4407b4557a1 100644 --- a/src/ui/trainer-team-bar.ts +++ b/src/ui/trainer-team-bar.ts @@ -11,28 +11,20 @@ export default class TeamBar extends Phaser.GameObjects.Container { // Private vars private bg: Phaser.GameObjects.NineSlice; - private teamIcons: Array; + private teamIcons: Array = []; private tween: Phaser.Tweens.Tween; private components: any[] = []; + private shown: boolean = false; + private overridden: boolean = false; // Constructor constructor(scene: Phaser.Scene) { - super(scene, -150, 0); + super(scene, -200, -107); this.gamescene = scene as BattleScene; 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.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. */ 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({ targets: this, - x: visible ? 0 : -200, - alpha: visible ? 1 : 0, + x: visible ? -100 : -200, duration: 500, - ease: "Sine.easeInOut" - //onComplete: () => { - // - //} + ease: "Sine.easeInOut", + 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: () => { + } }); } } \ No newline at end of file