feat(showcase): add remaining operator voices
This commit is contained in:
@@ -23,6 +23,8 @@ localization:
|
|||||||
ui_position_padding_top: Padding Top
|
ui_position_padding_top: Padding Top
|
||||||
ui_voice_title: <hr><h4>🔈Voice</h4><hr>
|
ui_voice_title: <hr><h4>🔈Voice</h4><hr>
|
||||||
ui_voice_lang: Voice Language
|
ui_voice_lang: Voice Language
|
||||||
|
ui_voice_idle: Idle Timeout
|
||||||
|
ui_voice_next: Voice Interval
|
||||||
ui_subtitle_title: <hr><h4>📑 Subtitle</h4><hr>
|
ui_subtitle_title: <hr><h4>📑 Subtitle</h4><hr>
|
||||||
ui_subtitle_lang: Subtitle Language
|
ui_subtitle_lang: Subtitle Language
|
||||||
ui_voice_actor_title: <hr><h4>🗣️ Voice Actor</h4><hr>
|
ui_voice_actor_title: <hr><h4>🗣️ Voice Actor</h4><hr>
|
||||||
@@ -49,6 +51,8 @@ localization:
|
|||||||
ui_position_padding_top: 上部距离
|
ui_position_padding_top: 上部距离
|
||||||
ui_voice_title: <hr><h4>🔈语音</h4><hr>
|
ui_voice_title: <hr><h4>🔈语音</h4><hr>
|
||||||
ui_voice_lang: 语音语言
|
ui_voice_lang: 语音语言
|
||||||
|
ui_voice_idle: 待机间隔
|
||||||
|
ui_voice_next: 下一条语音间隔
|
||||||
ui_subtitle_title: <hr><h4>📑 字幕</h4><hr>
|
ui_subtitle_title: <hr><h4>📑 字幕</h4><hr>
|
||||||
ui_subtitle_lang: 字幕语言
|
ui_subtitle_lang: 字幕语言
|
||||||
ui_voice_actor_title: <hr><h4>🗣️ 声优</h4><hr>
|
ui_voice_actor_title: <hr><h4>🗣️ 声优</h4><hr>
|
||||||
@@ -128,15 +132,77 @@ properties:
|
|||||||
text: ui_default_background
|
text: ui_default_background
|
||||||
type: combo
|
type: combo
|
||||||
value: !match ~{var('assets', "backgrounds")[0]}
|
value: !match ~{var('assets', "backgrounds")[0]}
|
||||||
fraction: false
|
options: !match ~{var('assets', "backgroundsOptions")}
|
||||||
max: 100
|
|
||||||
min: 0
|
|
||||||
options: !match ~{var('assets', "backgroundOptions")}
|
|
||||||
- key: background
|
- key: background
|
||||||
value:
|
value:
|
||||||
text: ui_custom_background
|
text: ui_custom_background
|
||||||
type: file
|
type: file
|
||||||
value: ""
|
value: ""
|
||||||
|
- key: voicetitle
|
||||||
|
value:
|
||||||
|
text: ui_voice_title
|
||||||
|
type: bool
|
||||||
|
value: false
|
||||||
|
- key: voicelanguage
|
||||||
|
value:
|
||||||
|
text: ui_voice_lang
|
||||||
|
type: combo
|
||||||
|
condition: voicetitle.value == true
|
||||||
|
value: !match ~{var('assets', "voiceLangs")[0]}
|
||||||
|
options: !match ~{var('assets', "voiceLangsOptions")}
|
||||||
|
- key: voiceidle
|
||||||
|
value:
|
||||||
|
text: ui_voice_idle
|
||||||
|
type: textinput
|
||||||
|
value: 10
|
||||||
|
condition: voicetitle.value == true
|
||||||
|
fraction: false
|
||||||
|
min: 0
|
||||||
|
- key: voicenext
|
||||||
|
value:
|
||||||
|
text: ui_voice_next
|
||||||
|
type: textinput
|
||||||
|
value: 3
|
||||||
|
condition: voicetitle.value == true
|
||||||
|
fraction: false
|
||||||
|
min: 0
|
||||||
|
- key: voicesubtitle
|
||||||
|
value:
|
||||||
|
text: ui_subtitle_title
|
||||||
|
condition: voicetitle.value == true
|
||||||
|
type: bool
|
||||||
|
value: false
|
||||||
|
- key: voicesubtitlelanguage
|
||||||
|
value:
|
||||||
|
text: ui_subtitle_lang
|
||||||
|
type: combo
|
||||||
|
condition: voicesubtitle.value == true
|
||||||
|
value: !match ~{var('assets', "subtitleLangs")[0]}
|
||||||
|
options: !match ~{var('assets', "subtitleLangsOptions")}
|
||||||
|
- key: voicesubtitlex
|
||||||
|
value:
|
||||||
|
text: ui_translate_x
|
||||||
|
type: slider
|
||||||
|
value: 0
|
||||||
|
condition: voicesubtitle.value == true
|
||||||
|
fraction: false
|
||||||
|
max: 100
|
||||||
|
min: 0
|
||||||
|
- key: voicesubtitley
|
||||||
|
value:
|
||||||
|
text: ui_translate_y
|
||||||
|
type: slider
|
||||||
|
value: 100
|
||||||
|
condition: voicesubtitle.value == true
|
||||||
|
fraction: false
|
||||||
|
max: 100
|
||||||
|
min: 0
|
||||||
|
- key: voiceactor
|
||||||
|
value:
|
||||||
|
text: ui_voice_actor_title
|
||||||
|
condition: voicesubtitle.value == true
|
||||||
|
type: bool
|
||||||
|
value: false
|
||||||
- key: position
|
- key: position
|
||||||
value:
|
value:
|
||||||
text: ui_position_title
|
text: ui_position_title
|
||||||
|
|||||||
@@ -23,12 +23,18 @@ export default class ProjectJson {
|
|||||||
this.#json = JSON.parse(await readFile(this.#getPath()))
|
this.#json = JSON.parse(await readFile(this.#getPath()))
|
||||||
const matcher = new Matcher('~{', '}', __config.operators[this.#operatorName], {
|
const matcher = new Matcher('~{', '}', __config.operators[this.#operatorName], {
|
||||||
...this.#assets,
|
...this.#assets,
|
||||||
backgroundOptions: this.#assets.backgrounds.map((b) => {
|
...(() => {
|
||||||
|
const output = {}
|
||||||
|
for (const [key, value] of Object.entries(this.#assets)) {
|
||||||
|
output[`${key}Options`] = value.map((b) => {
|
||||||
return {
|
return {
|
||||||
"label": b,
|
"label": b,
|
||||||
"value": b
|
"value": b
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
return output
|
||||||
|
})()
|
||||||
})
|
})
|
||||||
const match = {
|
const match = {
|
||||||
identify: value => value.startsWith('!match'),
|
identify: value => value.startsWith('!match'),
|
||||||
|
|||||||
31
runner.js
31
runner.js
@@ -75,8 +75,35 @@ async function main() {
|
|||||||
|
|
||||||
rmdir(OPERATOR_RELEASE_FOLDER)
|
rmdir(OPERATOR_RELEASE_FOLDER)
|
||||||
|
|
||||||
|
const charwordTableLookup = charwordTable.lookup(OPERATOR_NAME)
|
||||||
|
const voiceLangs = (() => {
|
||||||
|
const infoArray = Object.values(charwordTableLookup.operator.info[charwordTableLookup.config.default_region])
|
||||||
|
// combine the infoArray
|
||||||
|
let output = {}
|
||||||
|
for (const info of infoArray) {
|
||||||
|
output = {
|
||||||
|
...output,
|
||||||
|
...info
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Object.keys(output)
|
||||||
|
})()
|
||||||
|
const subtitleLangs = (() => {
|
||||||
|
const output = []
|
||||||
|
for (const [key, value] of Object.entries(charwordTableLookup.operator.info)) {
|
||||||
|
if (Object.keys(value).length !== 0) {
|
||||||
|
output.push(key)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return output
|
||||||
|
})()
|
||||||
|
|
||||||
|
writeSync(JSON.stringify(charwordTableLookup), path.join(OPERATOR_SOURCE_FOLDER, OPERATOR_NAME, 'charword_table.json'))
|
||||||
|
|
||||||
const projectJson = new ProjectJson(OPERATOR_NAME, OPERATOR_SHARE_FOLDER, {
|
const projectJson = new ProjectJson(OPERATOR_NAME, OPERATOR_SHARE_FOLDER, {
|
||||||
backgrounds
|
backgrounds,
|
||||||
|
voiceLangs,
|
||||||
|
subtitleLangs
|
||||||
})
|
})
|
||||||
projectJson.load().then((content) => {
|
projectJson.load().then((content) => {
|
||||||
write(JSON.stringify(content, null, 2), path.join(OPERATOR_RELEASE_FOLDER, 'project.json'))
|
write(JSON.stringify(content, null, 2), path.join(OPERATOR_RELEASE_FOLDER, 'project.json'))
|
||||||
@@ -87,8 +114,6 @@ async function main() {
|
|||||||
write(JSON.stringify(content.assetsJson, null), path.join(OPERATOR_SOURCE_FOLDER, OPERATOR_NAME, `assets.json`))
|
write(JSON.stringify(content.assetsJson, null), path.join(OPERATOR_SOURCE_FOLDER, OPERATOR_NAME, `assets.json`))
|
||||||
})
|
})
|
||||||
|
|
||||||
writeSync(JSON.stringify(charwordTable.lookup(OPERATOR_NAME)), path.join(OPERATOR_SOURCE_FOLDER, OPERATOR_NAME, 'charword_table.json'))
|
|
||||||
|
|
||||||
const filesToCopy = [
|
const filesToCopy = [
|
||||||
...background.getFilesToCopy(SHOWCASE_PUBLIC_ASSSETS_FOLDER),
|
...background.getFilesToCopy(SHOWCASE_PUBLIC_ASSSETS_FOLDER),
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ export default class Voice {
|
|||||||
set useSubtitle(show) {
|
set useSubtitle(show) {
|
||||||
this.#useSubtitle = show
|
this.#useSubtitle = show
|
||||||
this.#el.hidden = !show
|
this.#el.hidden = !show
|
||||||
|
window.settings.functionInsights("useSubtitle")
|
||||||
}
|
}
|
||||||
|
|
||||||
get useSubtitle() {
|
get useSubtitle() {
|
||||||
@@ -71,6 +72,7 @@ export default class Voice {
|
|||||||
* @param {boolean} show
|
* @param {boolean} show
|
||||||
*/
|
*/
|
||||||
set useVoice(show) {
|
set useVoice(show) {
|
||||||
|
window.settings.functionInsights("useVoice")
|
||||||
this.#useVoice = show
|
this.#useVoice = show
|
||||||
this.#el.hidden = !show
|
this.#el.hidden = !show
|
||||||
this.#playEntryVoice()
|
this.#playEntryVoice()
|
||||||
@@ -89,6 +91,7 @@ export default class Voice {
|
|||||||
set useVoiceActor(show) {
|
set useVoiceActor(show) {
|
||||||
this.#useVoiceActor = show
|
this.#useVoiceActor = show
|
||||||
document.getElementById('voice_actor_box').hidden = !show
|
document.getElementById('voice_actor_box').hidden = !show
|
||||||
|
window.settings.functionInsights("useVoiceActor")
|
||||||
}
|
}
|
||||||
|
|
||||||
get useVoiceActor() {
|
get useVoiceActor() {
|
||||||
@@ -104,6 +107,7 @@ export default class Voice {
|
|||||||
} else {
|
} else {
|
||||||
this.#subtitleLang = this.#defaultRegion
|
this.#subtitleLang = this.#defaultRegion
|
||||||
}
|
}
|
||||||
|
window.settings.functionInsights("subtitleLanguage")
|
||||||
}
|
}
|
||||||
|
|
||||||
get subtitleLanguage() {
|
get subtitleLanguage() {
|
||||||
@@ -140,6 +144,7 @@ export default class Voice {
|
|||||||
|
|
||||||
#updateSubtitlePosition() {
|
#updateSubtitlePosition() {
|
||||||
window.settings.elementPosition(this.#el, this.#subtitleX, this.#subtitleY)
|
window.settings.elementPosition(this.#el, this.#subtitleX, this.#subtitleY)
|
||||||
|
window.settings.functionInsights("subtitlePosition")
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -151,6 +156,7 @@ export default class Voice {
|
|||||||
} else {
|
} else {
|
||||||
this.#voiceLang = this.#defaultVoiceLang
|
this.#voiceLang = this.#defaultVoiceLang
|
||||||
}
|
}
|
||||||
|
window.settings.functionInsights("language")
|
||||||
const availableSubtitleLang = this.#getSubtitleLanguages()
|
const availableSubtitleLang = this.#getSubtitleLanguages()
|
||||||
if (!availableSubtitleLang.includes(this.#subtitleLang)) {
|
if (!availableSubtitleLang.includes(this.#subtitleLang)) {
|
||||||
this.#subtitleLang = availableSubtitleLang[0]
|
this.#subtitleLang = availableSubtitleLang[0]
|
||||||
@@ -174,6 +180,7 @@ export default class Voice {
|
|||||||
this.#idleDuration = duration * 60 * 1000
|
this.#idleDuration = duration * 60 * 1000
|
||||||
this.#initIdleVoiceTimer()
|
this.#initIdleVoiceTimer()
|
||||||
}
|
}
|
||||||
|
window.settings.functionInsights("idleDuration")
|
||||||
}
|
}
|
||||||
|
|
||||||
get idleDuration() {
|
get idleDuration() {
|
||||||
@@ -189,6 +196,7 @@ export default class Voice {
|
|||||||
this.#nextDuration = duration * 60 * 1000
|
this.#nextDuration = duration * 60 * 1000
|
||||||
this.#initNextVoiceTimer()
|
this.#initNextVoiceTimer()
|
||||||
}
|
}
|
||||||
|
window.settings.functionInsights("nextDuration")
|
||||||
}
|
}
|
||||||
|
|
||||||
get nextDuration() {
|
get nextDuration() {
|
||||||
@@ -227,7 +235,7 @@ export default class Voice {
|
|||||||
if (id === null) {
|
if (id === null) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (this.#isPlaying) return
|
if (this.#isPlaying) return
|
||||||
this.#el.style.opacity = 1
|
this.#el.style.opacity = 0
|
||||||
}, 5 * 1000);
|
}, 5 * 1000);
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -246,7 +254,7 @@ export default class Voice {
|
|||||||
this.#lastVoiceId = this.#currentVoiceId
|
this.#lastVoiceId = this.#currentVoiceId
|
||||||
this.#currentVoiceId = id
|
this.#currentVoiceId = id
|
||||||
this.#audioEl.src = `./assets/${this.#getVoiceFoler()
|
this.#audioEl.src = `./assets/${this.#getVoiceFoler()
|
||||||
}/${id}.wav`
|
}/${id}.ogg`
|
||||||
let startPlayPromise = this.#audioEl.play()
|
let startPlayPromise = this.#audioEl.play()
|
||||||
if (startPlayPromise !== undefined) {
|
if (startPlayPromise !== undefined) {
|
||||||
startPlayPromise
|
startPlayPromise
|
||||||
@@ -365,10 +373,12 @@ export default class Voice {
|
|||||||
<div class="voice-triangle"></div>
|
<div class="voice-triangle"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="voice-actor" id="voice_actor_box" hidden>
|
<div id="voice_actor_box" hidden>
|
||||||
|
<div class="voice-actor">
|
||||||
<span class="voice-actor-icon"></span>
|
<span class="voice-actor-icon"></span>
|
||||||
<span id="voice_actor_name" class="voice-actor-name"></span>
|
<span id="voice_actor_name" class="voice-actor-name"></span>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -44,6 +44,33 @@ window.wallpaperPropertyListener = {
|
|||||||
window.settings.resetBackground()
|
window.settings.resetBackground()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (properties.voicetitle) {
|
||||||
|
window.voice.useVoice = properties.voicetitle.value
|
||||||
|
}
|
||||||
|
if (properties.voicelanguage) {
|
||||||
|
window.voice.language = properties.voicelanguage.value
|
||||||
|
}
|
||||||
|
if (properties.voiceidle) {
|
||||||
|
window.voice.idleDuration = parseInt(properties.voiceidle.value)
|
||||||
|
}
|
||||||
|
if (properties.voicenext) {
|
||||||
|
window.voice.nextDuration = parseInt(properties.voicenext.value)
|
||||||
|
}
|
||||||
|
if (properties.voicesubtitle) {
|
||||||
|
window.voice.useSubtitle = properties.voicesubtitle.value
|
||||||
|
}
|
||||||
|
if (properties.voicesubtitlelanguage) {
|
||||||
|
window.voice.subtitleLanguage = properties.voicesubtitlelanguage.value
|
||||||
|
}
|
||||||
|
if (properties.voicesubtitlex) {
|
||||||
|
window.voice.subtitleX = properties.voicesubtitlex.value
|
||||||
|
}
|
||||||
|
if (properties.voicesubtitley) {
|
||||||
|
window.voice.subtitleY = properties.voicesubtitley.value
|
||||||
|
}
|
||||||
|
if (properties.voiceactor) {
|
||||||
|
window.voice.useVoiceActor = properties.voiceactor.value
|
||||||
|
}
|
||||||
if (properties.position) {
|
if (properties.position) {
|
||||||
if (!properties.position.value) {
|
if (!properties.position.value) {
|
||||||
window.settings.positionReset()
|
window.settings.positionReset()
|
||||||
|
|||||||
Reference in New Issue
Block a user