update refactoring.md

更新的重构思路,关于edtior_file的重构思考的(可能)比较清晰了
This commit is contained in:
YouWei Zhao 2019-04-23 17:49:49 -04:00
parent b49fbc6c22
commit 9861319734
2 changed files with 10 additions and 0 deletions

View File

@ -3,6 +3,7 @@ editor_file_wrapper = function (editor) {
}
// 这个函数之后挪到editor.table?
editor_file_proto.prototype.loadCommentjs=function(callback){
var commentjs = {
'comment': 'comment',

View File

@ -1,9 +1,18 @@
# 重构
总体思路
+ 按功能拆分文件
+ 左侧页面模块化, 方便添加
+ 不同的模式的文件操作尽可能模块化
目前主要在重构editor_file, 思路是editor.file负责把editor.game内的游戏数据格式化成字符串以及写入到文件, 由editor.game来修改数据
+ editor.file维护一些标记, 描述哪些数据需要格式化并写入, 在save时写入文件(自动保存的话就是每次修改数据都触发save)
+ editor.game修改数据, 并修改editor.file中的标记
+ 此思路下editor.file的大部分内容会挪到editor.game, editor.game和editor.table可能会再进一步合并拆分
editor_file之后是更改editor.map的储存方式, 现有的存对象的模式要在对象和数字间来回转换, 非常繁琐和奇怪
再之后是把editor_unsorted_*.js整理清晰
## 文件结构