Merge pull request #73 from zhaouv/v2.0-editor-20180304
V2 0 editor 20180304
This commit is contained in:
commit
73f2ea3a84
149
2.0diff.md
149
2.0diff.md
@ -1,149 +0,0 @@
|
|||||||
# v2.0目前的改动
|
|
||||||
|
|
||||||
## 总体上:
|
|
||||||
|
|
||||||
部分重构了运行时
|
|
||||||
+ 把`libs`中的数据分离出来保存为类似json的js文件,分离后的数据进一步分离为纯数据和注释两部分
|
|
||||||
+ 更改目录结构,分离后的`libs`一般无需修改,把数据楼层文件声音图片放入`project`目录中
|
|
||||||
* 需要相应的修改地图生成器和js压缩工具
|
|
||||||
+ 设置了三个模式`play|editor|replay`在`editor`模式关闭了部分动画,并且角色无法行动
|
|
||||||
|
|
||||||
重构editor
|
|
||||||
+ 重命名为`editor.html`
|
|
||||||
* 需要相应的修改本地服务的按钮打开的网址,为了兼容,临时加了个内容为`<html><body><script>window.location='editor.html'</script></body></html>`的`drawMapGUI.html`
|
|
||||||
+ 不再独立的导入数据和画图,尽可能的通过`main.init('editor')`复用代码
|
|
||||||
+ 能够在本地服务器环境中直接修改`project`中的数据,即全GUI下做塔
|
|
||||||
+ 把`editor`的代码拆到了`_server/editor.js`中
|
|
||||||
+ 添加了`_server/css/editor_mode.css`存放编辑模式有关的样式
|
|
||||||
+ 添加了`_server/editor_mode.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('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)});
|
|
||||||
```
|
|
||||||
5个编辑模式有关的编辑
|
|
||||||
```javascript
|
|
||||||
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_mode.js
|
|
||||||
4个生成表格并绑定事件的函数
|
|
||||||
```javascript
|
|
||||||
editor.mode.loc();
|
|
||||||
editor.mode.emenyitem();
|
|
||||||
editor.mode.floor();
|
|
||||||
editor.mode.tower();
|
|
||||||
```
|
|
||||||
切换模式
|
|
||||||
```javascript
|
|
||||||
editor.mode.onmode('');
|
|
||||||
editor.mode.onmode('loc');
|
|
||||||
editor.mode.onmode('emenyitem');
|
|
||||||
editor.mode.onmode('floor');
|
|
||||||
editor.mode.onmode('tower');
|
|
||||||
```
|
|
||||||
在切换模式时,改动才会保存到文件,并且需要刷新页面使得`editor`能看到改动
|
|
||||||
|
|
||||||
表格的`onchange`的实现中,获得当前模式的方式.不注意的话,修改`index.html`中页面的结构,会被坑
|
|
||||||
```javascript
|
|
||||||
var node = thisTr.parentNode;
|
|
||||||
while (!editor_mode._ids.hasOwnProperty(node.getAttribute('id'))) {
|
|
||||||
node = node.parentNode;
|
|
||||||
}
|
|
||||||
editor_mode.onmode(editor_mode._ids[node.getAttribute('id')]);
|
|
||||||
```
|
|
||||||
### drawMapGUI.html
|
|
||||||
重命名为`editor.html`
|
|
||||||
|
|
||||||
把`editor`的代码拆到了`_server/editor.js`中
|
|
||||||
|
|
||||||
以`display:none`的形式引入了`index.html`的`dom`,修改了原来的`.gameCanvas #ui #data`等的名字以避免冲突
|
|
||||||
|
|
||||||
通过`main.init('editor')`加载数据,移除了原有的`editor.loadjs`等
|
|
||||||
|
|
||||||
背景层如果未设置`editor.bgY`则通过运行时中的代码画背景
|
|
||||||
|
|
||||||
`editor.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
|
|
||||||
|
|
||||||
//以下几个中选一个 [
|
|
||||||
$select(evalstr)$end
|
|
||||||
渲染成<select>,选项为数组eval(evalstr)['values']
|
|
||||||
$input(evalstr)$end
|
|
||||||
渲染成<input>
|
|
||||||
$textarea(evalstr)$end
|
|
||||||
渲染成<textarea>
|
|
||||||
默认选项为$textarea()$end
|
|
||||||
// ]
|
|
||||||
```
|
|
||||||
# todo & 目前的bug
|
|
||||||
|
|
||||||
+ `event`,`after...`在地图上没有标记,可以在右下角加类似于无`id`的红问号类似的绿色星号小标记
|
|
||||||
+ [x] 添加新图块只对地形好使,添加的新物品还是需要手动在`project/items.js`中加东西
|
|
||||||
+ [x] 目前未做$range(evalstr:thiseval)$end的检查
|
|
||||||
+ 通过`core.values.redJewel`的方式设置物品加的数值,在全GUI下反而会不直观
|
|
||||||
+ `idnum`上限改到`999`,不需要在`.js`中手动设置`idnum`的话,根据数字范围来约定类型意义不大,而且`400`内随便输个数就发现已经被占了,体验极差
|
|
||||||
+ `editor.html`中独立换背景的功能不再需要,待移除
|
|
||||||
+ 全GUI下编辑要经常保存修改后F5
|
|
||||||
+ [x] 目前的报错只是throw,如果不开F12注意不到有错误发生,修改没有生效
|
|
||||||
+ [x] 有待美化,以及做成标签页式的模式切换
|
|
||||||
@ -2,15 +2,40 @@
|
|||||||
|
|
||||||
本目录下所有文件,以及`../editor.html`和`../启动服务.exe`([源码](http://github.com/ckcz123/mota-js-server/))是地图编辑器的所有组件.
|
本目录下所有文件,以及`../editor.html`和`../启动服务.exe`([源码](http://github.com/ckcz123/mota-js-server/))是地图编辑器的所有组件.
|
||||||
|
|
||||||
`editor.js`,`editor_file.js`和`editor_mode.js`耦合较强,`editor_blockly.js`和`fs.js`基本可以独立使用.
|
`editor.js`,`editor_file.js`和`editor_mode.js`耦合较强,`editor_blockly.js`和`editor_multi.js`和`fs.js`基本可以独立使用.
|
||||||
|
|
||||||
## 各组件功能
|
## 各组件功能
|
||||||
|
|
||||||
|
### 总体上
|
||||||
|
|
||||||
|
以`display:none`的形式引入了`index.html`的`dom`,修改了原来的`.gameCanvas #ui #data`等的名字以避免冲突
|
||||||
|
|
||||||
|
通过`main.init('editor')`加载数据
|
||||||
|
|
||||||
|
`editor`模式关闭了部分动画
|
||||||
|
|
||||||
|
`core.drawMap`中`editor`模式下不再画图,而是生成画图的函数提供给`editor`
|
||||||
|
|
||||||
|
`editor`模式下`GlobalAnimate`可以独立的选择是否播放
|
||||||
|
|
||||||
|
`core.playBgm`和`core.playSound`中非`play`模式不再播放声音
|
||||||
|
|
||||||
|
`core.show`和`core.hide`中非`play`模式不再进行动画而是立刻完成并执行回调
|
||||||
|
|
||||||
|
`editor`模式不执行`core.resize`
|
||||||
|
|
||||||
### editor.js
|
### editor.js
|
||||||
|
|
||||||
暂略
|
``` js
|
||||||
|
editor.mapInit();//清空地图
|
||||||
|
editor.changeFloor('MT2')//切换地图
|
||||||
|
editor.guid()//产生一个可以作为id的长随机字符串
|
||||||
|
```
|
||||||
|
|
||||||
|
`editor.updateMap`中画未定义快的报错
|
||||||
|
|
||||||
### editor_file.js
|
### editor_file.js
|
||||||
|
|
||||||
提供了以下函数进行楼层`map`数组相关的操作
|
提供了以下函数进行楼层`map`数组相关的操作
|
||||||
```javascript
|
```javascript
|
||||||
editor.file.getFloorFileList
|
editor.file.getFloorFileList
|
||||||
@ -18,6 +43,7 @@ editor.file.loadFloorFile
|
|||||||
editor.file.saveFloorFile
|
editor.file.saveFloorFile
|
||||||
editor.file.saveFloorFileAs
|
editor.file.saveFloorFileAs
|
||||||
```
|
```
|
||||||
|
|
||||||
编辑模式有关的查询
|
编辑模式有关的查询
|
||||||
```javascript
|
```javascript
|
||||||
editor.file.editItem('redJewel',[],function(a){console.log(a)});
|
editor.file.editItem('redJewel',[],function(a){console.log(a)});
|
||||||
@ -27,6 +53,7 @@ editor.file.editFloor([],function(a){console.log(a)});
|
|||||||
editor.file.editTower([],function(a){console.log(a)});
|
editor.file.editTower([],function(a){console.log(a)});
|
||||||
editor.file.editFunctions([],function(a){console.log(a)});
|
editor.file.editFunctions([],function(a){console.log(a)});
|
||||||
```
|
```
|
||||||
|
|
||||||
编辑模式有关的编辑
|
编辑模式有关的编辑
|
||||||
```javascript
|
```javascript
|
||||||
editor.info={images: "terrains", y: 9};
|
editor.info={images: "terrains", y: 9};
|
||||||
@ -40,7 +67,7 @@ editor.file.editFunctions(["change","['events']['afterChangeLight']","function(x
|
|||||||
```
|
```
|
||||||
|
|
||||||
### editor_mode.js
|
### editor_mode.js
|
||||||
5个生成表格并绑定事件的函数
|
生成表格并绑定事件的函数
|
||||||
```javascript
|
```javascript
|
||||||
editor.mode.loc();
|
editor.mode.loc();
|
||||||
editor.mode.emenyitem();
|
editor.mode.emenyitem();
|
||||||
@ -48,6 +75,7 @@ editor.mode.floor();
|
|||||||
editor.mode.tower();
|
editor.mode.tower();
|
||||||
editor.mode.functions();
|
editor.mode.functions();
|
||||||
```
|
```
|
||||||
|
|
||||||
切换模式
|
切换模式
|
||||||
```javascript
|
```javascript
|
||||||
editor.mode.onmode('');//清空
|
editor.mode.onmode('');//清空
|
||||||
@ -72,24 +100,82 @@ while (!editor_mode._ids.hasOwnProperty(node.getAttribute('id'))) {
|
|||||||
}
|
}
|
||||||
editor_mode.onmode(editor_mode._ids[node.getAttribute('id')]);
|
editor_mode.onmode(editor_mode._ids[node.getAttribute('id')]);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
`editor.mode.listen`中提供了追加素材的支持.
|
||||||
|
|
||||||
|
处理注释的特殊指令
|
||||||
|
```
|
||||||
|
$range(evalstr:thiseval)$end
|
||||||
|
限制取值范围,要求修改后的eval(evalstr)为true
|
||||||
|
$leaf(evalstr:thiseval)$end
|
||||||
|
强制指定为叶节点,如果eval(evalstr)为true
|
||||||
|
|
||||||
|
//以下几个中选一个 [
|
||||||
|
$select(evalstr)$end
|
||||||
|
渲染成<select>,选项为数组eval(evalstr)['values']
|
||||||
|
$input(evalstr)$end
|
||||||
|
渲染成<input>
|
||||||
|
$textarea(evalstr)$end
|
||||||
|
渲染成<textarea>
|
||||||
|
默认选项为$textarea()$end
|
||||||
|
// ]
|
||||||
|
```
|
||||||
|
|
||||||
### editor_blockly.js
|
### editor_blockly.js
|
||||||
|
|
||||||
把选定`id_`的事件用blockly编辑
|
把选定`id_`的事件用blockly编辑
|
||||||
``` js
|
``` js
|
||||||
editor_blockly.import(id_);
|
editor_blockly.import(id_);
|
||||||
```
|
```
|
||||||
|
|
||||||
把文本区域的代码转换成图块
|
把文本区域的代码转换成图块
|
||||||
``` js
|
``` js
|
||||||
editor_blockly.parse();
|
editor_blockly.parse();
|
||||||
```
|
```
|
||||||
把当前图块对应的事件返回给调用blockly的`id_`
|
|
||||||
|
### editor_multi.js
|
||||||
|
|
||||||
|
用[CodeMirror](https://github.com/codemirror/CodeMirror) 实现有高亮的多行文本编辑
|
||||||
|
|
||||||
|
编辑选定`id_`的文本域
|
||||||
``` js
|
``` js
|
||||||
editor_blockly.confirm();
|
editor_multi.import(id_)
|
||||||
```
|
```
|
||||||
|
|
||||||
### 待调整
|
编辑blockly方块的特定域
|
||||||
|
``` js
|
||||||
|
editor_multi.multiLineEdit(value,b,f,callback)
|
||||||
|
```
|
||||||
|
|
||||||
+ [x] 多行文本编辑器独立作为组件
|
### fs.js
|
||||||
+ [x] editor_multi.js
|
|
||||||
|
模仿node的fs模块提供如下api,与`启动服务.exe`配合为js提供文件读写功能
|
||||||
|
``` js
|
||||||
|
fs.readFile('file.in','utf-8',callback)
|
||||||
|
//读文本文件
|
||||||
|
//callback:function(err, data)
|
||||||
|
//data:字符串
|
||||||
|
fs.readFile('file.in','base64',callback)
|
||||||
|
//读二进制文件
|
||||||
|
//callback:function(err, data)
|
||||||
|
//data:base64字符串
|
||||||
|
|
||||||
|
fs.writeFile('file.out', data ,'utf-8', callback)
|
||||||
|
//写文本文件
|
||||||
|
//callback:function(err)
|
||||||
|
//data:字符串
|
||||||
|
fs.writeFile('file.out', data ,'base64', callback)
|
||||||
|
//写二进制文件
|
||||||
|
//callback:function(err)
|
||||||
|
//data:base64字符串
|
||||||
|
|
||||||
|
fs.readdir(path, callback)
|
||||||
|
//callback:function(err, data)
|
||||||
|
//path:支持"/"做分隔符
|
||||||
|
//data:[filename1,filename2,..] filename是字符串,只包含文件不包含目录
|
||||||
|
|
||||||
|
//所有参数不允许缺省
|
||||||
|
```
|
||||||
|
|
||||||
## z-index
|
## z-index
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -19,6 +19,11 @@
|
|||||||
width: 435px;
|
width: 435px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#appendPicSelection span {
|
||||||
|
font-size:11px;
|
||||||
|
-webkit-text-stroke: 1px black;
|
||||||
|
}
|
||||||
|
|
||||||
#left6 {
|
#left6 {
|
||||||
left: 5px;
|
left: 5px;
|
||||||
/* top: 1930px; */
|
/* top: 1930px; */
|
||||||
@ -30,8 +35,17 @@
|
|||||||
height: 780px;
|
height: 780px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#left6 #blocklyDiv {height: 480px; width: 940px;float:left;}
|
#left6 #blocklyDiv {
|
||||||
#left6 #codeArea {width: 99.5%; height: 15.4em;overflow:y;/* resize:none; */clear:both;}
|
height: 480px;
|
||||||
|
width: 940px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#left6 .CodeMirror {
|
||||||
|
border: 1px solid #eee;
|
||||||
|
height: 200px;
|
||||||
|
width: 1300px;
|
||||||
|
}
|
||||||
|
#left6 #codeArea {width: 99.5%; height: 15.4em;overflow:y;/* resize:none; */}
|
||||||
|
|
||||||
#left7 {
|
#left7 {
|
||||||
/* height: 440px; width: 375px;float:left; */
|
/* height: 440px; width: 375px;float:left; */
|
||||||
@ -87,6 +101,7 @@
|
|||||||
background-color: #f6f8fa;
|
background-color: #f6f8fa;
|
||||||
}
|
}
|
||||||
/* copy end --------------------------------------------- */
|
/* copy end --------------------------------------------- */
|
||||||
|
|
||||||
.etable tr {width:100%}
|
.etable tr {width:100%}
|
||||||
.etable tr > :nth-child(1) {width:20%}
|
.etable tr > :nth-child(1) {width:20%}
|
||||||
.etable tr > :nth-child(2) {width:20%}
|
.etable tr > :nth-child(2) {width:20%}
|
||||||
|
|||||||
@ -209,9 +209,9 @@ initscript=String.raw`
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
var code = Blockly.JavaScript.workspaceToCode(workspace);
|
var code = Blockly.JavaScript.workspaceToCode(workspace);
|
||||||
document.getElementById('codeArea').value = code;
|
codeAreaHL.setValue(code);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
document.getElementById('codeArea').value = String(error);
|
codeAreaHL.setValue(String(error));
|
||||||
if (error instanceof OmitedError){
|
if (error instanceof OmitedError){
|
||||||
var blockName = error.blockName;
|
var blockName = error.blockName;
|
||||||
var varName = error.varName;
|
var varName = error.varName;
|
||||||
@ -267,6 +267,14 @@ xhr.onreadystatechange = function (){
|
|||||||
xhr.open('GET','_server/blockly/MotaAction.g4',true);
|
xhr.open('GET','_server/blockly/MotaAction.g4',true);
|
||||||
xhr.send(null);
|
xhr.send(null);
|
||||||
|
|
||||||
|
var codeAreaHL = CodeMirror.fromTextArea(document.getElementById("codeArea"), {
|
||||||
|
lineNumbers: true,
|
||||||
|
matchBrackets: true,
|
||||||
|
lineWrapping: true,
|
||||||
|
continueComments: "Enter",
|
||||||
|
extraKeys: {"Ctrl-Q": "toggleComment"}
|
||||||
|
});
|
||||||
|
|
||||||
editor_blockly.showXML = function () {
|
editor_blockly.showXML = function () {
|
||||||
var xml = Blockly.Xml.workspaceToDom(editor_blockly.workspace);
|
var xml = Blockly.Xml.workspaceToDom(editor_blockly.workspace);
|
||||||
var xml_text = Blockly.Xml.domToPrettyText(xml);
|
var xml_text = Blockly.Xml.domToPrettyText(xml);
|
||||||
@ -293,7 +301,7 @@ editor_blockly.runCode = function () {
|
|||||||
|
|
||||||
editor_blockly.parse = function () {
|
editor_blockly.parse = function () {
|
||||||
MotaActionFunctions.parse(
|
MotaActionFunctions.parse(
|
||||||
eval('obj=' + document.getElementById('codeArea').value.replace(/[<>&]/g,function(c){return {'<':'<','>':'>','&':'&'}[c];})),
|
eval('obj=' + codeAreaHL.getValue().replace(/[<>&]/g,function(c){return {'<':'<','>':'>','&':'&'}[c];})),
|
||||||
document.getElementById('entryType').value
|
document.getElementById('entryType').value
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -322,7 +330,7 @@ editor_blockly.import = function(id_){
|
|||||||
}[field];
|
}[field];
|
||||||
if(!type)return false;
|
if(!type)return false;
|
||||||
editor_blockly.id=id_;
|
editor_blockly.id=id_;
|
||||||
document.getElementById('codeArea').value = input.value;
|
codeAreaHL.setValue(input.value);
|
||||||
document.getElementById('entryType').value = type;
|
document.getElementById('entryType').value = type;
|
||||||
editor_blockly.parse();
|
editor_blockly.parse();
|
||||||
editor_blockly.show();
|
editor_blockly.show();
|
||||||
@ -350,7 +358,7 @@ editor_blockly.confirm = function (){
|
|||||||
editor_blockly.hide();
|
editor_blockly.hide();
|
||||||
input.onchange();
|
input.onchange();
|
||||||
}
|
}
|
||||||
if(document.getElementById('codeArea').value===''){
|
if(codeAreaHL.getValue()===''){
|
||||||
setvalue('null');
|
setvalue('null');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -175,11 +175,11 @@ editor_file = function(editor, callback){
|
|||||||
saveSetting('items',actionList,function (err) {
|
saveSetting('items',actionList,function (err) {
|
||||||
callback([
|
callback([
|
||||||
{'items':(function(){
|
{'items':(function(){
|
||||||
var locObj={};
|
var locObj=Object.assign({},editor.core.items.items[id]);
|
||||||
Object.keys(editor_file.comment.items.items).forEach(function(v){
|
Object.keys(editor_file.comment.items.items).forEach(function(v){
|
||||||
if (isset(editor.core.items.items[id][v]))
|
if (!isset(editor.core.items.items[id][v]))
|
||||||
locObj[v]=editor.core.items.items[id][v];
|
/* locObj[v]=editor.core.items.items[id][v];
|
||||||
else
|
else */
|
||||||
locObj[v]=null;
|
locObj[v]=null;
|
||||||
});
|
});
|
||||||
return locObj;
|
return locObj;
|
||||||
@ -191,11 +191,11 @@ editor_file = function(editor, callback){
|
|||||||
} else {
|
} else {
|
||||||
callback([
|
callback([
|
||||||
{'items':(function(){
|
{'items':(function(){
|
||||||
var locObj={};
|
var locObj=Object.assign({},editor.core.items.items[id]);
|
||||||
Object.keys(editor_file.comment.items.items).forEach(function(v){
|
Object.keys(editor_file.comment.items.items).forEach(function(v){
|
||||||
if (isset(editor.core.items.items[id][v]))
|
if (!isset(editor.core.items.items[id][v]))
|
||||||
locObj[v]=editor.core.items.items[id][v];
|
/* locObj[v]=editor.core.items.items[id][v];
|
||||||
else
|
else */
|
||||||
locObj[v]=null;
|
locObj[v]=null;
|
||||||
});
|
});
|
||||||
return locObj;
|
return locObj;
|
||||||
@ -223,11 +223,11 @@ editor_file = function(editor, callback){
|
|||||||
saveSetting('enemys',actionList,function (err) {
|
saveSetting('enemys',actionList,function (err) {
|
||||||
callback([
|
callback([
|
||||||
(function(){
|
(function(){
|
||||||
var locObj={};
|
var locObj=Object.assign({},editor.core.enemys.enemys[id]);
|
||||||
Object.keys(editor_file.comment.enemys).forEach(function(v){
|
Object.keys(editor_file.comment.enemys).forEach(function(v){
|
||||||
if (isset(editor.core.enemys.enemys[id][v]))
|
if (!isset(editor.core.enemys.enemys[id][v]))
|
||||||
locObj[v]=editor.core.enemys.enemys[id][v];
|
/* locObj[v]=editor.core.enemys.enemys[id][v];
|
||||||
else
|
else */
|
||||||
locObj[v]=null;
|
locObj[v]=null;
|
||||||
});
|
});
|
||||||
return locObj;
|
return locObj;
|
||||||
@ -238,11 +238,11 @@ editor_file = function(editor, callback){
|
|||||||
} else {
|
} else {
|
||||||
callback([
|
callback([
|
||||||
(function(){
|
(function(){
|
||||||
var locObj={};
|
var locObj=Object.assign({},editor.core.enemys.enemys[id]);
|
||||||
Object.keys(editor_file.comment.enemys).forEach(function(v){
|
Object.keys(editor_file.comment.enemys).forEach(function(v){
|
||||||
if (isset(editor.core.enemys.enemys[id][v]))
|
if (!isset(editor.core.enemys.enemys[id][v]))
|
||||||
locObj[v]=editor.core.enemys.enemys[id][v];
|
/* locObj[v]=editor.core.enemys.enemys[id][v];
|
||||||
else
|
else */
|
||||||
locObj[v]=null;
|
locObj[v]=null;
|
||||||
});
|
});
|
||||||
return locObj;
|
return locObj;
|
||||||
@ -315,13 +315,17 @@ editor_file = function(editor, callback){
|
|||||||
saveSetting('floors',actionList,function (err) {
|
saveSetting('floors',actionList,function (err) {
|
||||||
callback([
|
callback([
|
||||||
(function(){
|
(function(){
|
||||||
var locObj={};
|
var locObj=Object.assign({},editor.currentFloorData);
|
||||||
Object.keys(editor_file.comment.floors.floor).forEach(function(v){
|
Object.keys(editor_file.comment.floors.floor).forEach(function(v){
|
||||||
if (isset(editor.currentFloorData[v]))
|
if (!isset(editor.currentFloorData[v]))
|
||||||
locObj[v]=editor.currentFloorData[v];
|
/* locObj[v]=editor.currentFloorData[v];
|
||||||
else
|
else */
|
||||||
locObj[v]=null;
|
locObj[v]=null;
|
||||||
});
|
});
|
||||||
|
Object.keys(editor_file.comment.floors.loc).forEach(function(v){
|
||||||
|
delete(locObj[v]);
|
||||||
|
});
|
||||||
|
delete(locObj.map);
|
||||||
return locObj;
|
return locObj;
|
||||||
})(),
|
})(),
|
||||||
editor_file.comment.floors.floor,
|
editor_file.comment.floors.floor,
|
||||||
@ -330,13 +334,17 @@ editor_file = function(editor, callback){
|
|||||||
} else {
|
} else {
|
||||||
callback([
|
callback([
|
||||||
(function(){
|
(function(){
|
||||||
var locObj={};
|
var locObj=Object.assign({},editor.currentFloorData);
|
||||||
Object.keys(editor_file.comment.floors.floor).forEach(function(v){
|
Object.keys(editor_file.comment.floors.floor).forEach(function(v){
|
||||||
if (isset(editor.currentFloorData[v]))
|
if (!isset(editor.currentFloorData[v]))
|
||||||
locObj[v]=editor.currentFloorData[v];
|
/* locObj[v]=editor.currentFloorData[v];
|
||||||
else
|
else */
|
||||||
locObj[v]=null;
|
locObj[v]=null;
|
||||||
});
|
});
|
||||||
|
Object.keys(editor_file.comment.floors.loc).forEach(function(v){
|
||||||
|
delete(locObj[v]);
|
||||||
|
});
|
||||||
|
delete(locObj.map);
|
||||||
return locObj;
|
return locObj;
|
||||||
})(),
|
})(),
|
||||||
editor_file.comment.floors.floor,
|
editor_file.comment.floors.floor,
|
||||||
|
|||||||
@ -1,46 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html>
|
|
||||||
<head><meta charset="utf-8"></head>
|
|
||||||
<body>
|
|
||||||
<pre id='pout'>
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<script src="fs.js"></script>
|
|
||||||
<script src="editor_file.js"></script>
|
|
||||||
<script>
|
|
||||||
pout.innerHTML='waiting\nwaiting waiting';
|
|
||||||
var editor={};
|
|
||||||
editor.fs=fs;
|
|
||||||
editor_file = editor_file(editor);
|
|
||||||
editor.file=editor_file;
|
|
||||||
//代码复制到 http://127.0.0.1:1055/drawMapGUI.html 的console中进行测试
|
|
||||||
|
|
||||||
/* editor.file.loadFloorFile('sample0',function(err){console.log(err);
|
|
||||||
editor.file.saveFloorFileAs('aaa',function(err){console.log(err)});
|
|
||||||
}); */
|
|
||||||
|
|
||||||
//查询
|
|
||||||
/*
|
|
||||||
editor.file.editItem('redJewel',[],function(a){console.log(a)});
|
|
||||||
editor.file.editEnemy('redBat',[],function(a){console.log(a)});
|
|
||||||
editor.file.editLoc(2,6,[],function(a){console.log(a)});
|
|
||||||
editor.file.editFloor([],function(a){console.log(a)});
|
|
||||||
editor.file.editTower([],function(a){console.log(a)});
|
|
||||||
*/
|
|
||||||
|
|
||||||
//编辑
|
|
||||||
/*
|
|
||||||
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)});
|
|
||||||
*/
|
|
||||||
|
|
||||||
pout.innerHTML='succeed\nsucceed succeed';
|
|
||||||
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@ -371,7 +371,6 @@ editor_mode.prototype.listen = function(callback){
|
|||||||
selectAppend.onchange();
|
selectAppend.onchange();
|
||||||
|
|
||||||
var selectFileBtn = document.getElementById('selectFileBtn');
|
var selectFileBtn = document.getElementById('selectFileBtn');
|
||||||
var selectFileStr = document.getElementById('selectFileStr');
|
|
||||||
selectFileBtn.onclick = function(){
|
selectFileBtn.onclick = function(){
|
||||||
var loadImage = function (content, callback) {
|
var loadImage = function (content, callback) {
|
||||||
var image = new Image();
|
var image = new Image();
|
||||||
|
|||||||
@ -29,7 +29,7 @@ editor_multi.import = function(id_){
|
|||||||
editor_multi.isString=true;
|
editor_multi.isString=true;
|
||||||
codeEditor.setValue(JSON.parse(input.value)||'');
|
codeEditor.setValue(JSON.parse(input.value)||'');
|
||||||
} else {
|
} else {
|
||||||
eval('var tobj='+input.value);
|
eval('var tobj='+(input.value||'null'));
|
||||||
var tmap={};
|
var tmap={};
|
||||||
var tstr = JSON.stringify(tobj,function(k,v){if(typeof(v)===typeof('') && v.slice(0,8)==='function'){var id_ = editor.guid();tmap[id_]=v.toString();return id_;}else return v},4);
|
var tstr = JSON.stringify(tobj,function(k,v){if(typeof(v)===typeof('') && v.slice(0,8)==='function'){var id_ = editor.guid();tmap[id_]=v.toString();return id_;}else return v},4);
|
||||||
for(var id_ in tmap){
|
for(var id_ in tmap){
|
||||||
@ -64,7 +64,7 @@ editor_multi.confirm = function (){
|
|||||||
if(editor_multi.isString){
|
if(editor_multi.isString){
|
||||||
input.value = JSON.stringify(value);
|
input.value = JSON.stringify(value);
|
||||||
} else {
|
} else {
|
||||||
eval('var tobj='+value);
|
eval('var tobj='+(value||'null'));
|
||||||
var tmap={};
|
var tmap={};
|
||||||
var tstr = JSON.stringify(tobj,function(k,v){if(v instanceof Function){var id_ = editor.guid();tmap[id_]=v.toString();return id_;}else return v},4);
|
var tstr = JSON.stringify(tobj,function(k,v){if(v instanceof Function){var id_ = editor.guid();tmap[id_]=v.toString();return id_;}else return v},4);
|
||||||
for(var id_ in tmap){
|
for(var id_ in tmap){
|
||||||
|
|||||||
@ -219,6 +219,7 @@ tip_in_showMode = [
|
|||||||
'涉及图片的更改需要F5刷新浏览器来生效',
|
'涉及图片的更改需要F5刷新浏览器来生效',
|
||||||
'文本域可以通过双击,在文本编辑器或事件编辑器中编辑',
|
'文本域可以通过双击,在文本编辑器或事件编辑器中编辑',
|
||||||
'事件编辑器中的显示文本和自定义脚本的方块也可以双击',
|
'事件编辑器中的显示文本和自定义脚本的方块也可以双击',
|
||||||
|
"画出的地图要点击\"保存地图\"才会写入到文件中",
|
||||||
];
|
];
|
||||||
var tip = new Vue({
|
var tip = new Vue({
|
||||||
el: '#tip',
|
el: '#tip',
|
||||||
|
|||||||
22
editor.html
22
editor.html
@ -17,10 +17,9 @@
|
|||||||
<p class="warnText" v-if="error">{{ errors[error-1] }}</p>
|
<p class="warnText" v-if="error">{{ errors[error-1] }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div id="editTip" v-cloak>
|
<div id="editTip" v-cloak>
|
||||||
<select id="selectFloor"></select><br>
|
<br>
|
||||||
|
<input type="button" value="当前地图另存为" id='saveFloorAs'/>
|
||||||
<input id='saveAsName' placeholder="输入新楼层id"/>
|
<input id='saveAsName' placeholder="输入新楼层id"/>
|
||||||
<input class='btn' type="button" value="save" id='saveFloor'/>
|
|
||||||
<input class='btn' type="button" value="saveAs" id='saveFloorAs'/>
|
|
||||||
<input class='btn' type="button" value="复制地图" v-on:click="copyMap"/>
|
<input class='btn' type="button" value="复制地图" v-on:click="copyMap"/>
|
||||||
</div>
|
</div>
|
||||||
<div style="position: absolute;right: 10px;bottom:70px;">
|
<div style="position: absolute;right: 10px;bottom:70px;">
|
||||||
@ -49,10 +48,10 @@
|
|||||||
<canvas style="position:absolute;z-index:100"></canvas><!-- 用于响应鼠标点击 -->
|
<canvas style="position:absolute;z-index:100"></canvas><!-- 用于响应鼠标点击 -->
|
||||||
<canvas style="position:absolute;display:none;"></canvas><!-- 画出追加后的sprite用于储存 -->
|
<canvas style="position:absolute;display:none;"></canvas><!-- 画出追加后的sprite用于储存 -->
|
||||||
<div id="appendPicSelection">
|
<div id="appendPicSelection">
|
||||||
<div class="appendSelection"><span style="font-size:10px">1</span></div>
|
<div class="appendSelection"><span>1</span></div>
|
||||||
<div class="appendSelection"><span style="font-size:10px"> 2</span></div>
|
<div class="appendSelection"><span> 2</span></div>
|
||||||
<div class="appendSelection"><span style="font-size:10px"> 3</span></div>
|
<div class="appendSelection"><span> 3</span></div>
|
||||||
<div class="appendSelection"><span style="font-size:10px"> 4</span></div>
|
<div class="appendSelection"><span> 4</span></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div></div>
|
</div></div>
|
||||||
@ -128,7 +127,7 @@
|
|||||||
<category name="template"></category>
|
<category name="template"></category>
|
||||||
</xml>
|
</xml>
|
||||||
</h3>
|
</h3>
|
||||||
<div>
|
<div style="position: relative;">
|
||||||
<div id="blocklyDiv"></div>
|
<div id="blocklyDiv"></div>
|
||||||
<textarea id="codeArea" spellcheck="false"></textarea>
|
<textarea id="codeArea" spellcheck="false"></textarea>
|
||||||
</div>
|
</div>
|
||||||
@ -183,6 +182,9 @@
|
|||||||
<option value="functions">脚本编辑</option>
|
<option value="functions">脚本编辑</option>
|
||||||
<option value="appendpic">追加素材</option>
|
<option value="appendpic">追加素材</option>
|
||||||
</select>
|
</select>
|
||||||
|
<br><br><br><br>
|
||||||
|
<select id="selectFloor"></select>
|
||||||
|
<input type="button" value="保存地图" id='saveFloor'/>
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<div id="bgSelect" v-cloak style="display:none">
|
<div id="bgSelect" v-cloak style="display:none">
|
||||||
<span>当前地板: </span>
|
<span>当前地板: </span>
|
||||||
@ -337,7 +339,7 @@
|
|||||||
<script>
|
<script>
|
||||||
//所有全局量
|
//所有全局量
|
||||||
__all__=['Vue','fs','editor_file','editor_mode','main','core','hasOwnProp','printf','printe','editor','converter','ActionParser','MotaActionFunctions','MotaActionBlocks'];
|
__all__=['Vue','fs','editor_file','editor_mode','main','core','hasOwnProp','printf','printe','editor','converter','ActionParser','MotaActionFunctions','MotaActionBlocks'];
|
||||||
__id__=['editArea','arrRowMark','mapRowMark','data','bg','dataSelection','blocklyDiv','codeArea','entryType'];
|
__id__=['editArea','arrRowMark','mapRowMark','data','bg','dataSelection','blocklyDiv','codeAreaHL','entryType'];
|
||||||
__Vue__=['exportM','editArea','editTip','clear','tip','selectBox'];
|
__Vue__=['exportM','editArea','editTip','clear','tip','selectBox'];
|
||||||
//var event = document.getElementById('event');
|
//var event = document.getElementById('event');
|
||||||
|
|
||||||
@ -357,7 +359,7 @@ main.init('editor', function() {
|
|||||||
editor.mode.floor();
|
editor.mode.floor();
|
||||||
editor.mode.tower();
|
editor.mode.tower();
|
||||||
editor.mode.functions();
|
editor.mode.functions();
|
||||||
editor.mode.showMode('loc');
|
editor.mode.showMode('floor');
|
||||||
editor.mode.listen();
|
editor.mode.listen();
|
||||||
editor_multi=editor_multi();
|
editor_multi=editor_multi();
|
||||||
editor_blockly=editor_blockly();
|
editor_blockly=editor_blockly();
|
||||||
|
|||||||
2
main.js
2
main.js
@ -118,7 +118,7 @@ main.prototype.init = function (mode, callback) {
|
|||||||
for (var i = 0; i < main.dom.gameCanvas.length; i++) {
|
for (var i = 0; i < main.dom.gameCanvas.length; i++) {
|
||||||
main.canvas[main.dom.gameCanvas[i].id] = main.dom.gameCanvas[i].getContext('2d');
|
main.canvas[main.dom.gameCanvas[i].id] = main.dom.gameCanvas[i].getContext('2d');
|
||||||
}
|
}
|
||||||
if (({"editor":0,"replay":0}).hasOwnProperty(mode)) {
|
if (({"editor":0}).hasOwnProperty(mode)) {
|
||||||
main.mode = mode;
|
main.mode = mode;
|
||||||
if (mode === 'editor')main.editor = {'disableGlobalAnimate':true};
|
if (mode === 'editor')main.editor = {'disableGlobalAnimate':true};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,7 @@ comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
|
|||||||
'range': 'range可选,代表领域伤害的范围;不加默认为1\n$range((thiseval==~~thiseval && thiseval>0)||thiseval==null)$end',
|
'range': 'range可选,代表领域伤害的范围;不加默认为1\n$range((thiseval==~~thiseval && thiseval>0)||thiseval==null)$end',
|
||||||
'bomb':' 加入 "bomb": false 代表该怪物不可被炸弹或圣锤炸掉\n$select({\"values\":[true,false]})$end',
|
'bomb':' 加入 "bomb": false 代表该怪物不可被炸弹或圣锤炸掉\n$select({\"values\":[true,false]})$end',
|
||||||
'n': '多连击需要在后面指定n代表是几连击\n$range((thiseval==~~thiseval && thiseval>0)||thiseval==null)$end',
|
'n': '多连击需要在后面指定n代表是几连击\n$range((thiseval==~~thiseval && thiseval>0)||thiseval==null)$end',
|
||||||
|
'add': '代表吸血后是否加到自身\n$select({\"values\":[true,false]})$end',
|
||||||
'atkValue':'退化时勇士下降的攻击力点数\n$range(thiseval==~~thiseval||thiseval==null)$end',
|
'atkValue':'退化时勇士下降的攻击力点数\n$range(thiseval==~~thiseval||thiseval==null)$end',
|
||||||
'defValue':'退化时勇士下降的防御力点数\n$range(thiseval==~~thiseval||thiseval==null)$end',
|
'defValue':'退化时勇士下降的防御力点数\n$range(thiseval==~~thiseval||thiseval==null)$end',
|
||||||
'damage':'战前扣血的点数\n$range(thiseval==~~thiseval||thiseval==null)$end'
|
'damage':'战前扣血的点数\n$range(thiseval==~~thiseval||thiseval==null)$end'
|
||||||
|
|||||||
@ -1,152 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta http-equiv='content-type' content='text/html' charset='utf-8'>
|
|
||||||
<meta http-equiv='X-UA-Compatible' content='IE=Edge, chrome=1'>
|
|
||||||
<meta name='author' content='ckcz123'>
|
|
||||||
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=yes'>
|
|
||||||
<title></title>
|
|
||||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/>
|
|
||||||
<meta name="screen-orientation" content="portrait">
|
|
||||||
<meta name="full-screen" content="yes">
|
|
||||||
<meta name="browsermode" content="application">
|
|
||||||
<meta name="x5-orientation" content="portrait">
|
|
||||||
<meta name="x5-fullscreen" content="true">
|
|
||||||
<meta name="x5-page-mode" content="app">
|
|
||||||
<link type='text/css' href='styles.css' rel='stylesheet'>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id='gameGroup'>
|
|
||||||
<p id='mainTips'>请稍后...</p>
|
|
||||||
<div id='startPanel'>
|
|
||||||
<div id='startTop'>
|
|
||||||
<div id='startTopProgressBar'>
|
|
||||||
<div id='startTopProgress'></div>
|
|
||||||
</div>
|
|
||||||
<p id='startTopLoadTips'>资源即将开始加载</p>
|
|
||||||
</div>
|
|
||||||
<img id='startBackground' src='project/images/bg.png'>
|
|
||||||
<!-- 标题界面;可以改style的color使标题改变颜色 -->
|
|
||||||
<p id='startLogo' style="color: black"></p>
|
|
||||||
<div id='startButtonGroup'>
|
|
||||||
<div id='startButtons'>
|
|
||||||
<span class='startButton' id='playGame'>开始游戏</span>
|
|
||||||
<span class='startButton' id='loadGame'>载入游戏</span>
|
|
||||||
<span class='startButton' id='aboutGame'>关于本塔</span>
|
|
||||||
</div>
|
|
||||||
<div id='levelChooseButtons'>
|
|
||||||
<span class='startButton' id='easyLevel'>简单</span>
|
|
||||||
<span class='startButton' id='normalLevel'>普通</span>
|
|
||||||
<span class='startButton' id='hardLevel'>困难</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id='floorMsgGroup'>
|
|
||||||
<p id='logoLabel'></p>
|
|
||||||
<p id='versionLabel'></p>
|
|
||||||
<p id='floorNameLabel'></p>
|
|
||||||
</div>
|
|
||||||
<div id='statusBar' class="clearfix">
|
|
||||||
<div class="status" id="floorCol">
|
|
||||||
<img src='project/images/floor.png' id="img-floor">
|
|
||||||
<p class='statusLabel' id='floor'></p>
|
|
||||||
</div>
|
|
||||||
<div class="status" id="lvCol">
|
|
||||||
<img src='project/images/lv.png' id="img-lv">
|
|
||||||
<p class='statusLabel' id='lv'></p>
|
|
||||||
</div>
|
|
||||||
<div class="status">
|
|
||||||
<img src='project/images/hp.png' id="img-hp">
|
|
||||||
<p class='statusLabel' id='hp'></p>
|
|
||||||
</div>
|
|
||||||
<div class="status">
|
|
||||||
<img src='project/images/atk.png' id="img-atk">
|
|
||||||
<p class='statusLabel' id='atk'></p>
|
|
||||||
</div>
|
|
||||||
<div class="status">
|
|
||||||
<img src='project/images/def.png' id="img-def">
|
|
||||||
<p class='statusLabel' id='def'></p>
|
|
||||||
</div>
|
|
||||||
<div class="status" id="mdefCol">
|
|
||||||
<img src='project/images/mdef.png' id="img-mdef">
|
|
||||||
<p class='statusLabel' id='mdef'></p>
|
|
||||||
</div>
|
|
||||||
<div class="status" id="moneyCol">
|
|
||||||
<img src='project/images/money.png' id="img-money">
|
|
||||||
<p class='statusLabel' id='money'></p>
|
|
||||||
</div>
|
|
||||||
<div class="status" id="expCol">
|
|
||||||
<img src='project/images/experience.png' id="img-experience">
|
|
||||||
<p class='statusLabel' id='experience'></p>
|
|
||||||
</div>
|
|
||||||
<div class="status" id="upCol">
|
|
||||||
<img src='project/images/up.png' id="img-up">
|
|
||||||
<p class='statusLabel' id='up'></p>
|
|
||||||
</div>
|
|
||||||
<div class="status">
|
|
||||||
<span class='statusLabel' id='yellowKey' style="color:#FFCCAA"></span>
|
|
||||||
<span class='statusLabel' id='blueKey' style="color:#AAAADD"></span>
|
|
||||||
<span class='statusLabel' id='redKey' style="color:#FF8888"></span>
|
|
||||||
</div>
|
|
||||||
<div class="status" id="debuffCol">
|
|
||||||
<span class='statusLabel' id='poison' style="color: #AFFCA8;"></span>
|
|
||||||
<span class='statusLabel' id='weak' style="color: #FECCD0;"></span>
|
|
||||||
<span class='statusLabel' id='curse' style="color: #C2F4E7;"></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="toolBar" class="clearfix">
|
|
||||||
<img src="project/images/book.png" class="tools" id='img-book'>
|
|
||||||
<img src="project/images/fly.png" class="tools" id='img-fly'>
|
|
||||||
<img src="project/images/toolbox.png" class="tools" id='img-toolbox'>
|
|
||||||
<img src="project/images/shop.png" class="tools" id='img-shop'>
|
|
||||||
<img src="project/images/save.png" class="tools" id='img-save'>
|
|
||||||
<img src="project/images/load.png" class="tools" id='img-load'>
|
|
||||||
<img src="project/images/settings.png" class="tools" id='img-settings'>
|
|
||||||
<p class="statusLabel tools" id="hard"></p>
|
|
||||||
</div>
|
|
||||||
<div id="curtain"></div>
|
|
||||||
<canvas class='gameCanvas' id='bg' width='416' height='416'></canvas>
|
|
||||||
<canvas class='gameCanvas' id='event' width='416' height='416'></canvas>
|
|
||||||
<canvas class='gameCanvas' id='fg' width='416' height='416'></canvas>
|
|
||||||
<canvas class='gameCanvas' id='hero' width='416' height='416'></canvas>
|
|
||||||
<canvas class='gameCanvas' id='ui' width='416' height='416'></canvas>
|
|
||||||
<canvas class='gameCanvas' id='data' width='416' height='416'>此浏览器不支持HTML5</canvas>
|
|
||||||
</div>
|
|
||||||
<script id='mainScript' src='main.js'></script>
|
|
||||||
<script>
|
|
||||||
main.init('editor');
|
|
||||||
//main.init('replay');
|
|
||||||
main.listen();
|
|
||||||
|
|
||||||
var replayActions = function(){
|
|
||||||
//core.onclick(7,7,[]);
|
|
||||||
}
|
|
||||||
|
|
||||||
var replay = function(){
|
|
||||||
core.events.startGame('');
|
|
||||||
//setTimeout(function(){Array.from(Array(200)).forEach(function(){core.onclick(7,7,[]);});console.log(1);},1000);//关开场剧情
|
|
||||||
//setTimeout(function(){try {Array.from(Array(200)).forEach(function(){core.drawText();})} catch (error){}},3000);//关firstArrive
|
|
||||||
//console.log(1);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
var afterInit = function(){
|
|
||||||
main.editor.disableGlobalAnimate=false;
|
|
||||||
main.editor.drawMapBg();
|
|
||||||
main.editor.updateMap();
|
|
||||||
core.setHeroMoveTriggerInterval();
|
|
||||||
}
|
|
||||||
var start = function(){
|
|
||||||
var hard = 'Hard';
|
|
||||||
core.resetStatus(core.firstData.hero, hard, core.firstData.floorId, core.initStatus.maps);
|
|
||||||
core.changeFloor(core.status.floorId, null, core.firstData.hero.loc, null, function() {
|
|
||||||
/* core.setHeroMoveTriggerInterval(); */
|
|
||||||
afterInit();
|
|
||||||
});
|
|
||||||
core.events.setInitData(hard);
|
|
||||||
}
|
|
||||||
setTimeout(start, 300);
|
|
||||||
//setTimeout(replay, 300);
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
Loading…
Reference in New Issue
Block a user