From e761eb63cc54b97a8fb2f58d226594e54abdf803 Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Sat, 14 Nov 2020 22:40:28 +0800 Subject: [PATCH] Fix 273 bugs --- _server/editor_file.js | 20 ++++++++++++++------ _server/editor_ui.js | 1 - libs/actions.js | 2 +- libs/core.js | 4 ++-- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/_server/editor_file.js b/_server/editor_file.js index b4a3608c..278c56e1 100644 --- a/_server/editor_file.js +++ b/_server/editor_file.js @@ -875,13 +875,21 @@ editor_file = function (editor, callback) { } var saveSetting = function (file, actionList, callback) { + var _update = function (name, value) { + if (value[2] === undefined) { + eval("delete " + name + value[1]); + } else { + eval(name + value[1] + "=" + JSON.stringify(value[2])); + } + } + //console.log(file); //console.log(actionList); editor.file.alertWhenCompress(); if (file == 'icons') { actionList.forEach(function (value) { - eval("icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1" + value[1] + '=' + JSON.stringify(value[2])); + _update("icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1", value); }); var datastr = 'var icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1 = \n'; datastr += JSON.stringify(icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1, null, '\t'); @@ -892,7 +900,7 @@ editor_file = function (editor, callback) { } if (file == 'maps') { actionList.forEach(function (value) { - eval("maps_90f36752_8815_4be8_b32b_d7fad1d0542e" + value[1] + '=' + JSON.stringify(value[2])); + _update("maps_90f36752_8815_4be8_b32b_d7fad1d0542e", value); }); var datastr = 'var maps_90f36752_8815_4be8_b32b_d7fad1d0542e = \n'; //datastr+=JSON.stringify(maps_90f36752_8815_4be8_b32b_d7fad1d0542e,null,4); @@ -917,7 +925,7 @@ editor_file = function (editor, callback) { } if (file == 'items') { actionList.forEach(function (value) { - eval("items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a" + value[1] + '=' + JSON.stringify(value[2])); + _update("items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a", value); }); var datastr = 'var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = \n'; var items = core.clone(items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a); @@ -930,7 +938,7 @@ editor_file = function (editor, callback) { } if (file == 'enemys') { actionList.forEach(function (value) { - eval("enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80" + value[1] + '=' + JSON.stringify(value[2])); + _update("enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80", value); }); var datastr = 'var enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80 = \n'; var emap = {}; @@ -954,7 +962,7 @@ editor_file = function (editor, callback) { } if (file == 'data') { actionList.forEach(function (value) { - eval("data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d" + value[1] + '=' + JSON.stringify(value[2])); + _update("data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d", value); }); if (data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.main.floorIds.indexOf(data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.firstData.floorId) < 0) data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.firstData.floorId = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.main.floorIds[0]; @@ -1006,7 +1014,7 @@ editor_file = function (editor, callback) { } if (file == 'events') { actionList.forEach(function (value) { - eval("events_c12a15a8_c380_4b28_8144_256cba95f760" + value[1] + '=' + JSON.stringify(value[2])); + _update("events_c12a15a8_c380_4b28_8144_256cba95f760", value); }); var datastr = 'var events_c12a15a8_c380_4b28_8144_256cba95f760 = \n'; datastr += JSON.stringify(events_c12a15a8_c380_4b28_8144_256cba95f760, null, '\t'); diff --git a/_server/editor_ui.js b/_server/editor_ui.js index 0117a9b6..aa7fa7aa 100644 --- a/_server/editor_ui.js +++ b/_server/editor_ui.js @@ -872,7 +872,6 @@ editor_ui_wrapper = function (editor) { if (span.style.display == 'none') { clearInterval(uievent.values.interval); uievent.values.interval = null; - span.removeChild(uievent.values.dom); return; } core.clearMap(uievent.values.ctx); diff --git a/libs/actions.js b/libs/actions.js index 8318b1f0..09d35aac 100644 --- a/libs/actions.js +++ b/libs/actions.js @@ -2167,7 +2167,7 @@ actions.prototype._clickSwitchs_display_enemyDamage = function () { actions.prototype._clickSwitchs_display_critical = function () { core.flags.displayCritical = !core.flags.displayCritical; core.updateDamage(); - core.setLocalStorage('critical', core.flags.displayExtraDamage); + core.setLocalStorage('critical', core.flags.displayCritical); core.ui._drawSwitchs_display(); } diff --git a/libs/core.js b/libs/core.js index 2d96619b..8c670349 100644 --- a/libs/core.js +++ b/libs/core.js @@ -351,8 +351,8 @@ core.prototype._init_platform = function () { } core.musicStatus.bgmStatus = core.getLocalStorage('bgmStatus', true); core.musicStatus.soundStatus = core.getLocalStorage('soundStatus', true); - //新增 userVolume 默认值1.0 - core.musicStatus.userVolume = core.getLocalStorage('userVolume', 1.0); + //新增 userVolume 默认值0.7 + core.musicStatus.userVolume = core.getLocalStorage('userVolume', 0.7); ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"].forEach(function (t) { if (navigator.userAgent.indexOf(t) >= 0) { if (t == 'iPhone' || t == 'iPad' || t == 'iPod') core.platform.isIOS = true;