添加了2.0的修改说明
This commit is contained in:
parent
1854d96fce
commit
f493bc1577
116
2.0diff.md
Normal file
116
2.0diff.md
Normal file
@ -0,0 +1,116 @@
|
||||
# v2.0目前的改动
|
||||
|
||||
## 总体上:
|
||||
|
||||
部分重构了运行时
|
||||
+ 把`libs`中的数据分离出来保存为类似json的js文件,分离后的数据进一步分离为纯数据和注释两部分
|
||||
+ 更改目录结构,分离后的`libs`一般无需修改,把数据楼层文件声音图片放入`project`目录中
|
||||
* 需要相应的修改地图生成器和js压缩工具
|
||||
+ 设置了三个模式`play|editor|replay`在`editor`模式关闭了部分动画,并且角色无法行动
|
||||
|
||||
重构editor
|
||||
+ 不再独立的导入数据和画图,尽可能的通过`main.init('editor')`复用代码
|
||||
+ 能够在本地服务器环境中直接修改`project`中的数据,目前只完成了文件操作的代码`editor_file.js`,前端尚未完成
|
||||
|
||||
## 具体:
|
||||
|
||||
### main.js
|
||||
用户修改内容转移到了`project/data.js`中
|
||||
|
||||
把事件监听打包成了`main.prototype.listen`
|
||||
|
||||
`main.listen`和`main.init`改为在`index.html`中执行
|
||||
|
||||
添加了`main.prototype.loadPureData`,在`main.init`中先加载存数据再加载`libs`
|
||||
|
||||
### core.js
|
||||
`core.drawMap`中`editor`模式下不再画图,而是生成画图的函数提供给`editor`
|
||||
|
||||
`editor`模式下`GlobalAnimate`可以独立的选择是否播放
|
||||
|
||||
`core.playBgm`和`core.playSound`中非`play`模式不再播放声音
|
||||
|
||||
`core.show`和`core.hide`中非`play`模式不再进行动画而是立刻完成并执行回调
|
||||
|
||||
`editor`模式不执行`core.resize`
|
||||
|
||||
### data.js
|
||||
数据转移到了`project/data.js`中
|
||||
|
||||
注释转移到了`project/data.comment.js`中
|
||||
|
||||
### enemy.js,items.js,maps.js,icons.js
|
||||
数据转移到了`project`下的同名文件中
|
||||
|
||||
注释转移到了`project/comment.js`中
|
||||
|
||||
### editor_file.js
|
||||
提供了以下函数进行楼层`map`数组相关的操作
|
||||
```javascript
|
||||
editor.file.getFloorFileList
|
||||
editor_file.loadFloorFile
|
||||
editor_file.saveFloorFile
|
||||
editor_file.saveFloorFileAs
|
||||
```
|
||||
5个编辑模式有关的查询
|
||||
```javascript
|
||||
editor_file.editItem(editor,'redJewel',[],function(a){console.log(a)});
|
||||
editor_file.editEnemy(editor,'redBat',[],function(a){console.log(a)});
|
||||
editor_file.editLoc(editor,2,0,[],function(a){console.log(a)});
|
||||
editor_file.editFloor(editor,[],function(a){console.log(a)});
|
||||
editor.file.editTower(editor,[],function(a){console.log(a)});
|
||||
```
|
||||
5个编辑模式有关的编辑
|
||||
```javascript
|
||||
editor.info={images: "terrains", y: 9};
|
||||
editor.file.changeIdAndIdnum(editor,'yellowWall2',16,editor.info,function(a){console.log(a)});
|
||||
editor_file.editItem(editor,'book',[["change","['items']['name']","怪物手册的新名字"]],function(a){console.log(a)});
|
||||
editor_file.editEnemy(editor,'redBat',[['change',"['atk']",20]],function(a){console.log(a)});
|
||||
editor_file.editLoc(editor,2,6,[["change","['afterBattle']",null]],function(a){console.log(a)});
|
||||
editor_file.editFloor(editor,[["change","['title']",'样板 33 层']],function(a){console.log(a)});
|
||||
editor.file.editTower(editor,[["change","['values']['lavaDamage']",200]],function(a){console.log(a)});
|
||||
```
|
||||
|
||||
### drawMapGUI.html
|
||||
以`display:none`的形式引入了`index.html`的`dom`,修改了原来的`.gameCanvas #ui #data`等的名字以避免冲突
|
||||
|
||||
通过`main.init('editor')`加载数据,移除了原有的`editor.loadjs`等
|
||||
|
||||
背景层如果未设置`editor.bgY`则通过运行时中的代码画背景
|
||||
|
||||
`updateMap`中只画未定义快的报错,其他的由运行时中的代码完成
|
||||
|
||||
`editor.ids[0] = 0; editor.indexs[0]=[0];`
|
||||
|
||||
添加了`editor.changeFloor`用于切换楼层
|
||||
|
||||
### 注释的特殊指令
|
||||
```
|
||||
$range(evalstr:thiseval)$end
|
||||
限制取值范围,要求修改后的eval(evalstr)为true
|
||||
$leaf(evalstr:thiseval)$end
|
||||
强制指定为叶节点,如果eval(evalstr)为true
|
||||
|
||||
todo:
|
||||
//以下几个中选一个 [
|
||||
$select(evalstr)$end
|
||||
渲染成<select>,选项为数组eval(evalstr)['values']
|
||||
$input
|
||||
渲染成<input>,此为默认选项
|
||||
$textarea(evalstr)$end
|
||||
渲染成<textarea>,行数为正整数eval(evalstr)['rows']
|
||||
// ]
|
||||
```
|
||||
目前只出现了以下5种
|
||||
```
|
||||
$range(thiseval in ['keys','items','constants','tools'])$end
|
||||
$range(thiseval==~~thiseval &&thiseval>0)$end
|
||||
$range(thiseval in [true,false])$end
|
||||
$range(false)$end
|
||||
$leaf(true)$end
|
||||
```
|
||||
# todo
|
||||
|
||||
+ editor的5个编辑模式(标签页)`map|item & enemy|loc|floor|tower`
|
||||
+ replay模式
|
||||
+ 把js压缩工具改为一键生成发布版
|
||||
@ -465,7 +465,14 @@
|
||||
}
|
||||
|
||||
/*
|
||||
$range((function(){typeof(thiseval)==typeof(0)||})())
|
||||
$range(thiseval in ['keys','items','constants','tools'])$end
|
||||
$range(thiseval==~~thiseval &&thiseval>0)$end
|
||||
$range(thiseval in [true,false])$end
|
||||
$range(false)$end
|
||||
$leaf(true)$end
|
||||
|
||||
//$range((function(){typeof(thiseval)==typeof(0)||})())$end
|
||||
|
||||
if( 注释.indexof('$range(')!= -1){
|
||||
var thiseval = 新值;
|
||||
evalstr = 注释.split('$range')[1].split('$end')[0];
|
||||
|
||||
@ -12,6 +12,8 @@ pout.innerHTML='waiting\nwaiting waiting';
|
||||
var editor={};
|
||||
editor.fs=fs;
|
||||
editor.file=editor_file;
|
||||
//代码复制到 http://127.0.0.1:1055/drawMapGUI.html 的console中进行测试
|
||||
|
||||
/* editor.file.loadFloorFile(editor,'sample0',function(err){console.log(err);
|
||||
editor.file.saveFloorFileAs(editor,'aaa',function(err){console.log(err)});
|
||||
}); */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user