mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-26 09:19:31 +02:00
Added trainer team bar
This commit is contained in:
parent
42304070a0
commit
1e63f99765
@ -54,6 +54,7 @@ import {InputsController} from "./inputs-controller";
|
||||
import {UiInputs} from "./ui-inputs";
|
||||
import { NewArenaEvent } from "./events/battle-scene";
|
||||
import ArenaFlyout from "./ui/arena-flyout";
|
||||
import TeamBar from "./ui/trainer-team-bar";
|
||||
import { EaseType } from "#enums/ease-type";
|
||||
import { Abilities } from "#enums/abilities";
|
||||
import { BattleSpec } from "#enums/battle-spec";
|
||||
@ -220,6 +221,7 @@ export default class BattleScene extends SceneBase {
|
||||
private modifierBar: ModifierBar;
|
||||
private enemyModifierBar: ModifierBar;
|
||||
public arenaFlyout: ArenaFlyout;
|
||||
public trainerBar: TeamBar;
|
||||
|
||||
private fieldOverlay: Phaser.GameObjects.Rectangle;
|
||||
private shopOverlay: Phaser.GameObjects.Rectangle;
|
||||
@ -473,6 +475,9 @@ export default class BattleScene extends SceneBase {
|
||||
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.updateUIPositions();
|
||||
|
||||
@ -1396,6 +1401,7 @@ export default class BattleScene extends SceneBase {
|
||||
}
|
||||
processInfoButton(pressed: boolean): void {
|
||||
this.arenaFlyout.toggleFlyout(pressed);
|
||||
this.trainerBar.toggleFlyout(pressed);
|
||||
}
|
||||
|
||||
showFieldOverlay(duration: integer): Promise<void> {
|
||||
|
54
src/ui/trainer-team-bar.ts
Normal file
54
src/ui/trainer-team-bar.ts
Normal file
@ -0,0 +1,54 @@
|
||||
import BattleScene from "../battle-scene";
|
||||
import {addTextObject, TextStyle} from "./text";
|
||||
import i18next from "i18next";
|
||||
import * as Utils from "#app/utils";
|
||||
import { EnemyPokemon } from "#app/field/pokemon.js";
|
||||
|
||||
export default class TeamBar extends Phaser.GameObjects.Container {
|
||||
// Public vars
|
||||
public party: EnemyPokemon[];
|
||||
public gamescene: BattleScene;
|
||||
|
||||
// Private vars
|
||||
private bg: Phaser.GameObjects.NineSlice;
|
||||
private teamIcons: Array<Phaser.GameObjects.Sprite[]>;
|
||||
private tween: Phaser.Tweens.Tween;
|
||||
private components: any[] = [];
|
||||
|
||||
// Constructor
|
||||
constructor(scene: Phaser.Scene) {
|
||||
super(scene, -150, 0);
|
||||
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.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])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Show or hide the BGM bar.
|
||||
@param {boolean} visible Whether to show or hide the BGM bar.
|
||||
*/
|
||||
public toggleFlyout(visible: boolean): void {
|
||||
this.scene.tweens.add({
|
||||
targets: this,
|
||||
x: visible ? 0 : -200,
|
||||
alpha: visible ? 1 : 0,
|
||||
duration: 500,
|
||||
ease: "Sine.easeInOut"
|
||||
//onComplete: () => {
|
||||
//
|
||||
//}
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user