Skip to content

Commit

Permalink
変更commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiroshiba committed May 1, 2024
1 parent 30b2e94 commit 523edeb
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 34 deletions.
38 changes: 19 additions & 19 deletions src/components/Talk/AudioCell.vue
Original file line number Diff line number Diff line change
Expand Up @@ -497,26 +497,26 @@ const removeCell = async () => {
// N番目のキャラクターを選ぶ
const selectCharacterAt = (index: number) => {
if (userOrderedCharacterInfos.value.length >= index + 1) {
const speakerUuid =
userOrderedCharacterInfos.value[index].metas.speakerUuid;
const style = getDefaultStyle(
speakerUuid,
userOrderedCharacterInfos.value,
store.state.defaultStyleIds,
);
const voice = {
engineId: style.engineId,
speakerId: speakerUuid,
styleId: style.styleId,
};
store.dispatch("COMMAND_MULTI_CHANGE_VOICE", {
audioKeys: isMultiSelectEnabled.value
? store.getters.SELECTED_AUDIO_KEYS
: [props.audioKey],
voice,
});
if (userOrderedCharacterInfos.value.length < index + 1) {
return;
}
const speakerUuid = userOrderedCharacterInfos.value[index].metas.speakerUuid;
const style = getDefaultStyle(
speakerUuid,
userOrderedCharacterInfos.value,
store.state.defaultStyleIds,
);
const voice = {
engineId: style.engineId,
speakerId: speakerUuid,
styleId: style.styleId,
};
store.dispatch("COMMAND_MULTI_CHANGE_VOICE", {
audioKeys: isMultiSelectEnabled.value
? store.getters.SELECTED_AUDIO_KEYS
: [props.audioKey],
voice,
});
};
// 削除ボタンの有効/無効判定
Expand Down
3 changes: 2 additions & 1 deletion src/components/Talk/TalkEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ import {
SplitterPositionType,
Voice,
HotkeyActionNameType,
actionPostfixSelectNthCharacter,
} from "@/type/preload";
import { useHotkeyManager } from "@/plugins/hotkeyPlugin";
import onetimeWatch from "@/helpers/onetimeWatch";
Expand Down Expand Up @@ -251,7 +252,7 @@ for (let i = 0; i < 10; i++) {
registerHotkeyWithCleanup({
editor: "talk",
enableInTextbox: true,
name: `${i + 1}番目のキャラクターを選択` as HotkeyActionNameType,
name: `${i + 1}${actionPostfixSelectNthCharacter}` as HotkeyActionNameType,
callback: () => {
if (!uiLocked.value) {
onCharacterSelectHotkey(i);
Expand Down
30 changes: 16 additions & 14 deletions src/type/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ export type VoiceId = z.infer<typeof voiceIdSchema>;
export const VoiceId = (voice: Voice): VoiceId =>
voiceIdSchema.parse(`${voice.engineId}:${voice.speakerId}:${voice.styleId}`);

// 共通のアクション名
export const actionPostfixSelectNthCharacter = "番目のキャラクターを選択";

// ホットキーを追加したときは設定のマイグレーションが必要
export const defaultHotkeySettings: HotkeySettingType[] = [
{
Expand Down Expand Up @@ -175,10 +178,9 @@ export const defaultHotkeySettings: HotkeySettingType[] = [
...Array.from({ length: 10 }, (_, index) => {
const roleKey = index == 9 ? 0 : index + 1;
return {
action: `${index + 1}番目のキャラクターを選択` as HotkeyActionNameType,
combination: HotkeyCombination(
!isMac ? "Ctrl " + roleKey : "Meta " + roleKey,
),
action:
`${index + 1}${actionPostfixSelectNthCharacter}` as HotkeyActionNameType,
combination: HotkeyCombination((!isMac ? "Ctrl " : "Meta ") + roleKey),
};
}),
];
Expand Down Expand Up @@ -467,16 +469,16 @@ export const hotkeyActionNameSchema = z.enum([
"貼り付け",
"すべて選択",
"選択解除",
"1番目のキャラクターを選択",
"2番目のキャラクターを選択",
"3番目のキャラクターを選択",
"4番目のキャラクターを選択",
"5番目のキャラクターを選択",
"6番目のキャラクターを選択",
"7番目のキャラクターを選択",
"8番目のキャラクターを選択",
"9番目のキャラクターを選択",
"10番目のキャラクターを選択",
`1${actionPostfixSelectNthCharacter}`,
`2${actionPostfixSelectNthCharacter}`,
`3${actionPostfixSelectNthCharacter}`,
`4${actionPostfixSelectNthCharacter}`,
`5${actionPostfixSelectNthCharacter}`,
`6${actionPostfixSelectNthCharacter}`,
`7${actionPostfixSelectNthCharacter}`,
`8${actionPostfixSelectNthCharacter}`,
`9${actionPostfixSelectNthCharacter}`,
`10${actionPostfixSelectNthCharacter}`,
]);

export type HotkeyActionNameType = z.infer<typeof hotkeyActionNameSchema>;
Expand Down

0 comments on commit 523edeb

Please sign in to comment.