feat(aklive2d): added a new variable use_json for json skel

This commit is contained in:
Haoyu Xu
2024-07-16 14:53:21 +08:00
parent e917c37b8b
commit 0abc0832cb
50 changed files with 80 additions and 7 deletions

View File

@@ -220,6 +220,9 @@ async function main() {
}, { }, {
key: "music_mapping", key: "music_mapping",
value: JSON.stringify(musicMapping) value: JSON.stringify(musicMapping)
}, {
key: "use_json",
value: __config.operators[OPERATOR_NAME].use_json
} }
]), envPath) ]), envPath)

View File

@@ -8,4 +8,5 @@ viewport_bottom: 0
invert_filter: false invert_filter: false
codename: codename:
zh-CN: 假日威龙陈 zh-CN: 假日威龙陈
en-US: Ch'en/Chen the Holungday en-US: Ch'en/Chen the Holungday
use_json: false

View File

@@ -9,4 +9,5 @@ invert_filter: false
codename: codename:
zh-CN: 假日威龙陈 zh-CN: 假日威龙陈
en-US: Ch'en/Chen the Holungday en-US: Ch'en/Chen the Holungday
use_json: false
offical_id: "20220345" offical_id: "20220345"

View File

@@ -9,4 +9,5 @@ invert_filter: false
codename: codename:
zh-CN: 万重山 · 假日威龙陈 zh-CN: 万重山 · 假日威龙陈
en-US: Ten Thousand Mountains / Ch'en/Chen the Holungday en-US: Ten Thousand Mountains / Ch'en/Chen the Holungday
use_json: false
offical_id: "202304659" offical_id: "202304659"

View File

@@ -9,4 +9,5 @@ invert_filter: true
codename: codename:
zh-CN: 重岳 zh-CN: 重岳
en-US: Chongyue en-US: Chongyue
use_json: false
offical_id: "202301606" offical_id: "202301606"

View File

@@ -9,4 +9,5 @@ invert_filter: true
codename: codename:
zh-CN: 何处栖 · 重岳 zh-CN: 何处栖 · 重岳
en-US: Alighting / Chongyue en-US: Alighting / Chongyue
use_json: false
offical_id: "202401812" offical_id: "202401812"

View File

@@ -9,4 +9,5 @@ invert_filter: true
codename: codename:
zh-CN: zh-CN:
en-US: Dusk en-US: Dusk
use_json: false
offical_id: "202203263" offical_id: "202203263"

View File

@@ -9,4 +9,5 @@ invert_filter: true
codename: codename:
zh-CN: 染尘烟 · 夕 zh-CN: 染尘烟 · 夕
en-US: Everything is a Miracle / Dusk en-US: Everything is a Miracle / Dusk
use_json: false
offical_id: "20220321" offical_id: "20220321"

View File

@@ -9,4 +9,5 @@ invert_filter: true
codename: codename:
zh-CN: 纯烬艾雅法拉 zh-CN: 纯烬艾雅法拉
en-US: Eyjafjalla the Hvít Aska en-US: Eyjafjalla the Hvít Aska
use_json: false
offical_id: "202307865" offical_id: "202307865"

View File

@@ -9,4 +9,5 @@ invert_filter: false
codename: codename:
zh-CN: 百练嘉维尔 zh-CN: 百练嘉维尔
en-US: Gavial the Invincible en-US: Gavial the Invincible
use_json: false
offical_id: "202208258" offical_id: "202208258"

View File

@@ -9,4 +9,5 @@ invert_filter: false
codename: codename:
zh-CN: 悠然假日 HD26 · 百炼嘉维尔 zh-CN: 悠然假日 HD26 · 百炼嘉维尔
en-US: Holiday HD26 / Gavial the Invincible en-US: Holiday HD26 / Gavial the Invincible
use_json: false
offical_id: "202307886" offical_id: "202307886"

View File

@@ -9,4 +9,5 @@ invert_filter: true
codename: codename:
zh-CN: 夏卉 FA394 · 澄闪 zh-CN: 夏卉 FA394 · 澄闪
en-US: Summer Flowers FA394 / Goldenglow en-US: Summer Flowers FA394 / Goldenglow
use_json: false
offical_id: "202307824" offical_id: "202307824"

View File

@@ -9,4 +9,5 @@ invert_filter: true
codename: codename:
zh-CN: 燃烧天穹下 · 伊内丝 zh-CN: 燃烧天穹下 · 伊内丝
en-US: Under the Flaming Dome / Ines en-US: Under the Flaming Dome / Ines
use_json: false
offical_id: "202404087" offical_id: "202404087"

View File

