Use bitmap text for modifier text for optimization

pull/70/head
Flashfyre 2024-04-09 13:59:46 -04:00
parent b48dd1c7fc
commit eff64db70e
4 changed files with 9 additions and 17 deletions

BIN
public/fonts/item-count.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 607 B

View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><font><info face="item-count" size="11" bold="0" italic="0" charset="" unicode="1" stretchH="100" smooth="1" aa="1" padding="0,0,0,0" spacing="0,0"/><common lineHeight="11" base="8" scaleW="23" scaleH="27" pages="1" packed="0"/><pages><page id="0" file="item-count.png"/></pages><chars count="11"><char id="32" x="0" y="0" width="0" height="0" xoffset="0" yoffset="0" xadvance="3" page="0" chnl="15"/><!-- --><char id="48" x="0" y="0" width="6" height="9" xoffset="-1" yoffset="0" xadvance="5" page="0" chnl="15"/><!-- 0 --><char id="49" x="6" y="0" width="5" height="9" xoffset="-1" yoffset="0" xadvance="5" page="0" chnl="15"/><!-- 1 --><char id="50" x="11" y="0" width="6" height="9" xoffset="-1" yoffset="0" xadvance="5" page="0" chnl="15"/><!-- 2 --><char id="51" x="17" y="0" width="6" height="9" xoffset="-1" yoffset="0" xadvance="5" page="0" chnl="15"/><!-- 3 --><char id="52" x="0" y="9" width="6" height="9" xoffset="-1" yoffset="0" xadvance="5" page="0" chnl="15"/><!-- 4 --><char id="53" x="0" y="18" width="6" height="9" xoffset="-1" yoffset="0" xadvance="5" page="0" chnl="15"/><!-- 5 --><char id="54" x="6" y="9" width="6" height="9" xoffset="-1" yoffset="0" xadvance="5" page="0" chnl="15"/><!-- 6 --><char id="55" x="6" y="18" width="6" height="9" xoffset="-1" yoffset="0" xadvance="5" page="0" chnl="15"/><!-- 7 --><char id="56" x="12" y="9" width="6" height="9" xoffset="-1" yoffset="0" xadvance="5" page="0" chnl="15"/><!-- 8 --><char id="57" x="12" y="18" width="6" height="9" xoffset="-1" yoffset="0" xadvance="5" page="0" chnl="15"/><!-- 9 --></chars></font>

View File

@ -129,6 +129,9 @@ export class LoadingScene extends SceneBase {
} }
}); });
// Load bitmap fonts
this.load.bitmapFont('item-count', 'fonts/item-count.png', 'fonts/item-count.xml');
// Load trainer images // Load trainer images
this.loadAtlas('trainer_m_back', 'trainer'); this.loadAtlas('trainer_m_back', 'trainer');
this.loadAtlas('trainer_m_back_pb', 'trainer'); this.loadAtlas('trainer_m_back_pb', 'trainer');

View File

@ -183,26 +183,14 @@ export abstract class PersistentModifier extends Modifier {
return container; return container;
} }
getIconStackText(scene: BattleScene, virtual?: boolean): Phaser.GameObjects.Text { getIconStackText(scene: BattleScene, virtual?: boolean): Phaser.GameObjects.BitmapText {
if (this.getMaxStackCount(scene) === 1 || (virtual && !this.virtualStackCount)) if (this.getMaxStackCount(scene) === 1 || (virtual && !this.virtualStackCount))
return null; return null;
const isStackMax = this.getStackCount() >= this.getMaxStackCount(scene); const text = scene.add.bitmapText(10, 15, 'item-count', this.stackCount.toString(), 11);
const maxColor = '#f89890'; text.letterSpacing = -0.5;
const maxStrokeColor = '#984038'; if (this.getStackCount() >= this.getMaxStackCount(scene))
text.setTint(0xf89890)
if (virtual) {
const virtualText = addTextObject(scene, 27, 12, `+${this.virtualStackCount.toString()}`, TextStyle.PARTY, { fontSize: '66px', color: !isStackMax ? '#40c8f8' : maxColor });
virtualText.setShadow(0, 0, null);
virtualText.setStroke(!isStackMax ? '#006090' : maxStrokeColor, 16)
virtualText.setOrigin(1, 0);
return virtualText;
}
const text = addTextObject(scene, 8, 12, this.stackCount.toString(), TextStyle.PARTY, { fontSize: '66px', color: !isStackMax ? '#f8f8f8' : maxColor });
text.setShadow(0, 0, null);
text.setStroke('#424242', 16);
text.setOrigin(0, 0); text.setOrigin(0, 0);
return text; return text;