mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-24 16:29:27 +02:00
set up descriptions
This commit is contained in:
parent
d7475793e6
commit
514055dcd8
@ -37,6 +37,7 @@ import { GameOverPhase } from "#app/phases/game-over-phase";
|
||||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
||||
import { PartyExpPhase } from "#app/phases/party-exp-phase";
|
||||
import { Variant } from "#app/data/variant";
|
||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
|
||||
/**
|
||||
* Animates exclamation sprite over trainer's head at start of encounter
|
||||
|
@ -271,6 +271,19 @@ export default class RunInfoUiHandler extends UiHandler {
|
||||
pokeball.setPosition(52 + ((i % row_limit) * 8), (i <= 2) ? 25 : 32);
|
||||
enemyContainer.add(pokeball);
|
||||
});
|
||||
const trainerObj = this.runInfo.trainer.toTrainer(this.scene);
|
||||
const RIVAL_TRAINER_ID_THRESHOLD = 375;
|
||||
let trainerName = "";
|
||||
if (this.runInfo.trainer.trainerType >= RIVAL_TRAINER_ID_THRESHOLD) {
|
||||
trainerName = (trainerObj.variant === TrainerVariant.FEMALE) ? i18next.t("trainerNames:rival_female") : i18next.t("trainerNames:rival");
|
||||
} else {
|
||||
trainerName = trainerObj.getName(0, true);
|
||||
}
|
||||
const boxString = i18next.t(trainerObj.variant !== TrainerVariant.DOUBLE ? "battle:trainerAppeared" : "battle:trainerAppearedDouble", { trainerName: trainerName }).replace(/\n/g, " ");
|
||||
const descContainer = this.scene.add.container(0, 0);
|
||||
this.provideDesc(descContainer, boxString);
|
||||
descContainer.setPosition(52, 38);
|
||||
this.runResultContainer.add(descContainer);
|
||||
} else if (this.runInfo.battleType === BattleType.MYSTERY_ENCOUNTER) {
|
||||
console.log(this.runInfo.mysteryEncounterType);
|
||||
}
|
||||
@ -429,6 +442,12 @@ export default class RunInfoUiHandler extends UiHandler {
|
||||
enemyContainer.add(enemyPartyContainer);
|
||||
}
|
||||
|
||||
provideDesc(descContainer: Phaser.GameObjects.Container, desc: string) {
|
||||
const textBox = addTextObject(this.scene, 0, 0, desc, TextStyle.MESSAGE, { fontSize : "35px", wordWrap: {width: 150} });
|
||||
console.log(textBox.width);
|
||||
descContainer.add(textBox);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows information about the run like the run's mode, duration, luck, money, and player held items
|
||||
* The values for luck and money are from the end of the run, not the player's luck at the start of the run.
|
||||
|
Loading…
Reference in New Issue
Block a user