Add fourth sequential asset expansion batch
BIN
src/assets/images/portraits/guan-yu-campaign.png
Normal file
|
After Width: | Height: | Size: 2.6 MiB |
BIN
src/assets/images/portraits/liu-bei-campaign.png
Normal file
|
After Width: | Height: | Size: 2.2 MiB |
BIN
src/assets/images/portraits/ma-dai.png
Normal file
|
After Width: | Height: | Size: 2.3 MiB |
BIN
src/assets/images/portraits/zhang-fei-campaign.png
Normal file
|
After Width: | Height: | Size: 2.5 MiB |
BIN
src/assets/images/portraits/zhuge-liang-campaign.png
Normal file
|
After Width: | Height: | Size: 2.3 MiB |
BIN
src/assets/images/story/55-yellow-pursuit-ambush.png
Normal file
|
After Width: | Height: | Size: 2.7 MiB |
BIN
src/assets/images/story/56-yellow-pursuit-village-relief.png
Normal file
|
After Width: | Height: | Size: 3.1 MiB |
BIN
src/assets/images/story/57-wolong-straw-boats.png
Normal file
|
After Width: | Height: | Size: 2.4 MiB |
BIN
src/assets/images/story/58-red-cliffs-wind-prayer.png
Normal file
|
After Width: | Height: | Size: 2.8 MiB |
BIN
src/assets/images/story/59-yiling-baidi-mountain-retreat.png
Normal file
|
After Width: | Height: | Size: 2.8 MiB |
BIN
src/assets/images/story/60-maicheng-isolation-snow-road.png
Normal file
|
After Width: | Height: | Size: 2.7 MiB |
BIN
src/assets/images/story/61-yiling-fire-attack-riverbank.png
Normal file
|
After Width: | Height: | Size: 2.6 MiB |
BIN
src/assets/images/story/62-hanzhong-rain-night-watch.png
Normal file
|
After Width: | Height: | Size: 2.5 MiB |
BIN
src/assets/images/story/63-weishui-northbank-cavalry-screen.png
Normal file
|
After Width: | Height: | Size: 2.7 MiB |
BIN
src/assets/images/story/64-nanzhong-forest-council.png
Normal file
|
After Width: | Height: | Size: 2.7 MiB |
BIN
src/assets/images/units/unit-nanman-officer-warlord-actions.png
Normal file
|
After Width: | Height: | Size: 1.5 MiB |
BIN
src/assets/images/units/unit-nanman-officer-warlord.png
Normal file
|
After Width: | Height: | Size: 1.3 MiB |
BIN
src/assets/images/units/unit-shu-spearman-veteran-actions.png
Normal file
|
After Width: | Height: | Size: 1.2 MiB |
BIN
src/assets/images/units/unit-shu-spearman-veteran.png
Normal file
|
After Width: | Height: | Size: 1.1 MiB |
BIN
src/assets/images/units/unit-wei-strategist-blue-actions.png
Normal file
|
After Width: | Height: | Size: 1.4 MiB |
BIN
src/assets/images/units/unit-wei-strategist-blue.png
Normal file
|
After Width: | Height: | Size: 1.2 MiB |
BIN
src/assets/images/units/unit-wu-officer-river-actions.png
Normal file
|
After Width: | Height: | Size: 1.2 MiB |
BIN
src/assets/images/units/unit-wu-officer-river.png
Normal file
|
After Width: | Height: | Size: 1.2 MiB |
@@ -65,6 +65,16 @@ export function portraitTextureKey(key: string) {
|
||||
return portraitAssets[slug] ? `portrait-${slug}` : undefined;
|
||||
}
|
||||
|
||||
export function portraitTextureKeysForKey(key: string) {
|
||||
const slug = portraitSlugForKey(key);
|
||||
const prefix = `${slug}-`;
|
||||
const slugs = Object.keys(portraitAssets)
|
||||
.filter((candidate) => candidate === slug || candidate.startsWith(prefix))
|
||||
.sort();
|
||||
|
||||
return Array.from(new Set(slugs.map((candidate) => `portrait-${candidate}`)));
|
||||
}
|
||||
|
||||
export function portraitKeyForSpeaker(speaker?: string) {
|
||||
return speaker ? speakerPortraitKeys[speaker] : undefined;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Phaser from 'phaser';
|
||||
import { soundDirector } from '../audio/SoundDirector';
|
||||
import { portraitKeyForSpeaker, portraitTextureKey } from '../data/portraitAssets';
|
||||
import { portraitKeyForSpeaker, portraitTextureKeysForKey } from '../data/portraitAssets';
|
||||
import { storyBackgroundAssets, storyBackgroundKeysFor } from '../data/storyAssets';
|
||||
import { prologuePages, type PortraitKey, type StoryPage } from '../data/scenario';
|
||||
import { palette } from '../ui/palette';
|
||||
@@ -238,8 +238,7 @@ export class StoryScene extends Phaser.Scene {
|
||||
this.applyBackground(page);
|
||||
this.chapterText?.setText(page.chapter);
|
||||
|
||||
const portraitKey = this.pagePortraitKey(page);
|
||||
const textureKey = portraitKey ? portraitTextureKey(portraitKey) : undefined;
|
||||
const textureKey = this.pagePortraitTextureKey(page);
|
||||
|
||||
if (textureKey && this.textures.exists(textureKey)) {
|
||||
this.portraitFrame?.setVisible(true);
|
||||
@@ -268,6 +267,20 @@ export class StoryScene extends Phaser.Scene {
|
||||
return page.portrait ?? portraitKeyForSpeaker(page.speaker);
|
||||
}
|
||||
|
||||
private pagePortraitTextureKey(page: StoryPage) {
|
||||
const portraitKey = this.pagePortraitKey(page);
|
||||
if (!portraitKey) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const keys = portraitTextureKeysForKey(portraitKey).filter((key) => this.textures.exists(key));
|
||||
if (keys.length <= 1) {
|
||||
return keys[0];
|
||||
}
|
||||
|
||||
return keys[this.hashString(page.id) % keys.length];
|
||||
}
|
||||
|
||||
private pageBackgroundKey(page: StoryPage) {
|
||||
const keys = storyBackgroundKeysFor(page.background).filter((key) => this.textures.exists(key));
|
||||
if (keys.length <= 1) {
|
||||
|
||||