From abaeff404fd26fcfb2b4f5e16aafccc9f282159e Mon Sep 17 00:00:00 2001 From: tengge1 <930372551@qq.com> Date: Tue, 24 Mar 2020 19:59:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=96=E6=B6=88=E6=8C=89=E9=92=AE=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E6=B8=85=E7=A9=BA=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- ShadowEditor.Web/locales/zh-CN.json | 3 ++- ShadowEditor.Web/src/Application.js | 8 +++++--- ShadowEditor.Web/src/event/AutoSaveEvent.js | 6 ++++++ 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c1b64bf7..fd73fe4b 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Supported Languages: 中文 / [繁體中文](README-tw.md) / [English](README-en ## v0.4.6即将更新 -1. 修复加载自动保存场景确认对话框无法取消bug。 +1. 修复加载自动保存场景确认对话框无法取消bug,取消按钮改为`清空`。 ## v0.4.5更新【[更新日志](docs-dev/update/UpdateLog.md)】 diff --git a/ShadowEditor.Web/locales/zh-CN.json b/ShadowEditor.Web/locales/zh-CN.json index b5772491..dceeec6e 100644 --- a/ShadowEditor.Web/locales/zh-CN.json +++ b/ShadowEditor.Web/locales/zh-CN.json @@ -1024,5 +1024,6 @@ "It is not allowed to drop on another script.": "不允许拖动到另一个脚本上。", "Auto Save": "自动保存", "Load Scene": "加载场景", - "An auto-save scene was detected. Load?": "检测到有自动保存的场景。是否加载?" + "An auto-save scene was detected. Load?": "检测到有自动保存的场景。是否加载?", + "Auto-save scene is cleared.": "自动保存场景已被清空。" } \ No newline at end of file diff --git a/ShadowEditor.Web/src/Application.js b/ShadowEditor.Web/src/Application.js index d25ee4ff..ac98ce2a 100644 --- a/ShadowEditor.Web/src/Application.js +++ b/ShadowEditor.Web/src/Application.js @@ -192,6 +192,8 @@ Application.prototype.confirm = function (options = {}) { const { title, content, + okText, + cancelText, className, style, onOK, @@ -211,15 +213,15 @@ Application.prototype.confirm = function (options = {}) { }; let handleCancel = () => { - if(onCancel && onCancel() !== false) { + if (onCancel && onCancel() !== false) { close(); } }; component = this.createElement(Confirm, { title, - okText: _t('OK'), - cancelText: _t('Cancel'), + okText: okText || _t('OK'), + cancelText: cancelText || _t('Cancel'), className, style, onOK: handleOK, diff --git a/ShadowEditor.Web/src/event/AutoSaveEvent.js b/ShadowEditor.Web/src/event/AutoSaveEvent.js index 7c8effc7..44e6fe6d 100644 --- a/ShadowEditor.Web/src/event/AutoSaveEvent.js +++ b/ShadowEditor.Web/src/event/AutoSaveEvent.js @@ -88,11 +88,17 @@ class AutoSaveEvent extends BaseEvent { app.confirm({ title: _t('Load Scene'), content: _t('An auto-save scene was detected. Load?') + ` (${autoSaveTime})`, + cancelText: _t('Clear'), onOK: () => { this.queryLoad = false; this.commitLoadScene(autoSaveData, autoSaveSceneName, autoSaveSceneID); }, onCancel: () => { + window.localStorage.removeItem('autoSaveTime'); + window.localStorage.removeItem('autoSaveData'); + window.localStorage.removeItem('autoSaveSceneID'); + window.localStorage.removeItem('autoSaveSceneName'); + app.toast(_t('Auto-save scene is cleared.')); this.queryLoad = false; } });