Approve Shu infantry handpainted sprite v8

This commit is contained in:
2026-07-01 10:40:38 +09:00
parent 7b27d7aa9a
commit 199bc47192
51 changed files with 10323 additions and 1 deletions

View File

@@ -6,6 +6,7 @@ import { defaultBattleScenario, getBattleScenario, type BattleObjectiveDefinitio
import { getTerrainRule, getUnitClass, type TerrainType, type UnitClassKey } from '../data/battleRules';
import {
ensureUnitAnimations,
hasUnitSheetAsset,
loadUnitSheets,
unitBaseFramesPerDirection,
unitTextureVariantKeys as unitAssetTextureVariantKeys,
@@ -2995,6 +2996,7 @@ export class BattleScene extends Phaser.Scene {
this.drawMap();
this.drawUnits();
this.drawSidePanel();
this.drawDebugSpritePreview();
this.updateTurnText();
this.time.delayedCall(180, () => this.showOpeningBattleEvent());
this.renderRosterPanel('ally', '행동할 장수를 선택하세요.');
@@ -3038,7 +3040,7 @@ export class BattleScene extends Phaser.Scene {
}
private ensureScenarioUnitTextures(onReady: () => void) {
const textureKeys = Array.from(new Set(battleUnits.map((unit) => this.unitTextureKey(unit))));
const textureKeys = Array.from(new Set([...battleUnits.map((unit) => this.unitTextureKey(unit)), ...this.debugSpritePreviewKeys()]));
const texturesReady = textureKeys.every((key) => this.textures.exists(key) && this.textures.exists(`${key}-actions`));
if (texturesReady) {
@@ -3070,6 +3072,19 @@ export class BattleScene extends Phaser.Scene {
});
}
private debugSpritePreviewKeys() {
const key = this.debugSpritePreviewKey();
return key ? [key] : [];
}
private debugSpritePreviewKey() {
if (!this.debugToolsEnabled() || typeof window === 'undefined') {
return undefined;
}
const key = new URLSearchParams(window.location.search).get('debugSpritePreview')?.trim();
return key && hasUnitSheetAsset(key) ? key : undefined;
}
private resetBattleData(campaign?: CampaignState) {
const selected = new Set(campaign?.selectedSortieUnitIds ?? []);
const forcedAllyIds = new Set(
@@ -3281,6 +3296,64 @@ export class BattleScene extends Phaser.Scene {
this.drawMiniMap();
}
private drawDebugSpritePreview() {
const textureKey = this.debugSpritePreviewKey();
if (!textureKey) {
return;
}
const { panelX, panelY, panelWidth, panelHeight } = this.layout;
const left = panelX + 24;
const miniMapTop = this.miniMapLayout?.y ?? panelY + panelHeight - 156;
const top = Math.max(panelY + 212, miniMapTop - 148);
const width = panelWidth - 48;
const height = 128;
const depth = 42;
const panel = this.add.rectangle(left, top, width, height, 0x0b1118, 0.96);
panel.setOrigin(0);
panel.setDepth(depth);
panel.setStrokeStyle(1, palette.gold, 0.78);
this.add.text(left + 12, top + 10, `Debug sprite preview: ${textureKey}`, {
fontFamily: 'Consolas, monospace',
fontSize: '12px',
color: '#f4dfad'
}).setDepth(depth + 1);
const idle72 = this.add.sprite(left + 48, top + 78, textureKey, this.unitFrameIndex('south'));
idle72.setDisplaySize(72, 72);
idle72.setDepth(depth + 1);
this.applyBaseSpriteBlend(idle72);
const idle50 = this.add.sprite(left + 120, top + 88, textureKey, this.unitFrameIndex('south'));
idle50.setDisplaySize(50, 50);
idle50.setDepth(depth + 1);
this.applyBaseSpriteBlend(idle50);
const action = this.add.sprite(
left + 196,
top + 76,
`${textureKey}-actions`,
this.unitActionFrameIndex('east', 'attack', this.unitActionImpactFrame('attack'))
);
action.setDisplaySize(78, 78);
action.setDepth(depth + 1);
this.applyActionSpriteBlend(action);
[
{ label: '72px', x: left + 24 },
{ label: '50px', x: left + 104 },
{ label: 'action', x: left + 174 }
].forEach(({ label, x }) => {
this.add.text(x, top + 112, label, {
fontFamily: 'Consolas, monospace',
fontSize: '10px',
color: '#d4dce6'
}).setDepth(depth + 1);
});
}
update(_time: number, delta: number) {
this.updateEdgeScroll(delta);
}