non-null in location

This commit is contained in:
ckcz123 2018-12-04 18:57:02 +08:00
parent 4db79dec3f
commit 105d73e0af
4 changed files with 15 additions and 6 deletions

2
.gitignore vendored
View File

@ -1,7 +1,7 @@
.vscode
*ce5eec52_2fa1_447b_8dad_764e267a7fab*
.DS_Store
MTBuilder.app
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

View File

@ -1009,6 +1009,7 @@ editor.prototype.listen = function () {
editor.updateMap();
fields.forEach(function(v){
editor.currentFloorData[v][now.x+','+now.y]=editor.currentFloorData[v][last.x+','+last.y]
if (!core.isset(editor.currentFloorData[v][now.x+','+now.y])) delete editor.currentFloorData[v][now.x+','+now.y];
})
editor.file.saveFloorFile(function (err) {
if (err) {
@ -1053,8 +1054,10 @@ editor.prototype.listen = function () {
fields.forEach(function(v){
var temp_atsfcytaf=editor.currentFloorData[v][now.x+','+now.y];
editor.currentFloorData[v][now.x+','+now.y]=editor.currentFloorData[v][last.x+','+last.y];
editor.currentFloorData[v][last.x+','+last.y]=temp_atsfcytaf
if (!core.isset(editor.currentFloorData[v][last.x+','+last.y])) delete editor.currentFloorData[v][now.x+','+now.y];
else editor.currentFloorData[v][now.x+','+now.y]=editor.currentFloorData[v][last.x+','+last.y];
if (!core.isset(temp_atsfcytaf)) delete editor.currentFloorData[v][last.x+','+last.y];
else editor.currentFloorData[v][last.x+','+last.y]=temp_atsfcytaf
})
editor.file.saveFloorFile(function (err) {
if (err) {
@ -1078,7 +1081,7 @@ editor.prototype.listen = function () {
editor.map[now.y][now.x]=editor.info;
editor.updateMap();
fields.forEach(function(v){
editor.currentFloorData[v][now.x+','+now.y]=null;
delete editor.currentFloorData[v][now.x+','+now.y];
})
editor.file.saveFloorFile(function (err) {
if (err) {

View File

@ -901,7 +901,11 @@ editor_file = function (editor, callback) {
}
if (file == 'floors') {
actionList.forEach(function (value) {
eval("editor.currentFloorData" + value[1] + '=' + JSON.stringify(value[2]));
// 检测null/undefined
if (core.isset(value[2]))
eval("editor.currentFloorData" + value[1] + '=' + JSON.stringify(value[2]));
else
eval("delete editor.currentFloorData"+value[1]);
});
editor_file.saveFloorFile(callback);
return;

View File

@ -79,7 +79,9 @@ var maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
'65':{'cls': 'items', 'id': 'hammer'}, // 圣锤
'68':{'cls': 'items', 'id': 'lifeWand'}, // 生命魔杖
'69':{'cls': 'items', 'id': 'jumpShoes'}, // 生命魔杖
'70':{'cls': 'items', 'id': 'skill1'}, // 技能:二倍斩
'70':{'cls': 'items', 'id': 'sword0'},
'71':{'cls': 'items', 'id': 'shield0'},
'72':{'cls': 'items', 'id': 'skill1'}, // 技能:二倍斩
////////////////////////// 门、楼梯、传送点部分 //////////////////////////