feat: updated music and background handling to support _form_x type background

This commit is contained in:
Haoyu Xu
2025-10-05 20:26:10 +08:00
parent 49a49e5210
commit 33c7553506
8 changed files with 39 additions and 32 deletions

View File

@@ -158,10 +158,10 @@ const generateMapping = () => {
: operatorInfo.skinName['en-US']
const skinEntry = findSkinEntry(skinTable, name, type)
operator.filename = skinEntry.dynIllustId.replace(/_2$/, '')
operator.fallback_name =
type === 'skin'
? skinEntry.skinId.replace(/@/, '_')
: `${skinEntry.charId}_2`
operator.portrait_filename = type === 'skin'
? skinEntry.skinId.replace(/@/, '_')
: `${skinEntry.charId}_2`
operator.fallback_name = `${operator.portrait_filename}${operator.isSP ? '_sp' : ''}`
const regions = Object.keys(
operator.codename

View File

@@ -73,9 +73,9 @@ const generateAssets = async (name: string) => {
) as string
if (!portraitHubContent) throw new Error('portrait_hub.json not found')
const portraitHub: PortraitHub = JSON.parse(portraitHubContent)
const fallback_name_lowerCase = fallback_name.toLowerCase()
const portrait_filename_lowerCase = operators[name].portrait_filename.toLowerCase()
const portraitItem = portraitHub._sprites.find(
(item) => item.name.toLowerCase() === fallback_name_lowerCase
(item) => item.name.toLowerCase() === portrait_filename_lowerCase
)
if (!portraitItem) throw new Error(`portrait ${fallback_name} not found`)
const portraitAtlas = portraitItem.atlas
@@ -90,7 +90,7 @@ const generateAssets = async (name: string) => {
throw new Error(`portrait ${fallback_name} json not found`)
const portraitJson: PortraitJson = JSON.parse(portraitJsonText)
const item = portraitJson._sprites.find(
(item) => item.name.toLowerCase() === fallback_name_lowerCase
(item) => item.name.toLowerCase() === portrait_filename_lowerCase
)
if (!item) throw new Error(`portrait ${fallback_name} not found`)
const rect = {

View File

@@ -6,6 +6,7 @@ export interface OperatorConfig {
filename: string
logo: string
fallback_name: string
portrait_filename: string
viewport_left: number // should be default to 0 in the future
viewport_right: number
viewport_top: number