[QOL] Have Friendship Value be shown in summary (#4490)

* Have Friendship Value be shown in summary

* Fix how "fill" of icon is calced

* Update src/locales/de/pokemon-summary.json

* Actually add the images

* Add correct image files

* Update src/ui/summary-ui-handler.ts

Co-authored-by: Adrian T. <68144167+torranx@users.noreply.github.com>

* Update src/ui/summary-ui-handler.ts

Co-authored-by: Adrian T. <68144167+torranx@users.noreply.github.com>

* Update src/ui/summary-ui-handler.ts

* Update src/ui/summary-ui-handler.ts

Co-authored-by: MokaStitcher <54149968+MokaStitcher@users.noreply.github.com>

* Made changed suggested in code review

* Update src/locales/en/pokemon-summary.json

---------

Co-authored-by: Adrian T. <68144167+torranx@users.noreply.github.com>
Co-authored-by: MokaStitcher <54149968+MokaStitcher@users.noreply.github.com>
This commit is contained in:
Jannik Tappert 2024-10-03 16:34:29 +02:00 committed by GitHub
parent 831efeb6bf
commit 5f700590be
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 35 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 B

View File

@ -44,6 +44,8 @@ export class LoadingScene extends SceneBase {
this.loadAtlas("prompt", "ui");
this.loadImage("candy", "ui");
this.loadImage("candy_overlay", "ui");
this.loadImage("friendship", "ui");
this.loadImage("friendship_overlay", "ui");
this.loadImage("cursor", "ui");
this.loadImage("cursor_reverse", "ui");
for (const wv of Utils.getEnumValues(WindowVariant)) {

View File

@ -87,6 +87,10 @@ export default class SummaryUiHandler extends UiHandler {
private moveAccuracyText: Phaser.GameObjects.Text;
private moveCategoryIcon: Phaser.GameObjects.Sprite;
private summaryPageTransitionContainer: Phaser.GameObjects.Container;
private friendshipShadow: Phaser.GameObjects.Sprite;
private friendshipText: Phaser.GameObjects.Text;
private friendshipIcon: Phaser.GameObjects.Sprite;
private friendshipOverlay: Phaser.GameObjects.Sprite;
private descriptionScrollTween: Phaser.Tweens.Tween | null;
private moveCursorBlinkTimer: Phaser.Time.TimerEvent | null;
@ -187,6 +191,25 @@ export default class SummaryUiHandler extends UiHandler {
this.candyCountText.setOrigin(0, 0);
this.summaryContainer.add(this.candyCountText);
this.friendshipIcon = this.scene.add.sprite(13, -60, "friendship");
this.friendshipIcon.setScale(0.8);
this.summaryContainer.add(this.friendshipIcon);
this.friendshipOverlay = this.scene.add.sprite(13, -60, "friendship_overlay");
this.friendshipOverlay.setScale(0.8);
this.summaryContainer.add(this.friendshipOverlay);
this.friendshipShadow = this.scene.add.sprite(13, -60, "friendship");
this.friendshipShadow.setTint(0x000000);
this.friendshipShadow.setAlpha(0.50);
this.friendshipShadow.setScale(0.8);
this.friendshipShadow.setInteractive(new Phaser.Geom.Rectangle(0, 0, 16, 16), Phaser.Geom.Rectangle.Contains);
this.summaryContainer.add(this.friendshipShadow);
this.friendshipText = addTextObject(this.scene, 20, -66, "x0", TextStyle.WINDOW_ALT, { fontSize: "76px" });
this.friendshipText.setOrigin(0, 0);
this.summaryContainer.add(this.friendshipText);
this.championRibbon = this.scene.add.image(88, -146, "champion_ribbon");
this.championRibbon.setOrigin(0, 0);
//this.championRibbon.setScale(0.8);
@ -292,6 +315,7 @@ export default class SummaryUiHandler extends UiHandler {
this.candyIcon.setTint(argbFromRgba(Utils.rgbHexToRgba(colorScheme[0])));
this.candyOverlay.setTint(argbFromRgba(Utils.rgbHexToRgba(colorScheme[1])));
this.numberText.setText(Utils.padInt(this.pokemon.species.speciesId, 4));
this.numberText.setColor(this.getTextColor(!this.pokemon.isShiny() ? TextStyle.SUMMARY : TextStyle.SUMMARY_GOLD));
this.numberText.setShadowColor(this.getTextColor(!this.pokemon.isShiny() ? TextStyle.SUMMARY : TextStyle.SUMMARY_GOLD, true));
@ -345,6 +369,15 @@ export default class SummaryUiHandler extends UiHandler {
this.candyShadow.setCrop(0, 0, 16, candyCropY);
if (this.friendshipShadow.visible) {
this.friendshipShadow.on("pointerover", () => this.scene.ui.showTooltip("", `${i18next.t("pokemonSummary:friendship")}`, true));
this.friendshipShadow.on("pointerout", () => this.scene.ui.hideTooltip());
}
this.friendshipText.setText(`${this.pokemon?.friendship || "0"} / 255`);
this.friendshipShadow.setCrop(0, 0, 16, 16 - (16 * ((this.pokemon?.friendship || 0) / 255)));
const doubleShiny = isFusion && this.pokemon.shiny && this.pokemon.fusionShiny;
const baseVariant = !doubleShiny ? this.pokemon.getVariant() : this.pokemon.variant;