Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

複数エンジン対応:キャラ立ち絵にエンジン名を追加 #927

Merged
merged 5 commits into from
Sep 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions src/components/CharacterPortrait.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<template>
<div class="character-portrait-wrapper">
<span class="character-name">{{ characterName }}</span>
<span class="character-engine-name" v-if="isMultipleEngine">{{
engineName
}}</span>
<img :src="portraitPath" class="character-portrait" />
<div v-if="isInitializingSpeaker" class="loading">
<q-spinner color="primary" size="5rem" :thickness="4" />
Expand Down Expand Up @@ -46,17 +49,31 @@ export default defineComponent({
: characterInfo.value?.metas.speakerName;
});

const engineName = computed(() => {
const activeAudioKey = store.getters.ACTIVE_AUDIO_KEY;
const audioItem = activeAudioKey
? store.state.audioItems[activeAudioKey]
: undefined;
const engineId = audioItem?.engineId ?? store.state.engineIds[0];
const engineInfo = store.state.engineInfos[engineId];
return engineInfo?.name;
});

const portraitPath = computed(() => characterInfo.value?.portraitPath);

const isInitializingSpeaker = computed(() => {
const activeAudioKey = store.getters.ACTIVE_AUDIO_KEY;
return store.state.audioKeyInitializingSpeaker === activeAudioKey;
});

const isMultipleEngine = computed(() => store.state.engineIds.length > 1);

return {
characterName,
engineName,
portraitPath,
isInitializingSpeaker,
isMultipleEngine,
};
},
});
Expand All @@ -77,6 +94,19 @@ export default defineComponent({
overflow-wrap: anywhere;
}

.character-engine-name {
position: absolute;
padding: 1px 24px 1px 8px;
background-image: linear-gradient(
90deg,
rgba(colors.$background-rgb, 0.5) 0%,
rgba(colors.$background-rgb, 0.5) 75%,
transparent 100%
);
bottom: 0;
overflow-wrap: anywhere;
}

.character-portrait-wrapper {
display: grid;
justify-content: center;
Expand Down