fix bug 以及调整追加素材的字体
This commit is contained in:
parent
3b9e03efee
commit
46d4d77bde
@ -2,15 +2,20 @@
|
|||||||
|
|
||||||
本目录下所有文件,以及`../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`基本可以独立使用.
|
||||||
|
|
||||||
## 各组件功能
|
## 各组件功能
|
||||||
|
|
||||||
### editor.js
|
### editor.js
|
||||||
|
|
||||||
暂略
|
``` js
|
||||||
|
editor.mapInit();//清空地图
|
||||||
|
editor.changeFloor('MT2')//切换地图
|
||||||
|
editor.guid()//产生一个可以作为id的长随机字符串
|
||||||
|
```
|
||||||
|
|
||||||
### editor_file.js
|
### editor_file.js
|
||||||
|
|
||||||
提供了以下函数进行楼层`map`数组相关的操作
|
提供了以下函数进行楼层`map`数组相关的操作
|
||||||
```javascript
|
```javascript
|
||||||
editor.file.getFloorFileList
|
editor.file.getFloorFileList
|
||||||
@ -18,6 +23,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 +33,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 +47,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 +55,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 +80,64 @@ 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`中提供了追加素材的支持.
|
||||||
|
|
||||||
### 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
|
||||||
|
|
||||||
|
|||||||
@ -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; */
|
||||||
@ -87,6 +92,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%}
|
||||||
|
|||||||
@ -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,11 +315,11 @@ 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;
|
||||||
});
|
});
|
||||||
return locObj;
|
return locObj;
|
||||||
@ -330,11 +330,11 @@ 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;
|
||||||
});
|
});
|
||||||
return locObj;
|
return locObj;
|
||||||
|
|||||||
@ -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){
|
||||||
|
|||||||
@ -49,10 +49,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>
|
||||||
|
|||||||
@ -25,6 +25,7 @@ comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
|
|||||||
'bomb':' 加入 "bomb": false 代表该怪物不可被炸弹或圣锤炸掉\n$select({\"values\":[true,false]})$end',
|
'bomb':' 加入 "bomb": false 代表该怪物不可被炸弹或圣锤炸掉\n$select({\"values\":[true,false]})$end',
|
||||||
'point': 'point可以在打败怪物后进行加点,详见文档说明\n$range((thiseval==~~thiseval && thiseval>0)||thiseval==null)$end',
|
'point': 'point可以在打败怪物后进行加点,详见文档说明\n$range((thiseval==~~thiseval && thiseval>0)||thiseval==null)$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'
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user