取消按钮改为清空。

This commit is contained in:
tengge1 2020-03-24 19:59:15 +08:00
parent b6e6588c6c
commit abaeff404f
4 changed files with 14 additions and 5 deletions

View File

@ -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)】

View File

@ -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.": "自动保存场景已被清空。"
}

View File

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

View File

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