Show completed campaign state on title screen
This commit is contained in:
@@ -199,16 +199,53 @@ export class TitleScene extends Phaser.Scene {
|
||||
const compact = width < 720;
|
||||
const menuX = compact ? width / 2 : width - 318;
|
||||
const menuY = height * (compact ? 0.36 : 0.43);
|
||||
|
||||
const plate = this.add.rectangle(menuX, menuY, 250, 252, 0x111821, 0.66);
|
||||
plate.setStrokeStyle(1, palette.gold, 0.45);
|
||||
this.add.rectangle(menuX, menuY - 126, 186, 2, palette.gold, 0.7);
|
||||
this.add.rectangle(menuX, menuY + 126, 186, 2, palette.gold, 0.36);
|
||||
|
||||
const canContinue = hasCampaignSave();
|
||||
const campaign = canContinue ? loadCampaignState() : undefined;
|
||||
const isEndingComplete = campaign?.step === 'ending-complete';
|
||||
const plateHeight = isEndingComplete ? 324 : 252;
|
||||
|
||||
const plate = this.add.rectangle(menuX, menuY, 250, plateHeight, 0x111821, 0.66);
|
||||
plate.setStrokeStyle(1, palette.gold, 0.45);
|
||||
this.add.rectangle(menuX, menuY - plateHeight / 2, 186, 2, palette.gold, 0.7);
|
||||
this.add.rectangle(menuX, menuY + plateHeight / 2, 186, 2, palette.gold, 0.36);
|
||||
|
||||
this.createMenuButton(menuX, menuY - 70, '새 게임', true, () => this.startGame());
|
||||
this.createMenuButton(menuX, menuY, '이어하기', canContinue, () => this.continueGame());
|
||||
this.createMenuButton(menuX, menuY, isEndingComplete ? '엔딩 보기' : '이어하기', canContinue, () => this.continueGame());
|
||||
this.createMenuButton(menuX, menuY + 70, '설정', true, () => this.openSettingsPanel(menuX, menuY));
|
||||
|
||||
if (isEndingComplete && campaign) {
|
||||
this.drawCampaignCompleteBadge(menuX, menuY + 132, campaign);
|
||||
}
|
||||
}
|
||||
|
||||
private drawCampaignCompleteBadge(x: number, y: number, campaign: ReturnType<typeof loadCampaignState>) {
|
||||
const completedBattles = Object.keys(campaign.battleHistory).length;
|
||||
const rosterCount = campaign.roster.length;
|
||||
const badge = this.add.container(x, y);
|
||||
const background = this.add.rectangle(0, 0, 210, 58, 0x21180f, 0.92);
|
||||
background.setStrokeStyle(1, palette.gold, 0.52);
|
||||
|
||||
const title = this.add.text(0, -14, '완결 저장', {
|
||||
fontFamily: '"Malgun Gothic", "Noto Sans KR", sans-serif',
|
||||
fontSize: '18px',
|
||||
color: '#f6e6bd',
|
||||
fontStyle: '700',
|
||||
fixedWidth: 190,
|
||||
align: 'center',
|
||||
padding: { top: 3, bottom: 3 }
|
||||
});
|
||||
title.setOrigin(0.5);
|
||||
|
||||
const detail = this.add.text(0, 14, `${completedBattles}전 완수 · ${rosterCount}명 합류`, {
|
||||
fontFamily: '"Malgun Gothic", "Noto Sans KR", sans-serif',
|
||||
fontSize: '14px',
|
||||
color: '#d8b15f',
|
||||
fixedWidth: 190,
|
||||
align: 'center'
|
||||
});
|
||||
detail.setOrigin(0.5);
|
||||
|
||||
badge.add([background, title, detail]);
|
||||
}
|
||||
|
||||
private createMenuButton(
|
||||
|
||||
Reference in New Issue
Block a user