Add tactical battle UI icons
This commit is contained in:
57
src/game/data/battleUiIcons.ts
Normal file
57
src/game/data/battleUiIcons.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
import Phaser from 'phaser';
|
||||
|
||||
import battleUiIconsUrl from '../../assets/images/ui/battle-ui-icons.png';
|
||||
|
||||
export const battleUiIconTextureKey = 'battle-ui-icons';
|
||||
export const battleUiIconFrameSize = 48;
|
||||
|
||||
export const battleUiIconFrames = {
|
||||
hp: 0,
|
||||
might: 1,
|
||||
intelligence: 2,
|
||||
leadership: 3,
|
||||
attack: 4,
|
||||
defense: 5,
|
||||
move: 6,
|
||||
mastery: 7,
|
||||
sword: 8,
|
||||
spear: 9,
|
||||
axe: 10,
|
||||
bow: 11,
|
||||
strategy: 12,
|
||||
horse: 13,
|
||||
armor: 14,
|
||||
accessory: 15,
|
||||
hit: 16,
|
||||
critical: 17,
|
||||
terrain: 18,
|
||||
counter: 19,
|
||||
advantage: 20,
|
||||
success: 21
|
||||
} as const;
|
||||
|
||||
export type BattleUiIconKey = keyof typeof battleUiIconFrames;
|
||||
|
||||
export const battleUiIconManifest = {
|
||||
source: 'src/assets/images/ui/battle-ui-icons.png',
|
||||
textureKey: battleUiIconTextureKey,
|
||||
frameWidth: battleUiIconFrameSize,
|
||||
frameHeight: battleUiIconFrameSize,
|
||||
columns: 5,
|
||||
rows: 5,
|
||||
frames: battleUiIconFrames
|
||||
} as const;
|
||||
|
||||
export function loadBattleUiIcons(scene: Phaser.Scene, onReady: () => void) {
|
||||
if (scene.textures.exists(battleUiIconTextureKey)) {
|
||||
onReady();
|
||||
return;
|
||||
}
|
||||
|
||||
scene.load.once('complete', onReady);
|
||||
scene.load.spritesheet(battleUiIconTextureKey, battleUiIconsUrl, {
|
||||
frameWidth: battleUiIconFrameSize,
|
||||
frameHeight: battleUiIconFrameSize
|
||||
});
|
||||
scene.load.start();
|
||||
}
|
||||
Reference in New Issue
Block a user