mota-js/_server
2018-03-08 19:00:20 +08:00
..
blockly Support Callback in Editor 2018-03-05 19:37:21 +08:00
CodeMirror 引入CodeMirror作为多行文本编辑器 2018-02-17 17:16:05 +08:00
css editor前端上切换模式 2018-03-08 19:00:20 +08:00
vendor fix bug: polyfill old version of IE 2018-01-20 13:30:36 +08:00
editor_blockly.js issue #57 2018-03-07 22:44:57 +08:00
editor_file_test.html 调整 editor.file & editor.mode 2018-03-04 11:11:52 +08:00
editor_file.js issue #57 2018-03-07 22:44:57 +08:00
editor_mode.js editor前端上切换模式 2018-03-08 19:00:20 +08:00
editor_multi.js issue #57 2018-03-07 22:44:57 +08:00
editor.js editor前端上切换模式 2018-03-08 19:00:20 +08:00
fs.js 重构drawMapGui 2017-12-26 00:55:41 +08:00
fsTest_cs.html 重构drawMapGui 2017-12-26 00:55:41 +08:00
README.md issue #57 2018-03-07 22:44:57 +08:00
vm.js editor前端上切换模式 2018-03-08 19:00:20 +08:00

editor

本目录下所有文件,以及../editor.html../启动服务.exe(源码)是地图编辑器的所有组件.

editor.js,editor_file.jseditor_mode.js耦合较强,editor_blockly.jsfs.js基本可以独立使用.

各组件功能

editor.js

暂略

editor_file.js

提供了以下函数进行楼层map数组相关的操作

editor.file.getFloorFileList
editor.file.loadFloorFile
editor.file.saveFloorFile
editor.file.saveFloorFileAs

6个编辑模式有关的查询

editor.file.editItem('redJewel',[],function(a){console.log(a)});
editor.file.editEnemy('redBat',[],function(a){console.log(a)});
editor.file.editLoc(2,0,[],function(a){console.log(a)});
editor.file.editFloor([],function(a){console.log(a)});
editor.file.editTower([],function(a){console.log(a)});
editor.file.editFunctions([],function(a){console.log(a)});

6个编辑模式有关的编辑

editor.info={images: "terrains", y: 9};
editor.file.changeIdAndIdnum('yellowWall2',16,editor.info,function(a){console.log(a)});
editor.file.editItem('book',[["change","['items']['name']","怪物手册的新名字"]],function(a){console.log(a)});
editor.file.editEnemy('redBat',[['change',"['atk']",20]],function(a){console.log(a)});
editor.file.editLoc(2,6,[["change","['afterBattle']",null]],function(a){console.log(a)});
editor.file.editFloor([["change","['title']",'样板 33 层']],function(a){console.log(a)});
editor.file.editTower([["change","['values']['lavaDamage']",200]],function(a){console.log(a)});
editor.file.editFunctions(["change","['events']['afterChangeLight']","function(x,y){console.log(x,y)}"],function(a){console.log(a)});

editor_mode.js

5个生成表格并绑定事件的函数

editor.mode.loc();
editor.mode.emenyitem();
editor.mode.floor();
editor.mode.tower();
editor.mode.functions();

切换模式

editor.mode.onmode('');
editor.mode.onmode('loc');
editor.mode.onmode('emenyitem');
editor.mode.onmode('floor');
editor.mode.onmode('tower');
editor.mode.onmode('functions');

在切换模式时,改动才会保存到文件,并且需要刷新页面使得editor能看到改动

表格的onchange的实现中,获得当前模式的方式.不注意的话,修改index.html中页面的结构,会被坑

var node = thisTr.parentNode;
while (!editor_mode._ids.hasOwnProperty(node.getAttribute('id'))) {
  node = node.parentNode;
}
editor_mode.onmode(editor_mode._ids[node.getAttribute('id')]);

editor_blockly.js

把选定id_的事件用blockly编辑

editor_blockly.import(id_);

把文本区域的代码转换成图块

editor_blockly.parse();

把当前图块对应的事件返回给调用blockly的id_

editor_blockly.confirm();

待调整

多行文本编辑器独立作为组件 editor_multi.js

z-index

目前主体部分使用了 0,75,100

暂定blockly使用 200 ,多行文本编辑器使用 300

完成后再调整