From 398712062ce096df55fc2e7b5d9f7495c97cce06 Mon Sep 17 00:00:00 2001 From: liteng <930372551@qq.com> Date: Tue, 9 Oct 2018 20:37:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E7=89=87=E5=88=97=E8=A1=A8=E7=AA=97?= =?UTF-8?q?=E5=8F=A3=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/editor/window/AudioWindow.js | 16 +++++----------- ShadowEditor.Web/src/editor/window/MMDWindow.js | 16 +++++----------- .../src/editor/window/ModelWindow.js | 16 +++++----------- .../src/editor/window/SceneWindow.js | 13 ++++--------- .../src/editor/window/TextureWindow.js | 16 +++++----------- ShadowEditor.Web/src/ui/ImageListWindow.js | 10 +++++----- 6 files changed, 29 insertions(+), 58 deletions(-) diff --git a/ShadowEditor.Web/src/editor/window/AudioWindow.js b/ShadowEditor.Web/src/editor/window/AudioWindow.js index 73d55c09..9df51e11 100644 --- a/ShadowEditor.Web/src/editor/window/AudioWindow.js +++ b/ShadowEditor.Web/src/editor/window/AudioWindow.js @@ -18,19 +18,13 @@ function AudioWindow(options) { this.preImageUrl = this.app.options.server; this.showUploadButton = true; - this.beforeUpdateList = this.beforeUpdateAudioList; - this.onUpload = this.onUploadAudio; - this.onClick = this.onClickAudio; - this.onEdit = this.onEditAudio; - this.onDelete = this.onDeleteAudio; - this.onSelect = options.onSelect || null; } AudioWindow.prototype = Object.create(UI.ImageListWindow.prototype); AudioWindow.prototype.constructor = AudioWindow; -AudioWindow.prototype.beforeUpdateAudioList = function () { +AudioWindow.prototype.beforeUpdateList = function () { var server = this.app.options.server; return new Promise(resolve => { @@ -40,12 +34,12 @@ AudioWindow.prototype.beforeUpdateAudioList = function () { }); }; -AudioWindow.prototype.onUploadAudio = function (obj) { +AudioWindow.prototype.onUpload = function (obj) { this.update(); UI.msg(obj.Msg); }; -AudioWindow.prototype.onClickAudio = function (data) { +AudioWindow.prototype.onClick = function (data) { if (typeof (this.onSelect) === 'function') { this.onSelect(data); } else { @@ -53,7 +47,7 @@ AudioWindow.prototype.onClickAudio = function (data) { } }; -AudioWindow.prototype.onEditAudio = function (data) { +AudioWindow.prototype.onEdit = function (data) { if (this.editWindow === undefined) { this.editWindow = new AudioEditWindow({ app: this.app, @@ -66,7 +60,7 @@ AudioWindow.prototype.onEditAudio = function (data) { this.editWindow.show(); }; -AudioWindow.prototype.onDeleteAudio = function (data) { +AudioWindow.prototype.onDelete = function (data) { var server = this.app.options.server; UI.confirm('询问', `是否删除音频${data.Name}?`, (event, btn) => { diff --git a/ShadowEditor.Web/src/editor/window/MMDWindow.js b/ShadowEditor.Web/src/editor/window/MMDWindow.js index 0d2779ac..a9e1f3b2 100644 --- a/ShadowEditor.Web/src/editor/window/MMDWindow.js +++ b/ShadowEditor.Web/src/editor/window/MMDWindow.js @@ -20,19 +20,13 @@ function MMDWindow(options) { this.preImageUrl = this.app.options.server; this.showUploadButton = true; - this.beforeUpdateList = this.beforeUpdateMMDList; - this.onUpload = this.onUploadMMD; - this.onClick = this.onClickMMD; - this.onEdit = this.onEditMMD; - this.onDelete = this.onDeleteMMD; - this.onSelect = options.onSelect || null; } MMDWindow.prototype = Object.create(UI.ImageListWindow.prototype); MMDWindow.prototype.constructor = MMDWindow; -MMDWindow.prototype.beforeUpdateMMDList = function () { +MMDWindow.prototype.beforeUpdateList = function () { var server = this.app.options.server; return new Promise(resolve => { @@ -42,12 +36,12 @@ MMDWindow.prototype.beforeUpdateMMDList = function () { }); }; -MMDWindow.prototype.onUploadMMD = function (obj) { +MMDWindow.prototype.onUpload = function (obj) { this.update(); UI.msg(obj.Msg); }; -MMDWindow.prototype.onClickMMD = function (model) { +MMDWindow.prototype.onClick = function (model) { if (model.Type === 'vmd') { if (this.onSelect) { this.onSelect(model); @@ -91,7 +85,7 @@ MMDWindow.prototype.onClickMMD = function (model) { }); }; -MMDWindow.prototype.onEditMMD = function (data) { +MMDWindow.prototype.onEdit = function (data) { if (this.editWindow === undefined) { this.editWindow = new MMDEditWindow({ app: this.app, @@ -104,7 +98,7 @@ MMDWindow.prototype.onEditMMD = function (data) { this.editWindow.show(); }; -MMDWindow.prototype.onDeleteMMD = function (data) { +MMDWindow.prototype.onDelete = function (data) { var server = this.app.options.server; UI.confirm('询问', `是否删除MMD资源${data.Name}?`, (event, btn) => { diff --git a/ShadowEditor.Web/src/editor/window/ModelWindow.js b/ShadowEditor.Web/src/editor/window/ModelWindow.js index 4b2ed3fc..42a504a7 100644 --- a/ShadowEditor.Web/src/editor/window/ModelWindow.js +++ b/ShadowEditor.Web/src/editor/window/ModelWindow.js @@ -19,18 +19,12 @@ function ModelWindow(options) { this.uploadUrl = `${this.app.options.server}/api/Mesh/Add`; this.preImageUrl = this.app.options.server; this.showUploadButton = true; - - this.beforeUpdateList = this.beforeUpdateModelList; - this.onUpload = this.onUploadModel; - this.onClick = this.onClickModel; - this.onEdit = this.onEditModel; - this.onDelete = this.onDeleteModel; } ModelWindow.prototype = Object.create(UI.ImageListWindow.prototype); ModelWindow.prototype.constructor = ModelWindow; -ModelWindow.prototype.beforeUpdateModelList = function () { +ModelWindow.prototype.beforeUpdateList = function () { var server = this.app.options.server; return new Promise(resolve => { @@ -40,12 +34,12 @@ ModelWindow.prototype.beforeUpdateModelList = function () { }); }; -ModelWindow.prototype.onUploadModel = function (obj) { +ModelWindow.prototype.onUpload = function (obj) { this.update(); UI.msg(obj.Msg); }; -ModelWindow.prototype.onClickModel = function (model) { +ModelWindow.prototype.onClick = function (model) { var loader = new ModelLoader(this.app); var url = model.Url; @@ -78,7 +72,7 @@ ModelWindow.prototype.onClickModel = function (model) { }); }; -ModelWindow.prototype.onEditModel = function (data) { +ModelWindow.prototype.onEdit = function (data) { if (this.editWindow === undefined) { this.editWindow = new ModelEditWindow({ app: this.app, @@ -91,7 +85,7 @@ ModelWindow.prototype.onEditModel = function (data) { this.editWindow.show(); }; -ModelWindow.prototype.onDeleteModel = function (data) { +ModelWindow.prototype.onDelete = function (data) { var server = this.app.options.server; UI.confirm('询问', `是否删除模型${data.Name}?`, (event, btn) => { diff --git a/ShadowEditor.Web/src/editor/window/SceneWindow.js b/ShadowEditor.Web/src/editor/window/SceneWindow.js index 950baffa..f02fa433 100644 --- a/ShadowEditor.Web/src/editor/window/SceneWindow.js +++ b/ShadowEditor.Web/src/editor/window/SceneWindow.js @@ -19,17 +19,12 @@ function SceneWindow(options) { this.title = '场景列表'; this.imageIcon = 'icon-scenes'; this.preImageUrl = this.app.options.server; - - this.beforeUpdateList = this.beforeUpdateSceneList; - this.onClick = this.onClickScene; - this.onEdit = this.onEditScene; - this.onDelete = this.onDeleteScene; } SceneWindow.prototype = Object.create(UI.ImageListWindow.prototype); SceneWindow.prototype.constructor = SceneWindow; -SceneWindow.prototype.beforeUpdateSceneList = function () { +SceneWindow.prototype.beforeUpdateList = function () { var server = this.app.options.server; return new Promise(resolve => { @@ -39,7 +34,7 @@ SceneWindow.prototype.beforeUpdateSceneList = function () { }); }; -SceneWindow.prototype.onClickScene = function (data) { +SceneWindow.prototype.onClick = function (data) { var app = this.app; var editor = app.editor; var server = app.options.server; @@ -177,7 +172,7 @@ SceneWindow.prototype.onLoadScene = function (obj) { this.app.editor.camera.updateProjectionMatrix(); }; -SceneWindow.prototype.onEditScene = function (data) { +SceneWindow.prototype.onEdit = function (data) { if (this.editWindow === undefined) { this.editWindow = new SceneEditWindow({ app: this.app, @@ -190,7 +185,7 @@ SceneWindow.prototype.onEditScene = function (data) { this.editWindow.show(); }; -SceneWindow.prototype.onDeleteScene = function (data) { +SceneWindow.prototype.onDelete = function (data) { var server = this.app.options.server; UI.confirm('询问', `是否删除场景${data.Name}?`, (event, btn) => { diff --git a/ShadowEditor.Web/src/editor/window/TextureWindow.js b/ShadowEditor.Web/src/editor/window/TextureWindow.js index f95cb57d..20b6fd82 100644 --- a/ShadowEditor.Web/src/editor/window/TextureWindow.js +++ b/ShadowEditor.Web/src/editor/window/TextureWindow.js @@ -19,19 +19,13 @@ function TextureWindow(options) { this.preImageUrl = this.app.options.server; this.showUploadButton = true; - this.beforeUpdateList = this.beforeUpdateTextureList; - this.onUpload = this.onUploadTexture; - this.onClick = this.onClickTexture; - this.onEdit = this.onEditTexture; - this.onDelete = this.onDeleteTexture; - this.onSelect = options.onSelect || null; } TextureWindow.prototype = Object.create(UI.ImageListWindow.prototype); TextureWindow.prototype.constructor = TextureWindow; -TextureWindow.prototype.beforeUpdateTextureList = function () { +TextureWindow.prototype.beforeUpdateList = function () { var server = this.app.options.server; return new Promise(resolve => { @@ -41,12 +35,12 @@ TextureWindow.prototype.beforeUpdateTextureList = function () { }); }; -TextureWindow.prototype.onUploadTexture = function (obj) { +TextureWindow.prototype.onUpload = function (obj) { this.update(); UI.msg(obj.Msg); }; -TextureWindow.prototype.onClickTexture = function (data) { +TextureWindow.prototype.onClick = function (data) { if (typeof (this.onSelect) === 'function') { this.onSelect(data); } else { @@ -54,7 +48,7 @@ TextureWindow.prototype.onClickTexture = function (data) { } }; -TextureWindow.prototype.onEditTexture = function (data) { +TextureWindow.prototype.onEdit = function (data) { if (this.editWindow === undefined) { this.editWindow = new TextureEditWindow({ app: this.app, @@ -67,7 +61,7 @@ TextureWindow.prototype.onEditTexture = function (data) { this.editWindow.show(); }; -TextureWindow.prototype.onDeleteTexture = function (data) { +TextureWindow.prototype.onDelete = function (data) { var server = this.app.options.server; UI.confirm('询问', `是否删除纹理${data.Name}?`, (event, btn) => { diff --git a/ShadowEditor.Web/src/ui/ImageListWindow.js b/ShadowEditor.Web/src/ui/ImageListWindow.js index 0379a462..729d8616 100644 --- a/ShadowEditor.Web/src/ui/ImageListWindow.js +++ b/ShadowEditor.Web/src/ui/ImageListWindow.js @@ -20,11 +20,11 @@ function ImageListWindow(options) { this.preImageUrl = options.preImageUrl || '/'; // 缩略图url前缀,一般是服务端url this.showUploadButton = options.showUploadButton || false; // 是否显示上传按钮 - this.beforeUpdateList = options.beforeUpdateList || null; // 图片列表刷新前调用,返回Promise,resolve(data)。 - this.onUpload = options.onUpload || null; // 上传成功回调 - this.onClick = options.onClick || null; // 点击图片列表 - this.onEdit = options.onEdit || null; // 编辑图片列表 - this.onDelete = options.onDelete || null; // 删除图片列表 + this.beforeUpdateList = options.beforeUpdateList || this.beforeUpdateList; // 图片列表刷新前调用,返回Promise,resolve(data)。 + this.onUpload = options.onUpload || this.onUpload; // 上传成功回调 + this.onClick = options.onClick || this.onClick; // 点击图片列表 + this.onEdit = options.onEdit || this.onEdit; // 编辑图片列表 + this.onDelete = options.onDelete || this.onDelete; // 删除图片列表 this.data = []; this.keyword = '';