From a61e7caa752bc0070c47b8bb3eb0e07d97e879e9 Mon Sep 17 00:00:00 2001 From: Haoyu Xu Date: Wed, 1 Nov 2023 15:12:17 -0400 Subject: [PATCH] build: updated build assets --- aklive2d.js | 5 +++++ libs/logo_info.js | 29 +++++++++++++++++++++++++++++ package.json | 1 + 3 files changed, 35 insertions(+) create mode 100644 libs/logo_info.js diff --git a/aklive2d.js b/aklive2d.js index 32a20a4..3cf3118 100644 --- a/aklive2d.js +++ b/aklive2d.js @@ -15,6 +15,7 @@ import Background from './libs/background.js' import CharwordTable from './libs/charword_table.js'; import Music from './libs/music.js'; import officalUpdate from './libs/offical_update.js'; +import LogoInfo from './libs/logo_info.js'; async function main() { global.__projectRoot = path.dirname(fileURLToPath(import.meta.url)) @@ -27,6 +28,7 @@ async function main() { const charwordTable = new CharwordTable() const musicTable = new Music() + const logoTable = new LogoInfo() /** * Skip all, no need for OPERATOR_NAME @@ -54,6 +56,9 @@ async function main() { case 'music': await musicTable.process() process.exit(0) + case 'logo': + await logoTable.process() + process.exit(0) case 'offical_update': await officalUpdate() process.exit(0) diff --git a/libs/logo_info.js b/libs/logo_info.js new file mode 100644 index 0000000..b091c32 --- /dev/null +++ b/libs/logo_info.js @@ -0,0 +1,29 @@ +/* eslint-disable no-undef */ +import path from 'path'; +import { writeSync, readSync } from "./file.js" +import Downloader from "./downloader.js" + +export default class LogoInfo { + #downloader = new Downloader() + #sharedPath = path.join(__projectRoot, __config.folder.operator, __config.folder.share) + + async process() { + const logoTable = await this.#download() + const nameFileMapping = {} + Object.keys(logoTable.forceToGroupDict).forEach(key => { + nameFileMapping[logoTable.forceToGroupDict[key]] = `${key}.png`; + }); + // writeSync(JSON.stringify(list, null), path.join(this.#sharedPath, `logo_table.json`)) + } + + async #download() { + const logoTable = await this.#downloader.github(`https://api.github.com/repos/Kengxxiao/ArknightsGameData/commits?path=zh_CN/gamedata/art/handbookpos_table.json`, `https://raw.githubusercontent.com/Kengxxiao/ArknightsGameData/master/zh_CN/gamedata/art/handbookpos_table.json`, path.join(this.#sharedPath, `handbookpos_table.json`)) + return logoTable + } + + lookup() { + const logoTable = JSON.parse(readSync(path.join(this.#sharedPath, `logo_table.json`))) + + + } +} diff --git a/package.json b/package.json index fc4c485..82403e1 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "directory": "node aklive2d directory", "charwords:update": "node aklive2d charwords:update", "charwords:build": "node aklive2d charwords:build", + "logo": "node aklive2d logo", "music": "node aklive2d music", "vite:dev": "vite", "vite:build": "vite build",