添加动画面板。

This commit is contained in:
liteng 2018-12-16 16:52:44 +08:00
parent 5412d17ce1
commit d148a65d16
5 changed files with 43 additions and 9 deletions

1
.gitignore vendored
View File

@ -86,3 +86,4 @@ typings/
/ShadowEditor.Model/bin
/ShadowEditor.Model/obj
/THREE/THREE.csproj.user
/ShadowEditor.Web/Upload/Animation

View File

@ -40,5 +40,10 @@ namespace ShadowEditor.Model.Category
/// 音频
/// </summary>
Audio,
/// <summary>
/// 动画
/// </summary>
Animation,
}
}

View File

@ -24,7 +24,7 @@ AnimationPanel.prototype.render = function () {
};
AnimationPanel.prototype.onShowPanel = function (tabName) {
if (tabName !== 'map') {
if (tabName !== 'animation') {
return;
}
@ -121,7 +121,7 @@ AnimationPanel.prototype.updateCategory = function () {
var category = UI.get('category', this.id);
category.clear();
Ajax.getJson(`/api/Category/List?type=Map`, obj => {
Ajax.getJson(`/api/Category/List?type=Animation`, obj => {
category.options = {};
obj.Data.forEach(n => {
category.options[n.ID] = n.Name;
@ -133,7 +133,7 @@ AnimationPanel.prototype.updateCategory = function () {
AnimationPanel.prototype.updateList = function () {
var search = UI.get('search', this.id);
Ajax.getJson(`/api/Map/List`, obj => {
Ajax.getJson(`/api/Animation/List`, obj => {
this.data = obj.Data;
search.setValue('');
this.onSearch();
@ -210,7 +210,7 @@ AnimationPanel.prototype.onClick = function (event, index, btn, control) {
// ------------------------------------- 添加 ------------------------------------
AnimationPanel.prototype.onAddMap = function (data) {
this.app.call(`selectMap`, this, data);
this.app.call(`selectAnimation`, this, data);
};
// ----------------------------------- 上传 ----------------------------------------
@ -230,7 +230,7 @@ AnimationPanel.prototype.onUpload = function () {
};
AnimationPanel.prototype.onCommitUpload = function () {
UploadUtils.upload(`file_${this.id}`, `/api/Map/Add`, event => {
UploadUtils.upload(`file_${this.id}`, `/api/Animation/Add`, event => {
if (event.target.status === 200) {
var response = event.target.response;
var obj = JSON.parse(response);
@ -253,9 +253,9 @@ AnimationPanel.prototype.onEdit = function (data) {
this.editWindow = new EditWindow({
app: this.app,
parent: document.body,
type: 'Map',
typeName: '贴图',
saveUrl: '/api/Map/Edit',
type: 'Animation',
typeName: '动画',
saveUrl: '/api/Animation/Edit',
callback: this.update.bind(this)
});
this.editWindow.render();
@ -269,7 +269,7 @@ AnimationPanel.prototype.onEdit = function (data) {
AnimationPanel.prototype.onDelete = function (data) {
UI.confirm('询问', `是否删除${data.Name}`, (event, btn) => {
if (btn === 'ok') {
Ajax.post(`/api/Map/Delete?ID=${data.ID}`, json => {
Ajax.post(`/api/Animation/Delete?ID=${data.ID}`, json => {
var obj = JSON.parse(json);
if (obj.Code === 200) {
this.update();

View File

@ -5,6 +5,7 @@ import ModelPanel from './ModelPanel';
import MapPanel from './MapPanel';
import MaterialPanel from './MaterialPanel';
import AudioPanel from './AudioPanel';
import AnimationPanel from './AnimationPanel';
import ParticlePanel from './ParticlePanel';
import LogPanel from './LogPanel';
@ -76,6 +77,13 @@ BottomPanel.prototype.render = function () {
onClick: () => {
this.selectTab('audio');
}
}, {
xtype: 'text',
id: 'animationTab',
text: '动画',
onClick: () => {
this.selectTab('animation');
}
}, {
xtype: 'text',
id: 'particleTab',
@ -168,6 +176,17 @@ BottomPanel.prototype.render = function () {
app: this.app
})
]
}, {
xtype: 'div',
id: 'animationPanel',
style: {
height: 'calc(100% - 40px)'
},
children: [
new AnimationPanel({
app: this.app
})
]
}, {
xtype: 'div',
id: 'particlePanel',
@ -214,6 +233,7 @@ BottomPanel.prototype.onSelectPanel = function (tabName) {
var mapTab = UI.get('mapTab');
var materialTab = UI.get('materialTab');
var audioTab = UI.get('audioTab');
var animationTab = UI.get('animationTab');
var particleTab = UI.get('particleTab');
var logTab = UI.get('logTab');
@ -223,6 +243,7 @@ BottomPanel.prototype.onSelectPanel = function (tabName) {
var mapPanel = UI.get('mapPanel');
var materialPanel = UI.get('materialPanel');
var audioPanel = UI.get('audioPanel');
var animationPanel = UI.get('animationPanel');
var particlePanel = UI.get('particlePanel');
var logPanel = UI.get('logPanel');
@ -232,6 +253,7 @@ BottomPanel.prototype.onSelectPanel = function (tabName) {
mapTab.dom.className = '';
materialTab.dom.className = '';
audioTab.dom.className = '';
animationTab.dom.className = '';
particleTab.dom.className = '';
logTab.dom.className = '';
@ -241,6 +263,7 @@ BottomPanel.prototype.onSelectPanel = function (tabName) {
mapPanel.dom.style.display = 'none';
materialPanel.dom.style.display = 'none';
audioPanel.dom.style.display = 'none';
animationPanel.dom.style.display = 'none';
particlePanel.dom.style.display = 'none';
logPanel.dom.style.display = 'none';
@ -269,6 +292,10 @@ BottomPanel.prototype.onSelectPanel = function (tabName) {
audioTab.dom.className = 'selected';
audioPanel.dom.style.display = '';
break;
case 'animation':
animationTab.dom.className = 'selected';
animationPanel.dom.style.display = '';
break;
case 'particle':
particleTab.dom.className = 'selected';
particlePanel.dom.style.display = '';

View File

@ -95,6 +95,7 @@ var EventList = [
'selectMap', // 选择贴图
'selectMaterial', // 选择材质
'selectAudio', // 选择音频
'selectAnimation', // 选择动画
'selectParticle', // 选择粒子
];