From 7efdba437400672fbad1ff15fb15aef5d495dbe2 Mon Sep 17 00:00:00 2001 From: liteng <930372551@qq.com> Date: Sun, 16 Dec 2018 20:02:13 +0800 Subject: [PATCH] =?UTF-8?q?MMD=E9=80=89=E6=8B=A9=E9=9F=B3=E4=B9=90?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/component/MMDComponent.js | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/ShadowEditor.Web/src/component/MMDComponent.js b/ShadowEditor.Web/src/component/MMDComponent.js index 3648ac39..d54095b7 100644 --- a/ShadowEditor.Web/src/component/MMDComponent.js +++ b/ShadowEditor.Web/src/component/MMDComponent.js @@ -76,6 +76,25 @@ MMDComponent.prototype.render = function () { text: '选择', onClick: this.selectCameraAnimation.bind(this) }] + }, { + xtype: 'row', + children: [{ + xtype: 'label', + text: '音频' + }, { + xtype: 'input', + id: 'audio', + scope: this.id, + disabled: true, + style: { + width: '80px', + fontSize: '12px' + } + }, { + xtype: 'button', + text: '选择', + onClick: this.selectAudio.bind(this) + }] }] }; @@ -108,6 +127,7 @@ MMDComponent.prototype.updateUI = function () { var animation = UI.get('animation', this.id); var cameraAnimation = UI.get('cameraAnimation', this.id); + var audio = UI.get('audio', this.id); if (this.selected.userData.Animation) { animation.setValue(this.selected.userData.Animation.Name); @@ -120,6 +140,12 @@ MMDComponent.prototype.updateUI = function () { } else { cameraAnimation.setValue(''); } + + if (this.selected.userData.Audio) { + audio.setValue(this.selected.userData.Audio.Name); + } else { + audio.setValue(''); + } }; // ----------------------------- 模型动画 ------------------------------------------ @@ -162,4 +188,20 @@ MMDComponent.prototype.onSelectCameraAnimation = function (data) { this.updateUI(); }; +// ------------------------------ MMD音乐 -------------------------------------------- + +MMDComponent.prototype.selectAudio = function () { + this.app.call(`selectBottomPanel`, this, 'audio'); + UI.msg('请点击MMD动画对应的音频!'); + this.app.on(`selectAudio.${this.id}`, this.onSelectAudio.bind(this)); +}; + +MMDComponent.prototype.onSelectAudio = function (data) { + this.app.on(`selectAudio.${this.id}`, null); + + this.selected.userData.Audio = {}; + Object.assign(this.selected.userData.Audio, data); + this.updateUI(); +}; + export default MMDComponent; \ No newline at end of file