diff --git a/_server/editor_table.js b/_server/editor_table.js
index 74c8fd7e..c1ca22e9 100644
--- a/_server/editor_table.js
+++ b/_server/editor_table.js
@@ -9,8 +9,13 @@ editor_table_wrapper = function (editor) {
* HTML模板
*/
- editor_table.prototype.select = function (options) {
- return `\n`
+ editor_table.prototype.select = function (value, values) {
+ return `\n`
}
editor_table.prototype.option = function (value) {
return `\n`
@@ -25,6 +30,51 @@ editor_table_wrapper = function (editor) {
return `\n`
}
+ editor_table.prototype.title = function () {
+ return `\n
| 条目 | 注释 | 值 |
\n`
+ }
+
+ editor_table.prototype.gap = function (field) {
+ return `| ---- | ---- | ${field} |
\n`
+ }
+
+
+ /////////////////////////////////////////////////////////////////////////////
+ /**
+ * 表格生成的控制
+ */
+
+
+ /**
+ * 缩进控制, 此函数未实装, 目前全部使用的是0
+ */
+ editor_table.prototype.indent = function (field) {
+ var num = '\t';
+ if (field.indexOf("['main']") === 0) return 0;
+ if (field === "['special']") return 0;
+ return num;
+ }
+
+ /**
+ * 注释对象的默认值
+ */
+ editor_table.prototype.defaultcobj = {
+ // 默认是文本域
+ _type: 'textarea',
+ _data: '',
+ _string: function (args) {//object~[field,cfield,vobj,cobj]
+ var thiseval = args.vobj;
+ return (typeof (thiseval) === typeof ('')) && thiseval[0] === '"';
+ },
+ // 默认情况下 非对象和数组的视为叶节点
+ _leaf: function (args) {//object~[field,cfield,vobj,cobj]
+ var thiseval = args.vobj;
+ if (thiseval == null || thiseval == undefined) return true;//null,undefined
+ if (typeof (thiseval) === typeof ('')) return true;//字符串
+ if (Object.keys(thiseval).length === 0) return true;//数字,true,false,空数组,空对象
+ return false;
+ },
+ }
/////////////////////////////////////////////////////////////////////////////
/**
@@ -56,7 +106,7 @@ editor_table_wrapper = function (editor) {
*/
editor_table.prototype.objToTable_ = function (obj, commentObj) {
// 表格抬头
- var outstr = ["\n| 条目 | 注释 | 值 |
\n"];
+ var outstr = [editor.table.title()];
var guids = [];
var defaultcobj = {
// 默认是文本域
@@ -124,7 +174,7 @@ editor_table_wrapper = function (editor) {
if (cobj._hide) continue;
if (!cobj._leaf) {
// 不是叶节点时, 插入展开的标记并继续遍历, 此处可以改成按钮用来添加新项或折叠等
- outstr.push(["| ---- | ---- | ", field, " |
\n"].join(''));
+ outstr.push(editor.table.gap(field));
recursionParse(field, cfield, vobj, cobj);
} else {
// 是叶节点时, 调objToTr_渲染
@@ -309,28 +359,18 @@ editor_table_wrapper = function (editor) {
var thiseval = vobj;
if (cobj._select) {
var values = cobj._select.values;
- var outstr = ['');
- return outstr.join('');
+ return editor.table.select(thiseval,values);
} else if (cobj._input) {
- return ["\n"].join('');
+ return editor.table.text(thiseval);
} else if (cobj._bool) {
- return ["\n"].join('');
+ return editor.table.checkbox(thiseval);
} else {
var num = 0;//editor_table.indent(field);
- return ["\n'].join('');
+ return editor.table.textarea(thiseval,num);
}
}
- editor_table.prototype.indent = function (field) {
- var num = '\t';
- if (field.indexOf("['main']") === 0) return 0;
- if (field === "['special']") return 0;
- return num;
- }
+
editor.constructor.prototype.table = new editor_table();
}
diff --git a/_server/refactoring.md b/_server/refactoring.md
index 7bda1da8..6b6428d2 100644
--- a/_server/refactoring.md
+++ b/_server/refactoring.md
@@ -13,6 +13,7 @@
+ [ ] editor_table 处理表格的生成, 及其响应的事件, 从原editor\_mode中分离
+ [ ] editor_file 调用fs.js编辑文件, 把原editor\_file模块化
+ [ ] editor_game 处理来自core的数据, 导入为editor的数据, 从原editor中分离
++ [ ] editor_util 生成guid等函数, 从editor分离
+ [ ] editor 执行初始化流程加组合各组件
+ [ ] 原editor_mode 移除
@@ -29,6 +30,7 @@ editor: {
multi: 组件
file: 组件
table: 组件
+ util: 组件
}
game: 来自游戏的数据
mode: 当前的模式(左侧的选择)
@@ -57,6 +59,26 @@ editor: {
+ [ ] ? 表格折叠
变为四栏, 可以折叠展开
++ [ ] blockly对于无法识别的图块原样返回
+
++ [ ] ? 简洁的事件方块注册
+ `editor.registerEvent('log',[['test','Int','测试',0],['floorId','Idstring','楼层','MT0']])`
+
++ [ ] 一个显示所有快捷键的文本
+
++ [ ] 更多快捷键
+ 【全塔属性】、【楼层属性】等常用的编辑栏切换
+
++ [ ] ? 地图编辑优化
+ 常用的地图编辑快捷键/命令:复制ctrl+c、粘贴ctrl+v、(复制可绑定为现在的“选中xx位置事件” 粘贴为复制xx事件到此处),撤回ctrl+z、取消撤回ctrl+y
+ 可以按住拖动图块与事件。
+
++ [ ] ? 自由建立快捷键到命令的注册表。
+
+
+
+
+
## 左侧页面模式
标题? 保存按钮? 添加按钮? 删除按钮?