re-write editor_mode.prototype.doActionList

This commit is contained in:
YouWei Zhao 2019-01-31 18:04:51 -05:00
parent f77c8edf29
commit 2b1334fe8c

View File

@ -341,75 +341,37 @@ editor_mode = function (editor) {
editor_mode.prototype.doActionList = function (mode, actionList) { editor_mode.prototype.doActionList = function (mode, actionList) {
if (actionList.length == 0) return; if (actionList.length == 0) return;
printf('修改中...'); printf('修改中...');
var cb=function(objs_){
if (objs_.slice(-1)[0] != null) {
printe(objs_.slice(-1)[0]);
throw(objs_.slice(-1)[0])
}
;printf('修改成功');
}
switch (mode) { switch (mode) {
case 'loc': case 'loc':
editor.file.editLoc(editor_mode.pos.x, editor_mode.pos.y, actionList, function (objs_) {
editor.file.editLoc(editor_mode.pos.x, editor_mode.pos.y, actionList, function (objs_) {//console.log(objs_); cb();
if (objs_.slice(-1)[0] != null) {
printe(objs_.slice(-1)[0]);
throw(objs_.slice(-1)[0])
}
;printf('修改成功');
editor.drawPosSelection(); editor.drawPosSelection();
}); });
break; break;
case 'enemyitem': case 'enemyitem':
if (editor_mode.info.images == 'enemys' || editor_mode.info.images == 'enemy48') { if (editor_mode.info.images == 'enemys' || editor_mode.info.images == 'enemy48') {
editor.file.editEnemy(editor_mode.info.id, actionList, function (objs_) {//console.log(objs_); editor.file.editEnemy(editor_mode.info.id, actionList, cb);
if (objs_.slice(-1)[0] != null) {
printe(objs_.slice(-1)[0]);
throw(objs_.slice(-1)[0])
}
;printf('修改成功')
});
} else if (editor_mode.info.images == 'items') { } else if (editor_mode.info.images == 'items') {
editor.file.editItem(editor_mode.info.id, actionList, function (objs_) {//console.log(objs_); editor.file.editItem(editor_mode.info.id, actionList, cb);
if (objs_.slice(-1)[0] != null) {
printe(objs_.slice(-1)[0]);
throw(objs_.slice(-1)[0])
}
;printf('修改成功')
});
} else { } else {
editor.file.editMapBlocksInfo(editor_mode.info.idnum, actionList, function (objs_) {//console.log(objs_); editor.file.editMapBlocksInfo(editor_mode.info.idnum, actionList, cb);
if (objs_.slice(-1)[0] != null) {
printe(objs_.slice(-1)[0]);
throw(objs_.slice(-1)[0])
}
;printf('修改成功');
});
} }
break; break;
case 'floor': case 'floor':
editor.file.editFloor(actionList, cb);
editor.file.editFloor(actionList, function (objs_) {//console.log(objs_);
if (objs_.slice(-1)[0] != null) {
printe(objs_.slice(-1)[0]);
throw(objs_.slice(-1)[0])
}
;printf('修改成功');
});
break; break;
case 'tower': case 'tower':
editor.file.editTower(actionList, cb);
editor.file.editTower(actionList, function (objs_) {//console.log(objs_);
if (objs_.slice(-1)[0] != null) {
printe(objs_.slice(-1)[0]);
throw(objs_.slice(-1)[0])
}
;printf('修改成功')
});
break; break;
case 'functions': case 'functions':
editor.file.editFunctions(actionList, cb);
editor.file.editFunctions(actionList, function (objs_) {//console.log(objs_);
if (objs_.slice(-1)[0] != null) {
printe(objs_.slice(-1)[0]);
throw(objs_.slice(-1)[0])
}
;printf('修改成功')
});
break; break;
default: default:
break; break;