From dea5bedb8da10bbedcd97bdfdd25a8c5c9de573f Mon Sep 17 00:00:00 2001 From: tengge1 <930372551@qq.com> Date: Sat, 7 Dec 2019 20:06:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=B6=88=E6=81=AF=E5=BC=B9?= =?UTF-8?q?=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + ShadowEditor.Web/src/Application.js | 2 +- .../src/editor/assets/AnimationPanel.jsx | 6 +- .../src/editor/assets/AssetsPanel.jsx | 2 +- .../src/editor/assets/AudioPanel.jsx | 6 +- .../src/editor/assets/CharacterPanel.jsx | 4 +- .../src/editor/assets/MapPanel.jsx | 4 +- .../src/editor/assets/MaterialPanel.jsx | 6 +- .../src/editor/assets/ModelPanel.jsx | 6 +- .../src/editor/assets/ParticlePanel.jsx | 6 +- .../src/editor/assets/PrefabPanel.jsx | 6 +- .../src/editor/assets/ScenePanel.jsx | 8 +- .../src/editor/assets/ScreenshotPanel.jsx | 6 +- .../src/editor/assets/VideoPanel.jsx | 6 +- .../editor/assets/window/AddSkyBoxWindow.jsx | 53 ++++-- .../assets/window/CategoryEditWindow.jsx | 2 +- .../editor/assets/window/CategoryWindow.jsx | 6 +- .../src/editor/assets/window/EditWindow.jsx | 4 +- .../src/editor/component/LMeshComponent.jsx | 29 +++- .../src/editor/component/MMDComponent.jsx | 42 +++-- .../editor/component/MaterialComponent.jsx | 2 +- .../src/editor/component/SceneComponent.jsx | 154 +++++++++++++----- .../audio/BackgroundMusicComponent.jsx | 57 +++++-- .../line/CatmullRomCurveComponent.jsx | 41 +++-- .../src/editor/menu/AssetsMenu.jsx | 46 ++++-- .../src/editor/menu/LightMenu.jsx | 42 +++-- .../src/editor/menu/LoginMenu.jsx | 2 +- ShadowEditor.Web/src/editor/menu/PlayMenu.jsx | 2 +- .../src/editor/menu/SceneMenu.jsx | 12 +- .../src/editor/menu/SystemMenu.jsx | 2 +- ShadowEditor.Web/src/editor/menu/ToolMenu.jsx | 12 +- .../system/AuthorityManagementWindow.jsx | 8 +- .../editor/system/ChangePasswordWindow.jsx | 4 +- .../system/DepartmentManagementWindow.jsx | 10 +- .../src/editor/system/RegisterWindow.jsx | 4 +- .../src/editor/system/RoleManageWindow.jsx | 10 +- .../src/editor/system/SystemSettingWindow.jsx | 8 +- .../src/editor/system/UserManageWindow.jsx | 10 +- .../src/editor/system/dept/EditDeptWindow.jsx | 4 +- .../editor/system/dept/SelectDeptWindow.jsx | 2 +- .../src/editor/system/role/EditRoleWindow.jsx | 4 +- .../src/editor/system/user/EditUserWindow.jsx | 14 +- .../system/user/ResetPasswordWindow.jsx | 10 +- .../editor/system/user/SelectUserWindow.jsx | 2 +- .../src/editor/toolbar/GeneralTools.jsx | 4 +- ShadowEditor.Web/src/player/Player.js | 2 +- ShadowEditor.Web/src/utils/Server.js | 10 +- ShadowEditor.Web/src/utils/VideoRecorder.js | 8 +- 48 files changed, 451 insertions(+), 240 deletions(-) diff --git a/README.md b/README.md index 36ea123e..babe06e7 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ Supported Languages: 中文 / [繁體中文](README-tw.md) / [English](README-en 7. 选中效果由保存在场景中,改为保存在浏览器上。 8. 鼠标高亮效果,改为保存在浏览器上,默认不开启。可以通过选项、显示菜单设置是否开启高亮和高亮颜色。 9. SVG元素封装:`SvgCircle`、`SvgEllipse`、`SvgLine`、`SvgPath`、`SvgPolygon`、`SvgPolyline`、`SvgRect`。 +10. 优化消息弹窗,不再遮挡编辑区,使用背景和文字颜色区分`消息`、`成功`、`警告`、`错误`四种情景。 ## v0.3.8更新【[更新日志](docs-dev/update/UpdateLog.md)】 diff --git a/ShadowEditor.Web/src/Application.js b/ShadowEditor.Web/src/Application.js index 5b126f59..ea289e5c 100644 --- a/ShadowEditor.Web/src/Application.js +++ b/ShadowEditor.Web/src/Application.js @@ -375,7 +375,7 @@ Application.prototype.upload = function () { if (obj.Code === 200) { callback(obj); } else { - app.toast(obj.Msg); + app.toast(_t(obj.Msg), 'warn'); } }); }); diff --git a/ShadowEditor.Web/src/editor/assets/AnimationPanel.jsx b/ShadowEditor.Web/src/editor/assets/AnimationPanel.jsx index 81131197..ccfe9f9a 100644 --- a/ShadowEditor.Web/src/editor/assets/AnimationPanel.jsx +++ b/ShadowEditor.Web/src/editor/assets/AnimationPanel.jsx @@ -89,7 +89,7 @@ class AnimationPanel extends React.Component { fetch(`${app.options.server}/api/Category/List?type=Animation`).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.setState({ @@ -100,7 +100,7 @@ class AnimationPanel extends React.Component { fetch(`${app.options.server}/api/Animation/List`).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.setState({ @@ -158,7 +158,7 @@ class AnimationPanel extends React.Component { }).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.update(); diff --git a/ShadowEditor.Web/src/editor/assets/AssetsPanel.jsx b/ShadowEditor.Web/src/editor/assets/AssetsPanel.jsx index 15d2063d..53cecdd0 100644 --- a/ShadowEditor.Web/src/editor/assets/AssetsPanel.jsx +++ b/ShadowEditor.Web/src/editor/assets/AssetsPanel.jsx @@ -149,7 +149,7 @@ class AssetsPanel extends React.Component { if (response.ok) { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.setState(obj); diff --git a/ShadowEditor.Web/src/editor/assets/AudioPanel.jsx b/ShadowEditor.Web/src/editor/assets/AudioPanel.jsx index 5f2fdcaf..48851cac 100644 --- a/ShadowEditor.Web/src/editor/assets/AudioPanel.jsx +++ b/ShadowEditor.Web/src/editor/assets/AudioPanel.jsx @@ -89,7 +89,7 @@ class AudioPanel extends React.Component { fetch(`${app.options.server}/api/Category/List?type=Audio`).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.setState({ @@ -100,7 +100,7 @@ class AudioPanel extends React.Component { fetch(`${app.options.server}/api/Audio/List`).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.setState({ @@ -158,7 +158,7 @@ class AudioPanel extends React.Component { }).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.update(); diff --git a/ShadowEditor.Web/src/editor/assets/CharacterPanel.jsx b/ShadowEditor.Web/src/editor/assets/CharacterPanel.jsx index 20cbed17..b3567cdc 100644 --- a/ShadowEditor.Web/src/editor/assets/CharacterPanel.jsx +++ b/ShadowEditor.Web/src/editor/assets/CharacterPanel.jsx @@ -86,7 +86,7 @@ class CharacterPanel extends React.Component { fetch(`${app.options.server}/api/Category/List?type=Character`).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.setState({ @@ -97,7 +97,7 @@ class CharacterPanel extends React.Component { fetch(`${app.options.server}/api/Character/List`).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.setState({ diff --git a/ShadowEditor.Web/src/editor/assets/MapPanel.jsx b/ShadowEditor.Web/src/editor/assets/MapPanel.jsx index 3df930f5..ec10e192 100644 --- a/ShadowEditor.Web/src/editor/assets/MapPanel.jsx +++ b/ShadowEditor.Web/src/editor/assets/MapPanel.jsx @@ -110,7 +110,7 @@ class MapPanel extends React.Component { fetch(`${app.options.server}/api/Category/List?type=Map`).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.setState({ @@ -121,7 +121,7 @@ class MapPanel extends React.Component { fetch(`${app.options.server}/api/Map/List`).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.setState({ diff --git a/ShadowEditor.Web/src/editor/assets/MaterialPanel.jsx b/ShadowEditor.Web/src/editor/assets/MaterialPanel.jsx index 5bc5afe5..afa17ffb 100644 --- a/ShadowEditor.Web/src/editor/assets/MaterialPanel.jsx +++ b/ShadowEditor.Web/src/editor/assets/MaterialPanel.jsx @@ -87,7 +87,7 @@ class MaterialPanel extends React.Component { fetch(`${app.options.server}/api/Category/List?type=Material`).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.setState({ @@ -98,7 +98,7 @@ class MaterialPanel extends React.Component { fetch(`${app.options.server}/api/Material/List`).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.setState({ @@ -151,7 +151,7 @@ class MaterialPanel extends React.Component { }).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.update(); diff --git a/ShadowEditor.Web/src/editor/assets/ModelPanel.jsx b/ShadowEditor.Web/src/editor/assets/ModelPanel.jsx index 5fc400c7..8e4bb0b6 100644 --- a/ShadowEditor.Web/src/editor/assets/ModelPanel.jsx +++ b/ShadowEditor.Web/src/editor/assets/ModelPanel.jsx @@ -91,7 +91,7 @@ class ModelPanel extends React.Component { fetch(`${app.options.server}/api/Category/List?type=Mesh`).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.setState({ @@ -102,7 +102,7 @@ class ModelPanel extends React.Component { fetch(`${app.options.server}/api/Mesh/List`).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.setState({ @@ -224,7 +224,7 @@ class ModelPanel extends React.Component { }).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.update(); diff --git a/ShadowEditor.Web/src/editor/assets/ParticlePanel.jsx b/ShadowEditor.Web/src/editor/assets/ParticlePanel.jsx index d462a42e..93d41d56 100644 --- a/ShadowEditor.Web/src/editor/assets/ParticlePanel.jsx +++ b/ShadowEditor.Web/src/editor/assets/ParticlePanel.jsx @@ -86,7 +86,7 @@ class ParticlePanel extends React.Component { fetch(`${app.options.server}/api/Category/List?type=Particle`).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.setState({ @@ -97,7 +97,7 @@ class ParticlePanel extends React.Component { fetch(`${app.options.server}/api/Particle/List`).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.setState({ @@ -150,7 +150,7 @@ class ParticlePanel extends React.Component { }).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.update(); diff --git a/ShadowEditor.Web/src/editor/assets/PrefabPanel.jsx b/ShadowEditor.Web/src/editor/assets/PrefabPanel.jsx index fb6dad97..af4a8624 100644 --- a/ShadowEditor.Web/src/editor/assets/PrefabPanel.jsx +++ b/ShadowEditor.Web/src/editor/assets/PrefabPanel.jsx @@ -86,7 +86,7 @@ class PrefabPanel extends React.Component { fetch(`${app.options.server}/api/Category/List?type=Prefab`).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.setState({ @@ -97,7 +97,7 @@ class PrefabPanel extends React.Component { fetch(`${app.options.server}/api/Prefab/List`).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.setState({ @@ -150,7 +150,7 @@ class PrefabPanel extends React.Component { }).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.update(); diff --git a/ShadowEditor.Web/src/editor/assets/ScenePanel.jsx b/ShadowEditor.Web/src/editor/assets/ScenePanel.jsx index 58801742..827aada0 100644 --- a/ShadowEditor.Web/src/editor/assets/ScenePanel.jsx +++ b/ShadowEditor.Web/src/editor/assets/ScenePanel.jsx @@ -88,7 +88,7 @@ class ScenePanel extends React.Component { fetch(`${app.options.server}/api/Category/List?type=Scene`).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.setState({ @@ -99,7 +99,7 @@ class ScenePanel extends React.Component { fetch(`${app.options.server}/api/Scene/List`).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.setState({ @@ -132,7 +132,7 @@ class ScenePanel extends React.Component { fetch(url).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } @@ -282,7 +282,7 @@ class ScenePanel extends React.Component { }).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.update(); diff --git a/ShadowEditor.Web/src/editor/assets/ScreenshotPanel.jsx b/ShadowEditor.Web/src/editor/assets/ScreenshotPanel.jsx index 97e086b7..0dc33f09 100644 --- a/ShadowEditor.Web/src/editor/assets/ScreenshotPanel.jsx +++ b/ShadowEditor.Web/src/editor/assets/ScreenshotPanel.jsx @@ -85,7 +85,7 @@ class ScreenshotPanel extends React.Component { fetch(`${app.options.server}/api/Category/List?type=Screenshot`).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.setState({ @@ -96,7 +96,7 @@ class ScreenshotPanel extends React.Component { fetch(`${app.options.server}/api/Screenshot/List`).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.setState({ @@ -143,7 +143,7 @@ class ScreenshotPanel extends React.Component { }).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.update(); diff --git a/ShadowEditor.Web/src/editor/assets/VideoPanel.jsx b/ShadowEditor.Web/src/editor/assets/VideoPanel.jsx index c21b3518..d18da046 100644 --- a/ShadowEditor.Web/src/editor/assets/VideoPanel.jsx +++ b/ShadowEditor.Web/src/editor/assets/VideoPanel.jsx @@ -85,7 +85,7 @@ class VideoPanel extends React.Component { fetch(`${app.options.server}/api/Category/List?type=Video`).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.setState({ @@ -96,7 +96,7 @@ class VideoPanel extends React.Component { fetch(`${app.options.server}/api/Video/List`).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.setState({ @@ -143,7 +143,7 @@ class VideoPanel extends React.Component { }).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.update(); diff --git a/ShadowEditor.Web/src/editor/assets/window/AddSkyBoxWindow.jsx b/ShadowEditor.Web/src/editor/assets/window/AddSkyBoxWindow.jsx index 6aa6ad06..b3c99453 100644 --- a/ShadowEditor.Web/src/editor/assets/window/AddSkyBoxWindow.jsx +++ b/ShadowEditor.Web/src/editor/assets/window/AddSkyBoxWindow.jsx @@ -22,7 +22,7 @@ class AddSkyBoxWindow extends React.Component { posZ: null, posZFile: null, negZ: null, - negZFile: null, + negZFile: null }; this.handleChange = this.handleChange.bind(this); @@ -36,32 +36,57 @@ class AddSkyBoxWindow extends React.Component { return + onClose={this.handleClose} + >
- +
PosX
- +
NegX
- +
PosY
- +
NegY
- +
PosZ
- +
NegZ
@@ -80,7 +105,7 @@ class AddSkyBoxWindow extends React.Component { this.setState({ [name]: e.target.result, - [`${name}File`]: file, + [`${name}File`]: file }); }; @@ -91,7 +116,7 @@ class AddSkyBoxWindow extends React.Component { const { posXFile, negXFile, posYFile, negYFile, posZFile, negZFile } = this.state; if (!posXFile || !negXFile || !posYFile || !negYFile || !posZFile || !negZFile) { - app.toast(_t('Please upload all the textures before save.')); + app.toast(_t('Please upload all the textures before save.'), 'warn'); return; } @@ -101,7 +126,7 @@ class AddSkyBoxWindow extends React.Component { posY: posYFile, negY: negYFile, posZ: posZFile, - negZ: negZFile, + negZ: negZFile }, result => { let obj = JSON.parse(result); this.handleClose(); @@ -116,11 +141,11 @@ class AddSkyBoxWindow extends React.Component { } AddSkyBoxWindow.propTypes = { - callback: PropTypes.func, + callback: PropTypes.func }; AddSkyBoxWindow.defaultProps = { - callback: null, + callback: null }; export default AddSkyBoxWindow; \ No newline at end of file diff --git a/ShadowEditor.Web/src/editor/assets/window/CategoryEditWindow.jsx b/ShadowEditor.Web/src/editor/assets/window/CategoryEditWindow.jsx index e2ff02ce..455e1fc2 100644 --- a/ShadowEditor.Web/src/editor/assets/window/CategoryEditWindow.jsx +++ b/ShadowEditor.Web/src/editor/assets/window/CategoryEditWindow.jsx @@ -71,7 +71,7 @@ class CategoryEditWindow extends React.Component { }).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.handleCancel(); diff --git a/ShadowEditor.Web/src/editor/assets/window/CategoryWindow.jsx b/ShadowEditor.Web/src/editor/assets/window/CategoryWindow.jsx index 6e318b9c..1db57d57 100644 --- a/ShadowEditor.Web/src/editor/assets/window/CategoryWindow.jsx +++ b/ShadowEditor.Web/src/editor/assets/window/CategoryWindow.jsx @@ -106,7 +106,7 @@ class CategoryWindow extends React.Component { const { selected } = this.state; if (!selected) { - app.toast(_t('Please select a record.')); + app.toast(_t('Please select a record.'), 'warn'); return; } @@ -125,7 +125,7 @@ class CategoryWindow extends React.Component { const { selected } = this.state; if (!selected) { - app.toast(_t('Please select a record.')); + app.toast(_t('Please select a record.'), 'warn'); return; } @@ -141,7 +141,7 @@ class CategoryWindow extends React.Component { }).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.updateUI(); diff --git a/ShadowEditor.Web/src/editor/assets/window/EditWindow.jsx b/ShadowEditor.Web/src/editor/assets/window/EditWindow.jsx index 8c982f78..478e3b68 100644 --- a/ShadowEditor.Web/src/editor/assets/window/EditWindow.jsx +++ b/ShadowEditor.Web/src/editor/assets/window/EditWindow.jsx @@ -128,7 +128,7 @@ class EditWindow extends React.Component { thumbnail: obj.Data.url }); } else { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); } }); } @@ -164,7 +164,7 @@ class EditWindow extends React.Component { callback && callback(obj); this.handleClose(); } else { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); } }); } diff --git a/ShadowEditor.Web/src/editor/component/LMeshComponent.jsx b/ShadowEditor.Web/src/editor/component/LMeshComponent.jsx index c7c07f94..4416f1c9 100644 --- a/ShadowEditor.Web/src/editor/component/LMeshComponent.jsx +++ b/ShadowEditor.Web/src/editor/component/LMeshComponent.jsx @@ -17,7 +17,7 @@ class LMeshComponent extends React.Component { expanded: true, options: [], animation: '', - previewText: _t('Preview'), + previewText: _t('Preview') }; this.handleExpand = this.handleExpand.bind(this); @@ -34,9 +34,20 @@ class LMeshComponent extends React.Component { return null; } - return - - + return + + ; } @@ -47,7 +58,7 @@ class LMeshComponent extends React.Component { handleExpand(expanded) { this.setState({ - expanded, + expanded }); } @@ -56,7 +67,7 @@ class LMeshComponent extends React.Component { if (!editor.selected || !(editor.selected.userData.type === 'lol')) { this.setState({ - show: false, + show: false }); return; } @@ -78,7 +89,7 @@ class LMeshComponent extends React.Component { show: true, options, animation: animNames[0], - previewText: this.isPlaying ? _t('Cancel') : _t('Preview'), + previewText: this.isPlaying ? _t('Cancel') : _t('Preview') }); } @@ -109,7 +120,7 @@ class LMeshComponent extends React.Component { this.isPlaying = true; this.setState({ - previewText: _t('Cancel'), + previewText: _t('Cancel') }); const model = this.selected.userData.model; @@ -122,7 +133,7 @@ class LMeshComponent extends React.Component { this.isPlaying = false; this.setState({ - previewText: _t('Preview'), + previewText: _t('Preview') }); app.on(`animate.LMeshComponent`, null); diff --git a/ShadowEditor.Web/src/editor/component/MMDComponent.jsx b/ShadowEditor.Web/src/editor/component/MMDComponent.jsx index ad8753a7..263a19cc 100644 --- a/ShadowEditor.Web/src/editor/component/MMDComponent.jsx +++ b/ShadowEditor.Web/src/editor/component/MMDComponent.jsx @@ -19,7 +19,7 @@ class MMDComponent extends React.Component { animation: null, cameraAnimation: null, - audio: null, + audio: null }; this.handleExpand = this.handleExpand.bind(this); @@ -40,10 +40,32 @@ class MMDComponent extends React.Component { return null; } - return - - - + return + + + ; } @@ -54,7 +76,7 @@ class MMDComponent extends React.Component { handleExpand(expanded) { this.setState({ - expanded, + expanded }); } @@ -63,7 +85,7 @@ class MMDComponent extends React.Component { if (!editor.selected || !(editor.selected.userData.Type === 'pmd' || editor.selected.userData.Type === 'pmx')) { this.setState({ - show: false, + show: false }); return; } @@ -74,7 +96,7 @@ class MMDComponent extends React.Component { show: true, animation: this.selected.userData.Animation ? this.selected.userData.Animation.Name : null, cameraAnimation: this.selected.userData.CameraAnimation ? this.selected.userData.CameraAnimation.Name : null, - audio: this.selected.userData.Audio ? this.selected.userData.Audio.Name : null, + audio: this.selected.userData.Audio ? this.selected.userData.Audio.Name : null }; this.setState(state); @@ -90,7 +112,7 @@ class MMDComponent extends React.Component { onSelectAnimation(data) { if (data.Type !== 'mmd') { - app.toast(_t('Please select MMD animation only.')); + app.toast(_t('Please select MMD animation only.'), 'warn'); return; } app.on(`selectAnimation.MMDComponent`, null); @@ -111,7 +133,7 @@ class MMDComponent extends React.Component { onSelectCameraAnimation(data) { if (data.Type !== 'mmd') { - app.toast(_t('Please select camera animation only.')); + app.toast(_t('Please select camera animation only.'), 'warn'); return; } app.on(`selectAnimation.MMDComponent`, null); diff --git a/ShadowEditor.Web/src/editor/component/MaterialComponent.jsx b/ShadowEditor.Web/src/editor/component/MaterialComponent.jsx index e5a34333..1ba7447b 100644 --- a/ShadowEditor.Web/src/editor/component/MaterialComponent.jsx +++ b/ShadowEditor.Web/src/editor/component/MaterialComponent.jsx @@ -897,7 +897,7 @@ class MaterialComponent extends React.Component { handleTextureSetting() { if (!this.selected.material.map) { - app.toast(_t('Please select texture first.')); + app.toast(_t('Please select texture first.'), 'warn'); return; } diff --git a/ShadowEditor.Web/src/editor/component/SceneComponent.jsx b/ShadowEditor.Web/src/editor/component/SceneComponent.jsx index 76349bab..b0e07f31 100644 --- a/ShadowEditor.Web/src/editor/component/SceneComponent.jsx +++ b/ShadowEditor.Web/src/editor/component/SceneComponent.jsx @@ -57,7 +57,7 @@ class SceneComponent extends React.Component { fogFarShow: false, fogDensity: 0.05, - fogDensityShow: false, + fogDensityShow: false }; this.handleExpand = this.handleExpand.bind(this); @@ -88,25 +88,99 @@ class SceneComponent extends React.Component { return null; } - return - - - - - - - - - + return + + + + + + + + + - - - - - + + + + + ; } @@ -117,7 +191,7 @@ class SceneComponent extends React.Component { handleExpand(expanded) { this.setState({ - expanded, + expanded }); } @@ -126,7 +200,7 @@ class SceneComponent extends React.Component { if (!editor.selected || editor.selected !== app.editor.scene) { this.setState({ - show: false, + show: false }); return; } @@ -142,7 +216,7 @@ class SceneComponent extends React.Component { show: true, // 背景 - backgroundType: background instanceof THREE.CubeTexture ? 'SkyBox' : (background instanceof THREE.Texture ? 'Image' : 'Color'), + backgroundType: background instanceof THREE.CubeTexture ? 'SkyBox' : background instanceof THREE.Texture ? 'Image' : 'Color', backgroundColor: background instanceof THREE.Color ? `#${background.getHexString()}` : backgroundColor, backgroundColorShow: background instanceof THREE.Color, backgroundImage: background instanceof THREE.Texture && !(background instanceof THREE.CubeTexture) ? background : null, @@ -156,15 +230,15 @@ class SceneComponent extends React.Component { backgroundCubeTextureShow: background instanceof THREE.CubeTexture, // 雾效 - fogType: fog == null ? 'None' : (fog instanceof THREE.FogExp2 ? 'FogExp2' : 'Fog'), - fogColor: fog == null ? fogColor : `#${fog.color.getHexString()}`, + fogType: fog === null ? 'None' : fog instanceof THREE.FogExp2 ? 'FogExp2' : 'Fog', + fogColor: fog === null ? fogColor : `#${fog.color.getHexString()}`, fogColorShow: fog !== null, fogNear: fog instanceof THREE.Fog ? fog.near : fogNear, fogNearShow: fog !== null && fog instanceof THREE.Fog, fogFar: fog instanceof THREE.Fog ? fog.far : fogFar, fogFarShow: fog instanceof THREE.Fog, fogDensity: fog instanceof THREE.FogExp2 ? fog.density : fogDensity, - fogDensityShow: fog instanceof THREE.FogExp2, + fogDensityShow: fog instanceof THREE.FogExp2 }; this.setState(state); @@ -175,7 +249,7 @@ class SceneComponent extends React.Component { backgroundType, backgroundColor, backgroundImage, backgroundPosX, backgroundNegX, backgroundPosY, backgroundNegY, backgroundPosZ, backgroundNegZ } = Object.assign({}, this.state, { - [name]: value, + [name]: value }); let scene = this.selected; @@ -193,7 +267,7 @@ class SceneComponent extends React.Component { [name]: value, backgroundColorShow: false, backgroundImageShow: true, - backgroundCubeTextureShow: false, + backgroundCubeTextureShow: false }); return; } @@ -215,7 +289,7 @@ class SceneComponent extends React.Component { [name]: value, backgroundColorShow: false, backgroundImageShow: false, - backgroundCubeTextureShow: true, + backgroundCubeTextureShow: true }); return; } @@ -228,7 +302,7 @@ class SceneComponent extends React.Component { handleChangeBackgroundColor(value, name) { if (value === null) { this.setState({ - [name]: value, + [name]: value }); return; } @@ -243,7 +317,7 @@ class SceneComponent extends React.Component { this.selected.background = new THREE.Color(this.state.backgroundColor); this.setState({ - [name]: value, + [name]: value }); return; } @@ -258,13 +332,13 @@ class SceneComponent extends React.Component { this.selected.background = new THREE.Color(this.state.backgroundColor); this.setState({ - [name]: value, + [name]: value }); return; } const { backgroundPosX, backgroundNegX, backgroundPosY, backgroundNegY, backgroundPosZ, backgroundNegZ } = Object.assign({}, this.state, { - [name]: value, + [name]: value }); if (backgroundPosX && backgroundNegX && backgroundPosY && backgroundNegY && backgroundPosZ && backgroundNegZ) { @@ -284,7 +358,7 @@ class SceneComponent extends React.Component { app.call(`objectChanged`, this, this.selected); } else { this.setState({ - [name]: value, + [name]: value }); } } @@ -316,7 +390,7 @@ class SceneComponent extends React.Component { resolve(texture); }, undefined, error => { console.error(error); - app.toast(_t('Cube Texture fetch failed.')); + app.toast(_t('Cube Texture fetch failed.'), 'warn'); }); }); }); @@ -343,7 +417,7 @@ class SceneComponent extends React.Component { const { backgroundPosX, backgroundNegX, backgroundPosY, backgroundNegY, backgroundPosZ, backgroundNegZ } = this.state; if (!backgroundPosX || !backgroundNegX || !backgroundPosY || !backgroundNegY || !backgroundPosZ || !backgroundNegZ) { - app.toast(_t('Please upload all the textures before save.')); + app.toast(_t('Please upload all the textures before save.'), 'warn'); return; } @@ -355,7 +429,7 @@ class SceneComponent extends React.Component { const negZSrc = backgroundNegZ.image.src; if (posXSrc.startsWith('http') || negXSrc.startsWith('http') || posYSrc.startsWith('http') || negYSrc.startsWith('http') || posZSrc.startsWith('http') || negZSrc.startsWith('http')) { - app.toast(_t('Cube texture has already been uploaded.')); + app.toast(_t('Cube texture has already been uploaded.'), 'warn'); return; } @@ -365,7 +439,7 @@ class SceneComponent extends React.Component { Converter.dataURLtoFile(posYSrc, 'posY'), Converter.dataURLtoFile(negYSrc, 'negY'), Converter.dataURLtoFile(posZSrc, 'posZ'), - Converter.dataURLtoFile(negZSrc, 'negZ'), + Converter.dataURLtoFile(negZSrc, 'negZ') ]; Promise.all(promises).then(files => { @@ -375,7 +449,7 @@ class SceneComponent extends React.Component { posY: files[2], negY: files[3], posZ: files[4], - negZ: files[5], + negZ: files[5] }, result => { let obj = JSON.parse(result); app.toast(_t(obj.Msg)); @@ -385,7 +459,7 @@ class SceneComponent extends React.Component { handleChangeFogType(value, name) { const { fogType, fogColor, fogNear, fogFar, fogDensity } = Object.assign({}, this.state, { - [name]: value, + [name]: value }); let scene = this.selected; @@ -408,7 +482,7 @@ class SceneComponent extends React.Component { handleChangeFogColor(value, name) { if (value === null) { this.setState({ - [name]: value, + [name]: value }); return; } @@ -421,7 +495,7 @@ class SceneComponent extends React.Component { handleChangeFogNear(value, name) { if (value === null) { this.setState({ - [name]: value, + [name]: value }); return; } @@ -434,7 +508,7 @@ class SceneComponent extends React.Component { handleChangeFogFar(value, name) { if (value === null) { this.setState({ - [name]: value, + [name]: value }); return; } @@ -447,7 +521,7 @@ class SceneComponent extends React.Component { handleChangeFogDensity(value, name) { if (value === null) { this.setState({ - [name]: value, + [name]: value }); return; } diff --git a/ShadowEditor.Web/src/editor/component/audio/BackgroundMusicComponent.jsx b/ShadowEditor.Web/src/editor/component/audio/BackgroundMusicComponent.jsx index 78089d75..988c72ad 100644 --- a/ShadowEditor.Web/src/editor/component/audio/BackgroundMusicComponent.jsx +++ b/ShadowEditor.Web/src/editor/component/audio/BackgroundMusicComponent.jsx @@ -19,7 +19,7 @@ class BackgroundMusicComponent extends React.Component { loop: true, volume: 1, showPlayButton: false, - isPlaying: false, + isPlaying: false }; this.handleExpand = this.handleExpand.bind(this); @@ -37,12 +37,37 @@ class BackgroundMusicComponent extends React.Component { return null; } - return - - - - - + return + + + + + ; } @@ -53,7 +78,7 @@ class BackgroundMusicComponent extends React.Component { handleExpand(expanded) { this.setState({ - expanded, + expanded }); } @@ -62,7 +87,7 @@ class BackgroundMusicComponent extends React.Component { if (!editor.selected || !(editor.selected instanceof THREE.Audio)) { this.setState({ - show: false, + show: false }); return; } @@ -75,8 +100,8 @@ class BackgroundMusicComponent extends React.Component { autoplay: this.selected.userData.autoplay || false, loop: this.selected.getLoop(), volumn: this.selected.getVolume(), - showPlayButton: this.selected.buffer != null, - isPlaying: this.selected.isPlaying || false, + showPlayButton: this.selected.buffer !== null, + isPlaying: this.selected.isPlaying || false }; this.setState(state); @@ -100,7 +125,7 @@ class BackgroundMusicComponent extends React.Component { this.setState({ name: obj.Name, - showPlayButton: true, + showPlayButton: true }); }); } @@ -108,13 +133,13 @@ class BackgroundMusicComponent extends React.Component { handleChange(value, name) { if (value === null) { this.setState({ - [name]: value, + [name]: value }); return; } const { autoplay, loop, volumn } = Object.assign({}, this.state, { - [name]: value, + [name]: value }); this.selected.userData.autoplay = autoplay; // 这里不能给this.selected赋值,否则音频会自动播放 @@ -128,7 +153,7 @@ class BackgroundMusicComponent extends React.Component { if (!this.selected.buffer) { this.setState({ showPlayButton: false, - isPlaying: false, + isPlaying: false }); return; } @@ -142,7 +167,7 @@ class BackgroundMusicComponent extends React.Component { this.setState({ showPlayButton: true, - isPlaying: this.selected.isPlaying, + isPlaying: this.selected.isPlaying }); } } diff --git a/ShadowEditor.Web/src/editor/component/line/CatmullRomCurveComponent.jsx b/ShadowEditor.Web/src/editor/component/line/CatmullRomCurveComponent.jsx index f63db991..5d207f49 100644 --- a/ShadowEditor.Web/src/editor/component/line/CatmullRomCurveComponent.jsx +++ b/ShadowEditor.Web/src/editor/component/line/CatmullRomCurveComponent.jsx @@ -13,7 +13,7 @@ class CatmullRomCurveComponent extends React.Component { this.curveType = { centripetal: _t('Centripetal Force'), chordal: _t('Chord'), - catmullrom: _t('Catmullrom'), + catmullrom: _t('Catmullrom') }; this.state = { @@ -21,7 +21,7 @@ class CatmullRomCurveComponent extends React.Component { expanded: false, closed: true, curveType: 'catmullrom', - tension: 1, + tension: 1 }; this.handleExpand = this.handleExpand.bind(this); @@ -38,14 +38,31 @@ class CatmullRomCurveComponent extends React.Component { return null; } - return + return - - - + + + ; } @@ -56,7 +73,7 @@ class CatmullRomCurveComponent extends React.Component { handleExpand(expanded) { this.setState({ - expanded, + expanded }); } @@ -65,7 +82,7 @@ class CatmullRomCurveComponent extends React.Component { if (!editor.selected || editor.selected.userData.type !== 'CatmullRomCurve') { this.setState({ - show: false, + show: false }); return; } @@ -76,7 +93,7 @@ class CatmullRomCurveComponent extends React.Component { show: true, closed: this.selected.userData.closed, curveType: this.selected.userData.curveType, - tension: this.selected.userData.tension, + tension: this.selected.userData.tension }); } @@ -105,7 +122,7 @@ class CatmullRomCurveComponent extends React.Component { let points = this.selected.userData.points; if (points.length === 3) { - app.toast(_t('CatmullRom curve should have at least 3 points.')); + app.toast(_t('CatmullRom curve should have at least 3 points.'), 'warn'); return; } @@ -119,13 +136,13 @@ class CatmullRomCurveComponent extends React.Component { handleChange(value, name) { if (value === null) { this.setState({ - [name]: value, + [name]: value }); return; } const { closed, curveType, tension } = Object.assign({}, this.state, { - [name]: value, + [name]: value }); Object.assign(this.selected.userData, { diff --git a/ShadowEditor.Web/src/editor/menu/AssetsMenu.jsx b/ShadowEditor.Web/src/editor/menu/AssetsMenu.jsx index 21ad595d..ac394390 100644 --- a/ShadowEditor.Web/src/editor/menu/AssetsMenu.jsx +++ b/ShadowEditor.Web/src/editor/menu/AssetsMenu.jsx @@ -23,16 +23,34 @@ class AssetsMenu extends React.Component { render() { return - - + + - - - - - - - + + + + + + + ; } @@ -44,14 +62,14 @@ class AssetsMenu extends React.Component { var object = editor.selected; if (object === null) { - app.toast(_t('Please select object!')); + app.toast(_t('Please select object!'), 'warn'); return; } var geometry = object.geometry; if (geometry === undefined) { - app.toast(_t('The object you selected is not geometry.')); + app.toast(_t('The object you selected is not geometry.'), 'warn'); return; } @@ -75,7 +93,7 @@ class AssetsMenu extends React.Component { var object = editor.selected; if (object === null) { - app.toast(_t('Please select object!')); + app.toast(_t('Please select object!'), 'warn'); return; } @@ -141,7 +159,7 @@ class AssetsMenu extends React.Component { var object = editor.selected; if (object === null) { - app.toast(_t('Please select object!')); + app.toast(_t('Please select object!'), 'warn'); return; } @@ -159,7 +177,7 @@ class AssetsMenu extends React.Component { var object = editor.selected; if (object === null) { - app.toast(_t('Please select object!')); + app.toast(_t('Please select object!'), 'warn'); return; } diff --git a/ShadowEditor.Web/src/editor/menu/LightMenu.jsx b/ShadowEditor.Web/src/editor/menu/LightMenu.jsx index 49c4f912..7e9e2728 100644 --- a/ShadowEditor.Web/src/editor/menu/LightMenu.jsx +++ b/ShadowEditor.Web/src/editor/menu/LightMenu.jsx @@ -27,16 +27,34 @@ class LightMenu extends React.Component { render() { return - - - - - - + + + + + + - - - + + + ; } @@ -153,7 +171,7 @@ class LightMenu extends React.Component { let selected = app.editor.selected; if (!(selected instanceof THREE.PointLight)) { - app.toast(_t('The selected object is not a point light.')); + app.toast(_t('The selected object is not a point light.'), 'warn'); return; } @@ -167,7 +185,7 @@ class LightMenu extends React.Component { let selected = app.editor.selected; if (!(selected instanceof THREE.HemisphereLight)) { - app.toast(_t('The selected object is not a hemisphere light.')); + app.toast(_t('The selected object is not a hemisphere light.'), 'warn'); return; } @@ -181,7 +199,7 @@ class LightMenu extends React.Component { let selected = app.editor.selected; if (!(selected instanceof THREE.RectAreaLight)) { - app.toast(_t('The selected object is not a rect area light.')); + app.toast(_t('The selected object is not a rect area light.'), 'warn'); return; } diff --git a/ShadowEditor.Web/src/editor/menu/LoginMenu.jsx b/ShadowEditor.Web/src/editor/menu/LoginMenu.jsx index 97dae1da..fb47173c 100644 --- a/ShadowEditor.Web/src/editor/menu/LoginMenu.jsx +++ b/ShadowEditor.Web/src/editor/menu/LoginMenu.jsx @@ -94,7 +94,7 @@ class LoginMenu extends React.Component { }).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } app.confirm({ diff --git a/ShadowEditor.Web/src/editor/menu/PlayMenu.jsx b/ShadowEditor.Web/src/editor/menu/PlayMenu.jsx index e7d63c2b..4cd8f15f 100644 --- a/ShadowEditor.Web/src/editor/menu/PlayMenu.jsx +++ b/ShadowEditor.Web/src/editor/menu/PlayMenu.jsx @@ -93,7 +93,7 @@ class PlayMenu extends React.Component { let sceneID = app.editor.sceneID; if (!sceneID) { - app.toast(_t('Please save scene first.')); + app.toast(_t('Please save scene first.'), 'warn'); return; } diff --git a/ShadowEditor.Web/src/editor/menu/SceneMenu.jsx b/ShadowEditor.Web/src/editor/menu/SceneMenu.jsx index f1943be6..c1c17695 100644 --- a/ShadowEditor.Web/src/editor/menu/SceneMenu.jsx +++ b/ShadowEditor.Web/src/editor/menu/SceneMenu.jsx @@ -61,7 +61,7 @@ class SceneMenu extends React.Component { editor.sceneID = null; editor.sceneName = null; document.title = _t('No Name'); - app.toast(_t('Create empty scene successfully.')); + app.toast(_t('Create empty scene successfully.'), 'success'); return; } @@ -160,7 +160,7 @@ class SceneMenu extends React.Component { app.unmask(); - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'success'); }); } @@ -216,7 +216,7 @@ class SceneMenu extends React.Component { app.unmask(); - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'success'); }); } @@ -255,7 +255,7 @@ class SceneMenu extends React.Component { var sceneID = app.editor.sceneID; if (!sceneID) { - app.toast(_t('Please open scene first.')); + app.toast(_t('Please open scene first.'), 'warn'); return; } @@ -272,10 +272,10 @@ class SceneMenu extends React.Component { response.json().then(obj => { app.unmask(); if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'success'); window.open(`${app.options.server}${obj.Url}`, 'export'); }); } diff --git a/ShadowEditor.Web/src/editor/menu/SystemMenu.jsx b/ShadowEditor.Web/src/editor/menu/SystemMenu.jsx index cdcc7feb..1a050757 100644 --- a/ShadowEditor.Web/src/editor/menu/SystemMenu.jsx +++ b/ShadowEditor.Web/src/editor/menu/SystemMenu.jsx @@ -94,7 +94,7 @@ class SystemMenu extends React.Component { }).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } app.confirm({ diff --git a/ShadowEditor.Web/src/editor/menu/ToolMenu.jsx b/ShadowEditor.Web/src/editor/menu/ToolMenu.jsx index 034e218d..07a9a9f5 100644 --- a/ShadowEditor.Web/src/editor/menu/ToolMenu.jsx +++ b/ShadowEditor.Web/src/editor/menu/ToolMenu.jsx @@ -68,10 +68,10 @@ class ToolMenu extends React.Component { }).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'success'); }); }); } @@ -92,10 +92,10 @@ class ToolMenu extends React.Component { if (response.ok) { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'success'); window.open(`${app.options.server}${obj.Url}`, 'export'); }); } @@ -117,10 +117,10 @@ class ToolMenu extends React.Component { if (response.ok) { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'success'); window.open(`${app.options.server}${obj.Url}`, 'export'); }); } diff --git a/ShadowEditor.Web/src/editor/system/AuthorityManagementWindow.jsx b/ShadowEditor.Web/src/editor/system/AuthorityManagementWindow.jsx index a92f7dd6..ea7f79ae 100644 --- a/ShadowEditor.Web/src/editor/system/AuthorityManagementWindow.jsx +++ b/ShadowEditor.Web/src/editor/system/AuthorityManagementWindow.jsx @@ -77,7 +77,7 @@ class AuthorityManagementWindow extends React.Component { fetch(`${app.options.server}/api/Role/List?pageSize=10000`).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.setState({ @@ -96,7 +96,7 @@ class AuthorityManagementWindow extends React.Component { fetch(`${app.options.server}/api/OperatingAuthority/Get?roleID=${selected.ID}`).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } obj.Data.rows.forEach(n => { @@ -155,10 +155,10 @@ class AuthorityManagementWindow extends React.Component { }).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'success'); this.handleSelectRole({ ID: roleID }); diff --git a/ShadowEditor.Web/src/editor/system/ChangePasswordWindow.jsx b/ShadowEditor.Web/src/editor/system/ChangePasswordWindow.jsx index dc02ae81..d3cbe0be 100644 --- a/ShadowEditor.Web/src/editor/system/ChangePasswordWindow.jsx +++ b/ShadowEditor.Web/src/editor/system/ChangePasswordWindow.jsx @@ -84,10 +84,10 @@ class ChangePasswordWindow extends React.Component { }).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'success'); this.handleClose(); }); }); diff --git a/ShadowEditor.Web/src/editor/system/DepartmentManagementWindow.jsx b/ShadowEditor.Web/src/editor/system/DepartmentManagementWindow.jsx index 0376b1b0..c2da89b9 100644 --- a/ShadowEditor.Web/src/editor/system/DepartmentManagementWindow.jsx +++ b/ShadowEditor.Web/src/editor/system/DepartmentManagementWindow.jsx @@ -109,7 +109,7 @@ class DepartmentManagementWindow extends React.Component { fetch(`${app.options.server}/api/Department/List?pageSize=10000`).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.list = obj.Data; @@ -189,7 +189,7 @@ class DepartmentManagementWindow extends React.Component { }).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.handleRefresh(obj.Data); @@ -244,7 +244,7 @@ class DepartmentManagementWindow extends React.Component { const { selected, deptName, adminID } = this.state; if (!deptName || deptName.trim() === '') { - app.toast(_t('Name is not allowed to be empty.')); + app.toast(_t('Name is not allowed to be empty.'), 'warn'); return; } @@ -259,10 +259,10 @@ class DepartmentManagementWindow extends React.Component { }).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'success'); this.handleRefresh(); }); }); diff --git a/ShadowEditor.Web/src/editor/system/RegisterWindow.jsx b/ShadowEditor.Web/src/editor/system/RegisterWindow.jsx index ff3bc341..f23ad5d9 100644 --- a/ShadowEditor.Web/src/editor/system/RegisterWindow.jsx +++ b/ShadowEditor.Web/src/editor/system/RegisterWindow.jsx @@ -98,10 +98,10 @@ class RegisterWindow extends React.Component { }).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'success'); this.handleClose(); }); }); diff --git a/ShadowEditor.Web/src/editor/system/RoleManageWindow.jsx b/ShadowEditor.Web/src/editor/system/RoleManageWindow.jsx index 3ebb7126..79e9374c 100644 --- a/ShadowEditor.Web/src/editor/system/RoleManageWindow.jsx +++ b/ShadowEditor.Web/src/editor/system/RoleManageWindow.jsx @@ -117,7 +117,7 @@ class RoleManageWindow extends React.Component { response.json().then(obj => { app.unmask(); if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.setState({ @@ -152,7 +152,7 @@ class RoleManageWindow extends React.Component { if (record.Name === 'Administrator' || record.Name === 'User' || record.Name === 'Guest') { - app.toast(_t('Modifying system built-in roles is not allowed.')); + app.toast(_t('Modifying system built-in roles is not allowed.'), 'warn'); return; } @@ -176,7 +176,7 @@ class RoleManageWindow extends React.Component { if (record.Name === 'Administrator' || record.Name === 'User' || record.Name === 'Guest') { - app.toast(_t('It is not allowed to delete system built-in roles.')); + app.toast(_t('It is not allowed to delete system built-in roles.'), 'warn'); return; } @@ -195,10 +195,10 @@ class RoleManageWindow extends React.Component { }).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'success'); }); }); } diff --git a/ShadowEditor.Web/src/editor/system/SystemSettingWindow.jsx b/ShadowEditor.Web/src/editor/system/SystemSettingWindow.jsx index eb066515..aa4de0d7 100644 --- a/ShadowEditor.Web/src/editor/system/SystemSettingWindow.jsx +++ b/ShadowEditor.Web/src/editor/system/SystemSettingWindow.jsx @@ -52,7 +52,7 @@ class SystemSettingWindow extends React.Component { fetch(`/api/Config/Get`).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.setState({ @@ -64,7 +64,7 @@ class SystemSettingWindow extends React.Component { fetch(`/api/Role/List?pageSize=10000`).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } let roles = {}; @@ -96,10 +96,10 @@ class SystemSettingWindow extends React.Component { }).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'success'); this.handleClose(); }); }); diff --git a/ShadowEditor.Web/src/editor/system/UserManageWindow.jsx b/ShadowEditor.Web/src/editor/system/UserManageWindow.jsx index 7c045e73..2c501db9 100644 --- a/ShadowEditor.Web/src/editor/system/UserManageWindow.jsx +++ b/ShadowEditor.Web/src/editor/system/UserManageWindow.jsx @@ -132,7 +132,7 @@ class UserManageWindow extends React.Component { response.json().then(obj => { app.unmask(); if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.setState({ @@ -165,7 +165,7 @@ class UserManageWindow extends React.Component { const record = data.filter(n => n.ID === selected)[0]; if (record.Username === 'admin') { - app.toast(_t('Modifying system built-in users is not allowed.')); + app.toast(_t('Modifying system built-in users is not allowed.'), 'warn'); return; } @@ -192,7 +192,7 @@ class UserManageWindow extends React.Component { const record = this.state.data.filter(n => n.ID === selected)[0]; if (record.Username === 'admin') { - app.toast(_t('It is not allowed to delete system built-in users.')); + app.toast(_t('It is not allowed to delete system built-in users.'), 'warn'); return; } @@ -225,11 +225,11 @@ class UserManageWindow extends React.Component { }).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.handleRefresh(); - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'success'); }); }); } diff --git a/ShadowEditor.Web/src/editor/system/dept/EditDeptWindow.jsx b/ShadowEditor.Web/src/editor/system/dept/EditDeptWindow.jsx index f0b31f21..92daf58d 100644 --- a/ShadowEditor.Web/src/editor/system/dept/EditDeptWindow.jsx +++ b/ShadowEditor.Web/src/editor/system/dept/EditDeptWindow.jsx @@ -63,7 +63,7 @@ class EditDeptWindow extends React.Component { const { id, name, pid } = this.state; if (!name || name.trim() === '') { - app.toast(_t('Name is not allowed to be empty.')); + app.toast(_t('Name is not allowed to be empty.'), 'warn'); return; } @@ -78,7 +78,7 @@ class EditDeptWindow extends React.Component { }).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.handleClose(); diff --git a/ShadowEditor.Web/src/editor/system/dept/SelectDeptWindow.jsx b/ShadowEditor.Web/src/editor/system/dept/SelectDeptWindow.jsx index 6f76fbff..e1b2f8a9 100644 --- a/ShadowEditor.Web/src/editor/system/dept/SelectDeptWindow.jsx +++ b/ShadowEditor.Web/src/editor/system/dept/SelectDeptWindow.jsx @@ -62,7 +62,7 @@ class SelectDeptWindow extends React.Component { fetch(`${app.options.server}/api/Department/List?pageSize=10000`).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.list = obj.Data; diff --git a/ShadowEditor.Web/src/editor/system/role/EditRoleWindow.jsx b/ShadowEditor.Web/src/editor/system/role/EditRoleWindow.jsx index c194d525..a51cd3c7 100644 --- a/ShadowEditor.Web/src/editor/system/role/EditRoleWindow.jsx +++ b/ShadowEditor.Web/src/editor/system/role/EditRoleWindow.jsx @@ -56,7 +56,7 @@ class EditRoleWindow extends React.Component { const { id, name } = this.state; if (!name || name.trim() === '') { - app.toast(_t('Name is not allowed to be empty.')); + app.toast(_t('Name is not allowed to be empty.'), 'warn'); return; } @@ -71,7 +71,7 @@ class EditRoleWindow extends React.Component { }).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.handleClose(); diff --git a/ShadowEditor.Web/src/editor/system/user/EditUserWindow.jsx b/ShadowEditor.Web/src/editor/system/user/EditUserWindow.jsx index 31219c6c..4ef8db44 100644 --- a/ShadowEditor.Web/src/editor/system/user/EditUserWindow.jsx +++ b/ShadowEditor.Web/src/editor/system/user/EditUserWindow.jsx @@ -110,7 +110,7 @@ class EditUserWindow extends React.Component { fetch(`${app.options.server}/api/Role/List?pageSize=10000`).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } const roles = { @@ -150,27 +150,27 @@ class EditUserWindow extends React.Component { const { id, username, password, confirmPassword, name, roleID, deptID } = this.state; if (!username || username.trim() === '') { - app.toast(_t('Username is not allowed to be empty.')); + app.toast(_t('Username is not allowed to be empty.'), 'warn'); return; } if (!id && (!password || password.trim() === '')) { - app.toast(_t('Password is not allowed to be empty.')); + app.toast(_t('Password is not allowed to be empty.'), 'warn'); return; } if (!id && (!confirmPassword || confirmPassword.trim() === '')) { - app.toast(_t('Confirm password is not allowed to be empty.')); + app.toast(_t('Confirm password is not allowed to be empty.'), 'warn'); return; } if (!id && password !== confirmPassword) { - app.toast(_t('Password and confirm password is not the same.')); + app.toast(_t('Password and confirm password is not the same.'), 'warn'); return; } if (!name || name.trim() === '') { - app.toast(_t('Nick name is not allowed to be empty.')); + app.toast(_t('Nick name is not allowed to be empty.'), 'warn'); return; } @@ -185,7 +185,7 @@ class EditUserWindow extends React.Component { }).then(response => { response.json().then(json => { if (json.Code !== 200) { - app.toast(_t(json.Msg)); + app.toast(_t(json.Msg), 'warn'); return; } this.handleClose(); diff --git a/ShadowEditor.Web/src/editor/system/user/ResetPasswordWindow.jsx b/ShadowEditor.Web/src/editor/system/user/ResetPasswordWindow.jsx index 8fbd7658..4f028af0 100644 --- a/ShadowEditor.Web/src/editor/system/user/ResetPasswordWindow.jsx +++ b/ShadowEditor.Web/src/editor/system/user/ResetPasswordWindow.jsx @@ -67,17 +67,17 @@ class ResetPasswordWindow extends React.Component { const { id, newPassword, confirmPassword } = this.state; if (!newPassword || newPassword.trim() === '') { - app.toast(_t('New password is not allowed to be empty.')); + app.toast(_t('New password is not allowed to be empty.'), 'warn'); return; } if (!confirmPassword || confirmPassword.trim() === '') { - app.toast(_t('Confirm password is not allowed to be empty.')); + app.toast(_t('Confirm password is not allowed to be empty.'), 'warn'); return; } if (newPassword !== confirmPassword) { - app.toast(_t('New password and confirm password is not the same.')); + app.toast(_t('New password and confirm password is not the same.'), 'warn'); return; } @@ -90,10 +90,10 @@ class ResetPasswordWindow extends React.Component { }).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'success'); this.handleClose(); }); }); diff --git a/ShadowEditor.Web/src/editor/system/user/SelectUserWindow.jsx b/ShadowEditor.Web/src/editor/system/user/SelectUserWindow.jsx index 238c7a9e..df7d3b2d 100644 --- a/ShadowEditor.Web/src/editor/system/user/SelectUserWindow.jsx +++ b/ShadowEditor.Web/src/editor/system/user/SelectUserWindow.jsx @@ -125,7 +125,7 @@ class SelectUserWindow extends React.Component { response.json().then(obj => { app.unmask(); if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.setState({ diff --git a/ShadowEditor.Web/src/editor/toolbar/GeneralTools.jsx b/ShadowEditor.Web/src/editor/toolbar/GeneralTools.jsx index 10c27d01..3f5cc0be 100644 --- a/ShadowEditor.Web/src/editor/toolbar/GeneralTools.jsx +++ b/ShadowEditor.Web/src/editor/toolbar/GeneralTools.jsx @@ -204,10 +204,10 @@ class GeneralTools extends React.Component { }).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'success'); }); }); } diff --git a/ShadowEditor.Web/src/player/Player.js b/ShadowEditor.Web/src/player/Player.js index 0b6818cb..51db1aa4 100644 --- a/ShadowEditor.Web/src/player/Player.js +++ b/ShadowEditor.Web/src/player/Player.js @@ -103,7 +103,7 @@ Player.prototype.start = function (sceneData) { try { jsons = JSON.parse(sceneData); } catch (e) { - app.toast(_t('Cannot deserialize scene data.')); + app.toast(_t('Cannot deserialize scene data.'), 'error'); return; } diff --git a/ShadowEditor.Web/src/utils/Server.js b/ShadowEditor.Web/src/utils/Server.js index e1565b2b..8ae7fd14 100644 --- a/ShadowEditor.Web/src/utils/Server.js +++ b/ShadowEditor.Web/src/utils/Server.js @@ -23,7 +23,7 @@ class Server { fetch(`/api/Config/Get`).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } this.enableAuthority = obj.Data.EnableAuthority; @@ -41,12 +41,12 @@ class Server { resolve(); }).catch(e => { console.warn(e); - app.toast(_t('Server configuration acquisition failed.')); + app.toast(_t('Server configuration acquisition failed.'), 'error'); resolve(); }); }).catch(e => { console.warn(e); - app.toast(_t('Server configuration acquisition failed.')); + app.toast(_t('Server configuration acquisition failed.'), 'error'); resolve(); }); }); @@ -63,7 +63,7 @@ class Server { }).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); resolve(false); return; } @@ -93,7 +93,7 @@ class Server { }).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); resolve(false); return; } diff --git a/ShadowEditor.Web/src/utils/VideoRecorder.js b/ShadowEditor.Web/src/utils/VideoRecorder.js index 0003f34a..b8fffeb8 100644 --- a/ShadowEditor.Web/src/utils/VideoRecorder.js +++ b/ShadowEditor.Web/src/utils/VideoRecorder.js @@ -16,7 +16,7 @@ class VideoRecorder { start() { if (!navigator.mediaDevices) { - app.toast(`Record is not supported!`); + app.toast(`Record is not supported!`, 'error'); return new Promise(resolve => { resolve(false); }); @@ -31,7 +31,7 @@ class VideoRecorder { resolve(true); }) .catch(err => { - app.toast(err); + app.toast(err, 'error'); resolve(false); }); }); @@ -54,10 +54,10 @@ class VideoRecorder { }).then(response => { response.json().then(obj => { if (obj.Code !== 200) { - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'warn'); return; } - app.toast(_t(obj.Msg)); + app.toast(_t(obj.Msg), 'success'); this.chunks.length = 0; resolve(true); });