Implement Pokemon fusion icons
This commit is contained in:
1 parent
973eefee1d
commit
ca778e07d5
7 files changed
+80
-21
No files matched your search
@@ -4,7 +4,7 @@ import { TextStyle, addTextObject } from "./text";
|
||||
|
||||
export default class PartyExpBar extends Phaser.GameObjects.Container {
|
||||
private bg: Phaser.GameObjects.NineSlice;
|
||||
private pokemonIcon: Phaser.GameObjects.Sprite;
|
||||
private pokemonIcon: Phaser.GameObjects.Container;
|
||||
private expText: Phaser.GameObjects.Text;
|
||||
|
||||
private tween: Phaser.Tweens.Tween;
|
||||
@@ -21,11 +21,6 @@ export default class PartyExpBar extends Phaser.GameObjects.Container {
|
||||
|
||||
this.add(this.bg);
|
||||
|
||||
this.pokemonIcon = this.scene.add.sprite(1, 9, 'pokemon_icons_0');
|
||||
this.pokemonIcon.setOrigin(0, 0.5);
|
||||
this.pokemonIcon.setScale(0.5);
|
||||
this.add(this.pokemonIcon);
|
||||
|
||||
this.expText = addTextObject(this.scene, 22, 4, '', TextStyle.BATTLE_INFO);
|
||||
this.expText.setOrigin(0, 0);
|
||||
this.add(this.expText);
|
||||
@@ -39,8 +34,11 @@ export default class PartyExpBar extends Phaser.GameObjects.Container {
|
||||
if (this.shown)
|
||||
return resolve();
|
||||
|
||||
this.pokemonIcon.setTexture(pokemon.getIconAtlasKey());
|
||||
this.pokemonIcon.setFrame(pokemon.getIconId());
|
||||
this.pokemonIcon = (this.scene as BattleScene).addPokemonIcon(pokemon, -8, 15, 0, 0.5);
|
||||
this.pokemonIcon.setScale(0.5);
|
||||
|
||||
this.add(this.pokemonIcon);
|
||||
|
||||
this.expText.setText(`+${expValue.toString()}`);
|
||||
|
||||
this.bg.width = this.expText.displayWidth + 28;
|
||||
@@ -83,6 +81,7 @@ export default class PartyExpBar extends Phaser.GameObjects.Container {
|
||||
this.tween = null;
|
||||
this.shown = false;
|
||||
this.setVisible(false);
|
||||
this.pokemonIcon?.destroy();
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -795,7 +795,7 @@ class PartySlot extends Phaser.GameObjects.Container {
|
||||
private slotBg: Phaser.GameObjects.Image;
|
||||
private slotPb: Phaser.GameObjects.Sprite;
|
||||
|
||||
private pokemonIcon: Phaser.GameObjects.Sprite;
|
||||
private pokemonIcon: Phaser.GameObjects.Container;
|
||||
private iconAnimHandler: PokemonIconAnimHandler;
|
||||
|
||||
constructor(scene: BattleScene, slotIndex: integer, pokemon: PlayerPokemon, iconAnimHandler: PokemonIconAnimHandler, partyUiMode: PartyUiMode, tmMoveId: Moves) {
|
||||
@@ -825,8 +825,7 @@ class PartySlot extends Phaser.GameObjects.Container {
|
||||
|
||||
this.add(slotPb);
|
||||
|
||||
this.pokemonIcon = this.scene.add.sprite(slotPb.x, slotPb.y, this.pokemon.getIconAtlasKey(true));
|
||||
this.pokemonIcon.setFrame(this.pokemon.getIconId(true));
|
||||
this.pokemonIcon = (this.scene as BattleScene).addPokemonIcon(this.pokemon, slotPb.x, slotPb.y, 0.5, 0.5, true);
|
||||
|
||||
this.add(this.pokemonIcon);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ export enum PokemonIconAnimMode {
|
||||
}
|
||||
|
||||
export default class PokemonIconAnimHandler {
|
||||
private icons: Map<Phaser.GameObjects.Sprite, PokemonIconAnimMode>;
|
||||
private icons: Map<Phaser.GameObjects.Container, PokemonIconAnimMode>;
|
||||
private toggled: boolean;
|
||||
|
||||
setup(scene: BattleScene): void {
|
||||
@@ -43,7 +43,7 @@ export default class PokemonIconAnimHandler {
|
||||
}
|
||||
}
|
||||
|
||||
addOrUpdate(icons: Phaser.GameObjects.Sprite | Phaser.GameObjects.Sprite[], mode: PokemonIconAnimMode): void {
|
||||
addOrUpdate(icons: Phaser.GameObjects.Container | Phaser.GameObjects.Container[], mode: PokemonIconAnimMode): void {
|
||||
if (!Array.isArray(icons))
|
||||
icons = [ icons ];
|
||||
for (let i of icons) {
|
||||
@@ -60,7 +60,7 @@ export default class PokemonIconAnimHandler {
|
||||
}
|
||||
}
|
||||
|
||||
remove(icons: Phaser.GameObjects.Sprite | Phaser.GameObjects.Sprite[]): void {
|
||||
remove(icons: Phaser.GameObjects.Container | Phaser.GameObjects.Container[]): void {
|
||||
if (!Array.isArray(icons))
|
||||
icons = [ icons ];
|
||||
for (let i of icons) {
|
||||
|
||||
@@ -242,8 +242,7 @@ class SessionSlot extends Phaser.GameObjects.Container {
|
||||
iconContainer.setScale(0.75);
|
||||
|
||||
const pokemon = p.toPokemon(this.scene);
|
||||
const icon = this.scene.add.sprite(0, 0, pokemon.getIconAtlasKey(), pokemon.getIconId());
|
||||
icon.setOrigin(0, 0);
|
||||
const icon = this.scene.addPokemonIcon(pokemon, 0, 0, 0, 0);
|
||||
|
||||
const text = addTextObject(this.scene, 32, 20, `Lv${Utils.formatLargeNumber(pokemon.level, 1000)}`, TextStyle.PARTY, { fontSize: '54px', color: '#f8f8f8' });
|
||||
text.setShadow(0, 0, null);
|
||||
|
||||
Reference in new issue
Block a user