mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-25 00:06:18 +00:00
Use bitmap text for modifier text for optimization
This commit is contained in:
parent
b48dd1c7fc
commit
eff64db70e
BIN
public/fonts/item-count.png
Normal file
BIN
public/fonts/item-count.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 607 B |
1
public/fonts/item-count.xml
Normal file
1
public/fonts/item-count.xml
Normal 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>
|
@ -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
|
||||
this.loadAtlas('trainer_m_back', 'trainer');
|
||||
this.loadAtlas('trainer_m_back_pb', 'trainer');
|
||||
|
@ -183,26 +183,14 @@ export abstract class PersistentModifier extends Modifier {
|
||||
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))
|
||||
return null;
|
||||
|
||||
const isStackMax = this.getStackCount() >= this.getMaxStackCount(scene);
|
||||
const maxColor = '#f89890';
|
||||
const maxStrokeColor = '#984038';
|
||||
|
||||
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);
|
||||
const text = scene.add.bitmapText(10, 15, 'item-count', this.stackCount.toString(), 11);
|
||||
text.letterSpacing = -0.5;
|
||||
if (this.getStackCount() >= this.getMaxStackCount(scene))
|
||||
text.setTint(0xf89890)
|
||||
text.setOrigin(0, 0);
|
||||
|
||||
return text;
|
||||
|
Loading…
Reference in New Issue
Block a user