Added current biome text (#915)

* Added ability to get hex colour from type, added biome text, added functionality for querying biomeType with object.

* Revert "Added ability to get hex colour from type, added biome text, added functionality for querying biomeType with object."

This reverts commit 0f87000aa46ebb0a6d1fc628dd56ac39ef7229db.

* Reverted changes, added biome text to line one and renamed wavecounttext to a more standard name.

* Update battle-scene.ts

---------

Co-authored-by: Benjamin Odom <bennybroseph@gmail.com>
This commit is contained in:
Jon Studders 2024-05-24 23:36:02 +01:00 committed by GitHub
parent 919760e2e1
commit c8b77cffc1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -151,6 +151,7 @@ export default class BattleScene extends SceneBase {
public money: integer; public money: integer;
public pokemonInfoContainer: PokemonInfoContainer; public pokemonInfoContainer: PokemonInfoContainer;
private party: PlayerPokemon[]; private party: PlayerPokemon[];
private lineOneText: Phaser.GameObjects.Text;
private waveCountText: Phaser.GameObjects.Text; private waveCountText: Phaser.GameObjects.Text;
private moneyText: Phaser.GameObjects.Text; private moneyText: Phaser.GameObjects.Text;
private scoreText: Phaser.GameObjects.Text; private scoreText: Phaser.GameObjects.Text;
@ -350,9 +351,9 @@ export default class BattleScene extends SceneBase {
this.candyBar.setup(); this.candyBar.setup();
this.fieldUI.add(this.candyBar); this.fieldUI.add(this.candyBar);
this.waveCountText = addTextObject(this, (this.game.canvas.width / 6) - 2, 0, startingWave.toString(), TextStyle.BATTLE_INFO); this.lineOneText = addTextObject(this, (this.game.canvas.width / 6) - 2, 0, startingWave.toString(), TextStyle.BATTLE_INFO);
this.waveCountText.setOrigin(1, 0); this.lineOneText.setOrigin(1, 0);
this.fieldUI.add(this.waveCountText); this.fieldUI.add(this.lineOneText);
this.moneyText = addTextObject(this, (this.game.canvas.width / 6) - 2, 0, "", TextStyle.MONEY); this.moneyText = addTextObject(this, (this.game.canvas.width / 6) - 2, 0, "", TextStyle.MONEY);
this.moneyText.setOrigin(1, 0); this.moneyText.setOrigin(1, 0);
@ -480,7 +481,7 @@ export default class BattleScene extends SceneBase {
} }
}); });
this.updateWaveCountText(); this.updateLineOneText();
this.updateMoneyText(); this.updateMoneyText();
this.updateScoreText(); this.updateScoreText();
} }
@ -794,8 +795,8 @@ export default class BattleScene extends SceneBase {
this.currentBattle = null; this.currentBattle = null;
this.waveCountText.setText(startingWave.toString()); this.lineOneText.setText(startingWave.toString());
this.waveCountText.setVisible(false); this.lineOneText.setVisible(false);
this.updateMoneyText(); this.updateMoneyText();
this.moneyText.setVisible(false); this.moneyText.setVisible(false);
@ -1244,12 +1245,13 @@ export default class BattleScene extends SceneBase {
}); });
} }
updateWaveCountText(): void { updateLineOneText(): void {
const isBoss = !(this.currentBattle.waveIndex % 10); const isBoss = !(this.currentBattle.waveIndex % 10);
this.waveCountText.setText(this.currentBattle.waveIndex.toString()); const biomeString: string = getBiomeName(this.arena.biomeType);
this.waveCountText.setColor(!isBoss ? "#404040" : "#f89890"); this.lineOneText.setText( biomeString + " - " + this.currentBattle.waveIndex.toString());
this.waveCountText.setShadowColor(!isBoss ? "#ded6b5" : "#984038"); this.lineOneText.setColor(!isBoss ? "#404040" : "#f89890");
this.waveCountText.setVisible(true); this.lineOneText.setShadowColor(!isBoss ? "#ded6b5" : "#984038");
this.lineOneText.setVisible(true);
} }
updateMoneyText(): void { updateMoneyText(): void {
@ -1297,8 +1299,8 @@ export default class BattleScene extends SceneBase {
updateUIPositions(): void { updateUIPositions(): void {
const enemyModifierCount = this.enemyModifiers.filter(m => m.isIconVisible(this)).length; const enemyModifierCount = this.enemyModifiers.filter(m => m.isIconVisible(this)).length;
this.waveCountText.setY(-(this.game.canvas.height / 6) + (enemyModifierCount ? enemyModifierCount <= 12 ? 15 : 24 : 0)); this.lineOneText.setY(-(this.game.canvas.height / 6) + (enemyModifierCount ? enemyModifierCount <= 12 ? 15 : 24 : 0));
this.moneyText.setY(this.waveCountText.y + 10); this.moneyText.setY(this.lineOneText.y + 10);
this.scoreText.setY(this.moneyText.y + 10); this.scoreText.setY(this.moneyText.y + 10);
[ this.luckLabelText, this.luckText ].map(l => l.setY((this.scoreText.visible ? this.scoreText : this.moneyText).y + 10)); [ this.luckLabelText, this.luckText ].map(l => l.setY((this.scoreText.visible ? this.scoreText : this.moneyText).y + 10));
const offsetY = (this.scoreText.visible ? this.scoreText : this.moneyText).y + 15; const offsetY = (this.scoreText.visible ? this.scoreText : this.moneyText).y + 15;