MMD选择音乐。

This commit is contained in:
liteng 2018-12-16 20:02:13 +08:00
parent 5561c4c199
commit 7efdba4374

View File

@ -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;