@@ -9,4 +9,5 @@ invert_filter: false
codename: codename:
zh-CN: 残余 · 凯尔希 zh-CN: 残余 · 凯尔希
en-US: Remnant / Kal'tsit en-US: Remnant / Kal'tsit
use_json: false
offical_id: "202304833" offical_id: "202304833"

View File

@@ -9,4 +9,5 @@ invert_filter: true
codename: codename:
zh-CN: 手到牌来 · 老鲤 zh-CN: 手到牌来 · 老鲤
en-US: Trust Your Eyes / Lee en-US: Trust Your Eyes / Lee
use_json: false
offical_id: "202210279" offical_id: "202210279"

View File

@@ -9,4 +9,5 @@ invert_filter: true
codename: codename:
zh-CN: 列瑶台 · 林 zh-CN: 列瑶台 · 林
en-US: Heavenly Mirage / Lin en-US: Heavenly Mirage / Lin
use_json: false
offical_id: "202401034" offical_id: "202401034"

View File

@@ -9,4 +9,5 @@ invert_filter: true
codename: codename:
zh-CN: zh-CN:
en-US: Ling en-US: Ling
use_json: false
offical_id: "20220383" offical_id: "20220383"

View File

@@ -9,4 +9,5 @@ invert_filter: true
codename: codename:
zh-CN: 濯缨 · 令 zh-CN: 濯缨 · 令
en-US: It Does Wash the Strings / Ling en-US: It Does Wash the Strings / Ling
use_json: false
offical_id: "202301647" offical_id: "202301647"

View File

@@ -9,4 +9,5 @@ invert_filter: true
codename: codename:
zh-CN: 崖高梦远 · 令 zh-CN: 崖高梦远 · 令
en-US: Towering is Cliff of Nostalgia en-US: Towering is Cliff of Nostalgia
use_json: false
offical_id: "202308807" offical_id: "202308807"

View File

@@ -9,4 +9,5 @@ invert_filter: true
codename: codename:
zh-CN: 夏日餮宴 · 水月 zh-CN: 夏日餮宴 · 水月
en-US: Summer Feast / Mizuki en-US: Summer Feast / Mizuki
use_json: false
offical_id: "202211685" offical_id: "202211685"

View File

@@ -9,4 +9,5 @@ invert_filter: true
codename: codename:
zh-CN: 缪尔赛思 zh-CN: 缪尔赛思
en-US: Muelsyse en-US: Muelsyse
use_json: false
offical_id: "202304611" offical_id: "202304611"

View File

@@ -9,4 +9,5 @@ invert_filter: true
codename: codename:
zh-CN: 新枝 · 缪尔赛思 zh-CN: 新枝 · 缪尔赛思
en-US: Young Branch / Muelsyse en-US: Young Branch / Muelsyse
use_json: false
offical_id: "202404090" offical_id: "202404090"

View File

@@ -9,4 +9,5 @@ invert_filter: true
codename: codename:
zh-CN: 远路 · 玛恩纳 zh-CN: 远路 · 玛恩纳
en-US: W Dali / Młynar en-US: W Dali / Młynar
use_json: false
offical_id: "202310850" offical_id: "202310850"

View File

@@ -9,4 +9,5 @@ invert_filter: true
codename: codename:
zh-CN: 耀骑士临光 zh-CN: 耀骑士临光
en-US: Nearl the Radiant Knight en-US: Nearl the Radiant Knight
use_json: false
offical_id: "20220304" offical_id: "20220304"

View File

@@ -9,4 +9,5 @@ invert_filter: true
codename: codename:
zh-CN: 复现荣光 · 耀骑士临光 zh-CN: 复现荣光 · 耀骑士临光
en-US: Relight / Nearl en-US: Relight / Nearl
use_json: false
offical_id: "202210623" offical_id: "202210623"

View File

@@ -9,4 +9,5 @@ invert_filter: true
codename: codename:
zh-CN: zh-CN:
en-US: Nian en-US: Nian
use_json: false
offical_id: "202203231" offical_id: "202203231"

View File

@@ -9,4 +9,5 @@ invert_filter: true
codename: codename:
zh-CN: 乐逍遥 · 年 zh-CN: 乐逍遥 · 年
en-US: Unfettered Freedom / Nian en-US: Unfettered Freedom / Nian
use_json: false
offical_id: "20220362" offical_id: "20220362"

View File

@@ -9,4 +9,5 @@ invert_filter: true
codename: codename:
zh-CN: 今昔须臾之梦 · 异客 zh-CN: 今昔须臾之梦 · 异客
en-US: Dream in a Moment / Passager en-US: Dream in a Moment / Passager
use_json: false
offical_id: "202210664" offical_id: "202210664"

View File

