Merge branch 'v2.x' of https://github.com/ckcz123/mota-js into v2.x

This commit is contained in:
oc 2019-04-20 00:56:31 +08:00
commit 37d9b10f21
2 changed files with 17 additions and 118 deletions

View File

@ -439,27 +439,7 @@ editor_file = function (editor, callback) {
value[1] = [value[1].slice(0, tempindex), "['" + id + "']", value[1].slice(tempindex)].join('');
});
saveSetting('items', actionList, function (err) {
callback([
(function () {
var locObj_ = {};
Object.keys(editor_file.comment._data.items._data).forEach(function (v) {
if (isset(editor.core.items[v][id]) && v !== 'items')
locObj_[v] = editor.core.items[v][id];
else
locObj_[v] = null;
});
locObj_['items'] = (function () {
var locObj = Object.assign({}, editor.core.items.items[id]);
Object.keys(editor_file.comment._data.items._data.items._data).forEach(function (v) {
if (!isset(editor.core.items.items[id][v]))
locObj[v] = null;
});
return locObj;
})();
return locObj_;
})(),
editor_file.comment._data.items,
err]);
callback([err]);
});
} else {
callback([
@ -505,19 +485,7 @@ editor_file = function (editor, callback) {
value[1] = "['" + id + "']" + value[1];
});
saveSetting('enemys', actionList, function (err) {
callback([
(function () {
var locObj = Object.assign({}, editor.core.enemys.enemys[id]);
Object.keys(editor_file.comment._data.enemys._data).forEach(function (v) {
if (!isset(editor.core.enemys.enemys[id][v]))
/* locObj[v]=editor.core.enemys.enemys[id][v];
else */
locObj[v] = null;
});
return locObj;
})(),
editor_file.comment._data.enemys,
err]);
callback([err]);
});
} else {
callback([
@ -562,20 +530,7 @@ editor_file = function (editor, callback) {
value[1] = "['" + idnum + "']" + value[1];
}
saveSetting('maps', actionList, function (err) {
callback([
(function () {
var sourceobj=editor.core.maps.blocksInfo[idnum];
if(!isset(sourceobj) && idnum>=editor.core.icons.tilesetStartOffset)sourceobj={"cls": "tileset", "id": "X"+idnum, "noPass": true}
var locObj = Object.assign({}, sourceobj);
Object.keys(editor_file.comment._data.maps._data).forEach(function (v) {
if (!isset(sourceobj[v]))
locObj[v] = null;
});
locObj.idnum = idnum;
return locObj;
})(),
editor_file.comment._data.maps,
null]);
callback([err]);
});
} else {
callback([
@ -615,19 +570,7 @@ editor_file = function (editor, callback) {
value[1] = value[1] + "['" + x + "," + y + "']";
});
saveSetting('floorloc', actionList, function (err) {
callback([
(function () {
var locObj = {};
Object.keys(editor_file.comment._data.floors._data.loc._data).forEach(function (v) {
if (isset(editor.currentFloorData[v][x + ',' + y]))
locObj[v] = editor.currentFloorData[v][x + ',' + y];
else
locObj[v] = null;
});
return locObj;
})(),
editor_file.comment._data.floors._data.loc,
err]);
callback([err]);
});
} else {
callback([
@ -664,25 +607,7 @@ editor_file = function (editor, callback) {
;
if (isset(actionList) && actionList.length > 0) {
saveSetting('floors', actionList, function (err) {
callback([
(function () {
var locObj = Object.assign({}, editor.currentFloorData);
Object.keys(editor_file.comment._data.floors._data.floor._data).forEach(function (v) {
if (!isset(editor.currentFloorData[v]))
/* locObj[v]=editor.currentFloorData[v];
else */
locObj[v] = null;
});
Object.keys(editor_file.comment._data.floors._data.loc._data).forEach(function (v) {
delete(locObj[v]);
});
delete(locObj.map);
delete(locObj.bgmap);
delete(locObj.fgmap);
return locObj;
})(),
editor_file.comment._data.floors._data.floor,
err]);
callback([err]);
});
} else {
callback([
@ -725,20 +650,7 @@ editor_file = function (editor, callback) {
;
if (isset(actionList) && actionList.length > 0) {
saveSetting('data', actionList, function (err) {
callback([
(function () {
//var locObj=Object.assign({'main':{}},editor.core.data);
var locObj = Object.assign({}, data_obj, {'main': {}});
Object.keys(editor_file.dataComment._data.main._data).forEach(function (v) {
if (isset(editor.main[v]))
locObj.main[v] = data_obj.main[v];
else
locObj.main[v] = null;
});
return locObj;
})(),
editor_file.dataComment,
err]);
callback([err]);
});
} else {
callback([
@ -793,14 +705,7 @@ editor_file = function (editor, callback) {
;
if (isset(actionList) && actionList.length > 0) {
saveSetting('functions', actionList, function (err) {
callback([
(function () {
var locObj = JSON.parse(fjson);
buildlocobj(locObj);
return locObj;
})(),
editor_file.functionsComment,
err]);
callback([err]);
});
} else {
callback([
@ -834,10 +739,7 @@ editor_file = function (editor, callback) {
value[1] = "['commonEvent']" + value[1];
});
saveSetting('events', actionList, function (err) {
callback([
Object.assign({},data_obj),
editor_file.eventsComment._data.commonEvent,
err]);
callback([err]);
});
} else {
callback([
@ -885,14 +787,7 @@ editor_file = function (editor, callback) {
;
if (isset(actionList) && actionList.length > 0) {
saveSetting('plugins', actionList, function (err) {
callback([
(function () {
var locObj = JSON.parse(JSON.stringify(plobj));
buildpllocobj(locObj);
return locObj;
})(),
editor_file.pluginsComment,
err]);
callback([err]);
});
} else {
callback([

View File

@ -15,7 +15,7 @@
+ [x] editor_util 生成guid等函数, 从editor分离
+ [ ] editor 执行初始化流程加组合各组件
+ [ ] 原editor_mode 移除
+ [ ] 原vm 移除
+ [x] 原vm 移除
+ [x] \*comment.js 表格注释与结构, 移至table/\*comment.js
## 对象结构
@ -46,16 +46,18 @@ editor: {
+ 插入公共事件的参数的转义处理, .g4中添加ObjectString, 要求其中的值可以JSON.parse, 生成的code中也是作为对象而不是字符串出现
+ 修改editor.multi中的转义处理
+ 修改editor.multi中的转义处理, 目前双击某些方块使用文本编辑的处理, 一部分在editor.blockly, 一部分在editor.multi, 比较混乱
+ 地图的编辑与其他(如全塔属性和楼层属性), 现在的文件操作的模式是完全不同的
楼层文件的储存与其他不同
+ editor.file在修改时不再返回obj和commentobj,只在查询时返回
+ editor.file中的各个条目, 非常相似, 但是细节的不同处理非常麻烦. 是类似的代码复制后修改一部分, 尝试模块化
+ editor.file中的各个条目, 非常相似, 但是细节的不同处理非常麻烦. 是类似的代码复制后修改一部分, 尝试模块化(或者重写)
+ functions和plugins的借助JSON.stringify的replacer特殊处理
+ functions和plugins的借助JSON.stringify的replacer特殊处理, 与其他项的处理完全不同, 改成用统一的方法处理(为了统一,全部使用这种不直观的replacer的处理)
+ 怪物/物品/地图选点事件的处理, field中怪物id等明显与其他节地位不等, 处理起来很繁琐
+ 目前editor.map中储存的是info\<object\>, 准备改为和core一致只储存数字
@ -99,6 +101,8 @@ editor: {
+ [ ] 多帧素材只显示第一帧
+ [ ] `显示文章`以及`选项`等方块, 把`标题`和`图像`从字符串提取出填回相应的空
## 左侧页面模式
标题? 保存按钮? 添加按钮? 删除按钮?