Caught a few more instances of width / 6 etc

This commit is contained in:
Wlowscha 2025-07-29 23:07:05 +02:00
parent f6e477c2f9
commit 17ea39d836
No known key found for this signature in database
GPG Key ID: 3C8F1AD330565D04
4 changed files with 16 additions and 25 deletions

View File

@ -466,8 +466,8 @@ export class BattleScene extends SceneBase {
this.uiContainer = uiContainer;
const overlayWidth = this.game.canvas.width / 6;
const overlayHeight = this.game.canvas.height / 6 - 48;
const overlayWidth = this.scaledCanvas.width;
const overlayHeight = this.scaledCanvas.height - 48;
this.fieldOverlay = this.add.rectangle(0, overlayHeight * -1 - 48, overlayWidth, overlayHeight, 0x424242);
this.fieldOverlay.setName("rect-field-overlay");
this.fieldOverlay.setOrigin(0, 0);
@ -525,34 +525,29 @@ export class BattleScene extends SceneBase {
this.candyBar.setup();
this.fieldUI.add(this.candyBar);
this.biomeWaveText = addTextObject(
this.game.canvas.width / 6 - 2,
0,
startingWave.toString(),
TextStyle.BATTLE_INFO,
);
this.biomeWaveText = addTextObject(this.scaledCanvas.width - 2, 0, startingWave.toString(), TextStyle.BATTLE_INFO);
this.biomeWaveText.setName("text-biome-wave");
this.biomeWaveText.setOrigin(1, 0.5);
this.fieldUI.add(this.biomeWaveText);
this.moneyText = addTextObject(this.game.canvas.width / 6 - 2, 0, "", TextStyle.MONEY);
this.moneyText = addTextObject(this.scaledCanvas.width - 2, 0, "", TextStyle.MONEY);
this.moneyText.setName("text-money");
this.moneyText.setOrigin(1, 0.5);
this.fieldUI.add(this.moneyText);
this.scoreText = addTextObject(this.game.canvas.width / 6 - 2, 0, "", TextStyle.PARTY, { fontSize: "54px" });
this.scoreText = addTextObject(this.scaledCanvas.width - 2, 0, "", TextStyle.PARTY, { fontSize: "54px" });
this.scoreText.setName("text-score");
this.scoreText.setOrigin(1, 0.5);
this.fieldUI.add(this.scoreText);
this.luckText = addTextObject(this.game.canvas.width / 6 - 2, 0, "", TextStyle.PARTY, { fontSize: "54px" });
this.luckText = addTextObject(this.scaledCanvas.width - 2, 0, "", TextStyle.PARTY, { fontSize: "54px" });
this.luckText.setName("text-luck");
this.luckText.setOrigin(1, 0.5);
this.luckText.setVisible(false);
this.fieldUI.add(this.luckText);
this.luckLabelText = addTextObject(
this.game.canvas.width / 6 - 2,
this.scaledCanvas.width - 2,
0,
i18next.t("common:luckIndicator"),
TextStyle.PARTY,
@ -574,10 +569,7 @@ export class BattleScene extends SceneBase {
this.spriteSparkleHandler = new PokemonSpriteSparkleHandler();
this.spriteSparkleHandler.setup();
this.pokemonInfoContainer = new PokemonInfoContainer(
this.game.canvas.width / 6 + 52,
-(this.game.canvas.height / 6) + 66,
);
this.pokemonInfoContainer = new PokemonInfoContainer(this.scaledCanvas.width + 52, -this.scaledCanvas.height + 66);
this.pokemonInfoContainer.setup();
this.fieldUI.add(this.pokemonInfoContainer);
@ -2059,7 +2051,7 @@ export class BattleScene extends SceneBase {
} else {
this.luckText.setTint(0xffef5c, 0x47ff69, 0x6b6bff, 0xff6969);
}
this.luckLabelText.setX(this.game.canvas.width / 6 - 2 - (this.luckText.displayWidth + 2));
this.luckLabelText.setX(this.scaledCanvas.width - 2 - (this.luckText.displayWidth + 2));
this.tweens.add({
targets: labels,
duration: duration,
@ -2093,7 +2085,7 @@ export class BattleScene extends SceneBase {
const enemyModifierCount = this.enemyModifiers.filter(m => m.isIconVisible()).length;
const biomeWaveTextHeight = this.biomeWaveText.getBottomLeft().y - this.biomeWaveText.getTopLeft().y;
this.biomeWaveText.setY(
-(this.game.canvas.height / 6) +
-this.scaledCanvas.height +
(enemyModifierCount ? (enemyModifierCount <= 12 ? 15 : 24) : 0) +
biomeWaveTextHeight / 2,
);
@ -2105,7 +2097,7 @@ export class BattleScene extends SceneBase {
const offsetY = (this.scoreText.visible ? this.scoreText : this.moneyText).y + 15;
this.partyExpBar.setY(offsetY);
this.candyBar.setY(offsetY + 15);
this.ui?.achvBar.setY(this.game.canvas.height / 6 + offsetY);
this.ui?.achvBar.setY(this.scaledCanvas.height + offsetY);
}
/**

View File

@ -16,7 +16,6 @@ interface BaseStatsOverlaySettings {
const HEIGHT = 120;
const BORDER = 8;
const GLOBAL_SCALE = 6;
const shortStats = ["HP", "ATK", "DEF", "SPATK", "SPDEF", "SPD"];
export class BaseStatsOverlay extends Phaser.GameObjects.Container implements InfoToggle {
@ -109,7 +108,7 @@ export class BaseStatsOverlay extends Phaser.GameObjects.Container implements In
// width of this element
static getWidth(_scale: number): number {
return globalScene.game.canvas.width / GLOBAL_SCALE / 2;
return globalScene.scaledCanvas.width / 2;
}
// height of this element

View File

@ -553,7 +553,7 @@ export class ModifierSelectUiHandler extends AwaitableUiHandler {
// Continue button when no shop items
this.cursorObj.setScale(1.25);
this.cursorObj.setPosition(
globalScene.game.canvas.width / 18 + 23,
globalScene.scaledCanvas.width / 3 + 23,
-globalScene.scaledCanvas.height / 2 -
(this.shopOptionsRows.length > 1 ? SINGLE_SHOP_ROW_YOFFSET - 2 : DOUBLE_SHOP_ROW_YOFFSET - 2),
);

View File

@ -58,10 +58,10 @@ export class PokedexInfoOverlay extends Phaser.GameObjects.Container implements
this.maskPointOriginY = options?.y || 0;
if (this.maskPointOriginX < 0) {
this.maskPointOriginX += globalScene.game.canvas.width / GLOBAL_SCALE;
this.maskPointOriginX += globalScene.scaledCanvas.width;
}
if (this.maskPointOriginY < 0) {
this.maskPointOriginY += globalScene.game.canvas.height / GLOBAL_SCALE;
this.maskPointOriginY += globalScene.scaledCanvas.height;
}
this.textMaskRect = globalScene.make.graphics();
@ -165,7 +165,7 @@ export class PokedexInfoOverlay extends Phaser.GameObjects.Container implements
// width of this element
static getWidth(): number {
return globalScene.game.canvas.width / GLOBAL_SCALE / 2;
return globalScene.scaledCanvas.width / 2;
}
// height of this element