feat(aklive2d): many changes
- generalized env_generator - fixed content_processor - updated config to add fields - removed redundant fields in config
This commit is contained in:
@@ -5,7 +5,7 @@ export function appendReadme(operatorName) {
|
||||
const operatorConfig = __config.operators[operatorName]
|
||||
const projectJson = JSON.parse(readSync(path.join(__projetRoot, __config.folder.operator, operatorName, 'project.json')))
|
||||
appendSync(
|
||||
`\n| ${operatorConfig.title.split(' - ')[0].split('Arknights: ')[1]} | [Link](https://arknights.halyul.dev/${operatorConfig.link}/?settings) | [Link](https://steamcommunity.com/sharedfiles/filedetails/?id=${projectJson.workshopid}) |`,
|
||||
`\n| ${operatorConfig.codename["en-US"]} | [Link](https://arknights.halyul.dev/${operatorConfig.link}/?settings) | [Link](https://steamcommunity.com/sharedfiles/filedetails/?id=${projectJson.workshopid}) |`,
|
||||
path.join(__projetRoot, 'README.md')
|
||||
)
|
||||
}
|
||||
|
||||
@@ -2,5 +2,19 @@ import path from 'path'
|
||||
import { read } from './yaml.js'
|
||||
|
||||
export default function () {
|
||||
return read(path.join(__projetRoot, 'config.yaml'))
|
||||
return process(read(path.join(__projetRoot, 'config.yaml')))
|
||||
}
|
||||
|
||||
function process(config) {
|
||||
for (const [operatorName, operator] of Object.entries(config.operators)) {
|
||||
// add title
|
||||
operator.title = `${config.share.title["en-US"]}${operator.codename["en-US"]} - ${config.share.title["zh-CN"]}${operator.codename["zh-CN"]}`
|
||||
// add type
|
||||
operator.type = operator.codename["zh-CN"].includes('·') ? 'operator' : 'skin'
|
||||
|
||||
// add link
|
||||
operator.link = operatorName
|
||||
}
|
||||
|
||||
return config
|
||||
}
|
||||
@@ -1,6 +1,3 @@
|
||||
import path from 'path'
|
||||
import { readSync } from "./file.js"
|
||||
|
||||
export default class Matcher {
|
||||
#start
|
||||
#end
|
||||
@@ -57,9 +54,9 @@ class Evalable {
|
||||
|
||||
#step(location, varName) {
|
||||
let content = this.#config
|
||||
if (location === 'assets') content = this.#assets
|
||||
varName.split("->").forEach((item) => {
|
||||
try {
|
||||
if (location === 'assets') content = this.#assets
|
||||
content = content[item]
|
||||
} catch (e) {
|
||||
throw new Error(`Cannot step ${varName}.`)
|
||||
|
||||
@@ -1,31 +1,8 @@
|
||||
export default class EnvGenerator {
|
||||
#assets
|
||||
#operatorConfig
|
||||
|
||||
constructor(operatorName, assets) {
|
||||
this.#operatorConfig = __config.operators[operatorName]
|
||||
this.#assets = assets
|
||||
}
|
||||
|
||||
generate() {
|
||||
return [
|
||||
`VITE_LINK="${this.#operatorConfig.link}"`,
|
||||
`VITE_VERSION=${__config.version}`,
|
||||
`VITE_TITLE="${this.#operatorConfig.title}"`,
|
||||
`VITE_FILENAME=${this.#operatorConfig.filename.replace('#', '%23')}`,
|
||||
`VITE_LOGO_FILENAME=${this.#operatorConfig.logo}`,
|
||||
`VITE_FALLBACK_FILENAME=${this.#operatorConfig.fallback_name.replace('#', '%23')}`,
|
||||
`VITE_VIEWPORT_LEFT=${this.#operatorConfig.viewport_left}`,
|
||||
`VITE_VIEWPORT_RIGHT=${this.#operatorConfig.viewport_right}`,
|
||||
`VITE_VIEWPORT_TOP=${this.#operatorConfig.viewport_top}`,
|
||||
`VITE_VIEWPORT_BOTTOM=${this.#operatorConfig.viewport_bottom}`,
|
||||
`VITE_INVERT_FILTER=${this.#operatorConfig.invert_filter}`,
|
||||
`VITE_IMAGE_WIDTH=2048`,
|
||||
`VITE_IMAGE_HEIGHT=2048`,
|
||||
`VITE_BACKGROUND_FILES=${JSON.stringify(this.#assets.backgrounds)}`,
|
||||
`VITE_BACKGROUND_FOLDER=${__config.folder.background}`,
|
||||
`VITE_VOICE_FOLDERS=${JSON.stringify(__config.folder.voice)}`,
|
||||
].join('\n')
|
||||
generate(values) {
|
||||
return values.map((value) => {
|
||||
return `VITE_${value.key.toUpperCase()}=${value.value}`
|
||||
}).join('\n')
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user