@@ -9,4 +9,5 @@ invert_filter: true
codename: codename:
zh-CN: 焦点 · 傀影 zh-CN: 焦点 · 傀影
en-US: Focus / Phatom en-US: Focus / Phatom
use_json: false
offical_id: "202203222" offical_id: "202203222"

View File

@@ -9,4 +9,5 @@ invert_filter: false
codename: codename:
zh-CN: 字句中的雪原 · 鸿雪 zh-CN: 字句中的雪原 · 鸿雪
en-US: Snowy Plains in Words / Позёмка en-US: Snowy Plains in Words / Позёмка
use_json: false
offical_id: "202302698" offical_id: "202302698"

View File

@@ -9,4 +9,5 @@ invert_filter: true
codename: codename:
zh-CN: 博物 · 焰影苇草 zh-CN: 博物 · 焰影苇草
en-US: Curator / Reed The Flame Shadow en-US: Curator / Reed The Flame Shadow
use_json: false
offical_id: "202401871" offical_id: "202401871"

View File

@@ -0,0 +1,13 @@
filename: dyn_illust_char_1020_reed2_summer#17
logo: logo_dublinn
fallback_name: char_1020_reed2_summer#17
viewport_left: 0
viewport_right: 0
viewport_top: 0
viewport_bottom: 0
invert_filter: true
codename:
zh-CN: 夏卉 FA075 · 焰影苇草
en-US: Summer Flowers FA075 / Reed The Flame Shadow
use_json: true
offical_id: "202407051"

View File

@@ -9,4 +9,5 @@ invert_filter: true
codename: codename:
zh-CN: 迷迭香 zh-CN: 迷迭香
en-US: Rosmontis en-US: Rosmontis
use_json: false
offical_id: "20220378" offical_id: "20220378"

View File

@@ -9,4 +9,5 @@ invert_filter: true
codename: codename:
zh-CN: 拥抱新生 · 迷迭香 zh-CN: 拥抱新生 · 迷迭香
en-US: Become Anew / Rosmontis en-US: Become Anew / Rosmontis
use_json: false
offical_id: "202210632" offical_id: "202210632"

View File

@@ -9,4 +9,5 @@ invert_filter: true
codename: codename:
zh-CN: zh-CN:
en-US: Shu en-US: Shu
use_json: false
offical_id: "202401025" offical_id: "202401025"

View File

@@ -9,4 +9,5 @@ invert_filter: true
codename: codename:
zh-CN: 不融冰 · 银灰 zh-CN: 不融冰 · 银灰
en-US: Never-Melting Ice / SilverAsh en-US: Never-Melting Ice / SilverAsh
use_json: false
offical_id: "202404066" offical_id: "202404066"

View File

@@ -9,4 +9,5 @@ invert_filter: true
codename: codename:
zh-CN: 浊心斯卡蒂 zh-CN: 浊心斯卡蒂
en-US: Skadi the Corrupting Heart en-US: Skadi the Corrupting Heart
use_json: false
offical_id: "20220396" offical_id: "20220396"

View File

@@ -9,4 +9,5 @@ invert_filter: true
codename: codename:
zh-CN: 升华 · 浊心斯卡蒂 zh-CN: 升华 · 浊心斯卡蒂
en-US: Sublimation / Skadi the Corrupting Heart en-US: Sublimation / Skadi the Corrupting Heart
use_json: false
offical_id: "202204205" offical_id: "202204205"

View File

@@ -9,4 +9,5 @@ invert_filter: true
codename: codename:
zh-CN: 红女爵 · 浊心斯卡蒂 zh-CN: 红女爵 · 浊心斯卡蒂
en-US: Red Countess / Skadi the Corrupting Heart en-US: Red Countess / Skadi the Corrupting Heart
use_json: false
offical_id: "202404008" offical_id: "202404008"

View File

@@ -9,4 +9,5 @@ invert_filter: true
codename: codename:
zh-CN: 归溟幽灵鲨 zh-CN: 归溟幽灵鲨
en-US: Specter the Unchained en-US: Specter the Unchained
use_json: false
offical_id: "202204284" offical_id: "202204284"

View File

@@ -9,4 +9,5 @@ invert_filter: true
codename: codename:
zh-CN: 生而为一 · 归溟幽灵鲨 zh-CN: 生而为一 · 归溟幽灵鲨
en-US: Born as One / Specter the Unchained en-US: Born as One / Specter the Unchained
use_json: false
offical_id: "202304670" offical_id: "202304670"

View File

@@ -9,4 +9,5 @@ invert_filter: false
codename: codename:
zh-CN: 缤纷奇境 CW03 · 史尔特尔 zh-CN: 缤纷奇境 CW03 · 史尔特尔
en-US: Colorful Wonderland CW03 / Surtr en-US: Colorful Wonderland CW03 / Surtr
use_json: false
offical_id: "202208297" offical_id: "202208297"

