Skip to content

Commit dacbee9

Browse files
authored
feat: 新增「猫咪设置 > 模型设置 > 动作音效」配置项 (#893)
1 parent 8592b9b commit dacbee9

9 files changed

Lines changed: 28 additions & 1 deletion

File tree

src/locales/en-US.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"windowSize": "Window Size",
2121
"windowRadius": "Window Radius",
2222
"opacity": "Opacity",
23+
"motionSound": "Motion Sound",
2324
"autoReleaseDelay": "Auto Release Delay",
2425
"hideOnHover": "Hide on Hover",
2526
"position": "Window Position"
@@ -28,6 +29,7 @@
2829
"mirrorMode": "When enabled, the model will be mirrored horizontally.",
2930
"singleMode": "When enabled, only the last pressed key is displayed for each hand.",
3031
"mouseMirror": "When enabled, the mouse will mirror the hand movement.",
32+
"motionSound": "When enabled, the model will play corresponding sound effects when performing actions (if they exist).",
3133
"passThrough": "When enabled, clicks pass through the window without affecting it.",
3234
"alwaysOnTop": "When enabled, the window stays above all other windows.",
3335
"windowSize": "Move mouse to window edge, or hold Shift and right-drag to resize.",

src/locales/pt-BR.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"windowSize": "Tamanho da Janela",
2121
"windowRadius": "Raio da Janela",
2222
"opacity": "Opacidade",
23+
"motionSound": "Som de Ação",
2324
"autoReleaseDelay": "Atraso de Liberação Automática",
2425
"hideOnHover": "Ocultar ao Passar o Mouse",
2526
"position": "Posição da Janela"
@@ -28,6 +29,7 @@
2829
"mirrorMode": "Quando ativado, o modelo será invertido horizontalmente.",
2930
"singleMode": "Quando ativado, apenas a última tecla pressionada em cada mão é exibida (evita mostrar múltiplas mãos ao pressionar várias teclas ao mesmo tempo).",
3031
"mouseMirror": "Quando ativado, o mouse espelhará o movimento da mão.",
32+
"motionSound": "Quando ativado, o modelo reproduzirá efeitos sonoros correspondentes ao executar ações (se existirem).",
3133
"passThrough": "Quando ativado, a janela não afetará operações em outros aplicativos.",
3234
"alwaysOnTop": "Quando ativado, a janela sempre ficará acima de outros aplicativos.",
3335
"windowSize": "Mova o mouse para a borda da janela ou segure Shift e arraste com o botão direito para redimensionar.",

src/locales/vi-VN.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"windowSize": "Kích thước",
2121
"windowRadius": "Độ bo tròn cửa sổ",
2222
"opacity": "Độ mờ",
23+
"motionSound": "Âm thanh hành động",
2324
"autoReleaseDelay": "Độ trễ tự động nhả phím",
2425
"hideOnHover": "Ẩn khi di chuột",
2526
"position": "Vị trí cửa sổ"
@@ -28,6 +29,7 @@
2829
"mirrorMode": "Bật để lật ngang mô hình.",
2930
"singleMode": "Khi bật, mỗi tay mèo chỉ hiển thị phím vừa nhấn cuối cùng (tránh hiện nhiều tay khi nhấn nhiều phím cùng lúc).",
3031
"mouseMirror": "Khi bật, chuột của mô hình sẽ phản chiếu theo chuyển động chuột thực tế.",
32+
"motionSound": "Khi bật, mô hình sẽ phát các âm thanh tương ứng khi thực hiện hành động (nếu tồn tại).",
3133
"passThrough": "Bật để cửa sổ không ảnh hưởng đến thao tác trên ứng dụng khác.",
3234
"alwaysOnTop": "Bật để cửa sổ luôn nằm trên ứng dụng khác.",
3335
"windowSize": "Di chuyển chuột đến mép cửa sổ hoặc giữ Shift và kéo chuột phải để thay đổi kích thước.",

src/locales/zh-CN.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"windowSize": "窗口尺寸",
2121
"windowRadius": "窗口圆角",
2222
"opacity": "不透明度",
23+
"motionSound": "动作音效",
2324
"autoReleaseDelay": "按键自动释放延迟",
2425
"hideOnHover": "鼠标移入隐藏",
2526
"position": "窗口位置"
@@ -28,6 +29,7 @@
2829
"mirrorMode": "启用后,模型将水平镜像翻转。",
2930
"singleMode": "启用后,每只手只显示最后按下的一个按键。",
3031
"mouseMirror": "启用后,鼠标将镜像跟随手部移动。",
32+
"motionSound": "启用后,模型执行动作时会播放对应音效(如果存在)。",
3133
"passThrough": "启用后,窗口不影响对其他应用程序的操作。",
3234
"alwaysOnTop": "启用后,窗口始终显示在其他应用程序上方。",
3335
"windowSize": "将鼠标移至窗口边缘,或按住 Shift 并右键拖动,也可以调整窗口大小。",

src/locales/zh-TW.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"windowSize": "視窗尺寸",
2121
"windowRadius": "視窗圓角",
2222
"opacity": "不透明度",
23+
"motionSound": "動作音效",
2324
"autoReleaseDelay": "按鍵自動釋放延遲",
2425
"hideOnHover": "滑鼠游標移入隱藏",
2526
"position": "視窗位置"
@@ -28,6 +29,7 @@
2829
"mirrorMode": "啟用後,模型將水平鏡像翻轉。",
2930
"singleMode": "啟用後,每隻手只顯示最後按下的一個按鍵。",
3031
"mouseMirror": "啟用後,滑鼠游標將鏡像跟隨手部移動。",
32+
"motionSound": "啟用後,模型執行動作時會播放對應音效(如果存在)。",
3133
"passThrough": "啟用後,視窗不影響對其他應用程式的操作。",
3234
"alwaysOnTop": "啟用後,視窗始終顯示在其他應用程式上方。",
3335
"windowSize": "將滑鼠游標移至視窗邊緣,或按住 Shift 並右鍵拖曳,也可以調整視窗大小。",

src/pages/main/index.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ watch(() => catStore.window.alwaysOnTop, setAlwaysOnTop, { immediate: true })
126126
127127
watch(() => generalStore.app.taskbarVisible, setTaskbarVisibility, { immediate: true })
128128
129+
watch(() => catStore.model.motionSound, (value) => {
130+
live2d.setMotionSoundEnabled(value)
131+
}, { immediate: true })
132+
129133
useTauriListen<MotionInfo>(LISTEN_KEY.START_MOTION, ({ payload }) => {
130134
live2d.startMotion(payload)
131135
})

src/pages/preference/components/cat/index.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ const catStore = useCatStore()
3434
<Switch v-model:checked="catStore.model.mouseMirror" />
3535
</ProListItem>
3636

37+
<ProListItem
38+
:description="$t('pages.preference.cat.hints.motionSound')"
39+
:title="$t('pages.preference.cat.labels.motionSound')"
40+
>
41+
<Switch v-model:checked="catStore.model.motionSound" />
42+
</ProListItem>
43+
3744
<ProListItem
3845
v-if="isWindows"
3946
:description="$t('pages.preference.cat.hints.autoReleaseDelay')"

src/stores/cat.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export interface CatStore {
66
mirror: boolean
77
single: boolean
88
mouseMirror: boolean
9+
motionSound: boolean
910
autoReleaseDelay: number
1011
}
1112
window: {
@@ -51,6 +52,7 @@ export const useCatStore = defineStore('cat', () => {
5152
mirror: false,
5253
single: false,
5354
mouseMirror: false,
55+
motionSound: true,
5456
autoReleaseDelay: 3,
5557
})
5658

src/utils/live2d.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { MotionInfo } from 'easy-live2d'
33

44
import { convertFileSrc } from '@tauri-apps/api/core'
55
import { readDir, readTextFile } from '@tauri-apps/plugin-fs'
6-
import { CubismSetting, Live2DSprite, Priority } from 'easy-live2d'
6+
import { Config, CubismSetting, Live2DSprite, Priority } from 'easy-live2d'
77
import { groupBy } from 'es-toolkit/compat'
88
import JSON5 from 'json5'
99
import { Application, Ticker } from 'pixi.js'
@@ -122,6 +122,10 @@ class Live2d {
122122
public setParameterValue(id: string, value: number | boolean) {
123123
return this.model?.setParameterValueById(id, Number(value))
124124
}
125+
126+
public setMotionSoundEnabled(enabled: boolean) {
127+
Config.MotionSound = enabled
128+
}
125129
}
126130

127131
const live2d = new Live2d()

0 commit comments

Comments
 (0)