commit
ae0133eee4
121
2.0diff.md
Normal file
121
2.0diff.md
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
# 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`中的数据,目前只完成了文件操作的代码`_server/editor_file.js`,前端尚未完成
|
||||||
|
+ 把`editor`的代码拆到了`_server/editor.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
|
||||||
|
把`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
|
||||||
|
|
||||||
|
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压缩工具改为一键生成发布版
|
||||||
@ -1,27 +0,0 @@
|
|||||||
comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
|
|
||||||
{
|
|
||||||
"items" : {
|
|
||||||
'items':{
|
|
||||||
'cls': "只能取keys items constants tools\n$range(thiseval in ['keys','items','constants','tools'])$end",
|
|
||||||
'name': '名称',
|
|
||||||
'text': '道具在道具栏中显示的描述'
|
|
||||||
},
|
|
||||||
'itemEffect':'cls为items的即捡即用类物品的效果,执行时会对这里的字符串执行eval()',
|
|
||||||
'itemEffectTip':'cls为items的即捡即用类物品,在获得时左上角额外显示的文字,执行时会对这里的字符串执行eval()得到字符串'
|
|
||||||
},
|
|
||||||
"enemys" : {
|
|
||||||
'name': '名称',
|
|
||||||
'hp': '生命值',
|
|
||||||
'atk': '攻击力',
|
|
||||||
'def': '防御力',
|
|
||||||
'money': '金币',
|
|
||||||
'experience': '经验',
|
|
||||||
'special': '特殊属性\n1:先攻,2:魔攻,3:坚固,4:2连击,5:3连击,6:n连击,7:破甲,8:反击,9:净化,10:模仿,11:吸血,12:中毒,13:衰弱,14:诅咒,15:领域,16:夹击,17:仇恨,18:阻击,19:自爆,20:无敌\n多个属性例如用[1,4,11]表示先攻2连击吸血\n模仿怪的攻防设为0就好\n',
|
|
||||||
'value': '特殊属性的数值\n领域怪需要加value表示领域伤害的数值\n吸血怪需要在后面添加value代表吸血比例',
|
|
||||||
'zoneSquare': '领域怪zoneSquare代表是否九宫格伤害',
|
|
||||||
'range': 'range可选,代表领域伤害的范围;不加默认为1\n$range(thiseval==~~thiseval &&thiseval>0)$end',
|
|
||||||
'bomb':' 加入 "bomb": false 代表该怪物不可被炸弹或圣锤炸掉$range(thiseval in [true,false])$end',
|
|
||||||
'point': 'point可以在打败怪物后进行加点,详见文档说明\n$range(thiseval==~~thiseval && thiseval>0)$end',
|
|
||||||
'n': '多连击需要在后面指定n代表是几连击\n$range(thiseval==~~thiseval &&thiseval>0)$end',
|
|
||||||
}
|
|
||||||
}
|
|
||||||
508
_server/editor.js
Normal file
508
_server/editor.js
Normal file
@ -0,0 +1,508 @@
|
|||||||
|
function editor() {
|
||||||
|
this.version = "1.2";
|
||||||
|
this.material = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
editor.prototype.init = function(callback){
|
||||||
|
var afterCoreReset = function(){
|
||||||
|
|
||||||
|
main.editor.disableGlobalAnimate=false;//允许GlobalAnimate
|
||||||
|
/* core.setHeroMoveTriggerInterval(); */
|
||||||
|
|
||||||
|
editor.reset(function(){
|
||||||
|
editor.drawMapBg();
|
||||||
|
var mapArray = core.maps.getMapArray(core.status.maps, core.status.floorId);
|
||||||
|
editor.map = mapArray.map(function(v){return v.map(function(v){return editor.ids[[editor.indexs[v][0]]]})});
|
||||||
|
editor.updateMap();
|
||||||
|
editor.currentFloorId=core.status.floorId;
|
||||||
|
editor.currentFloorData = core.floors[core.status.floorId];
|
||||||
|
|
||||||
|
if (Boolean(callback))callback();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
var afterMainInit = function(){
|
||||||
|
editor.main=main;
|
||||||
|
editor.core=core;
|
||||||
|
editor.fs=fs;
|
||||||
|
editor.file=editor_file;
|
||||||
|
editor.material.images=core.material.images;
|
||||||
|
editor.listen(); // 开始监听事件
|
||||||
|
var hard = 'Hard';
|
||||||
|
core.resetStatus(core.firstData.hero, hard, core.firstData.floorId, core.initStatus.maps);
|
||||||
|
//core.status.maps = core.clone(core.maps.initMaps(floorIds));
|
||||||
|
core.changeFloor(core.status.floorId, null, core.firstData.hero.loc, null, function() {
|
||||||
|
afterCoreReset();
|
||||||
|
});
|
||||||
|
core.events.setInitData(hard);
|
||||||
|
}
|
||||||
|
setTimeout(afterMainInit, 300);
|
||||||
|
}
|
||||||
|
|
||||||
|
editor.prototype.reset = function(callback){
|
||||||
|
editor.idsInit(core.maps, core.icons.icons); // 初始化图片素材信息
|
||||||
|
editor.drawInitData(core.icons.icons); // 初始化绘图
|
||||||
|
if(Boolean(callback))callback();
|
||||||
|
}
|
||||||
|
|
||||||
|
editor.prototype.idsInit = function(maps, icons){
|
||||||
|
editor.ids = [0];
|
||||||
|
editor.indexs = [];
|
||||||
|
var MAX_NUM = 400;
|
||||||
|
var getInfoById = function(id){
|
||||||
|
var block = maps.getBlock(0, 0, id);
|
||||||
|
if(hasOwnProp(block, 'event')){
|
||||||
|
return block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var point = 0;
|
||||||
|
for(var i=0; i<MAX_NUM; i++){
|
||||||
|
var indexBlock = getInfoById(i);
|
||||||
|
editor.indexs[i] = [];
|
||||||
|
if(indexBlock){
|
||||||
|
var id = indexBlock.event.id;
|
||||||
|
var indexId = indexBlock.id;
|
||||||
|
var allCls = Object.keys(icons);
|
||||||
|
for(var j=0; j<allCls.length; j++){
|
||||||
|
if(id in icons[allCls[j]] ){
|
||||||
|
editor.ids.push({'idnum':indexId,'id':id,'images':allCls[j],'y':icons[allCls[j]][id]});
|
||||||
|
point++;
|
||||||
|
editor.indexs[i].push(point);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
editor.indexs[0]=[0];
|
||||||
|
}
|
||||||
|
editor.prototype.drawInitData = function (icons) {
|
||||||
|
var ratio=1;
|
||||||
|
var images=editor.material.images;
|
||||||
|
var maxHeight=700;
|
||||||
|
var sumWidth=0;
|
||||||
|
editor.widthsX={};
|
||||||
|
// var imgNames = Object.keys(images); //还是固定顺序吧;
|
||||||
|
var imgNames = ["terrains", "animates", "enemys", "items", "npcs", "autotile"];
|
||||||
|
|
||||||
|
for(var ii=0; ii<imgNames.length; ii++){
|
||||||
|
var img=imgNames[ii], tempy = 0;
|
||||||
|
if(img == 'autotile'){
|
||||||
|
var autotiles = images[img];
|
||||||
|
for(var im in autotiles){
|
||||||
|
tempy += autotiles[im].height;
|
||||||
|
}
|
||||||
|
editor.widthsX[img]=[img, sumWidth/32, (sumWidth+3*32)/32, tempy];
|
||||||
|
sumWidth += 3*32;
|
||||||
|
maxHeight = Math.max(maxHeight, tempy);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(img == 'terrains'){
|
||||||
|
editor.widthsX[img]=[img, sumWidth/32, (sumWidth+images[img].width)/32, images[img].height+32]
|
||||||
|
sumWidth += images[img].width;
|
||||||
|
maxHeight = Math.max(maxHeight, images[img].height+32);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
editor.widthsX[img]=[img, sumWidth/32, (sumWidth+images[img].width)/32, images[img].height];
|
||||||
|
sumWidth += images[img].width;
|
||||||
|
maxHeight = Math.max(maxHeight, images[img].height);
|
||||||
|
}
|
||||||
|
var fullWidth=~~(sumWidth*ratio);
|
||||||
|
var fullHeight=~~(maxHeight*ratio);
|
||||||
|
|
||||||
|
if (fullWidth > edata.width) edata.style.width = (edata.width = fullWidth)/ratio + 'px';
|
||||||
|
edata.style.height = (edata.height = fullHeight)/ratio + 'px';
|
||||||
|
var dc = edata.getContext('2d');
|
||||||
|
var nowx = 0;
|
||||||
|
var nowy = 0;
|
||||||
|
for(var ii=0; ii<imgNames.length; ii++){
|
||||||
|
var img=imgNames[ii];
|
||||||
|
if(img == 'terrains'){
|
||||||
|
dc.drawImage(images[img], nowx, 32);
|
||||||
|
nowx += images[img].width;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(img == 'autotile'){
|
||||||
|
var autotiles = images[img];
|
||||||
|
for(var im in autotiles){
|
||||||
|
dc.drawImage(autotiles[im], nowx, nowy);
|
||||||
|
nowy += autotiles[im].height;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
dc.drawImage(images[img], nowx, 0)
|
||||||
|
nowx += images[img].width;
|
||||||
|
}
|
||||||
|
bgSelect.bgs = Object.keys(icons.terrains);
|
||||||
|
//editor.drawMapBg();
|
||||||
|
//editor.mapInit();
|
||||||
|
}
|
||||||
|
editor.prototype.mapInit = function(){
|
||||||
|
var ec = document.getElementById('event').getContext('2d');
|
||||||
|
ec.clearRect(0, 0, 416, 416);
|
||||||
|
editor.map = [];
|
||||||
|
for(var y=0; y<13; y++){
|
||||||
|
editor.map[y] = [];
|
||||||
|
for(var x = 0; x<13; x++){
|
||||||
|
editor.map[y][x] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
editor.prototype.drawMapBg = function(img){
|
||||||
|
var bgc = bg.getContext('2d');
|
||||||
|
if (!core.isset(editor.bgY) || editor.bgY == 0){
|
||||||
|
editor.main.editor.drawMapBg();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var ii = 0; ii < 13; ii++)
|
||||||
|
for (var jj = 0; jj < 13; jj++) {
|
||||||
|
bgc.clearRect(ii*32, jj*32, 32, 32);
|
||||||
|
bgc.drawImage(editor.material.images['terrains'], 0, 32*(editor.bgY||0), 32, 32, ii*32, jj*32, 32, 32);
|
||||||
|
}
|
||||||
|
if(img){
|
||||||
|
bgc.drawImage(img, 0, 0, 416, 416);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
editor.prototype.updateMap = function(){
|
||||||
|
var blocks = main.editor.mapIntoBlocks(editor.map.map(function(v){return v.map(function(v){return v.idnum||v||0})}),{'events':{},'changeFloor':{}});
|
||||||
|
core.status.thisMap.blocks = blocks;
|
||||||
|
main.editor.updateMap();
|
||||||
|
|
||||||
|
var drawTile = function(ctx, x, y, tileInfo){ // 绘制一个普通块
|
||||||
|
|
||||||
|
//ctx.clearRect(x*32, y*32, 32, 32);
|
||||||
|
if(tileInfo == 0) return;
|
||||||
|
|
||||||
|
if(typeof(tileInfo) == typeof([][0]) || !hasOwnProp(tileInfo, 'idnum')) {//未定义块画红块
|
||||||
|
if(typeof(tileInfo) != typeof([][0]) && hasOwnProp(tileInfo, 'images')){
|
||||||
|
ctx.drawImage(editor.material.images[tileInfo.images], 0, tileInfo.y*32, 32, 32, x*32, y*32, 32, 32);
|
||||||
|
}
|
||||||
|
ctx.strokeStyle = 'red';
|
||||||
|
var OFFSET = 2;
|
||||||
|
ctx.lineWidth = OFFSET;
|
||||||
|
ctx.strokeRect(x*32+OFFSET, y*32+OFFSET, 32-OFFSET*2, 32-OFFSET*2);
|
||||||
|
ctx.font = "30px Verdana";
|
||||||
|
ctx.textAlign = 'center'
|
||||||
|
ctx.fillStyle = 'red';
|
||||||
|
ctx.fillText("?", x*32+16, y*32+27);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//ctx.drawImage(editor.material.images[tileInfo.images], 0, tileInfo.y*32, 32, 32, x*32, y*32, 32, 32);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
// autotile的相关处理
|
||||||
|
var indexArrs = [ //16种组合的图块索引数组; // 将autotile分割成48块16*16的小块; 数组索引即对应各个小块
|
||||||
|
// +----+----+----+----+----+----+
|
||||||
|
[10, 9, 4, 3 ], //0 bin:0000 | 1 | 2 | 3 | 4 | 5 | 6 |
|
||||||
|
[10, 9, 4, 13], //1 bin:0001 +----+----+----+----+----+----+
|
||||||
|
[10, 9, 18, 3 ], //2 bin:0010 | 7 | 8 | 9 | 10 | 11 | 12 |
|
||||||
|
[10, 9, 16, 15], //3 bin:0011 +----+----+----+----+----+----+
|
||||||
|
[10, 43, 4, 3 ], //4 bin:0100 | 13 | 14 | 15 | 16 | 17 | 18 |
|
||||||
|
[10, 31, 4, 25], //5 bin:0101 +----+----+----+----+----+----+
|
||||||
|
[10, 7, 2, 3 ], //6 bin:0110 | 19 | 20 | 21 | 22 | 23 | 24 |
|
||||||
|
[10, 31, 16, 5 ], //7 bin:0111 +----+----+----+----+----+----+
|
||||||
|
[48, 9, 4, 3 ], //8 bin:1000 | 25 | 26 | 27 | 28 | 29 | 30 |
|
||||||
|
[ 8, 9, 4, 1 ], //9 bin:1001 +----+----+----+----+----+----+
|
||||||
|
[36, 9, 30, 3 ], //10 bin:1010 | 31 | 32 | 33 | 34 | 35 | 36 |
|
||||||
|
[36, 9, 6, 15], //11 bin:1011 +----+----+----+----+----+----+
|
||||||
|
[46, 45, 4, 3 ], //12 bin:1100 | 37 | 38 | 39 | 40 | 41 | 42 |
|
||||||
|
[46, 11, 4, 25], //13 bin:1101 +----+----+----+----+----+----+
|
||||||
|
[12, 45, 30, 3 ], //14 bin:1110 | 43 | 44 | 45 | 46 | 47 | 48 |
|
||||||
|
[34, 33, 28, 27] //15 bin:1111 +----+----+----+----+----+----+
|
||||||
|
];
|
||||||
|
var drawBlockByIndex = function(ctx, dx, dy, autotileImg, index){ //index为autotile的图块索引1-48
|
||||||
|
var sx = 16*((index-1)%6), sy = 16*(~~((index-1)/6));
|
||||||
|
ctx.drawImage(autotileImg, sx, sy, 16, 16, dx, dy, 16, 16);
|
||||||
|
}
|
||||||
|
var isAutotile = function(info){
|
||||||
|
if(typeof(info)=='object' && hasOwnProp(info, 'images') && info.images=='autotile') return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var getAutotileAroundId = function(currId, x, y){ //与autotile当前idnum一致返回1,否则返回0
|
||||||
|
if(x>=0 && y >=0 && x<13 && y<13 && isAutotile(editor.map[y][x]) && editor.map[y][x].idnum == currId)
|
||||||
|
return 1;
|
||||||
|
else if(x<0 || y<0 || x>12 || y>12) return 1; //边界外视为通用autotile,这样好看些
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
var checkAround = function(x, y){ // 得到周围四个32*32块(周围每块都包含当前块的1/4,不清楚的话画下图你就明白)的数组索引
|
||||||
|
var currId = editor.map[y][x].idnum;
|
||||||
|
var pointBlock = [];
|
||||||
|
for(var i=0; i<4; i++){
|
||||||
|
var bsum = 0;
|
||||||
|
var offsetx = i%2, offsety = ~~(i/2);
|
||||||
|
for(var j=0; j<4; j++){
|
||||||
|
var mx = j%2, my = ~~(j/2);
|
||||||
|
var b = getAutotileAroundId(currId, x+offsetx+mx-1, y+offsety+my-1);
|
||||||
|
bsum += b*(Math.pow(2, 3-j));
|
||||||
|
}
|
||||||
|
pointBlock.push(bsum);
|
||||||
|
}
|
||||||
|
return pointBlock;
|
||||||
|
}
|
||||||
|
var addIndexToAutotileInfo = function(x, y){
|
||||||
|
var indexArr = [];
|
||||||
|
var pointBlocks = checkAround(x, y);
|
||||||
|
for(var i=0; i<4; i++){
|
||||||
|
var arr = indexArrs[pointBlocks[i]]
|
||||||
|
indexArr.push(arr[3-i]);
|
||||||
|
}
|
||||||
|
editor.map[y][x].blockIndex = indexArr;
|
||||||
|
}
|
||||||
|
var drawAutotile = function(ctx, x, y, info){ // 绘制一个autotile
|
||||||
|
ctx.clearRect(x*32, y*32, 32, 32);
|
||||||
|
//修正四个边角的固定搭配
|
||||||
|
if(info.blockIndex[0] == 13){
|
||||||
|
if(info.blockIndex[1] == 16) info.blockIndex[1] = 14;
|
||||||
|
if(info.blockIndex[2] == 31) info.blockIndex[2] = 19;
|
||||||
|
}
|
||||||
|
if(info.blockIndex[1] == 18){
|
||||||
|
if(info.blockIndex[0] == 15) info.blockIndex[0] = 17;
|
||||||
|
if(info.blockIndex[3] == 36) info.blockIndex[3] = 24;
|
||||||
|
}
|
||||||
|
if(info.blockIndex[2] == 43){
|
||||||
|
if(info.blockIndex[0] == 25) info.blockIndex[0] = 37;
|
||||||
|
if(info.blockIndex[3] == 46) info.blockIndex[3] = 44;
|
||||||
|
}
|
||||||
|
if(info.blockIndex[3] == 48){
|
||||||
|
if(info.blockIndex[1] == 30) info.blockIndex[1] = 42;
|
||||||
|
if(info.blockIndex[2] == 45) info.blockIndex[2] = 47;
|
||||||
|
}
|
||||||
|
for(var i=0; i<4; i++){
|
||||||
|
var index = info.blockIndex[i];
|
||||||
|
var dx = x*32 + 16*(i%2), dy = y*32 + 16*(~~(i/2));
|
||||||
|
drawBlockByIndex(ctx, dx, dy, editor.material.images[info.images][info.id], index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
// 绘制地图 start
|
||||||
|
var eventCtx = document.getElementById('event').getContext("2d");
|
||||||
|
for(var y=0; y<13; y++)
|
||||||
|
for(var x=0; x<13; x++){
|
||||||
|
var tileInfo = editor.map[y][x];
|
||||||
|
if(false && isAutotile(tileInfo)){
|
||||||
|
addIndexToAutotileInfo(x, y);
|
||||||
|
drawAutotile(eventCtx, x, y, tileInfo);
|
||||||
|
}else drawTile(eventCtx, x, y, tileInfo);
|
||||||
|
}
|
||||||
|
// 绘制地图 end
|
||||||
|
}
|
||||||
|
|
||||||
|
editor.prototype.changeFloor = function(floorId,callback) {
|
||||||
|
core.changeFloor(floorId, null, core.firstData.hero.loc, null, function(){
|
||||||
|
editor.drawMapBg();
|
||||||
|
var mapArray = core.maps.getMapArray(core.status.maps, core.status.floorId);
|
||||||
|
editor.map = mapArray.map(function(v){return v.map(function(v){return editor.ids[[editor.indexs[v][0]]]})});
|
||||||
|
editor.updateMap();
|
||||||
|
editor.currentFloorId=core.status.floorId;
|
||||||
|
editor.currentFloorData = core.floors[core.status.floorId];
|
||||||
|
if (core.isset(callback))callback();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
editor.prototype.listen = function() {
|
||||||
|
|
||||||
|
var uc = eui.getContext('2d');
|
||||||
|
|
||||||
|
function fillPos(pos) {
|
||||||
|
uc.fillStyle = '#' + ~~(Math.random() * 8) + ~~(Math.random() * 8) + ~~(Math.random() * 8);
|
||||||
|
uc.fillRect(pos.x * 32 + 12, pos.y * 32 + 12, 8, 8);
|
||||||
|
}//在格子内画一个随机色块
|
||||||
|
|
||||||
|
function eToLoc(e) {
|
||||||
|
editor.loc = {
|
||||||
|
'x': document.documentElement.scrollLeft+e.clientX - mid.offsetLeft-mapEdit.offsetLeft,
|
||||||
|
'y': document.documentElement.scrollTop+e.clientY - mid.offsetTop-mapEdit.offsetTop,
|
||||||
|
'size': 32
|
||||||
|
};
|
||||||
|
return editor.loc; }//返回可用的组件内坐标
|
||||||
|
|
||||||
|
function locToPos(loc) {
|
||||||
|
editor.pos = { 'x': ~~(loc.x / loc.size), 'y': ~~(loc.y / loc.size) }
|
||||||
|
return editor.pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
var holdingPath = 0;
|
||||||
|
var stepPostfix = null;//用于存放寻路检测的第一个点之后的后续移动
|
||||||
|
|
||||||
|
var mouseOutCheck = 2;
|
||||||
|
function clear1() {
|
||||||
|
if (mouseOutCheck > 1) {
|
||||||
|
mouseOutCheck--;
|
||||||
|
setTimeout(clear1, 1000);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
holdingPath = 0;
|
||||||
|
stepPostfix = [];
|
||||||
|
uc.clearRect(0, 0, 416, 416);
|
||||||
|
}//用于鼠标移出canvas时的自动清除状态
|
||||||
|
|
||||||
|
eui.onmousedown = function (e) {
|
||||||
|
if(!selectBox.isSelected) {
|
||||||
|
tip.whichShow = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
holdingPath = 1;
|
||||||
|
mouseOutCheck = 2;
|
||||||
|
setTimeout(clear1);
|
||||||
|
e.stopPropagation();
|
||||||
|
uc.clearRect(0, 0, 416, 416);
|
||||||
|
var loc = eToLoc(e);
|
||||||
|
var pos = locToPos(loc)
|
||||||
|
stepPostfix = [];
|
||||||
|
stepPostfix.push(pos);
|
||||||
|
fillPos(pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
eui.onmousemove = function (e) {
|
||||||
|
if(!selectBox.isSelected) {
|
||||||
|
// tip.whichShow = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (holdingPath == 0) { return; }
|
||||||
|
mouseOutCheck = 2;
|
||||||
|
e.stopPropagation();
|
||||||
|
var loc = eToLoc(e);
|
||||||
|
var pos = locToPos(loc);
|
||||||
|
var pos0 = stepPostfix[stepPostfix.length - 1]
|
||||||
|
var directionDistance = [pos.y - pos0.y, pos0.x - pos.x, pos0.y - pos.y, pos.x - pos0.x]
|
||||||
|
var max = 0, index = 4;
|
||||||
|
for (var i = 0; i < 4; i++) {
|
||||||
|
if (directionDistance[i] > max) {
|
||||||
|
index = i;
|
||||||
|
max = directionDistance[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var pos = [{ 'x': 0, 'y': 1 }, { 'x': -1, 'y': 0 }, { 'x': 0, 'y': -1 }, { 'x': 1, 'y': 0 }, false][index]
|
||||||
|
if (pos) {
|
||||||
|
pos.x += pos0.x;
|
||||||
|
pos.y += pos0.y;
|
||||||
|
stepPostfix.push(pos);
|
||||||
|
fillPos(pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
eui.onmouseup = function (e) {
|
||||||
|
if(!selectBox.isSelected) {
|
||||||
|
tip.whichShow = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
holdingPath = 0;
|
||||||
|
e.stopPropagation();
|
||||||
|
var loc = eToLoc(e);
|
||||||
|
if (stepPostfix.length) {
|
||||||
|
preMapData = JSON.parse(JSON.stringify(editor.map));
|
||||||
|
currDrawData.pos = JSON.parse(JSON.stringify(stepPostfix));
|
||||||
|
currDrawData.info = JSON.parse(JSON.stringify(editor.info));
|
||||||
|
reDo = null;
|
||||||
|
// console.log(stepPostfix);
|
||||||
|
for (var ii = 0; ii < stepPostfix.length; ii++)
|
||||||
|
editor.map[stepPostfix[ii].y][stepPostfix[ii].x] = editor.info;
|
||||||
|
// console.log(editor.map);
|
||||||
|
editor.updateMap();
|
||||||
|
holdingPath = 0;
|
||||||
|
stepPostfix = [];
|
||||||
|
uc.clearRect(0, 0, 416, 416);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var preMapData = {};
|
||||||
|
var currDrawData = {
|
||||||
|
pos: [],
|
||||||
|
info: {}
|
||||||
|
};
|
||||||
|
var reDo = null;
|
||||||
|
document.body.onkeydown = function(e) {
|
||||||
|
// 禁止快捷键的默认行为
|
||||||
|
if( e.ctrlKey && ( e.keyCode == 90 || e.keyCode == 89 ) )
|
||||||
|
e.preventDefault();
|
||||||
|
//Ctrl+z 撤销上一步undo
|
||||||
|
if(e.keyCode == 90 && e.ctrlKey && preMapData && currDrawData.pos.length){
|
||||||
|
editor.map = JSON.parse(JSON.stringify(preMapData));
|
||||||
|
editor.updateMap();
|
||||||
|
reDo = JSON.parse(JSON.stringify(currDrawData));
|
||||||
|
currDrawData = {pos: [],info: {}};
|
||||||
|
preMapData = null;
|
||||||
|
}
|
||||||
|
//Ctrl+y 重做一步redo
|
||||||
|
if(e.keyCode == 89 && e.ctrlKey && reDo && reDo.pos.length){
|
||||||
|
preMapData = JSON.parse(JSON.stringify(editor.map));
|
||||||
|
for(var j=0; j<reDo.pos.length;j++)
|
||||||
|
editor.map[reDo.pos[j].y][reDo.pos[j].x] = JSON.parse(JSON.stringify(reDo.info));
|
||||||
|
|
||||||
|
editor.updateMap();
|
||||||
|
currDrawData = JSON.parse(JSON.stringify(reDo));
|
||||||
|
reDo = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
edata.onmousedown = function (e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
var loc = {
|
||||||
|
'x': document.documentElement.scrollLeft + e.clientX + iconLib.scrollLeft - right.offsetLeft-iconLib.offsetLeft,
|
||||||
|
'y': document.documentElement.scrollTop + e.clientY + iconLib.scrollTop - right.offsetTop-iconLib.offsetTop,
|
||||||
|
'size': 32
|
||||||
|
};
|
||||||
|
editor.loc = loc;
|
||||||
|
var pos = locToPos(loc);
|
||||||
|
for (var spriter in editor.widthsX){
|
||||||
|
if(pos.x>=editor.widthsX[spriter][1] && pos.x<editor.widthsX[spriter][2]){
|
||||||
|
pos.x=editor.widthsX[spriter][1];
|
||||||
|
pos.images = editor.widthsX[spriter][0];
|
||||||
|
var autotiles = editor.material.images['autotile'];
|
||||||
|
if(pos.images=='autotile'){
|
||||||
|
var imNames = Object.keys(autotiles);
|
||||||
|
if((pos.y+1)*32 > editor.widthsX[spriter][3])
|
||||||
|
pos.y = ~~(editor.widthsX[spriter][3]/32)-4;
|
||||||
|
else{
|
||||||
|
for(var i=0; i<imNames.length; i++){
|
||||||
|
if(pos.y >= 4*i && pos.y < 4*(i+1)){
|
||||||
|
pos.images = imNames[i];
|
||||||
|
pos.y = 4*i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else if((pos.y+1)*32 > editor.widthsX[spriter][3])
|
||||||
|
pos.y = ~~(editor.widthsX[spriter][3]/32)-1;
|
||||||
|
|
||||||
|
selectBox.isSelected = true;
|
||||||
|
// console.log(pos,editor.material.images[pos.images].height)
|
||||||
|
dataSelection.style.left = pos.x*32 +'px';
|
||||||
|
dataSelection.style.top = pos.y*32 +'px';
|
||||||
|
|
||||||
|
if(pos.x==0&&pos.y==0){
|
||||||
|
// editor.info={idnum:0, id:'empty','images':'清除块', 'y':0};
|
||||||
|
editor.info=0;
|
||||||
|
}else{
|
||||||
|
if(hasOwnProp(autotiles, pos.images)) editor.info={'images':pos.images, 'y':0};
|
||||||
|
else if(pos.images == 'terrains') editor.info={'images':pos.images, 'y':pos.y-1};
|
||||||
|
else editor.info={'images':pos.images, 'y':pos.y};
|
||||||
|
|
||||||
|
for (var ii=0;ii<editor.ids.length;ii++){
|
||||||
|
if( ( editor.info.images==editor.ids[ii].images
|
||||||
|
&& editor.info.y==editor.ids[ii].y )
|
||||||
|
|| (hasOwnProp(autotiles, pos.images) && editor.info.images==editor.ids[ii].id
|
||||||
|
&& editor.info.y==editor.ids[ii].y)){
|
||||||
|
|
||||||
|
editor.info = editor.ids[ii];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tip.infos = JSON.parse(JSON.stringify(editor.info));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}//绑定事件
|
||||||
|
|
||||||
|
/*
|
||||||
|
editor.loc
|
||||||
|
editor.pos
|
||||||
|
editor.info
|
||||||
|
始终是最后一次点击的结果
|
||||||
|
注意editor.info可能因为点击其他地方而被清空
|
||||||
|
*/
|
||||||
|
|
||||||
|
editor = new editor();
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -12,9 +12,31 @@ pout.innerHTML='waiting\nwaiting waiting';
|
|||||||
var editor={};
|
var editor={};
|
||||||
editor.fs=fs;
|
editor.fs=fs;
|
||||||
editor.file=editor_file;
|
editor.file=editor_file;
|
||||||
editor.file.loadFloorFile(editor,'sample0',function(err){console.log(err);
|
//代码复制到 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)});
|
editor.file.saveFloorFileAs(editor,'aaa',function(err){console.log(err)});
|
||||||
});
|
}); */
|
||||||
|
|
||||||
|
//查询
|
||||||
|
/*
|
||||||
|
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)});
|
||||||
|
*/
|
||||||
|
|
||||||
|
//编辑
|
||||||
|
/*
|
||||||
|
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)});
|
||||||
|
*/
|
||||||
|
|
||||||
pout.innerHTML='succeed\nsucceed succeed';
|
pout.innerHTML='succeed\nsucceed succeed';
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
# 附录:API列表
|
# 附录:API列表
|
||||||
|
|
||||||
?> 上次更新时间:* {docsify-updated} * 如不是最新版,请Ctrl+F5强制刷新缓存。
|
?> 上次更新时间:* {docsify-updated} *
|
||||||
|
|
||||||
所有系统支持的API都列在了这里。所有可能被用到的API都在前面用\*标记。
|
所有系统支持的API都列在了这里。所有可能被用到的API都在前面用\*标记。
|
||||||
|
|
||||||
|
|||||||
731
drawMapGUI.html
731
drawMapGUI.html
@ -1,730 +1 @@
|
|||||||
<!doctype html>
|
<html><body><script>window.location='editor.html'</script></body></html>
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<link href="_server/css/editor.css" rel="stylesheet">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="main">
|
|
||||||
<div id="left">
|
|
||||||
<div id="arrEditor">
|
|
||||||
<table class="col" id='arrColMark'></table>
|
|
||||||
<table class="row" id='arrRowMark'></table>
|
|
||||||
<div id="editArea" v-cloak>
|
|
||||||
<textarea cols="10" rows="10" id="pout" v-model="mapArr"></textarea>
|
|
||||||
<p class="warnText" v-if="error">{{ errors[error-1] }}</p>
|
|
||||||
</div>
|
|
||||||
<div id="editTip" v-cloak>
|
|
||||||
<input class='btn' type="button" value="复制地图" v-on:click="copyMap"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="objDataEditor">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div id="eventEditor">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div id="mid">
|
|
||||||
<table class="col" id='mapColMark'></table>
|
|
||||||
<table class="row" id='mapRowMark'></table>
|
|
||||||
<div class="map" id="mapEdit">
|
|
||||||
<canvas class='gameCanvas' id='bg' width='416' height='416' style='z-index:1'></canvas>
|
|
||||||
<canvas class='gameCanvas' id='event' width='416' height='416' style='z-index:2'></canvas>
|
|
||||||
<canvas class='egameCanvas' id='eui' width='416' height='416' style='z-index:100'></canvas>
|
|
||||||
</div>
|
|
||||||
<div class="tools">
|
|
||||||
<div id="tip" v-cloak >
|
|
||||||
<div v-if="isSelectedBlock" >
|
|
||||||
<p v-if="isClearBlock" class="infoText">当前选择为清除块,可擦除地图上块</p>
|
|
||||||
<div v-else>
|
|
||||||
<p v-if="hasId">图块编号:<span class="infoText">{{ infos['idnum'] }}</span></p>
|
|
||||||
<p v-if="hasId">图块ID:<span class="infoText">{{ infos['id'] }}</span></p>
|
|
||||||
<p v-else class="warnText">该图块无对应的数字或ID存在,请先前往icons.js和maps.js中进行定义!</p>
|
|
||||||
<p>图块所在素材:<span class="infoText">{{ infos['images'] + (isAutotile ? '( '+infos['id']+' )' : '') }}</span></p>
|
|
||||||
<p>图块索引:<span class="infoText">{{ infos['y'] }}</span></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div v-else>
|
|
||||||
<p v-if="whichShow" v-bind:class="[ (whichShow%2) ? 'warnText' : 'successText']">{{ mapMsg }}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<input class='btn' id='clear' type="button" value="清除地图" v-on:click="clearMap"/>
|
|
||||||
<input class='btn' type="button" value="导出地图" id="exportM" v-on:click="exportMap"/>
|
|
||||||
|
|
||||||
<div id="bgSelect" v-cloak>
|
|
||||||
<span>当前地板: </span>
|
|
||||||
<select v-model="selectedBg">
|
|
||||||
<option disabled value="">请选择地板</option>
|
|
||||||
<option v-for="bg in bgs" v-bind:value="bg">
|
|
||||||
{{ bg }}
|
|
||||||
</option>
|
|
||||||
</select>
|
|
||||||
<div class="selectpng">
|
|
||||||
<input class='input' id='pin' v-model="imgname" placeholder="请输入自定义背景文件名"/>
|
|
||||||
<input class='btn' type="button" value="确定" v-on:click="updatebg"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="right">
|
|
||||||
<div id="iconLib">
|
|
||||||
<canvas class='egameCanvas' id='edata' width='416' height='416' style='z-index:0'></canvas>
|
|
||||||
<div id="selectBox">
|
|
||||||
<div id='dataSelection' v-show="isSelected" v-cloak></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- <script>/* -->
|
|
||||||
<div id='gameGroup' style='display:none'>
|
|
||||||
<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> -->
|
|
||||||
<script>
|
|
||||||
// 生成定位编号
|
|
||||||
(function(){
|
|
||||||
var colNum = ' ';
|
|
||||||
for(var i=0; i<13; i++){
|
|
||||||
var tpl = '<td>'+i+'<div class="colBlock" style="left:'+(i*32+1)+'px;"></div></td>';
|
|
||||||
colNum += tpl;
|
|
||||||
}
|
|
||||||
arrColMark.innerHTML = '<tr>'+colNum+'</tr>';
|
|
||||||
mapColMark.innerHTML = '<tr>'+colNum+'</tr>';
|
|
||||||
var rowNum = ' ';
|
|
||||||
for(var i=0; i<13; i++){
|
|
||||||
var tpl = '<tr><td>'+i+'<div class="rowBlock" style="top:'+(i*32+1)+'px;"></div></td></tr>';
|
|
||||||
rowNum += tpl;
|
|
||||||
}
|
|
||||||
arrRowMark.innerHTML = rowNum;
|
|
||||||
mapRowMark.innerHTML = rowNum;
|
|
||||||
})();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<!-- =========================================================== -->
|
|
||||||
|
|
||||||
<script src='_server/vendor/vue.min.js'></script>
|
|
||||||
<!-- <script src="https://cdn.bootcss.com/vue/2.5.13/vue.js"></script> -->
|
|
||||||
<script src='_server/fs.js'></script>
|
|
||||||
<script src='_server/editor_file.js'></script>
|
|
||||||
<script src='_server/vm.js'></script>
|
|
||||||
<script id='mainScript' src='main.js'></script>
|
|
||||||
<script>
|
|
||||||
|
|
||||||
//所有全局量
|
|
||||||
__all__=['Vue','fs','printf','editor','main','core'];
|
|
||||||
__id__=['printOut','arrRowMark','mapRowMark','data','bg','dataSelection'];
|
|
||||||
__Vue__=['exportM','editArea','editTip','clear','tip','selectBox'];
|
|
||||||
//var event = document.getElementById('event');
|
|
||||||
|
|
||||||
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
||||||
function hasOwnProp (obj, key) {
|
|
||||||
return hasOwnProperty.call(obj, key)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function editor() {
|
|
||||||
this.version = "1.2";
|
|
||||||
this.material = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
editor.prototype.init = function(callback){
|
|
||||||
editor.main=main;
|
|
||||||
editor.core=core;
|
|
||||||
editor.fs=fs;
|
|
||||||
editor.file=editor_file;
|
|
||||||
editor.material.images=core.material.images;
|
|
||||||
editor.idsInit(core.maps, core.icons.icons); // 初始化图片素材信息
|
|
||||||
editor.drawInitData(core.icons.icons); // 初始化绘图
|
|
||||||
editor.listen(); // 开始监听事件
|
|
||||||
if(Boolean(callback))callback();
|
|
||||||
}
|
|
||||||
|
|
||||||
editor.prototype.idsInit = function(maps, icons){
|
|
||||||
editor.ids = [0];
|
|
||||||
editor.indexs = [];
|
|
||||||
var MAX_NUM = 400;
|
|
||||||
var getInfoById = function(id){
|
|
||||||
var block = maps.getBlock(0, 0, id);
|
|
||||||
if(hasOwnProp(block, 'event')){
|
|
||||||
return block;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var point = 0;
|
|
||||||
for(var i=0; i<MAX_NUM; i++){
|
|
||||||
var indexBlock = getInfoById(i);
|
|
||||||
editor.indexs[i] = [];
|
|
||||||
if(indexBlock){
|
|
||||||
var id = indexBlock.event.id;
|
|
||||||
var indexId = indexBlock.id;
|
|
||||||
var allCls = Object.keys(icons);
|
|
||||||
for(var j=0; j<allCls.length; j++){
|
|
||||||
if(id in icons[allCls[j]] ){
|
|
||||||
editor.ids.push({'idnum':indexId,'id':id,'images':allCls[j],'y':icons[allCls[j]][id]});
|
|
||||||
point++;
|
|
||||||
editor.indexs[i].push(point);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
editor.indexs[0]=[0];
|
|
||||||
}
|
|
||||||
editor.prototype.drawInitData = function (icons) {
|
|
||||||
var ratio=1;
|
|
||||||
var images=editor.material.images;
|
|
||||||
var maxHeight=700;
|
|
||||||
var sumWidth=0;
|
|
||||||
editor.widthsX={};
|
|
||||||
// var imgNames = Object.keys(images); //还是固定顺序吧;
|
|
||||||
var imgNames = ["terrains", "animates", "enemys", "items", "npcs", "autotile"];
|
|
||||||
|
|
||||||
for(var ii=0; ii<imgNames.length; ii++){
|
|
||||||
var img=imgNames[ii], tempy = 0;
|
|
||||||
if(img == 'autotile'){
|
|
||||||
var autotiles = images[img];
|
|
||||||
for(var im in autotiles){
|
|
||||||
tempy += autotiles[im].height;
|
|
||||||
}
|
|
||||||
editor.widthsX[img]=[img, sumWidth/32, (sumWidth+3*32)/32, tempy];
|
|
||||||
sumWidth += 3*32;
|
|
||||||
maxHeight = Math.max(maxHeight, tempy);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if(img == 'terrains'){
|
|
||||||
editor.widthsX[img]=[img, sumWidth/32, (sumWidth+images[img].width)/32, images[img].height+32]
|
|
||||||
sumWidth += images[img].width;
|
|
||||||
maxHeight = Math.max(maxHeight, images[img].height+32);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
editor.widthsX[img]=[img, sumWidth/32, (sumWidth+images[img].width)/32, images[img].height];
|
|
||||||
sumWidth += images[img].width;
|
|
||||||
maxHeight = Math.max(maxHeight, images[img].height);
|
|
||||||
}
|
|
||||||
var fullWidth=~~(sumWidth*ratio);
|
|
||||||
var fullHeight=~~(maxHeight*ratio);
|
|
||||||
|
|
||||||
if (fullWidth > edata.width) edata.style.width = (edata.width = fullWidth)/ratio + 'px';
|
|
||||||
edata.style.height = (edata.height = fullHeight)/ratio + 'px';
|
|
||||||
var dc = edata.getContext('2d');
|
|
||||||
var nowx = 0;
|
|
||||||
var nowy = 0;
|
|
||||||
for(var ii=0; ii<imgNames.length; ii++){
|
|
||||||
var img=imgNames[ii];
|
|
||||||
if(img == 'terrains'){
|
|
||||||
dc.drawImage(images[img], nowx, 32);
|
|
||||||
nowx += images[img].width;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if(img == 'autotile'){
|
|
||||||
var autotiles = images[img];
|
|
||||||
for(var im in autotiles){
|
|
||||||
dc.drawImage(autotiles[im], nowx, nowy);
|
|
||||||
nowy += autotiles[im].height;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
dc.drawImage(images[img], nowx, 0)
|
|
||||||
nowx += images[img].width;
|
|
||||||
}
|
|
||||||
bgSelect.bgs = Object.keys(icons.terrains);
|
|
||||||
editor.drawMapBg();
|
|
||||||
editor.mapInit();
|
|
||||||
}
|
|
||||||
editor.prototype.mapInit = function(){
|
|
||||||
var ec = document.getElementById('event').getContext('2d');
|
|
||||||
ec.clearRect(0, 0, 416, 416);
|
|
||||||
editor.map = [];
|
|
||||||
for(var y=0; y<13; y++){
|
|
||||||
editor.map[y] = [];
|
|
||||||
for(var x = 0; x<13; x++){
|
|
||||||
editor.map[y][x] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
editor.prototype.drawMapBg = function(img){
|
|
||||||
var bgc = bg.getContext('2d');
|
|
||||||
if (!core.isset(editor.bgY) || editor.bgY == 0){
|
|
||||||
editor.main.editor.drawMapBg();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var ii = 0; ii < 13; ii++)
|
|
||||||
for (var jj = 0; jj < 13; jj++) {
|
|
||||||
bgc.clearRect(ii*32, jj*32, 32, 32);
|
|
||||||
bgc.drawImage(editor.material.images['terrains'], 0, 32*(editor.bgY||0), 32, 32, ii*32, jj*32, 32, 32);
|
|
||||||
}
|
|
||||||
if(img){
|
|
||||||
bgc.drawImage(img, 0, 0, 416, 416);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
editor.prototype.updateMap = function(){
|
|
||||||
var blocks = main.editor.mapIntoBlocks(editor.map.map(function(v){return v.map(function(v){return v.idnum||v||0})}),{'events':{},'changeFloor':{}});
|
|
||||||
core.status.thisMap.blocks = blocks;
|
|
||||||
main.editor.updateMap();
|
|
||||||
|
|
||||||
var drawTile = function(ctx, x, y, tileInfo){ // 绘制一个普通块
|
|
||||||
|
|
||||||
//ctx.clearRect(x*32, y*32, 32, 32);
|
|
||||||
if(tileInfo == 0) return;
|
|
||||||
|
|
||||||
if(typeof(tileInfo) == typeof([][0]) || !hasOwnProp(tileInfo, 'idnum')) {//未定义块画红块
|
|
||||||
if(typeof(tileInfo) != typeof([][0]) && hasOwnProp(tileInfo, 'images')){
|
|
||||||
ctx.drawImage(editor.material.images[tileInfo.images], 0, tileInfo.y*32, 32, 32, x*32, y*32, 32, 32);
|
|
||||||
}
|
|
||||||
ctx.strokeStyle = 'red';
|
|
||||||
var OFFSET = 2;
|
|
||||||
ctx.lineWidth = OFFSET;
|
|
||||||
ctx.strokeRect(x*32+OFFSET, y*32+OFFSET, 32-OFFSET*2, 32-OFFSET*2);
|
|
||||||
ctx.font = "30px Verdana";
|
|
||||||
ctx.textAlign = 'center'
|
|
||||||
ctx.fillStyle = 'red';
|
|
||||||
ctx.fillText("?", x*32+16, y*32+27);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//ctx.drawImage(editor.material.images[tileInfo.images], 0, tileInfo.y*32, 32, 32, x*32, y*32, 32, 32);
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
// autotile的相关处理
|
|
||||||
var indexArrs = [ //16种组合的图块索引数组; // 将autotile分割成48块16*16的小块; 数组索引即对应各个小块
|
|
||||||
// +----+----+----+----+----+----+
|
|
||||||
[10, 9, 4, 3 ], //0 bin:0000 | 1 | 2 | 3 | 4 | 5 | 6 |
|
|
||||||
[10, 9, 4, 13], //1 bin:0001 +----+----+----+----+----+----+
|
|
||||||
[10, 9, 18, 3 ], //2 bin:0010 | 7 | 8 | 9 | 10 | 11 | 12 |
|
|
||||||
[10, 9, 16, 15], //3 bin:0011 +----+----+----+----+----+----+
|
|
||||||
[10, 43, 4, 3 ], //4 bin:0100 | 13 | 14 | 15 | 16 | 17 | 18 |
|
|
||||||
[10, 31, 4, 25], //5 bin:0101 +----+----+----+----+----+----+
|
|
||||||
[10, 7, 2, 3 ], //6 bin:0110 | 19 | 20 | 21 | 22 | 23 | 24 |
|
|
||||||
[10, 31, 16, 5 ], //7 bin:0111 +----+----+----+----+----+----+
|
|
||||||
[48, 9, 4, 3 ], //8 bin:1000 | 25 | 26 | 27 | 28 | 29 | 30 |
|
|
||||||
[ 8, 9, 4, 1 ], //9 bin:1001 +----+----+----+----+----+----+
|
|
||||||
[36, 9, 30, 3 ], //10 bin:1010 | 31 | 32 | 33 | 34 | 35 | 36 |
|
|
||||||
[36, 9, 6, 15], //11 bin:1011 +----+----+----+----+----+----+
|
|
||||||
[46, 45, 4, 3 ], //12 bin:1100 | 37 | 38 | 39 | 40 | 41 | 42 |
|
|
||||||
[46, 11, 4, 25], //13 bin:1101 +----+----+----+----+----+----+
|
|
||||||
[12, 45, 30, 3 ], //14 bin:1110 | 43 | 44 | 45 | 46 | 47 | 48 |
|
|
||||||
[34, 33, 28, 27] //15 bin:1111 +----+----+----+----+----+----+
|
|
||||||
];
|
|
||||||
var drawBlockByIndex = function(ctx, dx, dy, autotileImg, index){ //index为autotile的图块索引1-48
|
|
||||||
var sx = 16*((index-1)%6), sy = 16*(~~((index-1)/6));
|
|
||||||
ctx.drawImage(autotileImg, sx, sy, 16, 16, dx, dy, 16, 16);
|
|
||||||
}
|
|
||||||
var isAutotile = function(info){
|
|
||||||
if(typeof(info)=='object' && hasOwnProp(info, 'images') && info.images=='autotile') return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
var getAutotileAroundId = function(currId, x, y){ //与autotile当前idnum一致返回1,否则返回0
|
|
||||||
if(x>=0 && y >=0 && x<13 && y<13 && isAutotile(editor.map[y][x]) && editor.map[y][x].idnum == currId)
|
|
||||||
return 1;
|
|
||||||
else if(x<0 || y<0 || x>12 || y>12) return 1; //边界外视为通用autotile,这样好看些
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
var checkAround = function(x, y){ // 得到周围四个32*32块(周围每块都包含当前块的1/4,不清楚的话画下图你就明白)的数组索引
|
|
||||||
var currId = editor.map[y][x].idnum;
|
|
||||||
var pointBlock = [];
|
|
||||||
for(var i=0; i<4; i++){
|
|
||||||
var bsum = 0;
|
|
||||||
var offsetx = i%2, offsety = ~~(i/2);
|
|
||||||
for(var j=0; j<4; j++){
|
|
||||||
var mx = j%2, my = ~~(j/2);
|
|
||||||
var b = getAutotileAroundId(currId, x+offsetx+mx-1, y+offsety+my-1);
|
|
||||||
bsum += b*(Math.pow(2, 3-j));
|
|
||||||
}
|
|
||||||
pointBlock.push(bsum);
|
|
||||||
}
|
|
||||||
return pointBlock;
|
|
||||||
}
|
|
||||||
var addIndexToAutotileInfo = function(x, y){
|
|
||||||
var indexArr = [];
|
|
||||||
var pointBlocks = checkAround(x, y);
|
|
||||||
for(var i=0; i<4; i++){
|
|
||||||
var arr = indexArrs[pointBlocks[i]]
|
|
||||||
indexArr.push(arr[3-i]);
|
|
||||||
}
|
|
||||||
editor.map[y][x].blockIndex = indexArr;
|
|
||||||
}
|
|
||||||
var drawAutotile = function(ctx, x, y, info){ // 绘制一个autotile
|
|
||||||
ctx.clearRect(x*32, y*32, 32, 32);
|
|
||||||
//修正四个边角的固定搭配
|
|
||||||
if(info.blockIndex[0] == 13){
|
|
||||||
if(info.blockIndex[1] == 16) info.blockIndex[1] = 14;
|
|
||||||
if(info.blockIndex[2] == 31) info.blockIndex[2] = 19;
|
|
||||||
}
|
|
||||||
if(info.blockIndex[1] == 18){
|
|
||||||
if(info.blockIndex[0] == 15) info.blockIndex[0] = 17;
|
|
||||||
if(info.blockIndex[3] == 36) info.blockIndex[3] = 24;
|
|
||||||
}
|
|
||||||
if(info.blockIndex[2] == 43){
|
|
||||||
if(info.blockIndex[0] == 25) info.blockIndex[0] = 37;
|
|
||||||
if(info.blockIndex[3] == 46) info.blockIndex[3] = 44;
|
|
||||||
}
|
|
||||||
if(info.blockIndex[3] == 48){
|
|
||||||
if(info.blockIndex[1] == 30) info.blockIndex[1] = 42;
|
|
||||||
if(info.blockIndex[2] == 45) info.blockIndex[2] = 47;
|
|
||||||
}
|
|
||||||
for(var i=0; i<4; i++){
|
|
||||||
var index = info.blockIndex[i];
|
|
||||||
var dx = x*32 + 16*(i%2), dy = y*32 + 16*(~~(i/2));
|
|
||||||
drawBlockByIndex(ctx, dx, dy, editor.material.images[info.images][info.id], index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
// 绘制地图 start
|
|
||||||
var eventCtx = document.getElementById('event').getContext("2d");
|
|
||||||
for(var y=0; y<13; y++)
|
|
||||||
for(var x=0; x<13; x++){
|
|
||||||
var tileInfo = editor.map[y][x];
|
|
||||||
if(false && isAutotile(tileInfo)){
|
|
||||||
addIndexToAutotileInfo(x, y);
|
|
||||||
drawAutotile(eventCtx, x, y, tileInfo);
|
|
||||||
}else drawTile(eventCtx, x, y, tileInfo);
|
|
||||||
}
|
|
||||||
// 绘制地图 end
|
|
||||||
}
|
|
||||||
|
|
||||||
editor.prototype.listen = function() {
|
|
||||||
|
|
||||||
var uc = eui.getContext('2d');
|
|
||||||
|
|
||||||
function fillPos(pos) {
|
|
||||||
uc.fillStyle = '#' + ~~(Math.random() * 8) + ~~(Math.random() * 8) + ~~(Math.random() * 8);
|
|
||||||
uc.fillRect(pos.x * 32 + 12, pos.y * 32 + 12, 8, 8);
|
|
||||||
}//在格子内画一个随机色块
|
|
||||||
|
|
||||||
function eToLoc(e) {
|
|
||||||
editor.loc = {
|
|
||||||
'x': document.documentElement.scrollLeft+e.clientX - mid.offsetLeft-mapEdit.offsetLeft,
|
|
||||||
'y': document.documentElement.scrollTop+e.clientY - mid.offsetTop-mapEdit.offsetTop,
|
|
||||||
'size': 32
|
|
||||||
};
|
|
||||||
return editor.loc; }//返回可用的组件内坐标
|
|
||||||
|
|
||||||
function locToPos(loc) {
|
|
||||||
editor.pos = { 'x': ~~(loc.x / loc.size), 'y': ~~(loc.y / loc.size) }
|
|
||||||
return editor.pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
var holdingPath = 0;
|
|
||||||
var stepPostfix = null;//用于存放寻路检测的第一个点之后的后续移动
|
|
||||||
|
|
||||||
var mouseOutCheck = 2;
|
|
||||||
function clear1() {
|
|
||||||
if (mouseOutCheck > 1) {
|
|
||||||
mouseOutCheck--;
|
|
||||||
setTimeout(clear1, 1000);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
holdingPath = 0;
|
|
||||||
stepPostfix = [];
|
|
||||||
uc.clearRect(0, 0, 416, 416);
|
|
||||||
}//用于鼠标移出canvas时的自动清除状态
|
|
||||||
|
|
||||||
eui.onmousedown = function (e) {
|
|
||||||
if(!selectBox.isSelected) {
|
|
||||||
tip.whichShow = 1;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
holdingPath = 1;
|
|
||||||
mouseOutCheck = 2;
|
|
||||||
setTimeout(clear1);
|
|
||||||
e.stopPropagation();
|
|
||||||
uc.clearRect(0, 0, 416, 416);
|
|
||||||
var loc = eToLoc(e);
|
|
||||||
var pos = locToPos(loc)
|
|
||||||
stepPostfix = [];
|
|
||||||
stepPostfix.push(pos);
|
|
||||||
fillPos(pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
eui.onmousemove = function (e) {
|
|
||||||
if(!selectBox.isSelected) {
|
|
||||||
// tip.whichShow = 1;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (holdingPath == 0) { return; }
|
|
||||||
mouseOutCheck = 2;
|
|
||||||
e.stopPropagation();
|
|
||||||
var loc = eToLoc(e);
|
|
||||||
var pos = locToPos(loc);
|
|
||||||
var pos0 = stepPostfix[stepPostfix.length - 1]
|
|
||||||
var directionDistance = [pos.y - pos0.y, pos0.x - pos.x, pos0.y - pos.y, pos.x - pos0.x]
|
|
||||||
var max = 0, index = 4;
|
|
||||||
for (var i = 0; i < 4; i++) {
|
|
||||||
if (directionDistance[i] > max) {
|
|
||||||
index = i;
|
|
||||||
max = directionDistance[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var pos = [{ 'x': 0, 'y': 1 }, { 'x': -1, 'y': 0 }, { 'x': 0, 'y': -1 }, { 'x': 1, 'y': 0 }, false][index]
|
|
||||||
if (pos) {
|
|
||||||
pos.x += pos0.x;
|
|
||||||
pos.y += pos0.y;
|
|
||||||
stepPostfix.push(pos);
|
|
||||||
fillPos(pos);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
eui.onmouseup = function (e) {
|
|
||||||
if(!selectBox.isSelected) {
|
|
||||||
tip.whichShow = 1;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
holdingPath = 0;
|
|
||||||
e.stopPropagation();
|
|
||||||
var loc = eToLoc(e);
|
|
||||||
if (stepPostfix.length) {
|
|
||||||
preMapData = JSON.parse(JSON.stringify(editor.map));
|
|
||||||
currDrawData.pos = JSON.parse(JSON.stringify(stepPostfix));
|
|
||||||
currDrawData.info = JSON.parse(JSON.stringify(editor.info));
|
|
||||||
reDo = null;
|
|
||||||
// console.log(stepPostfix);
|
|
||||||
for (var ii = 0; ii < stepPostfix.length; ii++)
|
|
||||||
editor.map[stepPostfix[ii].y][stepPostfix[ii].x] = editor.info;
|
|
||||||
// console.log(editor.map);
|
|
||||||
editor.updateMap();
|
|
||||||
holdingPath = 0;
|
|
||||||
stepPostfix = [];
|
|
||||||
uc.clearRect(0, 0, 416, 416);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var preMapData = {};
|
|
||||||
var currDrawData = {
|
|
||||||
pos: [],
|
|
||||||
info: {}
|
|
||||||
};
|
|
||||||
var reDo = null;
|
|
||||||
document.body.onkeydown = function(e) {
|
|
||||||
// 禁止快捷键的默认行为
|
|
||||||
if( e.ctrlKey && ( e.keyCode == 90 || e.keyCode == 89 ) )
|
|
||||||
e.preventDefault();
|
|
||||||
//Ctrl+z 撤销上一步undo
|
|
||||||
if(e.keyCode == 90 && e.ctrlKey && preMapData && currDrawData.pos.length){
|
|
||||||
editor.map = JSON.parse(JSON.stringify(preMapData));
|
|
||||||
editor.updateMap();
|
|
||||||
reDo = JSON.parse(JSON.stringify(currDrawData));
|
|
||||||
currDrawData = {pos: [],info: {}};
|
|
||||||
preMapData = null;
|
|
||||||
}
|
|
||||||
//Ctrl+y 重做一步redo
|
|
||||||
if(e.keyCode == 89 && e.ctrlKey && reDo && reDo.pos.length){
|
|
||||||
preMapData = JSON.parse(JSON.stringify(editor.map));
|
|
||||||
for(var j=0; j<reDo.pos.length;j++)
|
|
||||||
editor.map[reDo.pos[j].y][reDo.pos[j].x] = JSON.parse(JSON.stringify(reDo.info));
|
|
||||||
|
|
||||||
editor.updateMap();
|
|
||||||
currDrawData = JSON.parse(JSON.stringify(reDo));
|
|
||||||
reDo = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
edata.onmousedown = function (e) {
|
|
||||||
e.stopPropagation();
|
|
||||||
var loc = {
|
|
||||||
'x': document.documentElement.scrollLeft + e.clientX + iconLib.scrollLeft - right.offsetLeft-iconLib.offsetLeft,
|
|
||||||
'y': document.documentElement.scrollTop + e.clientY + iconLib.scrollTop - right.offsetTop-iconLib.offsetTop,
|
|
||||||
'size': 32
|
|
||||||
};
|
|
||||||
editor.loc = loc;
|
|
||||||
var pos = locToPos(loc);
|
|
||||||
for (var spriter in editor.widthsX){
|
|
||||||
if(pos.x>=editor.widthsX[spriter][1] && pos.x<editor.widthsX[spriter][2]){
|
|
||||||
pos.x=editor.widthsX[spriter][1];
|
|
||||||
pos.images = editor.widthsX[spriter][0];
|
|
||||||
var autotiles = editor.material.images['autotile'];
|
|
||||||
if(pos.images=='autotile'){
|
|
||||||
var imNames = Object.keys(autotiles);
|
|
||||||
if((pos.y+1)*32 > editor.widthsX[spriter][3])
|
|
||||||
pos.y = ~~(editor.widthsX[spriter][3]/32)-4;
|
|
||||||
else{
|
|
||||||
for(var i=0; i<imNames.length; i++){
|
|
||||||
if(pos.y >= 4*i && pos.y < 4*(i+1)){
|
|
||||||
pos.images = imNames[i];
|
|
||||||
pos.y = 4*i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else if((pos.y+1)*32 > editor.widthsX[spriter][3])
|
|
||||||
pos.y = ~~(editor.widthsX[spriter][3]/32)-1;
|
|
||||||
|
|
||||||
selectBox.isSelected = true;
|
|
||||||
// console.log(pos,editor.material.images[pos.images].height)
|
|
||||||
dataSelection.style.left = pos.x*32 +'px';
|
|
||||||
dataSelection.style.top = pos.y*32 +'px';
|
|
||||||
|
|
||||||
if(pos.x==0&&pos.y==0){
|
|
||||||
// editor.info={idnum:0, id:'empty','images':'清除块', 'y':0};
|
|
||||||
editor.info=0;
|
|
||||||
}else{
|
|
||||||
if(hasOwnProp(autotiles, pos.images)) editor.info={'images':pos.images, 'y':0};
|
|
||||||
else if(pos.images == 'terrains') editor.info={'images':pos.images, 'y':pos.y-1};
|
|
||||||
else editor.info={'images':pos.images, 'y':pos.y};
|
|
||||||
|
|
||||||
for (var ii=0;ii<editor.ids.length;ii++){
|
|
||||||
if( ( editor.info.images==editor.ids[ii].images
|
|
||||||
&& editor.info.y==editor.ids[ii].y )
|
|
||||||
|| (hasOwnProp(autotiles, pos.images) && editor.info.images==editor.ids[ii].id
|
|
||||||
&& editor.info.y==editor.ids[ii].y)){
|
|
||||||
|
|
||||||
editor.info = editor.ids[ii];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tip.infos = JSON.parse(JSON.stringify(editor.info));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}//绑定事件
|
|
||||||
|
|
||||||
/*
|
|
||||||
editor.updateMap
|
|
||||||
|
|
||||||
editor.loc
|
|
||||||
editor.pos
|
|
||||||
editor.info
|
|
||||||
始终是最后一次点击的结果
|
|
||||||
注意editor.info可能因为点击其他地方而被清空
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
editor = new editor();
|
|
||||||
main.init('editor');
|
|
||||||
editor.changeFloor = function(floorId,callback) {
|
|
||||||
core.changeFloor(floorId, null, core.firstData.hero.loc, null, function(){
|
|
||||||
editor.drawMapBg();
|
|
||||||
var mapArray = core.maps.getMapArray(core.status.maps, core.status.floorId);
|
|
||||||
editor.map = mapArray.map(function(v){return v.map(function(v){return editor.ids[[editor.indexs[v][0]]]})});
|
|
||||||
editor.updateMap();
|
|
||||||
if (core.isset(callback))callback();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//main.listen();
|
|
||||||
var afterMainInit = function(){
|
|
||||||
|
|
||||||
main.editor.disableGlobalAnimate=false;
|
|
||||||
//core.status.maps = core.clone(core.maps.initMaps(floorIds));
|
|
||||||
editor.init(function(){
|
|
||||||
//core.changeFloor('sample1')
|
|
||||||
//editor.drawMapBg()
|
|
||||||
var mapArray = core.maps.getMapArray(core.status.maps, core.status.floorId);
|
|
||||||
editor.map = mapArray.map(function(v){return v.map(function(v){return editor.ids[[editor.indexs[v][0]]]})});
|
|
||||||
editor.updateMap();
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
var startgame = 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(); */
|
|
||||||
afterMainInit();
|
|
||||||
});
|
|
||||||
core.events.setInitData(hard);
|
|
||||||
}
|
|
||||||
setTimeout(startgame, 300);
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
227
editor.html
Normal file
227
editor.html
Normal file
@ -0,0 +1,227 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<link href="_server/css/editor.css" rel="stylesheet">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="main">
|
||||||
|
<div id="left">
|
||||||
|
<div id="arrEditor">
|
||||||
|
<table class="col" id='arrColMark'></table>
|
||||||
|
<table class="row" id='arrRowMark'></table>
|
||||||
|
<div id="editArea" v-cloak>
|
||||||
|
<textarea cols="10" rows="10" id="pout" v-model="mapArr"></textarea>
|
||||||
|
<p class="warnText" v-if="error">{{ errors[error-1] }}</p>
|
||||||
|
</div>
|
||||||
|
<div id="editTip" v-cloak>
|
||||||
|
<input class='btn' type="button" value="复制地图" v-on:click="copyMap"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="objDataEditor">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div id="eventEditor">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div id="mid">
|
||||||
|
<table class="col" id='mapColMark'></table>
|
||||||
|
<table class="row" id='mapRowMark'></table>
|
||||||
|
<div class="map" id="mapEdit">
|
||||||
|
<canvas class='gameCanvas' id='bg' width='416' height='416'></canvas>
|
||||||
|
<canvas class='gameCanvas' id='event' width='416' height='416'></canvas>
|
||||||
|
<canvas class='egameCanvas' id='eui' width='416' height='416' style='z-index:100'></canvas>
|
||||||
|
</div>
|
||||||
|
<div class="tools">
|
||||||
|
<div id="tip" v-cloak >
|
||||||
|
<div v-if="isSelectedBlock" >
|
||||||
|
<p v-if="isClearBlock" class="infoText">当前选择为清除块,可擦除地图上块</p>
|
||||||
|
<div v-else>
|
||||||
|
<p v-if="hasId">图块编号:<span class="infoText">{{ infos['idnum'] }}</span></p>
|
||||||
|
<p v-if="hasId">图块ID:<span class="infoText">{{ infos['id'] }}</span></p>
|
||||||
|
<p v-else class="warnText">该图块无对应的数字或ID存在,请先前往icons.js和maps.js中进行定义!</p>
|
||||||
|
<p>图块所在素材:<span class="infoText">{{ infos['images'] + (isAutotile ? '( '+infos['id']+' )' : '') }}</span></p>
|
||||||
|
<p>图块索引:<span class="infoText">{{ infos['y'] }}</span></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-else>
|
||||||
|
<p v-if="whichShow" v-bind:class="[ (whichShow%2) ? 'warnText' : 'successText']">{{ mapMsg }}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<input class='btn' id='clear' type="button" value="清除地图" v-on:click="clearMap"/>
|
||||||
|
<input class='btn' type="button" value="导出地图" id="exportM" v-on:click="exportMap"/>
|
||||||
|
|
||||||
|
<div id="bgSelect" v-cloak>
|
||||||
|
<span>当前地板: </span>
|
||||||
|
<select v-model="selectedBg">
|
||||||
|
<option disabled value="">请选择地板</option>
|
||||||
|
<option v-for="bg in bgs" v-bind:value="bg">
|
||||||
|
{{ bg }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
<div class="selectpng">
|
||||||
|
<input class='input' id='pin' v-model="imgname" placeholder="请输入自定义背景文件名"/>
|
||||||
|
<input class='btn' type="button" value="确定" v-on:click="updatebg"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="right">
|
||||||
|
<div id="iconLib">
|
||||||
|
<canvas class='egameCanvas' id='edata' width='416' height='416' style='z-index:0'></canvas>
|
||||||
|
<div id="selectBox">
|
||||||
|
<div id='dataSelection' v-show="isSelected" v-cloak></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- <script>/* -->
|
||||||
|
<div id='gameGroup' style='display:none'>
|
||||||
|
<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> -->
|
||||||
|
<script>
|
||||||
|
// 生成定位编号
|
||||||
|
(function(){
|
||||||
|
var colNum = ' ';
|
||||||
|
for(var i=0; i<13; i++){
|
||||||
|
var tpl = '<td>'+i+'<div class="colBlock" style="left:'+(i*32+1)+'px;"></div></td>';
|
||||||
|
colNum += tpl;
|
||||||
|
}
|
||||||
|
arrColMark.innerHTML = '<tr>'+colNum+'</tr>';
|
||||||
|
mapColMark.innerHTML = '<tr>'+colNum+'</tr>';
|
||||||
|
var rowNum = ' ';
|
||||||
|
for(var i=0; i<13; i++){
|
||||||
|
var tpl = '<tr><td>'+i+'<div class="rowBlock" style="top:'+(i*32+1)+'px;"></div></td></tr>';
|
||||||
|
rowNum += tpl;
|
||||||
|
}
|
||||||
|
arrRowMark.innerHTML = rowNum;
|
||||||
|
mapRowMark.innerHTML = rowNum;
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<!-- =========================================================== -->
|
||||||
|
|
||||||
|
<script src='_server/vendor/vue.min.js'></script>
|
||||||
|
<!-- <script src="https://cdn.bootcss.com/vue/2.5.13/vue.js"></script> -->
|
||||||
|
<script src='_server/fs.js'></script>
|
||||||
|
<script src='_server/editor_file.js'></script>
|
||||||
|
<script src='_server/vm.js'></script>
|
||||||
|
<script id='mainScript' src='main.js'></script>
|
||||||
|
<script>
|
||||||
|
//所有全局量
|
||||||
|
__all__=['Vue','fs','editor_file','main','core','hasOwnProp','editor'];
|
||||||
|
__id__=['editArea','arrRowMark','mapRowMark','data','bg','dataSelection'];
|
||||||
|
__Vue__=['exportM','editArea','editTip','clear','tip','selectBox'];
|
||||||
|
//var event = document.getElementById('event');
|
||||||
|
|
||||||
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||||
|
function hasOwnProp (obj, key) {
|
||||||
|
return hasOwnProperty.call(obj, key)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<script src='_server/editor.js'></script>
|
||||||
|
<script>
|
||||||
|
main.init('editor');
|
||||||
|
editor.init();
|
||||||
|
//main.listen();
|
||||||
|
//core.setHeroMoveTriggerInterval();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
47
libs/core.js
47
libs/core.js
@ -79,7 +79,6 @@ function core() {
|
|||||||
'mouseOutCheck': 1,
|
'mouseOutCheck': 1,
|
||||||
'moveStepBeforeStop': [],
|
'moveStepBeforeStop': [],
|
||||||
|
|
||||||
// 勇士状态;中心对称飞行器
|
|
||||||
|
|
||||||
// event事件
|
// event事件
|
||||||
'saveIndex': null,
|
'saveIndex': null,
|
||||||
@ -264,24 +263,15 @@ core.prototype.loader = function (callback) {
|
|||||||
|
|
||||||
// 加载pngs
|
// 加载pngs
|
||||||
core.material.images.pngs = {};
|
core.material.images.pngs = {};
|
||||||
|
if (core.pngs.length==0) {
|
||||||
|
core.loadAutotile(callback);
|
||||||
|
return;
|
||||||
|
}
|
||||||
for (var x=0;x<core.pngs.length;x++) {
|
for (var x=0;x<core.pngs.length;x++) {
|
||||||
core.loadImage(core.pngs[x], function (pngId, image) {
|
core.loadImage(core.pngs[x], function (pngId, image) {
|
||||||
core.material.images.pngs[pngId] = image;
|
core.material.images.pngs[pngId] = image;
|
||||||
if (Object.keys(core.material.images.pngs).length==core.pngs.length) {
|
if (Object.keys(core.material.images.pngs).length==core.pngs.length) {
|
||||||
|
core.loadAutotile(callback);
|
||||||
// 加载Autotile
|
|
||||||
core.material.images.autotile={};
|
|
||||||
var autotileIds = Object.keys(core.material.icons.autotile);
|
|
||||||
for (var x=0;x<autotileIds.length;x++) {
|
|
||||||
core.loadImage(autotileIds[x], function (autotileId, image) {
|
|
||||||
core.material.images.autotile[autotileId]=image;
|
|
||||||
if (Object.keys(core.material.images.autotile).length==autotileIds.length) {
|
|
||||||
|
|
||||||
// 最后加载音频
|
|
||||||
core.loadMusic(callback);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -290,6 +280,26 @@ core.prototype.loader = function (callback) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////// 加载Autotile //////
|
||||||
|
core.prototype.loadAutotile = function (callback) {
|
||||||
|
core.material.images.autotile={};
|
||||||
|
var autotileIds = Object.keys(core.material.icons.autotile);
|
||||||
|
if (autotileIds.length==0) {
|
||||||
|
core.loadMusic(callback);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (var x=0;x<autotileIds.length;x++) {
|
||||||
|
core.loadImage(autotileIds[x], function (autotileId, image) {
|
||||||
|
core.material.images.autotile[autotileId]=image;
|
||||||
|
if (Object.keys(core.material.images.autotile).length==autotileIds.length) {
|
||||||
|
|
||||||
|
// 最后加载音频
|
||||||
|
core.loadMusic(callback);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
////// 加载图片 //////
|
////// 加载图片 //////
|
||||||
core.prototype.loadImage = function (imgName, callback) {
|
core.prototype.loadImage = function (imgName, callback) {
|
||||||
try {
|
try {
|
||||||
@ -2935,6 +2945,9 @@ core.prototype.setItem = function (itemId, itemNum) {
|
|||||||
core.status.hero.items[itemCls] = {};
|
core.status.hero.items[itemCls] = {};
|
||||||
}
|
}
|
||||||
core.status.hero.items[itemCls][itemId] = itemNum;
|
core.status.hero.items[itemCls][itemId] = itemNum;
|
||||||
|
if (itemCls!='keys' && itemNum==0) {
|
||||||
|
delete core.status.hero.items[itemCls][itemId];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 删除某个物品 //////
|
////// 删除某个物品 //////
|
||||||
@ -2942,10 +2955,10 @@ core.prototype.removeItem = function (itemId) {
|
|||||||
if (!core.hasItem(itemId)) return false;
|
if (!core.hasItem(itemId)) return false;
|
||||||
var itemCls = core.material.items[itemId].cls;
|
var itemCls = core.material.items[itemId].cls;
|
||||||
core.status.hero.items[itemCls][itemId]--;
|
core.status.hero.items[itemCls][itemId]--;
|
||||||
core.updateStatusBar();
|
if (itemCls!='keys' && core.status.hero.items[itemCls][itemId]==0) {
|
||||||
if (itemCls=='tools' && core.status.hero.items[itemCls][itemId]==0) {
|
|
||||||
delete core.status.hero.items[itemCls][itemId];
|
delete core.status.hero.items[itemCls][itemId];
|
||||||
}
|
}
|
||||||
|
core.updateStatusBar();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ data.prototype.init = function() {
|
|||||||
this.firstData = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.firstData;
|
this.firstData = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.firstData;
|
||||||
this.values = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.values;
|
this.values = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.values;
|
||||||
this.flags = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.flags;
|
this.flags = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.flags;
|
||||||
delete(data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d);
|
//delete(data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d);
|
||||||
}
|
}
|
||||||
|
|
||||||
data.prototype.getFirstData = function() {
|
data.prototype.getFirstData = function() {
|
||||||
|
|||||||
@ -6,7 +6,7 @@ function enemys() {
|
|||||||
enemys.prototype.init = function () {
|
enemys.prototype.init = function () {
|
||||||
// 怪物属性初始化定义:
|
// 怪物属性初始化定义:
|
||||||
this.enemys = enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80;
|
this.enemys = enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80;
|
||||||
delete(enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80);
|
//delete(enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80);
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 获得一个或所有怪物数据 //////
|
////// 获得一个或所有怪物数据 //////
|
||||||
@ -67,7 +67,7 @@ enemys.prototype.getSpecialHint = function (enemy, special) {
|
|||||||
|
|
||||||
switch (special) {
|
switch (special) {
|
||||||
case 1: return "先攻:怪物首先攻击";
|
case 1: return "先攻:怪物首先攻击";
|
||||||
case 2: return "魔攻:怪物无视勇士的魔防";
|
case 2: return "魔攻:怪物无视勇士的防御";
|
||||||
case 3: return "坚固:勇士每回合最多只能对怪物造成1点伤害";
|
case 3: return "坚固:勇士每回合最多只能对怪物造成1点伤害";
|
||||||
case 4: return "2连击:怪物每回合攻击2次";
|
case 4: return "2连击:怪物每回合攻击2次";
|
||||||
case 5: return "3连击:怪物每回合攻击3次";
|
case 5: return "3连击:怪物每回合攻击3次";
|
||||||
|
|||||||
@ -4,7 +4,7 @@ function icons() {
|
|||||||
|
|
||||||
icons.prototype.init = function () {
|
icons.prototype.init = function () {
|
||||||
this.icons = icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1;
|
this.icons = icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1;
|
||||||
delete(icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1);
|
//delete(icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1);
|
||||||
}
|
}
|
||||||
|
|
||||||
icons.prototype.getIcons = function () {
|
icons.prototype.getIcons = function () {
|
||||||
|
|||||||
@ -7,7 +7,7 @@ items.prototype.init = function () {
|
|||||||
this.items = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.items;
|
this.items = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.items;
|
||||||
this.itemEffect = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.itemEffect;
|
this.itemEffect = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.itemEffect;
|
||||||
this.itemEffectTip = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.itemEffectTip;
|
this.itemEffectTip = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.itemEffectTip;
|
||||||
delete(items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a);
|
//delete(items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a);
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 获得所有道具 //////
|
////// 获得所有道具 //////
|
||||||
@ -86,9 +86,11 @@ items.prototype.useItem = function (itemId) {
|
|||||||
if (itemId == 'curseWine') core.setFlag('curse', false);
|
if (itemId == 'curseWine') core.setFlag('curse', false);
|
||||||
if (itemId == 'superWine') {
|
if (itemId == 'superWine') {
|
||||||
core.setFlag('poison', false);
|
core.setFlag('poison', false);
|
||||||
core.setFlag('weak', false);
|
if (core.hasFlag('weak')) {
|
||||||
core.status.hero.atk += core.values.weakValue;
|
core.setFlag('weak', false);
|
||||||
core.status.hero.def += core.values.weakValue;
|
core.status.hero.atk += core.values.weakValue;
|
||||||
|
core.status.hero.def += core.values.weakValue;
|
||||||
|
}
|
||||||
core.setFlag('curse', false);
|
core.setFlag('curse', false);
|
||||||
}
|
}
|
||||||
core.updateStatusBar();
|
core.updateStatusBar();
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
function maps() {}
|
function maps() {}
|
||||||
maps.prototype.init = function() {
|
maps.prototype.init = function() {
|
||||||
this.blocksInfo = maps_90f36752_8815_4be8_b32b_d7fad1d0542e;
|
this.blocksInfo = maps_90f36752_8815_4be8_b32b_d7fad1d0542e;
|
||||||
delete(maps_90f36752_8815_4be8_b32b_d7fad1d0542e);
|
//delete(maps_90f36752_8815_4be8_b32b_d7fad1d0542e);
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 加载某个楼层(从剧本或存档中) //////
|
////// 加载某个楼层(从剧本或存档中) //////
|
||||||
|
|||||||
79
project/comment.js
Normal file
79
project/comment.js
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
|
||||||
|
{
|
||||||
|
"items" : {
|
||||||
|
'items':{
|
||||||
|
'cls': "只能取keys(钥匙) items(宝石、血瓶) constants(物品) tools(道具)\n$range(thiseval in ['keys','items','constants','tools'])$end",
|
||||||
|
'name': '名称',
|
||||||
|
'text': '道具在道具栏中显示的描述'
|
||||||
|
},
|
||||||
|
'itemEffect':'cls为items的即捡即用类物品的效果,执行时会对这里的字符串执行eval()',
|
||||||
|
'itemEffectTip':'cls为items的即捡即用类物品,在获得时左上角额外显示的文字,执行时会对这里的字符串执行eval()得到字符串'
|
||||||
|
},
|
||||||
|
"enemys" : {
|
||||||
|
'name': '名称',
|
||||||
|
'hp': '生命值',
|
||||||
|
'atk': '攻击力',
|
||||||
|
'def': '防御力',
|
||||||
|
'money': '金币',
|
||||||
|
'experience': '经验',
|
||||||
|
'special': '特殊属性\n0:无,1:先攻,2:魔攻,3:坚固,4:2连击,5:3连击,6:n连击,7:破甲,8:反击,9:净化,10:模仿,11:吸血,12:中毒,13:衰弱,14:诅咒,15:领域,16:夹击,17:仇恨,18:阻击,19:自爆,20:无敌\n多个属性例如用[1,4,11]表示先攻2连击吸血\n模仿怪的攻防设为0就好\n$leaf(true)$end',
|
||||||
|
'value': '特殊属性的数值\n领域怪需要加value表示领域伤害的数值\n吸血怪需要在后面添加value代表吸血比例',
|
||||||
|
'zoneSquare': '领域怪zoneSquare代表是否九宫格伤害',
|
||||||
|
'range': 'range可选,代表领域伤害的范围;不加默认为1\n$range(thiseval==~~thiseval &&thiseval>0)$end',
|
||||||
|
'bomb':' 加入 "bomb": false 代表该怪物不可被炸弹或圣锤炸掉\n$range(thiseval in [true,false])$end',
|
||||||
|
'point': 'point可以在打败怪物后进行加点,详见文档说明\n$range(thiseval==~~thiseval && thiseval>0)$end',
|
||||||
|
'n': '多连击需要在后面指定n代表是几连击\n$range(thiseval==~~thiseval &&thiseval>0)$end',
|
||||||
|
},
|
||||||
|
"floors" : {
|
||||||
|
'floor' : {
|
||||||
|
"floorId": "文件名和floorId需要保持完全一致 \n楼层唯一标识符仅能由字母、数字、下划线组成,且不能由数字开头 \n推荐用法:第20层就用MT20,第38层就用MT38,地下6层就用MT_6(用下划线代替负号),隐藏3层用MT3h(h表示隐藏),等等 \n楼层唯一标识符,需要和名字完全一致 \n这里不能更改floorId,请通过另存为来实现\n$range(false)$end",
|
||||||
|
"title": "楼层中文名 ",
|
||||||
|
"name": "显示在状态栏中的层数 ",
|
||||||
|
"canFlyTo": "该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器) \n$range(thiseval in [true,false])$end",
|
||||||
|
"canUseQuickShop": "该层是否允许使用快捷商店 \n$range(thiseval in [true,false])$end",
|
||||||
|
"defaultGround": "默认地面的图块ID(terrains中) ",
|
||||||
|
"png": "背景图;你可以选择一张png图片来作为背景素材。详细用法请参见文档“自定义素材”中的说明。 ",
|
||||||
|
"color": "该层的默认画面色调。本项可不写(代表无色调),如果写需要是一个RGBA数组。 \n$leaf(true)$end",
|
||||||
|
"bgm": "到达该层后默认播放的BGM。本项可忽略。 ",
|
||||||
|
//"map": "地图数据,需要是13x13,建议使用地图生成器来生成 ",
|
||||||
|
"firstArrive": "第一次到该楼层触发的事件 \n$leaf(true)$end",
|
||||||
|
},
|
||||||
|
'loc' : {
|
||||||
|
"events": "该楼的所有可能事件列表 \n$leaf(true)$end",
|
||||||
|
"changeFloor": "楼层转换事件;该事件不能和上面的events有冲突(同位置点),否则会被覆盖 \n$leaf(true)$end",
|
||||||
|
"afterBattle": "战斗后可能触发的事件列表 \n$leaf(true)$end",
|
||||||
|
"afterGetItem": "获得道具后可能触发的事件列表 \n$leaf(true)$end",
|
||||||
|
"afterOpenDoor": "开完门后可能触发的事件列表 \n$leaf(true)$end"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/*
|
||||||
|
'template' : {
|
||||||
|
"floorId": "tempfloor",
|
||||||
|
"title": "主塔 0 层",
|
||||||
|
"name": "0",
|
||||||
|
"canFlyTo": true,
|
||||||
|
"canUseQuickShop": true,
|
||||||
|
"defaultGround": "ground",
|
||||||
|
"map": [
|
||||||
|
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
|
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
|
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
|
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
|
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
|
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
|
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
|
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
|
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
|
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
|
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
|
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
|
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||||
|
],
|
||||||
|
"firstArrive": [],
|
||||||
|
"events": {},
|
||||||
|
"changeFloor": {},
|
||||||
|
"afterBattle": {},
|
||||||
|
"afterGetItem": {},
|
||||||
|
"afterOpenDoor": {}
|
||||||
|
}, */
|
||||||
|
}
|
||||||
165
project/data.comment.js
Normal file
165
project/data.comment.js
Normal file
@ -0,0 +1,165 @@
|
|||||||
|
data_comment_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||||
|
{
|
||||||
|
"main": {
|
||||||
|
"useCompress": " 是否使用压缩文件 \n 当你即将发布你的塔时,请使用“JS代码压缩工具”将所有js代码进行压缩,然后将这里的useCompress改为true。 \n 请注意,只有useCompress是false时才会读取floors目录下的文件,为true时会直接读取libs目录下的floors.min.js文件。 \n 如果要进行剧本的修改请务必将其改成false。 ",
|
||||||
|
"floorIds": " 在这里按顺序放所有的楼层;其顺序直接影响到楼层传送器的顺序和上楼器/下楼器的顺序 \n$leaf(true)$end",
|
||||||
|
"pngs": " 在此存放所有可能的背景图片;背景图片最好是416*416像素,其他分辨率会被强制缩放成416*416 \n 建议对于较大的图片,在网上使用在线的“图片压缩工具”来进行压缩,以节省流量 \n 有关使用自定义背景图,请参见文档的“自定义素材”说明 \n\n 依次向后添加 \n$leaf(true)$end",
|
||||||
|
"bgms": " 在此存放所有的bgm,和文件名一致。第一项为默认播放项 \n 音频名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好 \n$leaf(true)$end",
|
||||||
|
"sounds": " 在此存放所有的SE,和文件名一致 \n 音频名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好 \n$leaf(true)$end"
|
||||||
|
},
|
||||||
|
"firstData": {
|
||||||
|
"title": " 游戏名,将显示在标题页面以及切换楼层的界面中 ",
|
||||||
|
"name": " 游戏的唯一英文标识符。由英文、数字、下划线组成,不能超过20个字符。 ",
|
||||||
|
"version": " 当前游戏版本;版本不一致的存档不能通用。 ",
|
||||||
|
"floorId": " 初始楼层ID ",
|
||||||
|
"hero": {
|
||||||
|
"name": " 勇士初始数据 \n 勇士名;可以改成喜欢的 ",
|
||||||
|
"lv": " 初始等级,该项必须为正整数 ",
|
||||||
|
"hp": " 初始生命值 ",
|
||||||
|
"atk": " 初始攻击 ",
|
||||||
|
"def": " 初始防御 ",
|
||||||
|
"mdef": " 初始魔防 ",
|
||||||
|
"money": " 初始金币 ",
|
||||||
|
"experience": " 初始经验 ",
|
||||||
|
"items": {
|
||||||
|
"keys": {
|
||||||
|
"yellowKey": " 初始道具个数 ",
|
||||||
|
"blueKey": "",
|
||||||
|
"redKey": ""
|
||||||
|
},
|
||||||
|
"constants": "\n$leaf(true)$end",
|
||||||
|
"tools": "\n$leaf(true)$end"
|
||||||
|
},
|
||||||
|
"flyRange": " 初始可飞的楼层;一般留空数组即可 \n$leaf(true)$end",
|
||||||
|
"loc": {
|
||||||
|
"direction": " 勇士初始位置 ",
|
||||||
|
"x": "",
|
||||||
|
"y": ""
|
||||||
|
},
|
||||||
|
"flags": {
|
||||||
|
"poison": " 游戏过程中的变量或flags \n 毒 ",
|
||||||
|
"weak": " 衰 ",
|
||||||
|
"curse": " 咒 "
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"startText": " 游戏开始前剧情。如果无剧情直接留一个空数组即可。 \n$leaf(true)$end",
|
||||||
|
"shops": {
|
||||||
|
"moneyShop1": {
|
||||||
|
"name": " 定义全局商店(即快捷商店) \n 商店唯一ID \n 商店名称(标题) ",
|
||||||
|
"icon": " 商店图标,blueShop为蓝色商店,pinkShop为粉色商店 ",
|
||||||
|
"textInList": " 在快捷商店栏中显示的名称 ",
|
||||||
|
"use": " 商店所要使用的。只能是\"money\"或\"experience\"。 ",
|
||||||
|
"need": " 商店需要的金币/经验数值;可以是一个表达式,以times作为参数计算。 \n 这里用到的times为该商店的已经的访问次数。首次访问该商店时times的值为0。 \n 上面的例子是50层商店的计算公式。你也可以写任意其他的计算公式,只要以times作为参数即可。 \n 例如: \"need\": \"25\" 就是恒定需要25金币的商店; \"need\": \"20+2*times\" 就是第一次访问要20金币,以后每次递增2金币的商店。 \n 如果是对于每个选项有不同的计算公式,写 \"need\": \"-1\" 即可。可参见下面的经验商店。 ",
|
||||||
|
"text": " 显示的文字,需手动加换行符。可以使用${need}表示上面的need值。 ",
|
||||||
|
"choices": [
|
||||||
|
{
|
||||||
|
"text": "",
|
||||||
|
"effect": " 商店的选项 \n 如果有多个effect以分号分开,参见下面的经验商店 "
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "",
|
||||||
|
"effect": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "",
|
||||||
|
"effect": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "",
|
||||||
|
"effect": " effect只能对status和item进行操作,不能修改flag值。 \n 必须是X+=Y的形式,其中Y可以是一个表达式,以status:xxx或item:xxx为参数 \n 其他effect样例: \n \"item:yellowKey+=1\" 黄钥匙+1 \n \"item:pickaxe+=3\" 破墙镐+3 \n \"status:hp+=2*(status:atk+status:def)\" 将生命提升攻防和的数值的两倍 "
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"expShop1": {
|
||||||
|
"name": " 商店唯一ID ",
|
||||||
|
"icon": "",
|
||||||
|
"textInList": "",
|
||||||
|
"use": " 该商店使用的是经验进行计算 ",
|
||||||
|
"need": " 如果是对于每个选项所需要的数值不同,这里直接写-1,然后下面选项里给定具体数值 ",
|
||||||
|
"text": "",
|
||||||
|
"choices": [
|
||||||
|
{
|
||||||
|
"text": "",
|
||||||
|
"need": "",
|
||||||
|
"effect": " 在choices中写need,可以针对每个选项都有不同的需求。 \n 这里的need同样可以以times作为参数,比如 \"need\": \"100+20*times\" 多个effect直接以分号分开即可。如上面的意思是生命+1000,攻击+7,防御+7。 "
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "",
|
||||||
|
"need": "",
|
||||||
|
"effect": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "",
|
||||||
|
"need": "",
|
||||||
|
"effect": ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"levelUp": [
|
||||||
|
" 经验升级所需要的数值,是一个数组 \n 第一项为初始等级,可以简单留空,也可以写name \n 每一个里面可以含有三个参数 need, name, effect \n need为所需要的经验数值,是一个正整数。请确保need所需的依次递增 \n name为该等级的名称,也可以省略代表使用系统默认值;本项将显示在状态栏中 \n effect为本次升级所执行的操作,可由若干项组成,由分号分开 \n 其中每一项写法和上面的商店完全相同,同样必须是X+=Y的形式,Y是一个表达式,同样可以使用status:xxx或item:xxx代表勇士的某项数值/道具个数 \n$leaf(true)$end",
|
||||||
|
{
|
||||||
|
"need": "",
|
||||||
|
"name": "",
|
||||||
|
"effect": " 先将生命提升攻防和的2倍;再将攻击+10,防御+10 "
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"need": "",
|
||||||
|
"effect": " effect也允许写一个function,代表本次升级将会执行的操作 \n 依次往下写需要的数值即可 "
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"values": {
|
||||||
|
"HPMAX": " 各种数值;一些数值可以在这里设置\n /****** 角色相关 ******/ \n HP上限;-1则无上限 ",
|
||||||
|
"lavaDamage": " 经过血网受到的伤害 ",
|
||||||
|
"poisonDamage": " 中毒后每步受到的伤害 ",
|
||||||
|
"weakValue": " 衰弱状态下攻防减少的数值 ",
|
||||||
|
"redJewel": " /****** 道具相关 ******/ \n 红宝石加攻击的数值 ",
|
||||||
|
"blueJewel": " 蓝宝石加防御的数值 ",
|
||||||
|
"greenJewel": " 绿宝石加魔防的数值 ",
|
||||||
|
"redPotion": " 红血瓶加血数值 ",
|
||||||
|
"bluePotion": " 蓝血瓶加血数值 ",
|
||||||
|
"yellowPotion": " 黄血瓶加血数值 ",
|
||||||
|
"greenPotion": " 绿血瓶加血数值 ",
|
||||||
|
"sword1": " 铁剑加攻数值 ",
|
||||||
|
"shield1": " 铁盾加防数值 ",
|
||||||
|
"sword2": " 银剑加攻数值 ",
|
||||||
|
"shield2": " 银盾加防数值 ",
|
||||||
|
"sword3": " 骑士剑加攻数值 ",
|
||||||
|
"shield3": " 骑士盾加防数值 ",
|
||||||
|
"sword4": " 圣剑加攻数值 ",
|
||||||
|
"shield4": " 圣盾加防数值 ",
|
||||||
|
"sword5": " 神圣剑加攻数值 ",
|
||||||
|
"shield5": " 神圣盾加防数值 ",
|
||||||
|
"moneyPocket": " 金钱袋加金币的数值 ",
|
||||||
|
"breakArmor": " /****** 怪物相关 ******/ \n 破甲的比例(战斗前,怪物附加角色防御的x%作为伤害) ",
|
||||||
|
"counterAttack": " 反击的比例(战斗时,怪物每回合附加角色攻击的x%作为伤害,无视角色防御) ",
|
||||||
|
"purify": " 净化的比例(战斗前,怪物附加勇士魔防的x倍作为伤害) ",
|
||||||
|
"hatred": " 仇恨属性中,每杀死一个怪物获得的仇恨值 ",
|
||||||
|
"animateSpeed": " /****** 系统相关 ******/ \n 动画时间 "
|
||||||
|
},
|
||||||
|
"flags": {
|
||||||
|
"enableFloor": " 系统FLAG,在游戏运行中中请不要修改它。 /****** 状态栏相关 ******/ \n 是否在状态栏显示当前楼层 ",
|
||||||
|
"enableLv": " 是否在状态栏显示当前等级 ",
|
||||||
|
"enableMDef": " 是否在状态栏及战斗界面显示魔防(护盾) ",
|
||||||
|
"enableMoney": " 是否在状态栏、怪物手册及战斗界面显示金币 ",
|
||||||
|
"enableExperience": " 是否在状态栏、怪物手册及战斗界面显示经验 ",
|
||||||
|
"enableLevelUp": " 是否允许等级提升(进阶);如果上面enableExperience为false,则此项恒视为false ",
|
||||||
|
"enableDebuff": " 是否涉及毒衰咒;如果此项为false则不会在状态栏中显示毒衰咒的debuff ////// 上述的几个开关将直接影响状态栏的显示效果 ////// ",
|
||||||
|
"flyNearStair": " /****** 道具相关 ******/ \n 是否需要在楼梯边使用传送器 ",
|
||||||
|
"pickaxeFourDirections": " 使用破墙镐是否四个方向都破坏;如果false则只破坏面前的墙壁 ",
|
||||||
|
"bombFourDirections": " 使用炸弹是否四个方向都会炸;如果false则只炸面前的怪物(即和圣锤等价) ",
|
||||||
|
"bigKeyIsBox": " 如果此项为true,则视为钥匙盒,红黄蓝钥匙+1;若为false,则视为大黄门钥匙 ",
|
||||||
|
"enableNegativeDamage": " /****** 怪物相关 ******/ \n 是否支持负伤害(回血) ",
|
||||||
|
"zoneSquare": " 领域类型。如果此项为true则为九宫格伤害,为false则为十字伤害 ",
|
||||||
|
"startDirectly": " /****** 系统相关 ******/ \n 点击“开始游戏”后是否立刻开始游戏而不显示难度选择界面 ",
|
||||||
|
"canOpenBattleAnimate": " 是否允许用户开启战斗过程;如果此项为false,则下面两项均强制视为false ",
|
||||||
|
"showBattleAnimateConfirm": " 是否在游戏开始时提供“是否开启战斗动画”的选项 ",
|
||||||
|
"battleAnimate": " 是否默认显示战斗动画;用户可以手动在菜单栏中开关 ",
|
||||||
|
"displayEnemyDamage": " 是否地图怪物显伤;用户可以手动在菜单栏中开关 ",
|
||||||
|
"displayExtraDamage": " 是否地图高级显伤(领域、夹击等);用户可以手动在菜单栏中开关 ",
|
||||||
|
"enableGentleClick": " 是否允许轻触(获得面前物品) ",
|
||||||
|
"portalWithoutTrigger": " 经过楼梯、传送门时是否能“穿透”。穿透的意思是,自动寻路得到的的路径中间经过了楼梯,行走时是否触发楼层转换事件 ",
|
||||||
|
"potionWhileRouting": " 寻路算法是否经过血瓶;如果该项为false,则寻路算法会自动尽量绕过血瓶 "
|
||||||
|
}
|
||||||
|
}
|
||||||
109
project/data.js
109
project/data.js
@ -6,21 +6,24 @@ data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
|||||||
// 请注意,只有useCompress是false时才会读取floors目录下的文件,为true时会直接读取libs目录下的floors.min.js文件。
|
// 请注意,只有useCompress是false时才会读取floors目录下的文件,为true时会直接读取libs目录下的floors.min.js文件。
|
||||||
// 如果要进行剧本的修改请务必将其改成false。
|
// 如果要进行剧本的修改请务必将其改成false。
|
||||||
|
|
||||||
"floorIds" : [ // 在这里按顺序放所有的楼层;其顺序直接影响到楼层传送器的顺序和上楼器/下楼器的顺序
|
"floorIds" : [
|
||||||
"sample0", "sample1", "sample2"
|
"sample0", "sample1", "sample2"
|
||||||
],
|
],// 在这里按顺序放所有的楼层;其顺序直接影响到楼层传送器的顺序和上楼器/下楼器的顺序
|
||||||
"pngs" : [ // 在此存放所有可能的背景图片;背景图片最好是416*416像素,其他分辨率会被强制缩放成416*416
|
"pngs" : [
|
||||||
|
"bg.png", "yewai.png", // 在此存放所有可能的背景图片;背景图片最好是416*416像素,其他分辨率会被强制缩放成416*416
|
||||||
// 建议对于较大的图片,在网上使用在线的“图片压缩工具”来进行压缩,以节省流量
|
// 建议对于较大的图片,在网上使用在线的“图片压缩工具”来进行压缩,以节省流量
|
||||||
// 有关使用自定义背景图,请参见文档的“自定义素材”说明
|
// 有关使用自定义背景图,请参见文档的“自定义素材”说明
|
||||||
"bg.png", "yewai.png", // 依次向后添加
|
// 依次向后添加
|
||||||
],
|
],
|
||||||
"bgms" : [ // 在此存放所有的bgm,和文件名一致。第一项为默认播放项
|
"bgms" : [
|
||||||
// 音频名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好
|
|
||||||
'058-Slow01.mid', 'bgm.mp3', 'qianjin.mid', 'star.mid',
|
'058-Slow01.mid', 'bgm.mp3', 'qianjin.mid', 'star.mid',
|
||||||
],
|
// 在此存放所有的bgm,和文件名一致。第一项为默认播放项
|
||||||
"sounds" : [ // 在此存放所有的SE,和文件名一致
|
|
||||||
// 音频名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好
|
// 音频名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好
|
||||||
|
],
|
||||||
|
"sounds" : [
|
||||||
'floor.mp3', 'attack.ogg', 'door.ogg', 'item.ogg',
|
'floor.mp3', 'attack.ogg', 'door.ogg', 'item.ogg',
|
||||||
|
// 在此存放所有的SE,和文件名一致
|
||||||
|
// 音频名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"firstData" : {
|
"firstData" : {
|
||||||
@ -28,8 +31,9 @@ data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
|||||||
"name": "template", // 游戏的唯一英文标识符。由英文、数字、下划线组成,不能超过20个字符。
|
"name": "template", // 游戏的唯一英文标识符。由英文、数字、下划线组成,不能超过20个字符。
|
||||||
"version": "Ver 1.0.0 (Beta)", // 当前游戏版本;版本不一致的存档不能通用。
|
"version": "Ver 1.0.0 (Beta)", // 当前游戏版本;版本不一致的存档不能通用。
|
||||||
"floorId": "sample0", // 初始楼层ID
|
"floorId": "sample0", // 初始楼层ID
|
||||||
"hero": { // 勇士初始数据
|
"hero": {
|
||||||
"name": "阳光", // 勇士名;可以改成喜欢的
|
"name": "阳光", // 勇士初始数据
|
||||||
|
// 勇士名;可以改成喜欢的
|
||||||
'lv': 1, // 初始等级,该项必须为正整数
|
'lv': 1, // 初始等级,该项必须为正整数
|
||||||
"hp": 1000, // 初始生命值
|
"hp": 1000, // 初始生命值
|
||||||
"atk": 100, // 初始攻击
|
"atk": 100, // 初始攻击
|
||||||
@ -37,7 +41,7 @@ data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
|||||||
"mdef": 100, // 初始魔防
|
"mdef": 100, // 初始魔防
|
||||||
"money": 100, // 初始金币
|
"money": 100, // 初始金币
|
||||||
"experience": 0, // 初始经验
|
"experience": 0, // 初始经验
|
||||||
"items": { // 初始道具个数
|
"items": {
|
||||||
"keys": {
|
"keys": {
|
||||||
"yellowKey": 0,
|
"yellowKey": 0,
|
||||||
"blueKey": 0,
|
"blueKey": 0,
|
||||||
@ -45,23 +49,26 @@ data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
|||||||
},
|
},
|
||||||
"constants": {},
|
"constants": {},
|
||||||
"tools": {}
|
"tools": {}
|
||||||
},
|
},// 初始道具个数
|
||||||
"flyRange": [], // 初始可飞的楼层;一般留空数组即可
|
"flyRange": [], // 初始可飞的楼层;一般留空数组即可
|
||||||
"loc": {"direction": "up", "x": 6, "y": 10}, // 勇士初始位置
|
"loc": {"direction": "up", "x": 6, "y": 10}, // 勇士初始位置
|
||||||
"flags": { // 游戏过程中的变量或flags
|
"flags": {
|
||||||
"poison": false, // 毒
|
"poison": false, // 游戏过程中的变量或flags
|
||||||
|
// 毒
|
||||||
"weak": false, // 衰
|
"weak": false, // 衰
|
||||||
"curse": false, // 咒
|
"curse": false, // 咒
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"startText": [ // 游戏开始前剧情。如果无剧情直接留一个空数组即可。
|
"startText": [
|
||||||
"Hi,欢迎来到 HTML5 魔塔样板!\n\n本样板由艾之葵制作,可以让你在不会写任何代码\n的情况下也能做出属于自己的H5魔塔!",
|
"Hi,欢迎来到 HTML5 魔塔样板!\n\n本样板由艾之葵制作,可以让你在不会写任何代码\n的情况下也能做出属于自己的H5魔塔!",
|
||||||
"这里游戏开始时的剧情。\n定义在data.js的startText处。\n\n你可以在这里写上自己的内容。",
|
"这里游戏开始时的剧情。\n定义在data.js的startText处。\n\n你可以在这里写上自己的内容。",
|
||||||
"赶快来试一试吧!"
|
"赶快来试一试吧!"
|
||||||
],
|
], // 游戏开始前剧情。如果无剧情直接留一个空数组即可。
|
||||||
"shops": { // 定义全局商店(即快捷商店)
|
"shops": {
|
||||||
"moneyShop1": { // 商店唯一ID
|
"moneyShop1": {
|
||||||
"name": "贪婪之神", // 商店名称(标题)
|
"name": "贪婪之神", // 定义全局商店(即快捷商店)
|
||||||
|
// 商店唯一ID
|
||||||
|
// 商店名称(标题)
|
||||||
"icon": "blueShop", // 商店图标,blueShop为蓝色商店,pinkShop为粉色商店
|
"icon": "blueShop", // 商店图标,blueShop为蓝色商店,pinkShop为粉色商店
|
||||||
"textInList": "1F金币商店", // 在快捷商店栏中显示的名称
|
"textInList": "1F金币商店", // 在快捷商店栏中显示的名称
|
||||||
"use": "money", // 商店所要使用的。只能是"money"或"experience"。
|
"use": "money", // 商店所要使用的。只能是"money"或"experience"。
|
||||||
@ -71,8 +78,8 @@ data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
|||||||
// 例如: "need": "25" 就是恒定需要25金币的商店; "need": "20+2*times" 就是第一次访问要20金币,以后每次递增2金币的商店。
|
// 例如: "need": "25" 就是恒定需要25金币的商店; "need": "20+2*times" 就是第一次访问要20金币,以后每次递增2金币的商店。
|
||||||
// 如果是对于每个选项有不同的计算公式,写 "need": "-1" 即可。可参见下面的经验商店。
|
// 如果是对于每个选项有不同的计算公式,写 "need": "-1" 即可。可参见下面的经验商店。
|
||||||
"text": "勇敢的武士啊,给我${need}金币就可以:", // 显示的文字,需手动加换行符。可以使用${need}表示上面的need值。
|
"text": "勇敢的武士啊,给我${need}金币就可以:", // 显示的文字,需手动加换行符。可以使用${need}表示上面的need值。
|
||||||
"choices": [ // 商店的选项
|
"choices": [
|
||||||
{"text": "生命+800", "effect": "status:hp+=800"},
|
{"text": "生命+800", "effect": "status:hp+=800"}, // 商店的选项
|
||||||
// 如果有多个effect以分号分开,参见下面的经验商店
|
// 如果有多个effect以分号分开,参见下面的经验商店
|
||||||
{"text": "攻击+4", "effect": "status:atk+=4"},
|
{"text": "攻击+4", "effect": "status:atk+=4"},
|
||||||
{"text": "防御+4", "effect": "status:def+=4"},
|
{"text": "防御+4", "effect": "status:def+=4"},
|
||||||
@ -85,25 +92,27 @@ data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
|||||||
// "status:hp+=2*(status:atk+status:def)" 将生命提升攻防和的数值的两倍
|
// "status:hp+=2*(status:atk+status:def)" 将生命提升攻防和的数值的两倍
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"expShop1": { // 商店唯一ID
|
"expShop1": {
|
||||||
"name": "经验之神",
|
"name": "经验之神", // 商店唯一ID
|
||||||
"icon": "pinkShop",
|
"icon": "pinkShop",
|
||||||
"textInList": "1F经验商店",
|
"textInList": "1F经验商店",
|
||||||
"use": "experience", // 该商店使用的是经验进行计算
|
"use": "experience", // 该商店使用的是经验进行计算
|
||||||
"need": "-1", // 如果是对于每个选项所需要的数值不同,这里直接写-1,然后下面选项里给定具体数值
|
"need": "-1", // 如果是对于每个选项所需要的数值不同,这里直接写-1,然后下面选项里给定具体数值
|
||||||
"text": "勇敢的武士啊,给我若干经验就可以:",
|
"text": "勇敢的武士啊,给我若干经验就可以:",
|
||||||
"choices": [
|
"choices": [
|
||||||
|
{"text": "等级+1", "need": "100", "effect": "status:lv+=1;status:hp+=1000;status:atk+=7;status:def+=7"},
|
||||||
// 在choices中写need,可以针对每个选项都有不同的需求。
|
// 在choices中写need,可以针对每个选项都有不同的需求。
|
||||||
// 这里的need同样可以以times作为参数,比如 "need": "100+20*times"
|
// 这里的need同样可以以times作为参数,比如 "need": "100+20*times"
|
||||||
{"text": "等级+1", "need": "100", "effect": "status:lv+=1;status:hp+=1000;status:atk+=7;status:def+=7"},
|
|
||||||
// 多个effect直接以分号分开即可。如上面的意思是生命+1000,攻击+7,防御+7。
|
// 多个effect直接以分号分开即可。如上面的意思是生命+1000,攻击+7,防御+7。
|
||||||
{"text": "攻击+5", "need": "30", "effect": "status:atk+=5"},
|
{"text": "攻击+5", "need": "30", "effect": "status:atk+=5"},
|
||||||
{"text": "防御+5", "need": "30", "effect": "status:def+=5"},
|
{"text": "防御+5", "need": "30", "effect": "status:def+=5"},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"levelUp": [ // 经验升级所需要的数值,是一个数组
|
"levelUp": [
|
||||||
{}, // 第一项为初始等级,可以简单留空,也可以写name
|
{}, // 经验升级所需要的数值,是一个数组
|
||||||
|
// 第一项为初始等级,可以简单留空,也可以写name
|
||||||
|
|
||||||
// 每一个里面可以含有三个参数 need, name, effect
|
// 每一个里面可以含有三个参数 need, name, effect
|
||||||
// need为所需要的经验数值,是一个正整数。请确保need所需的依次递增
|
// need为所需要的经验数值,是一个正整数。请确保need所需的依次递增
|
||||||
@ -112,26 +121,29 @@ data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
|||||||
// 其中每一项写法和上面的商店完全相同,同样必须是X+=Y的形式,Y是一个表达式,同样可以使用status:xxx或item:xxx代表勇士的某项数值/道具个数
|
// 其中每一项写法和上面的商店完全相同,同样必须是X+=Y的形式,Y是一个表达式,同样可以使用status:xxx或item:xxx代表勇士的某项数值/道具个数
|
||||||
{"need": 20, "name": "第二级", "effect": "status:hp+=2*(status:atk+status:def);status:atk+=10;status:def+=10"}, // 先将生命提升攻防和的2倍;再将攻击+10,防御+10
|
{"need": 20, "name": "第二级", "effect": "status:hp+=2*(status:atk+status:def);status:atk+=10;status:def+=10"}, // 先将生命提升攻防和的2倍;再将攻击+10,防御+10
|
||||||
|
|
||||||
// effect也允许写一个function,代表本次升级将会执行的操作
|
|
||||||
{"need": 40, "effect": function () {
|
{"need": 40, "effect": `function () {
|
||||||
core.drawText("恭喜升级!");
|
core.drawText("恭喜升级!");
|
||||||
core.status.hero.hp *= 2;
|
core.status.hero.hp *= 2;
|
||||||
core.status.hero.atk += 100;
|
core.status.hero.atk += 100;
|
||||||
core.status.hero.def += 100;
|
core.status.hero.def += 100;
|
||||||
}},
|
}`}, // effect也允许写一个function,代表本次升级将会执行的操作
|
||||||
|
|
||||||
// 依次往下写需要的数值即可
|
// 依次往下写需要的数值即可
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
// 各种数值;一些数值可以在这里设置
|
|
||||||
"values" : {
|
"values" : {
|
||||||
|
|
||||||
|
"HPMAX": 999999, // 各种数值;一些数值可以在这里设置
|
||||||
/****** 角色相关 ******/
|
/****** 角色相关 ******/
|
||||||
"HPMAX": 999999, // HP上限;-1则无上限
|
// HP上限;-1则无上限
|
||||||
"lavaDamage": 100, // 经过血网受到的伤害
|
"lavaDamage": 100, // 经过血网受到的伤害
|
||||||
"poisonDamage": 10, // 中毒后每步受到的伤害
|
"poisonDamage": 10, // 中毒后每步受到的伤害
|
||||||
"weakValue": 20, // 衰弱状态下攻防减少的数值
|
"weakValue": 20, // 衰弱状态下攻防减少的数值
|
||||||
/****** 道具相关 ******/
|
|
||||||
"redJewel": 3, // 红宝石加攻击的数值
|
"redJewel": 3, /****** 道具相关 ******/
|
||||||
|
// 红宝石加攻击的数值
|
||||||
"blueJewel": 3, // 蓝宝石加防御的数值
|
"blueJewel": 3, // 蓝宝石加防御的数值
|
||||||
"greenJewel": 5, // 绿宝石加魔防的数值
|
"greenJewel": 5, // 绿宝石加魔防的数值
|
||||||
"redPotion": 100, // 红血瓶加血数值
|
"redPotion": 100, // 红血瓶加血数值
|
||||||
@ -149,18 +161,22 @@ data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
|||||||
"sword5": 160, // 神圣剑加攻数值
|
"sword5": 160, // 神圣剑加攻数值
|
||||||
"shield5": 160, // 神圣盾加防数值
|
"shield5": 160, // 神圣盾加防数值
|
||||||
"moneyPocket": 500, // 金钱袋加金币的数值
|
"moneyPocket": 500, // 金钱袋加金币的数值
|
||||||
/****** 怪物相关 ******/
|
|
||||||
'breakArmor': 0.9, // 破甲的比例(战斗前,怪物附加角色防御的x%作为伤害)
|
'breakArmor': 0.9, /****** 怪物相关 ******/
|
||||||
|
// 破甲的比例(战斗前,怪物附加角色防御的x%作为伤害)
|
||||||
'counterAttack': 0.1, // 反击的比例(战斗时,怪物每回合附加角色攻击的x%作为伤害,无视角色防御)
|
'counterAttack': 0.1, // 反击的比例(战斗时,怪物每回合附加角色攻击的x%作为伤害,无视角色防御)
|
||||||
'purify': 3, // 净化的比例(战斗前,怪物附加勇士魔防的x倍作为伤害)
|
'purify': 3, // 净化的比例(战斗前,怪物附加勇士魔防的x倍作为伤害)
|
||||||
'hatred': 2, // 仇恨属性中,每杀死一个怪物获得的仇恨值
|
'hatred': 2, // 仇恨属性中,每杀死一个怪物获得的仇恨值
|
||||||
/****** 系统相关 ******/
|
|
||||||
'animateSpeed': 500, // 动画时间
|
'animateSpeed': 500, /****** 系统相关 ******/
|
||||||
|
// 动画时间
|
||||||
},
|
},
|
||||||
// 系统FLAG,在游戏运行中中请不要修改它。
|
|
||||||
"flags" : {
|
"flags" : {
|
||||||
|
|
||||||
|
"enableFloor": true, // 系统FLAG,在游戏运行中中请不要修改它。
|
||||||
/****** 状态栏相关 ******/
|
/****** 状态栏相关 ******/
|
||||||
"enableFloor": true, // 是否在状态栏显示当前楼层
|
// 是否在状态栏显示当前楼层
|
||||||
"enableLv": true, // 是否在状态栏显示当前等级
|
"enableLv": true, // 是否在状态栏显示当前等级
|
||||||
"enableMDef": true, // 是否在状态栏及战斗界面显示魔防(护盾)
|
"enableMDef": true, // 是否在状态栏及战斗界面显示魔防(护盾)
|
||||||
"enableMoney": true, // 是否在状态栏、怪物手册及战斗界面显示金币
|
"enableMoney": true, // 是否在状态栏、怪物手册及战斗界面显示金币
|
||||||
@ -168,16 +184,19 @@ data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
|||||||
"enableLevelUp": true, // 是否允许等级提升(进阶);如果上面enableExperience为false,则此项恒视为false
|
"enableLevelUp": true, // 是否允许等级提升(进阶);如果上面enableExperience为false,则此项恒视为false
|
||||||
"enableDebuff": true, // 是否涉及毒衰咒;如果此项为false则不会在状态栏中显示毒衰咒的debuff
|
"enableDebuff": true, // 是否涉及毒衰咒;如果此项为false则不会在状态栏中显示毒衰咒的debuff
|
||||||
////// 上述的几个开关将直接影响状态栏的显示效果 //////
|
////// 上述的几个开关将直接影响状态栏的显示效果 //////
|
||||||
/****** 道具相关 ******/
|
|
||||||
"flyNearStair": true, // 是否需要在楼梯边使用传送器
|
"flyNearStair": true, /****** 道具相关 ******/
|
||||||
|
// 是否需要在楼梯边使用传送器
|
||||||
"pickaxeFourDirections": true, // 使用破墙镐是否四个方向都破坏;如果false则只破坏面前的墙壁
|
"pickaxeFourDirections": true, // 使用破墙镐是否四个方向都破坏;如果false则只破坏面前的墙壁
|
||||||
"bombFourDirections": true, // 使用炸弹是否四个方向都会炸;如果false则只炸面前的怪物(即和圣锤等价)
|
"bombFourDirections": true, // 使用炸弹是否四个方向都会炸;如果false则只炸面前的怪物(即和圣锤等价)
|
||||||
"bigKeyIsBox": false, // 如果此项为true,则视为钥匙盒,红黄蓝钥匙+1;若为false,则视为大黄门钥匙
|
"bigKeyIsBox": false, // 如果此项为true,则视为钥匙盒,红黄蓝钥匙+1;若为false,则视为大黄门钥匙
|
||||||
/****** 怪物相关 ******/
|
|
||||||
"enableNegativeDamage": true, // 是否支持负伤害(回血)
|
"enableNegativeDamage": true, /****** 怪物相关 ******/
|
||||||
|
// 是否支持负伤害(回血)
|
||||||
"zoneSquare": false, // 领域类型。如果此项为true则为九宫格伤害,为false则为十字伤害
|
"zoneSquare": false, // 领域类型。如果此项为true则为九宫格伤害,为false则为十字伤害
|
||||||
/****** 系统相关 ******/
|
|
||||||
"startDirectly": false, // 点击“开始游戏”后是否立刻开始游戏而不显示难度选择界面
|
"startDirectly": false, /****** 系统相关 ******/
|
||||||
|
// 点击“开始游戏”后是否立刻开始游戏而不显示难度选择界面
|
||||||
"canOpenBattleAnimate": true, // 是否允许用户开启战斗过程;如果此项为false,则下面两项均强制视为false
|
"canOpenBattleAnimate": true, // 是否允许用户开启战斗过程;如果此项为false,则下面两项均强制视为false
|
||||||
"showBattleAnimateConfirm": true, // 是否在游戏开始时提供“是否开启战斗动画”的选项
|
"showBattleAnimateConfirm": true, // 是否在游戏开始时提供“是否开启战斗动画”的选项
|
||||||
"battleAnimate": true, // 是否默认显示战斗动画;用户可以手动在菜单栏中开关
|
"battleAnimate": true, // 是否默认显示战斗动画;用户可以手动在菜单栏中开关
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80 = //1:先攻,2:魔攻,3:坚固,4:2连击,5:3连击,6:4连击,7:破甲,8:反击,9:净化,10:模仿,11:吸血,12:中毒,13:衰弱,14:诅咒,15:领域,16:夹击,17:仇恨
|
enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80 =
|
||||||
{
|
{
|
||||||
'greenSlime': {'name': '绿头怪', 'hp': 100, 'atk': 120, 'def': 0, 'money': 1, 'experience': 1, 'special': [1,5,7,8]},
|
'greenSlime': {'name': '绿头怪', 'hp': 100, 'atk': 120, 'def': 0, 'money': 1, 'experience': 1, 'special': [1,5,7,8]},
|
||||||
'redSlime': {'name': '红头怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
'redSlime': {'name': '红头怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
// 这里需要改楼层名,请和文件名及下面的floorId保持完全一致
|
main.floors.MT0 =
|
||||||
// 楼层唯一标识符仅能由字母、数字、下划线组成,且不能由数字开头
|
{
|
||||||
// 推荐用法:第20层就用MT20,第38层就用MT38,地下6层就用MT_6(用下划线代替负号),隐藏3层用MT3h(h表示隐藏),等等
|
"floorId": "MT0", // 这里需要改楼层名,请和文件名及下面的floorId保持完全一致
|
||||||
main.floors.MT0 = {
|
// 楼层唯一标识符仅能由字母、数字、下划线组成,且不能由数字开头
|
||||||
"floorId": "MT0", // 楼层唯一标识符,需要和名字完全一致
|
// 推荐用法:第20层就用MT20,第38层就用MT38,地下6层就用MT_6(用下划线代替负号),隐藏3层用MT3h(h表示隐藏),等等
|
||||||
|
// 楼层唯一标识符,需要和名字完全一致
|
||||||
"title": "主塔 0 层", // 楼层中文名
|
"title": "主塔 0 层", // 楼层中文名
|
||||||
"name": "0", // 显示在状态栏中的层数
|
"name": "0", // 显示在状态栏中的层数
|
||||||
"canFlyTo": true, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
|
"canFlyTo": true, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
// 这里需要改楼层名,请和文件名及下面的floorId保持完全一致
|
main.floors.sample0 =
|
||||||
// 楼层唯一标识符仅能由字母、数字、下划线组成,且不能由数字开头
|
{
|
||||||
// 推荐用法:第20层就用MT20,第38层就用MT38,地下6层就用MT_6(用下划线代替负号),隐藏3层用MT3h(h表示隐藏),等等
|
"floorId": "sample0", // 这里需要改楼层名,请和文件名及下面的floorId保持完全一致
|
||||||
main.floors.sample0 = {
|
// 楼层唯一标识符仅能由字母、数字、下划线组成,且不能由数字开头
|
||||||
"floorId": "sample0", // 楼层唯一标识符,需要和名字完全一致
|
// 推荐用法:第20层就用MT20,第38层就用MT38,地下6层就用MT_6(用下划线代替负号),隐藏3层用MT3h(h表示隐藏),等等
|
||||||
|
// 楼层唯一标识符,需要和名字完全一致
|
||||||
"title": "样板 0 层", // 楼层中文名
|
"title": "样板 0 层", // 楼层中文名
|
||||||
"name": "0", // 显示在状态栏中的层数
|
"name": "0", // 显示在状态栏中的层数
|
||||||
"canFlyTo": true, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
|
"canFlyTo": true, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
// 这里需要改楼层名,请和文件名及下面的floorId保持完全一致
|
main.floors.sample1 =
|
||||||
// 楼层唯一标识符仅能由字母、数字、下划线组成,且不能由数字开头
|
{
|
||||||
// 推荐用法:第20层就用MT20,第38层就用MT38,地下6层就用MT_6(用下划线代替负号),隐藏3层用MT3h(h表示隐藏),等等
|
"floorId": "sample1", // 这里需要改楼层名,请和文件名及下面的floorId保持完全一致
|
||||||
main.floors.sample1 = {
|
// 楼层唯一标识符仅能由字母、数字、下划线组成,且不能由数字开头
|
||||||
"floorId": "sample1", // 楼层唯一标识符,需要和名字完全一致
|
// 推荐用法:第20层就用MT20,第38层就用MT38,地下6层就用MT_6(用下划线代替负号),隐藏3层用MT3h(h表示隐藏),等等
|
||||||
|
// 楼层唯一标识符,需要和名字完全一致
|
||||||
"title": "样板 1 层", // 楼层中文名
|
"title": "样板 1 层", // 楼层中文名
|
||||||
"name": "1", // 显示在状态栏中的层数
|
"name": "1", // 显示在状态栏中的层数
|
||||||
"canFlyTo": true, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
|
"canFlyTo": true, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
|
||||||
@ -257,7 +258,7 @@ main.floors.sample1 = {
|
|||||||
"12,11": [ // 自定义事件的老人
|
"12,11": [ // 自定义事件的老人
|
||||||
"\t[老人,womanMagician]使用 {\"type\":\"function\"} 可以写自定义的JS脚本。\n本塔支持的所有主要API会在doc文档内给出。",
|
"\t[老人,womanMagician]使用 {\"type\":\"function\"} 可以写自定义的JS脚本。\n本塔支持的所有主要API会在doc文档内给出。",
|
||||||
"\t[老人,womanMagician]例如这个例子:即将弹出一个输入窗口,然后会将你的输入结果直接加到你的攻击力上。",
|
"\t[老人,womanMagician]例如这个例子:即将弹出一个输入窗口,然后会将你的输入结果直接加到你的攻击力上。",
|
||||||
{"type": "function", "function": function() { // 自己写JS脚本并执行
|
{"type": "function", "function": `function() { // 自己写JS脚本并执行
|
||||||
var value = prompt("请输入你要加攻击力的数值:"); // 弹出一个输入框让用户输入数据
|
var value = prompt("请输入你要加攻击力的数值:"); // 弹出一个输入框让用户输入数据
|
||||||
if (value!=null) {
|
if (value!=null) {
|
||||||
value=parseInt(value);
|
value=parseInt(value);
|
||||||
@ -271,7 +272,7 @@ main.floors.sample1 = {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}},
|
}`},
|
||||||
"\t[老人,womanMagician]具体可参见样板中本事件的写法。"
|
"\t[老人,womanMagician]具体可参见样板中本事件的写法。"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
// 这里需要改楼层名,请和文件名及下面的floorId保持完全一致
|
main.floors.sample2 =
|
||||||
// 楼层唯一标识符仅能由字母、数字、下划线组成,且不能由数字开头
|
{
|
||||||
// 推荐用法:第20层就用MT20,第38层就用MT38,地下6层就用MT_6(用下划线代替负号),隐藏3层用MT3h(h表示隐藏),等等
|
"floorId": "sample2", // 这里需要改楼层名,请和文件名及下面的floorId保持完全一致
|
||||||
main.floors.sample2 = {
|
// 楼层唯一标识符仅能由字母、数字、下划线组成,且不能由数字开头
|
||||||
"floorId": "sample2", // 楼层唯一标识符,需要和名字完全一致
|
// 推荐用法:第20层就用MT20,第38层就用MT38,地下6层就用MT_6(用下划线代替负号),隐藏3层用MT3h(h表示隐藏),等等
|
||||||
|
// 楼层唯一标识符,需要和名字完全一致
|
||||||
"title": "主塔 40 层", // 楼层中文名
|
"title": "主塔 40 层", // 楼层中文名
|
||||||
"name": "40", // 显示在状态栏中的层数
|
"name": "40", // 显示在状态栏中的层数
|
||||||
"canFlyTo": false, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
|
"canFlyTo": false, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
// 这里需要改楼层名,请和文件名及下面的floorId保持完全一致
|
main.floors.test =
|
||||||
// 楼层唯一标识符仅能由字母、数字、下划线组成,且不能由数字开头
|
{
|
||||||
// 推荐用法:第20层就用MT20,第38层就用MT38,地下6层就用MT_6(用下划线代替负号),隐藏3层用MT3h(h表示隐藏),等等
|
"floorId": "test", // 这里需要改楼层名,请和文件名及下面的floorId保持完全一致
|
||||||
main.floors.test = {
|
// 楼层唯一标识符仅能由字母、数字、下划线组成,且不能由数字开头
|
||||||
"floorId": "test", // 楼层唯一标识符,需要和名字完全一致
|
// 推荐用法:第20层就用MT20,第38层就用MT38,地下6层就用MT_6(用下划线代替负号),隐藏3层用MT3h(h表示隐藏),等等
|
||||||
|
// 楼层唯一标识符,需要和名字完全一致
|
||||||
"title": "test", // 楼层中文名
|
"title": "test", // 楼层中文名
|
||||||
"name": "", // 显示在状态栏中的层数
|
"name": "", // 显示在状态栏中的层数
|
||||||
"canFlyTo": true, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
|
"canFlyTo": true, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
|
||||||
|
|||||||
@ -2,12 +2,12 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
|||||||
{
|
{
|
||||||
|
|
||||||
"items" : {
|
"items" : {
|
||||||
// 钥匙
|
|
||||||
'yellowKey': {'cls': 'keys', 'name': '黄钥匙'},
|
'yellowKey': {'cls': 'keys', 'name': '黄钥匙'},
|
||||||
'blueKey': {'cls': 'keys', 'name': '蓝钥匙'},
|
'blueKey': {'cls': 'keys', 'name': '蓝钥匙'},
|
||||||
'redKey': {'cls': 'keys', 'name': '红钥匙'},
|
'redKey': {'cls': 'keys', 'name': '红钥匙'},
|
||||||
|
|
||||||
// 宝石、血瓶
|
|
||||||
'redJewel': {'cls': 'items', 'name': '红宝石'},
|
'redJewel': {'cls': 'items', 'name': '红宝石'},
|
||||||
'blueJewel': {'cls': 'items', 'name': '蓝宝石'},
|
'blueJewel': {'cls': 'items', 'name': '蓝宝石'},
|
||||||
'greenJewel': {'cls': 'items', 'name': '绿宝石'},
|
'greenJewel': {'cls': 'items', 'name': '绿宝石'},
|
||||||
@ -29,7 +29,7 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
|||||||
'superPotion': {'cls': 'items', 'name': '圣水'},
|
'superPotion': {'cls': 'items', 'name': '圣水'},
|
||||||
'moneyPocket': {'cls': 'items', 'name': '金钱袋'},
|
'moneyPocket': {'cls': 'items', 'name': '金钱袋'},
|
||||||
|
|
||||||
// 物品
|
|
||||||
'book': {'cls': 'constants', 'name': '怪物手册', 'text': '可以查看当前楼层各怪物属性'},
|
'book': {'cls': 'constants', 'name': '怪物手册', 'text': '可以查看当前楼层各怪物属性'},
|
||||||
'fly': {'cls': 'constants', 'name': '楼层传送器', 'text': '可以自由往来去过的楼层'},
|
'fly': {'cls': 'constants', 'name': '楼层传送器', 'text': '可以自由往来去过的楼层'},
|
||||||
'coin': {'cls': 'constants', 'name': '幸运金币', 'text': '持有时打败怪物可得双倍金币'},
|
'coin': {'cls': 'constants', 'name': '幸运金币', 'text': '持有时打败怪物可得双倍金币'},
|
||||||
@ -38,7 +38,7 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
|||||||
'knife': {'cls': 'constants', 'name': '屠龙匕首', 'text': '该道具尚未被定义'},
|
'knife': {'cls': 'constants', 'name': '屠龙匕首', 'text': '该道具尚未被定义'},
|
||||||
'shoes': {'cls': 'constants', 'name': '绿鞋', 'text': '持有时无视负面地形'},
|
'shoes': {'cls': 'constants', 'name': '绿鞋', 'text': '持有时无视负面地形'},
|
||||||
|
|
||||||
// 道具
|
|
||||||
'bigKey': {'cls': 'tools', 'name': '大黄门钥匙', 'text': '可以开启当前层所有黄门'},
|
'bigKey': {'cls': 'tools', 'name': '大黄门钥匙', 'text': '可以开启当前层所有黄门'},
|
||||||
'greenKey': {'cls': 'tools', 'name': '绿钥匙', 'text': '可以打开一扇绿门'},
|
'greenKey': {'cls': 'tools', 'name': '绿钥匙', 'text': '可以打开一扇绿门'},
|
||||||
'steelKey': {'cls': 'tools', 'name': '铁门钥匙', 'text': '可以打开一扇铁门'},
|
'steelKey': {'cls': 'tools', 'name': '铁门钥匙', 'text': '可以打开一扇铁门'},
|
||||||
@ -63,8 +63,9 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
|||||||
"redJewel":"core.status.hero.atk += core.values.redJewel",
|
"redJewel":"core.status.hero.atk += core.values.redJewel",
|
||||||
"blueJewel":"core.status.hero.def += core.values.blueJewel",
|
"blueJewel":"core.status.hero.def += core.values.blueJewel",
|
||||||
"greenJewel":"core.status.hero.mdef += core.values.greenJewel",
|
"greenJewel":"core.status.hero.mdef += core.values.greenJewel",
|
||||||
// 黄宝石属性:需自己定义
|
|
||||||
"yellowJewel":"core.status.hero.hp+=1000;core.status.hero.atk+=6;core.status.hero.def+=6;core.status.hero.mdef+=10;",
|
"yellowJewel":"core.status.hero.hp+=1000;core.status.hero.atk+=6;core.status.hero.def+=6;core.status.hero.mdef+=10;",
|
||||||
|
// 黄宝石属性:需自己定义
|
||||||
"redPotion":"core.status.hero.hp += core.values.redPotion",
|
"redPotion":"core.status.hero.hp += core.values.redPotion",
|
||||||
"bluePotion":"core.status.hero.hp += core.values.bluePotion",
|
"bluePotion":"core.status.hero.hp += core.values.bluePotion",
|
||||||
"yellowPotion":"core.status.hero.hp += core.values.yellowPotion",
|
"yellowPotion":"core.status.hero.hp += core.values.yellowPotion",
|
||||||
@ -79,8 +80,9 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
|||||||
"shield3":"core.status.hero.def += core.values.shield3",
|
"shield3":"core.status.hero.def += core.values.shield3",
|
||||||
"shield4":"core.status.hero.def += core.values.shield4",
|
"shield4":"core.status.hero.def += core.values.shield4",
|
||||||
"shield5":"core.status.hero.def += core.values.shield5",
|
"shield5":"core.status.hero.def += core.values.shield5",
|
||||||
// 只有是钥匙盒才会执行这一步
|
|
||||||
"bigKey":"core.status.hero.items.keys.yellowKey++;core.status.hero.items.keys.blueKey++;core.status.hero.items.keys.redKey++;",
|
"bigKey":"core.status.hero.items.keys.yellowKey++;core.status.hero.items.keys.blueKey++;core.status.hero.items.keys.redKey++;",
|
||||||
|
// 只有是钥匙盒才会执行这一步
|
||||||
"superPotion":"core.status.hero.hp *= 2",
|
"superPotion":"core.status.hero.hp *= 2",
|
||||||
"moneyPocket":"core.status.hero.money += core.values.moneyPocket",
|
"moneyPocket":"core.status.hero.money += core.values.moneyPocket",
|
||||||
},
|
},
|
||||||
|
|||||||
193
project/maps.comment.js
Normal file
193
project/maps.comment.js
Normal file
@ -0,0 +1,193 @@
|
|||||||
|
maps_comment_90f36752_8815_4be8_b32b_d7fad1d0542e =
|
||||||
|
{
|
||||||
|
////////////////////////// 地形部分 //////////////////////////
|
||||||
|
|
||||||
|
// 0-20 地形
|
||||||
|
'1':' 黄墙',
|
||||||
|
'2':' 白墙',
|
||||||
|
'3':' 蓝墙',
|
||||||
|
'4':' 星空',
|
||||||
|
'5':' 岩浆',
|
||||||
|
'6':' 岩浆',
|
||||||
|
'7':' 蓝色商店左',
|
||||||
|
'8':' 蓝色商店右',
|
||||||
|
'9':' 粉色商店左',
|
||||||
|
'10':' 粉色商店左',
|
||||||
|
'11':' 血网',
|
||||||
|
'12':' 毒网',
|
||||||
|
'13':' 衰网',
|
||||||
|
'14':' 咒网',
|
||||||
|
'15':' 水',
|
||||||
|
// 在这里添加更多地形
|
||||||
|
// 如果空位不足,可以从180以后开始继续放,只要不和现有的数字冲突即可
|
||||||
|
|
||||||
|
// Autotile
|
||||||
|
'20':' autotile',
|
||||||
|
// 更多的autotile从151到160等,只要不和现有的数字冲突即可
|
||||||
|
'151':'',
|
||||||
|
'152':'',
|
||||||
|
'153':'',
|
||||||
|
|
||||||
|
////////////////////////// 物品部分 //////////////////////////
|
||||||
|
|
||||||
|
// 21-80 物品
|
||||||
|
'21':' 黄钥匙',
|
||||||
|
'22':' 蓝钥匙',
|
||||||
|
'23':' 红钥匙',
|
||||||
|
'24':' 绿钥匙',
|
||||||
|
'25':' 铁门钥匙',
|
||||||
|
'26':' 大黄门钥匙(钥匙盒)',
|
||||||
|
'27':' 红宝石',
|
||||||
|
'28':' 蓝宝石',
|
||||||
|
'29':' 绿宝石',
|
||||||
|
'30':' 黄宝石',
|
||||||
|
'31':' 红血瓶',
|
||||||
|
'32':' 蓝血瓶',
|
||||||
|
'33':' 绿血瓶',
|
||||||
|
'34':' 黄血瓶',
|
||||||
|
'35':' 铁剑',
|
||||||
|
'36':' 铁盾',
|
||||||
|
'37':' 银剑',
|
||||||
|
'38':' 银盾',
|
||||||
|
'39':' 骑士剑',
|
||||||
|
'40':' 骑士盾',
|
||||||
|
'41':' 圣剑',
|
||||||
|
'42':' 圣盾',
|
||||||
|
'43':' 神圣剑',
|
||||||
|
'44':' 神圣盾',
|
||||||
|
'45':' 怪物手册',
|
||||||
|
'46':' 楼层传送器',
|
||||||
|
'47':' 破墙镐',
|
||||||
|
'48':' 破冰镐',
|
||||||
|
'49':' 炸弹',
|
||||||
|
'50':' 中心对称',
|
||||||
|
'51':' 上楼器',
|
||||||
|
'52':' 下楼器',
|
||||||
|
'53':' 幸运金币',
|
||||||
|
'54':' 冰冻徽章',
|
||||||
|
'55':' 十字架',
|
||||||
|
'56':' 圣水',
|
||||||
|
'57':' 地震卷轴',
|
||||||
|
'58':' 解毒药水',
|
||||||
|
'59':' 解衰药水',
|
||||||
|
'60':' 解咒药水',
|
||||||
|
'61':' 万能药水',
|
||||||
|
'62':' 屠龙匕首',
|
||||||
|
'63':' 金钱袋',
|
||||||
|
'64':' 绿鞋',
|
||||||
|
'65':' 圣锤',
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////// 门、楼梯、传送点部分 //////////////////////////
|
||||||
|
|
||||||
|
// 81-100 门
|
||||||
|
'81':' 黄门',
|
||||||
|
'82':' 蓝门',
|
||||||
|
'83':' 红门',
|
||||||
|
'84':' 绿门',
|
||||||
|
'85':' 机关门左',
|
||||||
|
'86':' 铁门',
|
||||||
|
'87':' 上楼梯',
|
||||||
|
'88':' 下楼梯',
|
||||||
|
'89':' 传送门',
|
||||||
|
'90':' 星空传送门',
|
||||||
|
'91':' 上箭头',
|
||||||
|
'92':' 左箭头',
|
||||||
|
'93':' 下箭头',
|
||||||
|
'94':' 右箭头',
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////// NPC部分 //////////////////////////
|
||||||
|
|
||||||
|
// 121-150 NPC
|
||||||
|
'121':'',
|
||||||
|
'122':'',
|
||||||
|
'123':'',
|
||||||
|
'124':'',
|
||||||
|
'125':'',
|
||||||
|
'126':'',
|
||||||
|
'127':'',
|
||||||
|
'128':'',
|
||||||
|
'129':'',
|
||||||
|
'130':'',
|
||||||
|
'131':'',
|
||||||
|
'132':'',
|
||||||
|
|
||||||
|
////////////////////////// 其他部分 //////////////////////////
|
||||||
|
|
||||||
|
// 161-200 其他(单向箭头、灯、箱子等等)
|
||||||
|
'161':' 单向上箭头',
|
||||||
|
'162':' 单向下箭头',
|
||||||
|
'163':' 单向左箭头',
|
||||||
|
'164':' 单向右箭头',
|
||||||
|
'165':' 灯',
|
||||||
|
'166':' 暗灯',
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////// 怪物部分 //////////////////////////
|
||||||
|
|
||||||
|
// 201-300 怪物
|
||||||
|
'201':'',
|
||||||
|
'202':'',
|
||||||
|
'203':'',
|
||||||
|
'204':'',
|
||||||
|
'205':'',
|
||||||
|
'206':'',
|
||||||
|
'207':'',
|
||||||
|
'208':'',
|
||||||
|
'209':'',
|
||||||
|
'210':'',
|
||||||
|
'211':'',
|
||||||
|
'212':'',
|
||||||
|
'213':'',
|
||||||
|
'214':'',
|
||||||
|
'215':'',
|
||||||
|
'216':'',
|
||||||
|
'217':'',
|
||||||
|
'218':'',
|
||||||
|
'219':'',
|
||||||
|
'220':'',
|
||||||
|
'221':'',
|
||||||
|
'222':'',
|
||||||
|
'223':'',
|
||||||
|
'224':'',
|
||||||
|
'225':'',
|
||||||
|
'226':'',
|
||||||
|
'227':'',
|
||||||
|
'228':'',
|
||||||
|
'229':'',
|
||||||
|
'230':'',
|
||||||
|
'231':'',
|
||||||
|
'232':'',
|
||||||
|
'233':'',
|
||||||
|
'234':'',
|
||||||
|
'235':'',
|
||||||
|
'236':'',
|
||||||
|
'237':'',
|
||||||
|
'238':'',
|
||||||
|
'239':'',
|
||||||
|
'240':'',
|
||||||
|
'241':'',
|
||||||
|
'242':'',
|
||||||
|
'243':'',
|
||||||
|
'244':'',
|
||||||
|
'245':'',
|
||||||
|
'246':'',
|
||||||
|
'247':'',
|
||||||
|
'248':'',
|
||||||
|
'249':'',
|
||||||
|
'250':'',
|
||||||
|
'251':'',
|
||||||
|
'252':'',
|
||||||
|
'253':'',
|
||||||
|
'254':'',
|
||||||
|
'255':'',
|
||||||
|
'256':'',
|
||||||
|
'257':'',
|
||||||
|
'258':'',
|
||||||
|
'259':'',
|
||||||
|
'260':'',
|
||||||
|
|
||||||
|
////////////////////////// 待定... //////////////////////////
|
||||||
|
// 目前ID暂时不要超过400
|
||||||
|
}
|
||||||
@ -25,7 +25,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<p id='startTopLoadTips'>资源即将开始加载</p>
|
<p id='startTopLoadTips'>资源即将开始加载</p>
|
||||||
</div>
|
</div>
|
||||||
<img id='startBackground' src='images/bg.png'>
|
<img id='startBackground' src='project/images/bg.png'>
|
||||||
<!-- 标题界面;可以改style的color使标题改变颜色 -->
|
<!-- 标题界面;可以改style的color使标题改变颜色 -->
|
||||||
<p id='startLogo' style="color: black"></p>
|
<p id='startLogo' style="color: black"></p>
|
||||||
<div id='startButtonGroup'>
|
<div id='startButtonGroup'>
|
||||||
@ -48,39 +48,39 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id='statusBar' class="clearfix">
|
<div id='statusBar' class="clearfix">
|
||||||
<div class="status" id="floorCol">
|
<div class="status" id="floorCol">
|
||||||
<img src='images/floor.png' id="img-floor">
|
<img src='project/images/floor.png' id="img-floor">
|
||||||
<p class='statusLabel' id='floor'></p>
|
<p class='statusLabel' id='floor'></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="status" id="lvCol">
|
<div class="status" id="lvCol">
|
||||||
<img src='images/lv.png' id="img-lv">
|
<img src='project/images/lv.png' id="img-lv">
|
||||||
<p class='statusLabel' id='lv'></p>
|
<p class='statusLabel' id='lv'></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="status">
|
<div class="status">
|
||||||
<img src='images/hp.png' id="img-hp">
|
<img src='project/images/hp.png' id="img-hp">
|
||||||
<p class='statusLabel' id='hp'></p>
|
<p class='statusLabel' id='hp'></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="status">
|
<div class="status">
|
||||||
<img src='images/atk.png' id="img-atk">
|
<img src='project/images/atk.png' id="img-atk">
|
||||||
<p class='statusLabel' id='atk'></p>
|
<p class='statusLabel' id='atk'></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="status">
|
<div class="status">
|
||||||
<img src='images/def.png' id="img-def">
|
<img src='project/images/def.png' id="img-def">
|
||||||
<p class='statusLabel' id='def'></p>
|
<p class='statusLabel' id='def'></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="status" id="mdefCol">
|
<div class="status" id="mdefCol">
|
||||||
<img src='images/mdef.png' id="img-mdef">
|
<img src='project/images/mdef.png' id="img-mdef">
|
||||||
<p class='statusLabel' id='mdef'></p>
|
<p class='statusLabel' id='mdef'></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="status" id="moneyCol">
|
<div class="status" id="moneyCol">
|
||||||
<img src='images/money.png' id="img-money">
|
<img src='project/images/money.png' id="img-money">
|
||||||
<p class='statusLabel' id='money'></p>
|
<p class='statusLabel' id='money'></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="status" id="expCol">
|
<div class="status" id="expCol">
|
||||||
<img src='images/experience.png' id="img-experience">
|
<img src='project/images/experience.png' id="img-experience">
|
||||||
<p class='statusLabel' id='experience'></p>
|
<p class='statusLabel' id='experience'></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="status" id="upCol">
|
<div class="status" id="upCol">
|
||||||
<img src='images/up.png' id="img-up">
|
<img src='project/images/up.png' id="img-up">
|
||||||
<p class='statusLabel' id='up'></p>
|
<p class='statusLabel' id='up'></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="status">
|
<div class="status">
|
||||||
@ -95,13 +95,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="toolBar" class="clearfix">
|
<div id="toolBar" class="clearfix">
|
||||||
<img src="images/book.png" class="tools" id='img-book'>
|
<img src="project/images/book.png" class="tools" id='img-book'>
|
||||||
<img src="images/fly.png" class="tools" id='img-fly'>
|
<img src="project/images/fly.png" class="tools" id='img-fly'>
|
||||||
<img src="images/toolbox.png" class="tools" id='img-toolbox'>
|
<img src="project/images/toolbox.png" class="tools" id='img-toolbox'>
|
||||||
<img src="images/shop.png" class="tools" id='img-shop'>
|
<img src="project/images/shop.png" class="tools" id='img-shop'>
|
||||||
<img src="images/save.png" class="tools" id='img-save'>
|
<img src="project/images/save.png" class="tools" id='img-save'>
|
||||||
<img src="images/load.png" class="tools" id='img-load'>
|
<img src="project/images/load.png" class="tools" id='img-load'>
|
||||||
<img src="images/settings.png" class="tools" id='img-settings'>
|
<img src="project/images/settings.png" class="tools" id='img-settings'>
|
||||||
<p class="statusLabel tools" id="hard"></p>
|
<p class="statusLabel tools" id="hard"></p>
|
||||||
</div>
|
</div>
|
||||||
<div id="curtain"></div>
|
<div id="curtain"></div>
|
||||||
@ -131,15 +131,17 @@ var replay = function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
var afterInit = function(){
|
var afterInit = function(){
|
||||||
|
main.editor.disableGlobalAnimate=false;
|
||||||
main.editor.drawMapBg();
|
main.editor.drawMapBg();
|
||||||
main.editor.updateMap();
|
main.editor.updateMap();
|
||||||
|
core.setHeroMoveTriggerInterval();
|
||||||
}
|
}
|
||||||
var start = function(){
|
var start = function(){
|
||||||
var hard = 'Hard';
|
var hard = 'Hard';
|
||||||
core.resetStatus(core.firstData.hero, hard, core.firstData.floorId, core.initStatus.maps);
|
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.changeFloor(core.status.floorId, null, core.firstData.hero.loc, null, function() {
|
||||||
/* core.setHeroMoveTriggerInterval(); */
|
/* core.setHeroMoveTriggerInterval(); */
|
||||||
//afterInit();
|
afterInit();
|
||||||
});
|
});
|
||||||
core.events.setInitData(hard);
|
core.events.setInitData(hard);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user