mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-26 17:29:30 +02:00
Commit
This commit is contained in:
parent
96146891dc
commit
adb2f90d96
@ -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<Phaser.GameObjects.GameObject>(this.arenaFlyout, this.fieldOverlay);
|
||||
this.trainerBar = new TeamBar(this);
|
||||
this.fieldUI.add(this.trainerBar);
|
||||
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();
|
||||
|
||||
@ -1400,6 +1400,11 @@ export default class BattleScene extends SceneBase {
|
||||
this.fieldUI.moveBelow<any>(gameObject, this.fieldOverlay);
|
||||
}
|
||||
processInfoButton(pressed: boolean): void {
|
||||
if (pressed) {
|
||||
this.trainerBar.tempToggleFlyout(false)
|
||||
} else {
|
||||
this.trainerBar.revertFlyout()
|
||||
}
|
||||
this.arenaFlyout.toggleFlyout(pressed);
|
||||
}
|
||||
|
||||
|
@ -11,28 +11,20 @@ export default class TeamBar extends Phaser.GameObjects.Container {
|
||||
|
||||
// Private vars
|
||||
private bg: Phaser.GameObjects.NineSlice;
|
||||
private teamIcons: Array<Phaser.GameObjects.Sprite[]>;
|
||||
private teamIcons: Array<Phaser.GameObjects.Sprite[]> = [];
|
||||
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: () => {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user