mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-26 00:36:25 +00:00
[QoL] Added an indicator when money changes. (#1772)
* added an animation and color shift when adding/removing money * eslint fix * The animation is now vertically centered, larger and faster.
This commit is contained in:
parent
90aa9b4209
commit
14b5d141c1
@ -13,7 +13,7 @@ import { Biome } from "./data/enums/biome";
|
||||
import { Arena, ArenaBase } from "./field/arena";
|
||||
import { GameData } from "./system/game-data";
|
||||
import { PlayerGender } from "./data/enums/player-gender";
|
||||
import { TextStyle, addTextObject } from "./ui/text";
|
||||
import { TextStyle, addTextObject, getTextColor } from "./ui/text";
|
||||
import { Moves } from "./data/enums/moves";
|
||||
import { allMoves } from "./data/move";
|
||||
import { ModifierPoolType, getDefaultModifierTypeForTier, getEnemyModifierTypesForWave, getLuckString, getLuckTextTint, getModifierPoolForType, getPartyLuckValue } from "./modifier/modifier-type";
|
||||
@ -409,28 +409,28 @@ export default class BattleScene extends SceneBase {
|
||||
|
||||
this.biomeWaveText = addTextObject(this, (this.game.canvas.width / 6) - 2, 0, startingWave.toString(), TextStyle.BATTLE_INFO);
|
||||
this.biomeWaveText.setName("text-biome-wave");
|
||||
this.biomeWaveText.setOrigin(1, 0);
|
||||
this.biomeWaveText.setOrigin(1, 0.5);
|
||||
this.fieldUI.add(this.biomeWaveText);
|
||||
|
||||
this.moneyText = addTextObject(this, (this.game.canvas.width / 6) - 2, 0, "", TextStyle.MONEY);
|
||||
this.moneyText.setName("text-money");
|
||||
this.moneyText.setOrigin(1, 0);
|
||||
this.moneyText.setOrigin(1, 0.5);
|
||||
this.fieldUI.add(this.moneyText);
|
||||
|
||||
this.scoreText = addTextObject(this, (this.game.canvas.width / 6) - 2, 0, "", TextStyle.PARTY, { fontSize: "54px" });
|
||||
this.scoreText.setName("text-score");
|
||||
this.scoreText.setOrigin(1, 0);
|
||||
this.scoreText.setOrigin(1, 0.5);
|
||||
this.fieldUI.add(this.scoreText);
|
||||
|
||||
this.luckText = addTextObject(this, (this.game.canvas.width / 6) - 2, 0, "", TextStyle.PARTY, { fontSize: "54px" });
|
||||
this.luckText.setName("text-luck");
|
||||
this.luckText.setOrigin(1, 0);
|
||||
this.luckText.setOrigin(1, 0.5);
|
||||
this.luckText.setVisible(false);
|
||||
this.fieldUI.add(this.luckText);
|
||||
|
||||
this.luckLabelText = addTextObject(this, (this.game.canvas.width / 6) - 2, 0, "Luck:", TextStyle.PARTY, { fontSize: "54px" });
|
||||
this.luckLabelText.setName("text-luck-label");
|
||||
this.luckLabelText.setOrigin(1, 0);
|
||||
this.luckLabelText.setOrigin(1, 0.5);
|
||||
this.luckLabelText.setVisible(false);
|
||||
this.fieldUI.add(this.luckLabelText);
|
||||
|
||||
@ -1378,6 +1378,24 @@ export default class BattleScene extends SceneBase {
|
||||
}
|
||||
}
|
||||
|
||||
animateMoneyChanged(positiveChange: boolean): void {
|
||||
let deltaScale = this.moneyText.scale * 0.14;
|
||||
if (positiveChange) {
|
||||
this.moneyText.setShadowColor("#008000");
|
||||
} else {
|
||||
this.moneyText.setShadowColor("#FF0000");
|
||||
deltaScale = -deltaScale;
|
||||
}
|
||||
this.tweens.add({
|
||||
targets: this.moneyText,
|
||||
duration: Utils.fixedInt(250),
|
||||
scale: this.moneyText.scale + deltaScale,
|
||||
loop: 0,
|
||||
yoyo: true,
|
||||
onComplete: (_) => this.moneyText.setShadowColor(getTextColor(TextStyle.MONEY, true)),
|
||||
});
|
||||
}
|
||||
|
||||
updateScoreText(): void {
|
||||
this.scoreText.setText(`Score: ${this.score.toString()}`);
|
||||
this.scoreText.setVisible(this.gameMode.isDaily);
|
||||
@ -1421,7 +1439,10 @@ export default class BattleScene extends SceneBase {
|
||||
|
||||
updateUIPositions(): void {
|
||||
const enemyModifierCount = this.enemyModifiers.filter(m => m.isIconVisible(this)).length;
|
||||
this.biomeWaveText.setY(-(this.game.canvas.height / 6) + (enemyModifierCount ? enemyModifierCount <= 12 ? 15 : 24 : 0));
|
||||
const biomeWaveTextHeight = this.biomeWaveText.getBottomLeft().y - this.biomeWaveText.getTopLeft().y;
|
||||
this.biomeWaveText.setY(
|
||||
-(this.game.canvas.height / 6) + (enemyModifierCount ? enemyModifierCount <= 12 ? 15 : 24 : 0) + (biomeWaveTextHeight / 2)
|
||||
);
|
||||
this.moneyText.setY(this.biomeWaveText.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));
|
||||
@ -1823,6 +1844,7 @@ export default class BattleScene extends SceneBase {
|
||||
addMoney(amount: integer): void {
|
||||
this.money = Math.min(this.money + amount, Number.MAX_SAFE_INTEGER);
|
||||
this.updateMoneyText();
|
||||
this.animateMoneyChanged(true);
|
||||
this.validateAchvs(MoneyAchv);
|
||||
}
|
||||
|
||||
|
@ -4921,6 +4921,7 @@ export class SelectModifierPhase extends BattlePhase {
|
||||
this.scene.ui.setMode(Mode.MESSAGE).then(() => super.end());
|
||||
this.scene.money -= rerollCost;
|
||||
this.scene.updateMoneyText();
|
||||
this.scene.animateMoneyChanged(false);
|
||||
this.scene.playSound("buy");
|
||||
}
|
||||
} else if (cursor === 1) {
|
||||
@ -4966,6 +4967,7 @@ export class SelectModifierPhase extends BattlePhase {
|
||||
if (success) {
|
||||
this.scene.money -= cost;
|
||||
this.scene.updateMoneyText();
|
||||
this.scene.animateMoneyChanged(false);
|
||||
this.scene.playSound("buy");
|
||||
(this.scene.ui.getHandler() as ModifierSelectUiHandler).updateCostText();
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user