View File

@@ -9,4 +9,5 @@ invert_filter: true
codename: codename:
zh-CN: 缄默德克萨斯 zh-CN: 缄默德克萨斯
en-US: Texas the Omertosa en-US: Texas the Omertosa
use_json: false
offical_id: "202210210" offical_id: "202210210"

View File

@@ -9,4 +9,5 @@ invert_filter: true
codename: codename:
zh-CN: 破翼者 · 缄默德克萨斯 zh-CN: 破翼者 · 缄默德克萨斯
en-US: Wingbreaker / Texas the Omertosa en-US: Wingbreaker / Texas the Omertosa
use_json: false
offical_id: "202310899" offical_id: "202310899"

View File

@@ -9,4 +9,5 @@ invert_filter: true
codename: codename:
zh-CN: 塑心 zh-CN: 塑心
en-US: Virtuosa en-US: Virtuosa
use_json: false
offical_id: "202310848" offical_id: "202310848"

View File

@@ -9,4 +9,5 @@ invert_filter: true
codename: codename:
zh-CN: W zh-CN: W
en-US: W en-US: W
use_json: false
offical_id: "20220319" offical_id: "20220319"

View File

@@ -9,4 +9,5 @@ invert_filter: true
codename: codename:
zh-CN: 恍惚 · W zh-CN: 恍惚 · W
en-US: Wonder / W en-US: Wonder / W
use_json: false
offical_id: "202206246" offical_id: "202206246"

View File

@@ -9,4 +9,5 @@ invert_filter: true
codename: codename:
zh-CN: 维什戴尔 zh-CN: 维什戴尔
en-US: Wisadel en-US: Wisadel
use_json: false
offical_id: "202404049" offical_id: "202404049"

View File

@@ -43,14 +43,20 @@ export default class AssetsProcessor {
const croppedBuffer = await this.#alphaCompositer.crop(portraitBuffer, rect) const croppedBuffer = await this.#alphaCompositer.crop(portraitBuffer, rect)
await write(croppedBuffer, path.join(this.#operatorSourceFolder, this.#operatorName, `${fallback_name}_portrait.png`)) await write(croppedBuffer, path.join(this.#operatorSourceFolder, this.#operatorName, `${fallback_name}_portrait.png`))
return await this.generateAssets(__config.operators[this.#operatorName].filename, extractedDir) return await this.generateAssets(__config.operators[this.#operatorName].filename, extractedDir, __config.operators[this.#operatorName].use_json)
} }
async generateAssets(filename, extractedDir) { async generateAssets(filename, extractedDir, useJSON=false) {
const BASE64_BINARY_PREFIX = 'data:application/octet-stream;base64,' const BASE64_BINARY_PREFIX = 'data:application/octet-stream;base64,'
const BASE64_PNG_PREFIX = 'data:image/png;base64,' const BASE64_PNG_PREFIX = 'data:image/png;base64,'
const assetsJson = {} const assetsJson = {}
const skelFilename = `${filename}.skel`
let skelFilename;
if (useJSON) {
skelFilename = `${filename}.json`
} else {
skelFilename = `${filename}.skel`
}
const skel = await read(path.join(extractedDir, skelFilename), null) const skel = await read(path.join(extractedDir, skelFilename), null)
const atlasFilename = `${filename}.atlas` const atlasFilename = `${filename}.atlas`
const atlas = await read(path.join(extractedDir, atlasFilename)) const atlas = await read(path.join(extractedDir, atlasFilename))

View File

@@ -9,8 +9,7 @@ let isPlayingInteract = false;
export default function spinePlayer(el) { export default function spinePlayer(el) {
el.hidden = false el.hidden = false
return new spine.SpinePlayer(el, { const playerConfig = {
skelUrl: `./assets/${import.meta.env.VITE_FILENAME}.skel`,
atlasUrl: `./assets/${import.meta.env.VITE_FILENAME}.atlas`, atlasUrl: `./assets/${import.meta.env.VITE_FILENAME}.atlas`,
rawDataURIs: assets, rawDataURIs: assets,
premultipliedAlpha: true, premultipliedAlpha: true,
@@ -62,5 +61,11 @@ export default function spinePlayer(el) {
window.settings.success() window.settings.success()
window.music.success() window.music.success()
}, },
}) }
if (import.meta.env.VITE_USE_JSON === "true") {
playerConfig.jsonUrl = `./assets/${import.meta.env.VITE_FILENAME}.json`
} else {
playerConfig.skelUrl = `./assets/${import.meta.env.VITE_FILENAME}.skel`
}
return new spine.SpinePlayer(el, playerConfig)
} }