Merge remote-tracking branch 'refs/remotes/ckcz123/master'
101
_server/fs.js
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
(function(){
|
||||||
|
fs = {};
|
||||||
|
var postsomething = function (data,_ip,callback) {
|
||||||
|
//callback:function(err, data)
|
||||||
|
//data:字符串
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.onreadystatechange = function(){
|
||||||
|
switch(xhr.readyState){
|
||||||
|
case 4 :
|
||||||
|
if ((xhr.status >= 200 && xhr.status < 300) || xhr.status == 304) {
|
||||||
|
if (Boolean(callback)){
|
||||||
|
if (xhr.responseText.slice(0,6)=='error:'){
|
||||||
|
callback(xhr.responseText,null);
|
||||||
|
} else {
|
||||||
|
callback(null,xhr.responseText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//printf(xhr.responseText)
|
||||||
|
}else{
|
||||||
|
if (Boolean(callback))callback(xhr.status,null);
|
||||||
|
//printf('error:' + xhr.status+'<br>'+(xhr.responseText||''));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xhr.open('post',_ip);
|
||||||
|
xhr.setRequestHeader('Content-Type','text/plain');
|
||||||
|
if(typeof(data)==typeof([][0]) || data==null)data=JSON.stringify({1:2});
|
||||||
|
xhr.send(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
fs.readFile = function (filename,encoding,callback) {
|
||||||
|
if (typeof(filename)!=typeof(''))
|
||||||
|
throw 'Type Error in fs.readFile';
|
||||||
|
if (encoding=='utf-8'){
|
||||||
|
//读文本文件
|
||||||
|
//filename:支持"/"做分隔符
|
||||||
|
//callback:function(err, data)
|
||||||
|
//data:字符串
|
||||||
|
var data='';
|
||||||
|
data+='type=utf8&';
|
||||||
|
data+='name='+filename;
|
||||||
|
postsomething(data,'/readFile',callback);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (encoding=='base64'){
|
||||||
|
//读二进制文件
|
||||||
|
//filename:支持"/"做分隔符
|
||||||
|
//callback:function(err, data)
|
||||||
|
//data:base64字符串
|
||||||
|
var data='';
|
||||||
|
data+='type=base64&';
|
||||||
|
data+='name='+filename;
|
||||||
|
postsomething(data,'/readFile',callback);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw 'Type Error in fs.readFile';
|
||||||
|
}
|
||||||
|
|
||||||
|
fs.writeFile = function (filename,datastr,encoding,callback) {
|
||||||
|
if (typeof(filename)!=typeof('') || typeof(datastr)!=typeof(''))
|
||||||
|
throw 'Type Error in fs.writeFile';
|
||||||
|
if (encoding=='utf-8'){
|
||||||
|
//写文本文件
|
||||||
|
//filename:支持"/"做分隔符
|
||||||
|
//callback:function(err)
|
||||||
|
//datastr:字符串
|
||||||
|
var data='';
|
||||||
|
data+='type=utf8&';
|
||||||
|
data+='name='+filename;
|
||||||
|
data+='&value='+datastr;
|
||||||
|
postsomething(data,'/writeFile',callback);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (encoding=='base64'){
|
||||||
|
//写二进制文件
|
||||||
|
//filename:支持"/"做分隔符
|
||||||
|
//callback:function(err)
|
||||||
|
//datastr:base64字符串
|
||||||
|
var data='';
|
||||||
|
data+='type=base64&';
|
||||||
|
data+='name='+filename;
|
||||||
|
data+='&value='+datastr;
|
||||||
|
postsomething(data,'/writeFile',callback);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw 'Type Error in fs.writeFile';
|
||||||
|
}
|
||||||
|
|
||||||
|
fs.readdir = function (path, callback) {
|
||||||
|
//callback:function(err, data)
|
||||||
|
//path:支持"/"做分隔符,不以"/"结尾
|
||||||
|
//data:[filename1,filename2,..] filename是字符串,只包含文件不包含目录
|
||||||
|
if (typeof(path)!=typeof(''))
|
||||||
|
throw 'Type Error in fs.readdir';
|
||||||
|
var data='';
|
||||||
|
data+='name='+path;
|
||||||
|
postsomething(data,'/listFile',function(err, data){callback(err,JSON.parse(data))});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
})();
|
||||||
@ -2,109 +2,7 @@
|
|||||||
<html>
|
<html>
|
||||||
<head><meta charset="utf-8"></head>
|
<head><meta charset="utf-8"></head>
|
||||||
<body>
|
<body>
|
||||||
<script>
|
<script src="./fs.js"></script>
|
||||||
(function(){
|
|
||||||
fs = {};
|
|
||||||
var postsomething = function (data,_ip,callback) {
|
|
||||||
//callback:function(err, data)
|
|
||||||
//data:字符串
|
|
||||||
var xhr = new XMLHttpRequest();
|
|
||||||
xhr.onreadystatechange = function(){
|
|
||||||
switch(xhr.readyState){
|
|
||||||
case 4 :
|
|
||||||
if ((xhr.status >= 200 && xhr.status < 300) || xhr.status == 304) {
|
|
||||||
if (Boolean(callback)){
|
|
||||||
if (xhr.responseText.slice(0,6)=='error:'){
|
|
||||||
callback(xhr.responseText,null);
|
|
||||||
} else {
|
|
||||||
callback(null,xhr.responseText);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//printf(xhr.responseText)
|
|
||||||
}else{
|
|
||||||
if (Boolean(callback))callback(xhr.status,null);
|
|
||||||
//printf('error:' + xhr.status+'<br>'+(xhr.responseText||''));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
xhr.open('post',_ip);
|
|
||||||
xhr.setRequestHeader('Content-Type','text/plain');
|
|
||||||
if(typeof(data)==typeof([][0]) || data==null)data=JSON.stringify({1:2});
|
|
||||||
xhr.send(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
fs.readFile = function (filename,encoding,callback) {
|
|
||||||
if (typeof(filename)!=typeof(''))
|
|
||||||
throw 'Type Error in fs.readFile';
|
|
||||||
if (encoding=='utf-8'){
|
|
||||||
//读文本文件
|
|
||||||
//filename:支持"/"做分隔符
|
|
||||||
//callback:function(err, data)
|
|
||||||
//data:字符串
|
|
||||||
var data='';
|
|
||||||
data+='type=utf8&';
|
|
||||||
data+='name='+filename;
|
|
||||||
postsomething(data,'/readFile',callback);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (encoding=='base64'){
|
|
||||||
//读二进制文件
|
|
||||||
//filename:支持"/"做分隔符
|
|
||||||
//callback:function(err, data)
|
|
||||||
//data:base64字符串
|
|
||||||
var data='';
|
|
||||||
data+='type=base64&';
|
|
||||||
data+='name='+filename;
|
|
||||||
postsomething(data,'/readFile',callback);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
throw 'Type Error in fs.readFile';
|
|
||||||
}
|
|
||||||
|
|
||||||
fs.writeFile = function (filename,datastr,encoding,callback) {
|
|
||||||
if (typeof(filename)!=typeof('') || typeof(datastr)!=typeof(''))
|
|
||||||
throw 'Type Error in fs.writeFile';
|
|
||||||
if (encoding=='utf-8'){
|
|
||||||
//写文本文件
|
|
||||||
//filename:支持"/"做分隔符
|
|
||||||
//callback:function(err)
|
|
||||||
//datastr:字符串
|
|
||||||
var data='';
|
|
||||||
data+='type=utf8&';
|
|
||||||
data+='name='+filename;
|
|
||||||
data+='&value='+datastr;
|
|
||||||
postsomething(data,'/writeFile',callback);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (encoding=='base64'){
|
|
||||||
//写二进制文件
|
|
||||||
//filename:支持"/"做分隔符
|
|
||||||
//callback:function(err)
|
|
||||||
//datastr:base64字符串
|
|
||||||
var data='';
|
|
||||||
data+='type=base64&';
|
|
||||||
data+='name='+filename;
|
|
||||||
data+='&value='+datastr;
|
|
||||||
postsomething(data,'/writeFile',callback);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
throw 'Type Error in fs.writeFile';
|
|
||||||
}
|
|
||||||
|
|
||||||
fs.readdir = function (path, callback) {
|
|
||||||
//callback:function(err, data)
|
|
||||||
//path:支持"/"做分隔符,不以"/"结尾
|
|
||||||
//data:[filename1,filename2,..] filename是字符串,只包含文件不包含目录
|
|
||||||
if (typeof(path)!=typeof(''))
|
|
||||||
throw 'Type Error in fs.readdir';
|
|
||||||
var data='';
|
|
||||||
data+='name='+path;
|
|
||||||
postsomething(data,'/listFile',function(err, data){callback(err,JSON.parse(data))});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
</script>
|
|
||||||
<script>
|
<script>
|
||||||
fs.writeFile('_test.txt','123中a文bc','utf-8',function(e,d){console.log(e);console.log(d);})
|
fs.writeFile('_test.txt','123中a文bc','utf-8',function(e,d){console.log(e);console.log(d);})
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## 事件的机制
|
## 事件的机制
|
||||||
|
|
||||||
本塔所有的事件都是依靠触发`trigger`完成的。例如,勇士碰到一个门可以触发一个事件`openDoor`,勇士碰到怪物可以触发一个事件`battle`,勇士碰到一个(上面定义的)楼层传送点可以触发一个事件`changeFloor`,勇士穿过路障可以触发一个事件`passNet`,包括勇士到达一个指定的`checkBlock`也可以触发一个检查领域、夹击的事件。上面说的这些事件都是系统本身自带的,即类似于RMXP中的公共事件。
|
本塔所有的事件都是依靠触发`trigger`完成的。例如,勇士碰到一个门可以触发一个事件`openDoor`,勇士碰到怪物可以触发一个事件`battle`,勇士碰到一个(上面定义的)楼层传送点可以触发一个事件`changeFloor`,勇士穿过路障可以触发一个事件`passNet`,等等。上面说的这些事件都是系统本身自带的,即类似于RMXP中的公共事件。
|
||||||
|
|
||||||
上述这些默认的事件已经存在处理机制,不需要我们操心。我们真正所需要关心的,其实只是一个自定义的事件。
|
上述这些默认的事件已经存在处理机制,不需要我们操心。我们真正所需要关心的,其实只是一个自定义的事件。
|
||||||
|
|
||||||
@ -829,7 +829,7 @@ core.insertAction(list) //往当前事件列表中插入一系列事件。使用
|
|||||||
|
|
||||||
请注意,快捷商店默认是不可被使用的。直到至少调用一次自定义事件中的 `{"type": "openShop"}` 打开商店后,才能真正在快捷栏中被使用。
|
请注意,快捷商店默认是不可被使用的。直到至少调用一次自定义事件中的 `{"type": "openShop"}` 打开商店后,才能真正在快捷栏中被使用。
|
||||||
|
|
||||||
``` java
|
``` js
|
||||||
"1,0": [ // 金币商店
|
"1,0": [ // 金币商店
|
||||||
// 打开商店前,你也可以添加自己的剧情
|
// 打开商店前,你也可以添加自己的剧情
|
||||||
// 例如,通过if来事件来判断是不是第一次访问商店,是的则显示一段文字(类似宿命的华音那样)
|
// 例如,通过if来事件来判断是不是第一次访问商店,是的则显示一段文字(类似宿命的华音那样)
|
||||||
|
|||||||
444
drawMapGUI.html
@ -348,44 +348,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<script>main={'instance':{}}</script>
|
|
||||||
<script src='libs/icons.js'></script>
|
|
||||||
<script src='libs/maps.js'></script>
|
|
||||||
<script src='_server/vendor/vue.min.js'></script>
|
|
||||||
<!-- <script src="https://unpkg.com/vue"></script> -->
|
|
||||||
<script>
|
<script>
|
||||||
main.instance.icons.init();//不知道为什么,需要手动init,明明maps是正常的
|
|
||||||
icons=main.instance.icons.getIcons();
|
|
||||||
|
|
||||||
var ids = [], indexs = []
|
|
||||||
ids.push({'idnum':0,'id':'ground','images':'terrains','y':0});
|
|
||||||
|
|
||||||
var point = 0
|
|
||||||
for(var i=0; i<400; i++){
|
|
||||||
var indexBlock = main.instance.maps.getBlock(0,0,i);
|
|
||||||
indexs[i] = [];
|
|
||||||
if('event' in indexBlock){
|
|
||||||
var id = indexBlock.event.id;
|
|
||||||
var indexId = indexBlock.id;
|
|
||||||
if(id=='autotile'){
|
|
||||||
ids.push({'idnum':indexId,'id':'autotile','images':'autotile','y':0});
|
|
||||||
point++;
|
|
||||||
indexs[i].push(point);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
var allCls = Object.keys(icons);
|
|
||||||
for(var j=0; j<allCls.length; j++){
|
|
||||||
if(id in icons[allCls[j]] ){
|
|
||||||
|
|
||||||
ids.push({'idnum':indexId,'id':id,'images':allCls[j],'y':icons[allCls[j]][id]});
|
|
||||||
point++;
|
|
||||||
indexs[i].push(point);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 生成定位编号
|
// 生成定位编号
|
||||||
|
(function(){
|
||||||
var colNum = ' ';
|
var colNum = ' ';
|
||||||
for(var i=0; i<13; i++){
|
for(var i=0; i<13; i++){
|
||||||
var tpl = '<td>'+i+'<div class="colBlock" style="left:'+(i*32+1)+'px;"></div></td>';
|
var tpl = '<td>'+i+'<div class="colBlock" style="left:'+(i*32+1)+'px;"></div></td>';
|
||||||
@ -400,11 +365,111 @@
|
|||||||
}
|
}
|
||||||
arrRowMark.innerHTML = rowNum;
|
arrRowMark.innerHTML = rowNum;
|
||||||
mapRowMark.innerHTML = rowNum;
|
mapRowMark.innerHTML = rowNum;
|
||||||
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<!-- =========================================================== -->
|
||||||
|
|
||||||
|
<script src='_server/vendor/vue.min.js'></script>
|
||||||
|
<!-- <script src="https://unpkg.com/vue"></script> -->
|
||||||
|
<script src='_server/fs.js'></script>
|
||||||
<script>
|
<script>
|
||||||
(function(){
|
printf = function(str,weak) {
|
||||||
|
var prefix='<span class="result">',postfix='</span>';
|
||||||
|
if (weak){prefix='<span class="weakresult">';}
|
||||||
|
if (typeof(str)==="undefined")str='';
|
||||||
|
printOut.innerHTML=prefix+String(str)+postfix;
|
||||||
|
}
|
||||||
|
//所有全局量
|
||||||
|
__all__=['Vue','fs','printf','editor','main','core','fullX','fullY'];
|
||||||
|
__id__=['printOut','arrRowMark','mapRowMark','data','bg','dataSelection'];
|
||||||
|
__Vue__=['exportM','editArea','editTip','clear','tip','selectBox'];
|
||||||
|
|
||||||
|
var main={'instance':{}};
|
||||||
|
var core={};
|
||||||
|
|
||||||
|
function editor() {
|
||||||
|
this.version = "0.1";
|
||||||
|
}
|
||||||
|
editor.prototype.init = function() {
|
||||||
|
var loadedNum=0;
|
||||||
|
var tmp_callback = function () {
|
||||||
|
loadedNum++;
|
||||||
|
if (loadedNum==2)
|
||||||
|
editor.drawInitData(function(){
|
||||||
|
editor.listen();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
editor.loadMod(function(){
|
||||||
|
editor.afterLoadMod(function(){
|
||||||
|
tmp_callback();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
editor.loadImage(function(){
|
||||||
|
editor.importGrass(function(){
|
||||||
|
editor.afterImportGrass(function(){
|
||||||
|
tmp_callback();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
editor.prototype.loadMod = function (callback) {
|
||||||
|
main={'instance':{}};
|
||||||
|
var loadedNum=0;
|
||||||
|
['libs/icons.js','libs/maps.js'].forEach( function (value,ii,aa) {
|
||||||
|
var script = document.createElement('script');
|
||||||
|
script.src = value + '?' + editor.version;
|
||||||
|
document.body.appendChild(script);
|
||||||
|
script.onload = function () {
|
||||||
|
loadedNum++;
|
||||||
|
if (loadedNum==aa.length)
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}//main 加载['libs/icons.js','libs/maps.js']
|
||||||
|
|
||||||
|
editor.prototype.afterLoadMod = function (callback) {
|
||||||
|
|
||||||
|
main.instance.icons.init();
|
||||||
|
var icons=main.instance.icons.getIcons();
|
||||||
|
|
||||||
|
editor.ids = [];
|
||||||
|
editor.indexs = [];
|
||||||
|
editor.ids.push({'idnum':0,'id':'ground','images':'terrains','y':0});
|
||||||
|
|
||||||
|
var point = 0
|
||||||
|
for(var i=0; i<400; i++){
|
||||||
|
var indexBlock = main.instance.maps.getBlock(0,0,i);
|
||||||
|
editor.indexs[i] = [];
|
||||||
|
if('event' in indexBlock){
|
||||||
|
var id = indexBlock.event.id;
|
||||||
|
var indexId = indexBlock.id;
|
||||||
|
if(id=='autotile'){
|
||||||
|
editor.ids.push({'idnum':indexId,'id':'autotile','images':'autotile','y':0});
|
||||||
|
point++;
|
||||||
|
editor.indexs[i].push(point);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
callback();
|
||||||
|
}//editor.ids,editor.indexs
|
||||||
|
|
||||||
|
editor.prototype.loadImage = function (callback) {
|
||||||
core={};
|
core={};
|
||||||
core.material={};
|
core.material={};
|
||||||
core.material.images = {};
|
core.material.images = {};
|
||||||
@ -432,26 +497,30 @@
|
|||||||
imgName = imgName[0];
|
imgName = imgName[0];
|
||||||
core.material.images[imgName] = image;
|
core.material.images[imgName] = image;
|
||||||
loadedImageNum++;
|
loadedImageNum++;
|
||||||
if (loadedImageNum == core.images.length) {importGrass();}
|
if (loadedImageNum == core.images.length) {callback();}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})();
|
}//core 加载['terrains','animates', 'enemys', 'items', 'npcs']
|
||||||
//context.drawImage(img,sx,sy,swidth,sheight,x,y,width,height)
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
editor.prototype.importGrass = function (callback) {
|
||||||
//预处理草的源图片
|
var autotile = new Image();
|
||||||
importGrass=function(){
|
|
||||||
autotile = new Image();
|
|
||||||
|
|
||||||
autotile.src = "images/autotile.png"
|
autotile.src = "images/autotile.png";
|
||||||
|
|
||||||
|
if (autotile.complete) {
|
||||||
|
editor.autotile = autotile;
|
||||||
|
callback();
|
||||||
|
return;
|
||||||
|
}
|
||||||
autotile.onload = function () {
|
autotile.onload = function () {
|
||||||
console.log("loaded")
|
editor.autotile = autotile;
|
||||||
drawInitData();
|
callback();
|
||||||
};
|
};
|
||||||
|
|
||||||
function drawAutotile(canvas, x, y, size, autotile, index) {
|
}// 加载 'autotile'
|
||||||
|
|
||||||
|
editor.prototype.afterImportGrass = function (callback) {
|
||||||
|
var drawAutotile = function (canvas, x, y, size, autotile, index) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
canvas.drawImage(autotile, 0, 0, 32, 32, x, y, size, size);
|
canvas.drawImage(autotile, 0, 0, 32, 32, x, y, size, size);
|
||||||
@ -529,36 +598,34 @@ importGrass=function(){
|
|||||||
//根据状态画图
|
//根据状态画图
|
||||||
var cxt = eventLayer.getContext("2d");
|
var cxt = eventLayer.getContext("2d");
|
||||||
|
|
||||||
grass = function (ii, x, y) {
|
var grass = function (ii, x, y) {
|
||||||
cxt.clearRect(x * 32, y * 32, 32, 32);
|
cxt.clearRect(x * 32, y * 32, 32, 32);
|
||||||
// cxt.putImageData(grassImageData[ii], x * 32, y * 32);
|
// cxt.putImageData(grassImageData[ii], x * 32, y * 32);
|
||||||
drawAutotile(cxt, x * 32, y * 32, 32, autotile, ii);
|
drawAutotile(cxt, x * 32, y * 32, 32, editor.autotile, ii);
|
||||||
}
|
}
|
||||||
|
|
||||||
//function clearGrass() { cxt.clearRect(0, 0, 416, 416); }
|
var isGrass = function (xx, yy) {
|
||||||
|
var mapxy=editor.map[editor.m(xx,yy)];
|
||||||
fullX = 12;
|
|
||||||
fullY = 12;
|
|
||||||
|
|
||||||
map = [];//-2表示边界,0表示空地,其他对象对应实体
|
|
||||||
map[fullX + 1 + fullY * (fullX + 1)] = -2;
|
|
||||||
for(var ii=0;ii<fullX + 1 + fullY * (fullX + 1);ii++)map[ii]=0;
|
|
||||||
|
|
||||||
m = function (x, y) {
|
|
||||||
if (x < 0 || x > fullX || y < 0 || y > fullY) return fullX + 1 + fullY * (fullX + 1);
|
|
||||||
return x + y * (fullX + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
isGrass = function (xx, yy) {
|
|
||||||
var mapxy=map[m(xx,yy)];
|
|
||||||
if (typeof(mapxy) == typeof(-1) || typeof(mapxy) == typeof([][0]))return 0;
|
if (typeof(mapxy) == typeof(-1) || typeof(mapxy) == typeof([][0]))return 0;
|
||||||
if (mapxy.images=='autotile')return 1;
|
if (mapxy.images=='autotile')return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateMap = function () {
|
fullX = 12;
|
||||||
|
fullY = 12;
|
||||||
|
|
||||||
|
editor.map = [];//-2表示边界,0表示空地,其他对象对应实体
|
||||||
|
editor.map[fullX + 1 + fullY * (fullX + 1)] = -2;
|
||||||
|
for(var ii=0;ii<fullX + 1 + fullY * (fullX + 1);ii++)editor.map[ii]=0;
|
||||||
|
|
||||||
|
editor.m = function (x, y) {
|
||||||
|
if (x < 0 || x > fullX || y < 0 || y > fullY) return fullX + 1 + fullY * (fullX + 1);
|
||||||
|
return x + y * (fullX + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
editor.updateMap = function (error) {
|
||||||
//clearGrass();
|
//clearGrass();
|
||||||
// console.log(map)
|
// console.log(editor.map)
|
||||||
for (var xx = 0; xx <= fullX; xx++) {
|
for (var xx = 0; xx <= fullX; xx++) {
|
||||||
for (var yy = 0; yy <= fullY; yy++) {
|
for (var yy = 0; yy <= fullY; yy++) {
|
||||||
if (!isGrass(xx, yy)) continue;
|
if (!isGrass(xx, yy)) continue;
|
||||||
@ -571,6 +638,7 @@ importGrass=function(){
|
|||||||
for (var xx = 0; xx < fullX; xx++) {
|
for (var xx = 0; xx < fullX; xx++) {
|
||||||
for (var yy = 0; yy < fullY; yy++) {
|
for (var yy = 0; yy < fullY; yy++) {
|
||||||
if (isGrass(xx, yy) + isGrass(xx + 1, yy) + isGrass(xx + 1, yy + 1) + isGrass(xx, yy + 1) != 3) continue;
|
if (isGrass(xx, yy) + isGrass(xx + 1, yy) + isGrass(xx + 1, yy + 1) + isGrass(xx, yy + 1) != 3) continue;
|
||||||
|
var autotile = editor.autotile;
|
||||||
if (!isGrass(xx, yy)) {
|
if (!isGrass(xx, yy)) {
|
||||||
// cxt.clearRect(xx * 32 + 32, yy * 32 + 32, 16, 16);
|
// cxt.clearRect(xx * 32 + 32, yy * 32 + 32, 16, 16);
|
||||||
// cxt.putImageData(grassImageData[16], xx * 32 + 32, yy * 32 + 32);
|
// cxt.putImageData(grassImageData[16], xx * 32 + 32, yy * 32 + 32);
|
||||||
@ -596,55 +664,54 @@ importGrass=function(){
|
|||||||
for (var xx = 0; xx <= fullX; xx++) {
|
for (var xx = 0; xx <= fullX; xx++) {
|
||||||
for (var yy = 0; yy <= fullY; yy++) {
|
for (var yy = 0; yy <= fullY; yy++) {
|
||||||
if (isGrass(xx, yy)) continue;
|
if (isGrass(xx, yy)) continue;
|
||||||
var mapxy=map[m(xx,yy)];
|
var mapxy=editor.map[editor.m(xx,yy)];
|
||||||
if (typeof(mapxy) == typeof(-1)){
|
if (typeof(mapxy) == typeof(-1)){
|
||||||
if(mapxy == 0) cxt.clearRect(xx*32, yy*32, 32, 32);
|
if(mapxy == 0) cxt.clearRect(xx*32, yy*32, 32, 32);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if(typeof(mapxy) == typeof([][0])) {//未定义块画红块
|
|
||||||
cxt.fillStyle = 'red';
|
|
||||||
cxt.fillRect(xx*32, yy*32, 32, 32);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
//context.drawImage(img,sx,sy,swidth,sheight,x,y,width,height)
|
//context.drawImage(img,sx,sy,swidth,sheight,x,y,width,height)
|
||||||
cxt.clearRect(xx*32, yy*32, 32, 32);
|
cxt.clearRect(xx*32, yy*32, 32, 32);
|
||||||
cxt.drawImage(core.material.images[mapxy.images], 0, mapxy.y*32, 32, 32, xx*32, yy*32, 32, 32);
|
cxt.drawImage(core.material.images[mapxy.images], 0, mapxy.y*32, 32, 32, xx*32, yy*32, 32, 32);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script>
|
if(typeof(mapxy) != typeof({}) || !('idnum' in mapxy) ) {//未定义块画红块
|
||||||
//画背景以及拖拽相关的支持
|
if (error=='clearError'){
|
||||||
|
editor.map[editor.m(xx,yy)]=0;
|
||||||
printf = function(str,weak) {
|
cxt.clearRect(xx*32, yy*32, 32, 32);
|
||||||
var prefix='<span class="result">',postfix='</span>';
|
continue;
|
||||||
if (weak){prefix='<span class="weakresult">';}
|
}
|
||||||
if (typeof(str)==="undefined")str='';
|
if (error=='showError'){
|
||||||
printOut.innerHTML=prefix+String(str)+postfix;
|
cxt.fillStyle = 'rgba(255,0,0,0.8)';
|
||||||
|
var tmpNum =6;
|
||||||
|
cxt.fillRect(xx*32+tmpNum, yy*32+tmpNum, 32-tmpNum*2, 32-tmpNum*2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
drawInitData = function(){
|
callback();
|
||||||
|
}//fullX,fullY,editor.map,editor.m,editor.updateMap
|
||||||
|
|
||||||
|
editor.prototype.drawInitData = function (callback) {
|
||||||
var ratio=1;
|
var ratio=1;
|
||||||
|
|
||||||
var images=core.material.images;
|
var images=core.material.images;
|
||||||
maxHeight=700;
|
var maxHeight=700;
|
||||||
sumWidth=0;
|
var sumWidth=0;
|
||||||
widthsX={};
|
editor.widthsX={};
|
||||||
for(var ii=0;ii<core.images.length;ii++){
|
for(var ii=0;ii<core.images.length;ii++){
|
||||||
var img=core.images[ii];
|
var img=core.images[ii];
|
||||||
widthsX[img]=[img,sumWidth/32,(sumWidth+images[img].width)/32];
|
editor.widthsX[img]=[img,sumWidth/32,(sumWidth+images[img].width)/32];
|
||||||
sumWidth+=images[img].width;
|
sumWidth+=images[img].width;
|
||||||
maxHeight=Math.max(maxHeight,images[img].height);
|
maxHeight=Math.max(maxHeight,images[img].height);
|
||||||
}
|
}
|
||||||
widthsX['autotile']=['autotile',sumWidth/32,(sumWidth+3*32)/32];
|
editor.widthsX['autotile']=['autotile',sumWidth/32,(sumWidth+3*32)/32];
|
||||||
sumWidth+=3*32;
|
sumWidth+=3*32;
|
||||||
|
|
||||||
var fullWidth=~~(sumWidth*ratio);
|
var fullWidth=~~(sumWidth*ratio);
|
||||||
var fullHeight=~~(maxHeight*ratio);
|
var fullHeight=~~(maxHeight*ratio);
|
||||||
|
|
||||||
// data.style.width = (data.width = fullWidth)/ratio + 'px';
|
if (fullWidth > data.width) data.style.width = (data.width = fullWidth)/ratio + 'px';
|
||||||
data.style.height = (data.height = fullHeight)/ratio + 'px';
|
data.style.height = (data.height = fullHeight)/ratio + 'px';
|
||||||
|
|
||||||
var dc = data.getContext('2d');
|
var dc = data.getContext('2d');
|
||||||
@ -665,12 +732,13 @@ importGrass=function(){
|
|||||||
dc.drawImage(images[img], nowx, 0)
|
dc.drawImage(images[img], nowx, 0)
|
||||||
nowx+=images[img].width;
|
nowx+=images[img].width;
|
||||||
}
|
}
|
||||||
dc.drawImage(autotile, nowx, 0)
|
dc.drawImage(editor.autotile, nowx, 0)
|
||||||
|
|
||||||
};
|
callback();
|
||||||
|
}//editor.widthsX
|
||||||
|
|
||||||
|
editor.prototype.listen = function() {
|
||||||
|
|
||||||
(function () {
|
|
||||||
var uc = ui.getContext('2d');
|
var uc = ui.getContext('2d');
|
||||||
|
|
||||||
function fillPos(pos) {
|
function fillPos(pos) {
|
||||||
@ -679,16 +747,16 @@ importGrass=function(){
|
|||||||
}//在格子内画一个随机色块
|
}//在格子内画一个随机色块
|
||||||
|
|
||||||
function eToLoc(e) {
|
function eToLoc(e) {
|
||||||
var loc = {
|
editor.loc = {
|
||||||
'x': document.documentElement.scrollLeft+e.clientX - mid.offsetLeft-mapEdit.offsetLeft,
|
'x': document.documentElement.scrollLeft+e.clientX - mid.offsetLeft-mapEdit.offsetLeft,
|
||||||
'y': document.documentElement.scrollTop+e.clientY - mid.offsetTop-mapEdit.offsetTop,
|
'y': document.documentElement.scrollTop+e.clientY - mid.offsetTop-mapEdit.offsetTop,
|
||||||
'size': 32
|
'size': 32
|
||||||
};
|
};
|
||||||
return loc; }//返回可用的组件内坐标
|
return editor.loc; }//返回可用的组件内坐标
|
||||||
|
|
||||||
function locToPos(loc) {
|
function locToPos(loc) {
|
||||||
pos = { 'x': ~~(loc.x / loc.size), 'y': ~~(loc.y / loc.size) }
|
editor.pos = { 'x': ~~(loc.x / loc.size), 'y': ~~(loc.y / loc.size) }
|
||||||
return pos;
|
return editor.pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
var holdingPath = 0;
|
var holdingPath = 0;
|
||||||
@ -718,7 +786,7 @@ importGrass=function(){
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
uc.clearRect(0, 0, 416, 416);
|
uc.clearRect(0, 0, 416, 416);
|
||||||
var loc = eToLoc(e);
|
var loc = eToLoc(e);
|
||||||
pos = locToPos(loc)
|
var pos = locToPos(loc)
|
||||||
stepPostfix = [];
|
stepPostfix = [];
|
||||||
stepPostfix.push(pos);
|
stepPostfix.push(pos);
|
||||||
fillPos(pos);
|
fillPos(pos);
|
||||||
@ -744,7 +812,7 @@ importGrass=function(){
|
|||||||
max = directionDistance[i];
|
max = directionDistance[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pos = [{ 'x': 0, 'y': 1 }, { 'x': -1, 'y': 0 }, { 'x': 0, 'y': -1 }, { 'x': 1, 'y': 0 }, false][index]
|
var pos = [{ 'x': 0, 'y': 1 }, { 'x': -1, 'y': 0 }, { 'x': 0, 'y': -1 }, { 'x': 1, 'y': 0 }, false][index]
|
||||||
if (pos) {
|
if (pos) {
|
||||||
pos.x += pos0.x;
|
pos.x += pos0.x;
|
||||||
pos.y += pos0.y;
|
pos.y += pos0.y;
|
||||||
@ -762,16 +830,16 @@ importGrass=function(){
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
var loc = eToLoc(e);
|
var loc = eToLoc(e);
|
||||||
if (stepPostfix.length) {
|
if (stepPostfix.length) {
|
||||||
preMapData = JSON.parse(JSON.stringify(map));
|
preMapData = JSON.parse(JSON.stringify(editor.map));
|
||||||
currDrawData.pos = JSON.parse(JSON.stringify(stepPostfix));
|
currDrawData.pos = JSON.parse(JSON.stringify(stepPostfix));
|
||||||
currDrawData.info = JSON.parse(JSON.stringify(info));
|
currDrawData.info = JSON.parse(JSON.stringify(editor.info));
|
||||||
reDo = null;
|
reDo = null;
|
||||||
// console.log(stepPostfix);
|
// console.log(stepPostfix);
|
||||||
for (var ii = 0; ii < stepPostfix.length; ii++)
|
for (var ii = 0; ii < stepPostfix.length; ii++)
|
||||||
map[m(stepPostfix[ii].x, stepPostfix[ii].y)] = info;
|
editor.map[editor.m(stepPostfix[ii].x, stepPostfix[ii].y)] = editor.info;
|
||||||
map[fullX + 1 + fullY * (fullX + 1)] = -2;
|
editor.map[fullX + 1 + fullY * (fullX + 1)] = -2;
|
||||||
// console.log(map);
|
// console.log(editor.map);
|
||||||
updateMap();
|
editor.updateMap();
|
||||||
holdingPath = 0;
|
holdingPath = 0;
|
||||||
stepPostfix = [];
|
stepPostfix = [];
|
||||||
uc.clearRect(0, 0, 416, 416);
|
uc.clearRect(0, 0, 416, 416);
|
||||||
@ -790,38 +858,39 @@ importGrass=function(){
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
//Ctrl+z 撤销上一步undo
|
//Ctrl+z 撤销上一步undo
|
||||||
if(e.keyCode == 90 && e.ctrlKey && preMapData && currDrawData.pos.length){
|
if(e.keyCode == 90 && e.ctrlKey && preMapData && currDrawData.pos.length){
|
||||||
map = JSON.parse(JSON.stringify(preMapData));
|
editor.map = JSON.parse(JSON.stringify(preMapData));
|
||||||
updateMap();
|
editor.updateMap();
|
||||||
reDo = JSON.parse(JSON.stringify(currDrawData));
|
reDo = JSON.parse(JSON.stringify(currDrawData));
|
||||||
currDrawData = {pos: [],info: {}};
|
currDrawData = {pos: [],info: {}};
|
||||||
preMapData = null;
|
preMapData = null;
|
||||||
}
|
}
|
||||||
//Ctrl+y 重做一步redo
|
//Ctrl+y 重做一步redo
|
||||||
if(e.keyCode == 89 && e.ctrlKey && reDo && reDo.pos.length){
|
if(e.keyCode == 89 && e.ctrlKey && reDo && reDo.pos.length){
|
||||||
preMapData = JSON.parse(JSON.stringify(map));
|
preMapData = JSON.parse(JSON.stringify(editor.map));
|
||||||
for(var j=0; j<reDo.pos.length;j++)
|
for(var j=0; j<reDo.pos.length;j++)
|
||||||
map[m(reDo.pos[j].x, reDo.pos[j].y)] = JSON.parse(JSON.stringify(reDo.info));
|
editor.map[editor.m(reDo.pos[j].x, reDo.pos[j].y)] = JSON.parse(JSON.stringify(reDo.info));
|
||||||
|
|
||||||
map[fullX + 1 + fullY * (fullX + 1)] = -2;
|
editor.map[fullX + 1 + fullY * (fullX + 1)] = -2;
|
||||||
updateMap();
|
editor.updateMap();
|
||||||
currDrawData = JSON.parse(JSON.stringify(reDo));
|
currDrawData = JSON.parse(JSON.stringify(reDo));
|
||||||
reDo = null;
|
reDo = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// info=ids[indexs[20][0]];//autotile
|
// info=editor.ids[editor.indexs[20][0]];//autotile
|
||||||
data.onmousedown = function (e) {
|
data.onmousedown = function (e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
var loc = {
|
var loc = {
|
||||||
'x': document.documentElement.scrollLeft + e.clientX - right.offsetLeft-iconLib.offsetLeft,
|
'x': document.documentElement.scrollLeft + e.clientX + (iconLib.scrollLeft||0) - right.offsetLeft-iconLib.offsetLeft,
|
||||||
'y': document.documentElement.scrollTop + e.clientY + iconLib.scrollTop - right.offsetTop-iconLib.offsetTop,
|
'y': document.documentElement.scrollTop + e.clientY + (iconLib.scrollTop||0) - right.offsetTop-iconLib.offsetTop,
|
||||||
'size': 32
|
'size': 32
|
||||||
};
|
};
|
||||||
pos = locToPos(loc);
|
editor.loc =loc;
|
||||||
for (var spriter in widthsX){
|
var pos = locToPos(loc);
|
||||||
if(pos.x>=widthsX[spriter][1] && pos.x<widthsX[spriter][2]){
|
for (var spriter in editor.widthsX){
|
||||||
pos.x=widthsX[spriter][1];
|
if(pos.x>=editor.widthsX[spriter][1] && pos.x<editor.widthsX[spriter][2]){
|
||||||
pos.images=widthsX[spriter][0];
|
pos.x=editor.widthsX[spriter][1];
|
||||||
|
pos.images=editor.widthsX[spriter][0];
|
||||||
if(pos.images=='autotile'){
|
if(pos.images=='autotile'){
|
||||||
pos.y=0;
|
pos.y=0;
|
||||||
}else if((pos.y+1)*32>core.material.images[pos.images].height)
|
}else if((pos.y+1)*32>core.material.images[pos.images].height)
|
||||||
@ -831,87 +900,39 @@ importGrass=function(){
|
|||||||
// console.log(pos,core.material.images[pos.images].height)
|
// console.log(pos,core.material.images[pos.images].height)
|
||||||
dataSelection.style.left = pos.x*32 +'px';
|
dataSelection.style.left = pos.x*32 +'px';
|
||||||
dataSelection.style.top = pos.y*32 +'px';
|
dataSelection.style.top = pos.y*32 +'px';
|
||||||
info={'images':pos.images,'y':pos.y};
|
editor.info={'images':pos.images,'y':pos.y};
|
||||||
for (var ii=0;ii<ids.length;ii++){
|
for (var ii=0;ii<editor.ids.length;ii++){
|
||||||
if(pos.images==ids[ii].images && pos.y==ids[ii].y)
|
if(pos.images==editor.ids[ii].images && pos.y==editor.ids[ii].y)
|
||||||
info = ids[ii];
|
editor.info = editor.ids[ii];
|
||||||
}
|
}
|
||||||
tip.infos = JSON.parse(JSON.stringify(info));
|
tip.infos = JSON.parse(JSON.stringify(editor.info));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
})();
|
|
||||||
|
}//绑定事件
|
||||||
|
|
||||||
|
/*
|
||||||
|
editor.updateMap
|
||||||
|
现在可以通过editor.updateMap('clearError')把所有错误id置零并绘图
|
||||||
|
以及editor.updateMap('showError')显示所有错误
|
||||||
|
|
||||||
|
editor.loc
|
||||||
|
editor.pos
|
||||||
|
editor.info
|
||||||
|
始终是最后一次点击的结果
|
||||||
|
注意editor.info可能因为点击其他地方而被清空
|
||||||
|
*/
|
||||||
|
var editor = new editor();
|
||||||
|
editor.init();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
//Vue
|
||||||
//var timecheck=0;
|
//var listenByVue = function() {
|
||||||
postsomething = function (data,callback) {
|
|
||||||
//if(timecheck!==0)return;
|
|
||||||
//timecheck=1;
|
|
||||||
setTimeout(function(){timecheck=0},5000);
|
|
||||||
var xhr = function(){
|
|
||||||
if (window.XMLHttpRequest) {
|
|
||||||
return new XMLHttpRequest();
|
|
||||||
}else{
|
|
||||||
return new ActiveObject('Micrsorf.XMLHttp');
|
|
||||||
}
|
|
||||||
}();
|
|
||||||
xhr.onreadystatechange = function(){
|
|
||||||
switch(xhr.readyState){
|
|
||||||
case 0 :
|
|
||||||
printf('waiting... ','weak');
|
|
||||||
break;
|
|
||||||
case 1 :
|
|
||||||
printf('waiting ...','weak');
|
|
||||||
break;
|
|
||||||
case 2 :
|
|
||||||
printf('waiting... ','weak');
|
|
||||||
break;
|
|
||||||
case 3 :
|
|
||||||
printf('waiting ...','weak');
|
|
||||||
break;
|
|
||||||
case 4 :
|
|
||||||
if ((xhr.status >= 200 && xhr.status < 300) || xhr.status == 304) {
|
|
||||||
printf(xhr.responseText);
|
|
||||||
if (Boolean(callback))callback(xhr.responseText);
|
|
||||||
}else{
|
|
||||||
printf('error:' + xhr.status+'<br>'+(xhr.responseText||''),'weak');
|
|
||||||
}
|
|
||||||
//timecheck=0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
xhr.open('post','http://127.0.0.1');
|
|
||||||
xhr.setRequestHeader('Content-Type','text/plain');
|
|
||||||
if(typeof(data)==typeof([][0]) || data==null)data=JSON.stringify({1:2});
|
|
||||||
xhr.send(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
function readUTF8file(filename,callback){
|
|
||||||
data={};
|
|
||||||
data.name='readUTF8file';
|
|
||||||
data.func='open';
|
|
||||||
data.args=[String(filename)];
|
|
||||||
postsomething(JSON.stringify(data),callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
function writeUTF8file(filename,filestr,callback){
|
|
||||||
data={};
|
|
||||||
data.name='writeUTF8file';
|
|
||||||
data.func='open';
|
|
||||||
data.args=[String(filename),String(filestr)];
|
|
||||||
postsomething(JSON.stringify(data),callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
|
|
||||||
document.body.onmousedown = function(e){
|
document.body.onmousedown = function(e){
|
||||||
selectBox.isSelected = false;
|
selectBox.isSelected = false;
|
||||||
info = {};
|
editor.info = {};
|
||||||
}
|
}
|
||||||
iconLib.onmousedown = function(e){
|
iconLib.onmousedown = function(e){
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
@ -921,24 +942,28 @@ importGrass=function(){
|
|||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
exportMap: function(){
|
exportMap: function(){
|
||||||
|
setTimeout(function(){editor.updateMap();},5000);
|
||||||
if(editArea.error) {
|
if(editArea.error) {
|
||||||
tip.whichShow = 3;
|
tip.whichShow = 3;
|
||||||
|
editor.updateMap('showError');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var filestr='';
|
var filestr='';
|
||||||
for (var yy = 0; yy < 13; yy++){
|
for (var yy = 0; yy < 13; yy++){
|
||||||
filestr+='['
|
filestr+='['
|
||||||
for (var xx = 0; xx < 13; xx++) {
|
for (var xx = 0; xx < 13; xx++) {
|
||||||
var mapxy=map[m(xx,yy)];
|
var mapxy=editor.map[editor.m(xx,yy)];
|
||||||
if(typeof(mapxy)==typeof({})){
|
if(typeof(mapxy)==typeof({})){
|
||||||
if ('idnum' in mapxy)mapxy=mapxy.idnum;
|
if ('idnum' in mapxy)mapxy=mapxy.idnum;
|
||||||
else {
|
else {
|
||||||
// mapxy='!!?';
|
// mapxy='!!?';
|
||||||
tip.whichShow = 3;
|
tip.whichShow = 3;
|
||||||
|
editor.updateMap('showError');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}else if(typeof(mapxy)=='undefined'){
|
}else if(typeof(mapxy)=='undefined'){
|
||||||
tip.whichShow = 3;
|
tip.whichShow = 3;
|
||||||
|
editor.updateMap('showError');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mapxy=String(mapxy);
|
mapxy=String(mapxy);
|
||||||
@ -997,17 +1022,17 @@ importGrass=function(){
|
|||||||
for(var i=0; i<mapArray.length; i++){
|
for(var i=0; i<mapArray.length; i++){
|
||||||
var num = parseInt(mapArray[i]);
|
var num = parseInt(mapArray[i]);
|
||||||
if(num == 0 )
|
if(num == 0 )
|
||||||
map[i] = 0;
|
editor.map[i] = 0;
|
||||||
else if(num >= 400){
|
else if(num >= 400){
|
||||||
that.error = 3;
|
that.error = 3;
|
||||||
map[i] = undefined;
|
editor.map[i] = undefined;
|
||||||
}else if(indexs[num][0] == undefined){
|
}else if(editor.indexs[num][0] == undefined){
|
||||||
that.error = 2;
|
that.error = 2;
|
||||||
map[i] = undefined;
|
editor.map[i] = undefined;
|
||||||
}else map[i] = ids[[indexs[num][0]]];
|
}else editor.map[i] = editor.ids[[editor.indexs[num][0]]];
|
||||||
}
|
}
|
||||||
|
|
||||||
updateMap();
|
editor.updateMap();
|
||||||
|
|
||||||
},
|
},
|
||||||
formatArr: function(){
|
formatArr: function(){
|
||||||
@ -1072,8 +1097,8 @@ importGrass=function(){
|
|||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
clearMap: function(){
|
clearMap: function(){
|
||||||
map[fullX + 1 + fullY * (fullX + 1)] = -2;
|
editor.map[fullX + 1 + fullY * (fullX + 1)] = -2;
|
||||||
for(var ii=0;ii<fullX + 1 + fullY * (fullX + 1);ii++)map[ii]=0;
|
for(var ii=0;ii<fullX + 1 + fullY * (fullX + 1);ii++)editor.map[ii]=0;
|
||||||
ec = eventLayer.getContext('2d');
|
ec = eventLayer.getContext('2d');
|
||||||
ec.clearRect(0, 0, 416, 416);
|
ec.clearRect(0, 0, 416, 416);
|
||||||
clearTimeout(editArea.formatTimer);
|
clearTimeout(editArea.formatTimer);
|
||||||
@ -1088,7 +1113,7 @@ importGrass=function(){
|
|||||||
var tip = new Vue({
|
var tip = new Vue({
|
||||||
el: '#tip',
|
el: '#tip',
|
||||||
data: {
|
data: {
|
||||||
infos: ids[indexs[20][0]],
|
infos: {idnum: 20, id: "autotile", images: "autotile", y: 0},//editor.ids[editor.indexs[20][0]],
|
||||||
hasId: true,
|
hasId: true,
|
||||||
isSelectedBlock: false,
|
isSelectedBlock: false,
|
||||||
geneMapSuccess: false,
|
geneMapSuccess: false,
|
||||||
@ -1150,6 +1175,11 @@ importGrass=function(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
//}
|
||||||
|
//listenByVue()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
BIN
images/autotile1.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
images/autotile2.png
Normal file
|
After Width: | Height: | Size: 7.3 KiB |
BIN
images/autotile3.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
images/lv.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 27 KiB |
BIN
images/up.png
Normal file
|
After Width: | Height: | Size: 863 B |
|
Before Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 7.7 KiB |
|
Before Width: | Height: | Size: 7.6 KiB |
|
Before Width: | Height: | Size: 7.0 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 7.6 KiB |
|
Before Width: | Height: | Size: 6.5 KiB |
|
Before Width: | Height: | Size: 12 KiB |
17
index.html
@ -47,10 +47,14 @@
|
|||||||
<p id='floorNameLabel'></p>
|
<p id='floorNameLabel'></p>
|
||||||
</div>
|
</div>
|
||||||
<div id='statusBar' class="clearfix">
|
<div id='statusBar' class="clearfix">
|
||||||
<div class="status">
|
<div class="status" id="floorCol">
|
||||||
<img src='images/floor.png' id="img-floor">
|
<img src='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">
|
||||||
|
<img src='images/lv.png' id="img-lv">
|
||||||
|
<p class='statusLabel' id='lv'></p>
|
||||||
|
</div>
|
||||||
<div class="status">
|
<div class="status">
|
||||||
<img src='images/hp.png' id="img-hp">
|
<img src='images/hp.png' id="img-hp">
|
||||||
<p class='statusLabel' id='hp'></p>
|
<p class='statusLabel' id='hp'></p>
|
||||||
@ -67,7 +71,7 @@
|
|||||||
<img src='images/mdef.png' id="img-mdef">
|
<img src='images/mdef.png' id="img-mdef">
|
||||||
<p class='statusLabel' id='mdef'></p>
|
<p class='statusLabel' id='mdef'></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="status">
|
<div class="status" id="moneyCol">
|
||||||
<img src='images/money.png' id="img-money">
|
<img src='images/money.png' id="img-money">
|
||||||
<p class='statusLabel' id='money'></p>
|
<p class='statusLabel' id='money'></p>
|
||||||
</div>
|
</div>
|
||||||
@ -75,12 +79,16 @@
|
|||||||
<img src='images/experience.png' id="img-experience">
|
<img src='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">
|
||||||
|
<img src='images/up.png' id="img-up">
|
||||||
|
<p class='statusLabel' id='up'></p>
|
||||||
|
</div>
|
||||||
<div class="status">
|
<div class="status">
|
||||||
<span class='statusLabel' id='yellowKey' style="color:#FFCCAA"></span>
|
<span class='statusLabel' id='yellowKey' style="color:#FFCCAA"></span>
|
||||||
<span class='statusLabel' id='blueKey' style="color:#AAAADD"></span>
|
<span class='statusLabel' id='blueKey' style="color:#AAAADD"></span>
|
||||||
<span class='statusLabel' id='redKey' style="color:#FF8888"></span>
|
<span class='statusLabel' id='redKey' style="color:#FF8888"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="status">
|
<div class="status" id="debuffCol">
|
||||||
<span class='statusLabel' id='poison' style="color: #AFFCA8;"></span>
|
<span class='statusLabel' id='poison' style="color: #AFFCA8;"></span>
|
||||||
<span class='statusLabel' id='weak' style="color: #FECCD0;"></span>
|
<span class='statusLabel' id='weak' style="color: #FECCD0;"></span>
|
||||||
<span class='statusLabel' id='curse' style="color: #C2F4E7;"></span>
|
<span class='statusLabel' id='curse' style="color: #C2F4E7;"></span>
|
||||||
@ -96,10 +104,11 @@
|
|||||||
<img src="images/settings.png" class="tools" id='img-settings'>
|
<img src="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>
|
||||||
<canvas class='gameCanvas' id='bg' width='416' height='416'></canvas>
|
<canvas class='gameCanvas' id='bg' width='416' height='416'></canvas>
|
||||||
<canvas class='gameCanvas' id='event' width='416' height='416'></canvas>
|
<canvas class='gameCanvas' id='event' width='416' height='416'></canvas>
|
||||||
<canvas class='gameCanvas' id='hero' width='416' height='416'></canvas>
|
|
||||||
<canvas class='gameCanvas' id='fg' 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='ui' width='416' height='416'></canvas>
|
||||||
<canvas class='gameCanvas' id='data' width='416' height='416'>此浏览器不支持HTML5</canvas>
|
<canvas class='gameCanvas' id='data' width='416' height='416'>此浏览器不支持HTML5</canvas>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
547
libs/core.js
42
libs/data.js
@ -10,12 +10,13 @@ data.prototype.init = function() {
|
|||||||
"floorId": "sample0", // 初始楼层ID
|
"floorId": "sample0", // 初始楼层ID
|
||||||
"hero": { // 勇士初始数据
|
"hero": { // 勇士初始数据
|
||||||
"name": "阳光", // 勇士名;可以改成喜欢的
|
"name": "阳光", // 勇士名;可以改成喜欢的
|
||||||
|
'lv': 1, // 初始等级,该项必须为正整数
|
||||||
"hp": 1000, // 初始生命值
|
"hp": 1000, // 初始生命值
|
||||||
"atk": 100, // 初始攻击
|
"atk": 100, // 初始攻击
|
||||||
"def": 100, // 初始防御
|
"def": 100, // 初始防御
|
||||||
"mdef": 100, // 初始魔防
|
"mdef": 100, // 初始魔防
|
||||||
"money": 100, // 初始金币
|
"money": 100, // 初始金币
|
||||||
"experience": 1000, // 初始经验
|
"experience": 0, // 初始经验
|
||||||
"items": { // 初始道具个数
|
"items": { // 初始道具个数
|
||||||
"keys": {
|
"keys": {
|
||||||
"yellowKey": 0,
|
"yellowKey": 0,
|
||||||
@ -57,10 +58,11 @@ data.prototype.init = function() {
|
|||||||
{"text": "防御+4", "effect": "status:def+=4"},
|
{"text": "防御+4", "effect": "status:def+=4"},
|
||||||
{"text": "魔防+10", "effect": "status:mdef+=10"}
|
{"text": "魔防+10", "effect": "status:mdef+=10"}
|
||||||
// effect只能对status和item进行操作,不能修改flag值。
|
// effect只能对status和item进行操作,不能修改flag值。
|
||||||
// 中间只能用+=符号(也就是只能增加某个属性或道具)
|
// 必须是X+=Y的形式,其中Y可以是一个表达式,以status:xxx或item:xxx为参数
|
||||||
// 其他effect样例:
|
// 其他effect样例:
|
||||||
// "item:yellowKey+=1" 黄钥匙+1
|
// "item:yellowKey+=1" 黄钥匙+1
|
||||||
// "item:pickaxe+=3" 破墙镐+3
|
// "item:pickaxe+=3" 破墙镐+3
|
||||||
|
// "status:hp+=2*(status:atk+status:def)" 将生命提升攻防和的数值的两倍
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"expShop1": { // 商店唯一ID
|
"expShop1": { // 商店唯一ID
|
||||||
@ -73,13 +75,33 @@ data.prototype.init = function() {
|
|||||||
"choices": [
|
"choices": [
|
||||||
// 在choices中写need,可以针对每个选项都有不同的需求。
|
// 在choices中写need,可以针对每个选项都有不同的需求。
|
||||||
// 这里的need同样可以以times作为参数,比如 "need": "100+20*times"
|
// 这里的need同样可以以times作为参数,比如 "need": "100+20*times"
|
||||||
{"text": "等级+1", "need": "100", "effect": "status:hp+=1000;status:atk+=7;status:def+=7"},
|
{"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": [ // 经验升级所需要的数值,是一个数组
|
||||||
|
{}, // 第一项为初始等级,可以简单留空,也可以写name
|
||||||
|
|
||||||
|
// 每一个里面可以含有三个参数 name, need, effect
|
||||||
|
// need为所需要的经验数值,是一个正整数。请确保need所需的依次递增
|
||||||
|
// name为该等级的名称,也可以省略代表使用系统默认值;本项将显示在状态栏中
|
||||||
|
// effect为本次升级所执行的操作,可由若干项组成,由分号分开
|
||||||
|
// 其中每一项写法和上面的商店完全相同,同样必须是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
|
||||||
|
|
||||||
|
// effect也允许写一个function,代表本次升级将会执行的操作
|
||||||
|
{"need": 40, "effect": function () {
|
||||||
|
core.drawText("恭喜升级!");
|
||||||
|
core.status.hero.hp *= 2;
|
||||||
|
core.status.hero.atk += 100;
|
||||||
|
core.status.hero.def += 100;
|
||||||
|
}},
|
||||||
|
|
||||||
|
// 依次往下写需要的数值即可
|
||||||
|
]
|
||||||
}
|
}
|
||||||
// 各种数值;一些数值可以在这里设置
|
// 各种数值;一些数值可以在这里设置
|
||||||
this.values = {
|
this.values = {
|
||||||
@ -118,9 +140,15 @@ data.prototype.init = function() {
|
|||||||
// 系统FLAG,在游戏运行中中请不要修改它。
|
// 系统FLAG,在游戏运行中中请不要修改它。
|
||||||
this.flags = {
|
this.flags = {
|
||||||
/****** 角色状态相关 ******/
|
/****** 角色状态相关 ******/
|
||||||
"enableMDef": true, // 是否涉及勇士的魔防值;如果此项为false,则状态栏不会显示勇士的魔防值
|
"enableNegativeDamage": true, // 是否支持负伤害(回血)
|
||||||
"enableExperience": true, // 是否涉及经验值;如果此项为false,则状态栏和怪物手册均将不会显示经验值
|
"enableFloor": false, // 是否在状态栏显示当前楼层
|
||||||
|
"enableLv": true, // 是否在状态栏显示当前等级
|
||||||
|
"enableMDef": true, // 是否在状态栏及战斗界面显示魔防(护盾)
|
||||||
|
"enableMoney": true, // 是否在状态栏、怪物手册及战斗界面显示金币
|
||||||
|
"enableExperience": true, // 是否在状态栏、怪物手册及战斗界面显示经验
|
||||||
|
"enableLevelUp": false, // 是否允许等级提升(进阶);如果上面enableExperience为false,则此项恒视为false
|
||||||
"enableDebuff": true, // 是否涉及毒衰咒;如果此项为false则不会在状态栏中显示毒衰咒的debuff
|
"enableDebuff": true, // 是否涉及毒衰咒;如果此项为false则不会在状态栏中显示毒衰咒的debuff
|
||||||
|
////// 上述的几个开关将直接影响状态栏的显示效果 //////
|
||||||
/****** 道具相关 ******/
|
/****** 道具相关 ******/
|
||||||
"flyNearStair": true, // 是否需要在楼梯边使用传送器
|
"flyNearStair": true, // 是否需要在楼梯边使用传送器
|
||||||
"pickaxeFourDirections": true, // 使用破墙镐是否四个方向都破坏;如果false则只破坏面前的墙壁
|
"pickaxeFourDirections": true, // 使用破墙镐是否四个方向都破坏;如果false则只破坏面前的墙壁
|
||||||
@ -128,6 +156,8 @@ data.prototype.init = function() {
|
|||||||
"bigKeyIsBox": false, // 如果此项为true,则视为钥匙盒,红黄蓝钥匙+1;若为false,则视为大黄门钥匙
|
"bigKeyIsBox": false, // 如果此项为true,则视为钥匙盒,红黄蓝钥匙+1;若为false,则视为大黄门钥匙
|
||||||
/****** 系统相关 ******/
|
/****** 系统相关 ******/
|
||||||
"startDirectly": false, // 点击“开始游戏”后是否立刻开始游戏而不显示难度选择界面
|
"startDirectly": false, // 点击“开始游戏”后是否立刻开始游戏而不显示难度选择界面
|
||||||
|
"canOpenBattleAnimate": true, // 是否允许用户开启战斗过程;如果此项为false,则下面两项均强制视为false
|
||||||
|
"showBattleAnimateConfirm": true, // 是否在游戏开始时提供“是否开启战斗动画”的选项
|
||||||
"battleAnimate": true, // 是否默认显示战斗动画;用户可以手动在菜单栏中开关
|
"battleAnimate": true, // 是否默认显示战斗动画;用户可以手动在菜单栏中开关
|
||||||
"displayEnemyDamage": true, // 是否地图怪物显伤;用户可以手动在菜单栏中开关
|
"displayEnemyDamage": true, // 是否地图怪物显伤;用户可以手动在菜单栏中开关
|
||||||
"displayExtraDamage": false, // 是否地图高级显伤(领域、夹击等);用户可以手动在菜单栏中开关
|
"displayExtraDamage": false, // 是否地图高级显伤(领域、夹击等);用户可以手动在菜单栏中开关
|
||||||
|
|||||||
@ -5,7 +5,7 @@ function enemys() {
|
|||||||
enemys.prototype.init = function () {
|
enemys.prototype.init = function () {
|
||||||
// 怪物属性初始化定义:
|
// 怪物属性初始化定义:
|
||||||
this.enemys = {
|
this.enemys = {
|
||||||
'greenSlime': {'name': '绿头怪', 'hp': 100, 'atk': 120, 'def': 0, 'money': 1, 'experience': 0, 'special': 0},
|
'greenSlime': {'name': '绿头怪', 'hp': 100, 'atk': 120, 'def': 0, 'money': 1, 'experience': 1, 'special': 0},
|
||||||
'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},
|
||||||
'blackSlime': {'name': '青头怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
'blackSlime': {'name': '青头怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||||
'slimelord': {'name': '怪王', 'hp': 100, 'atk': 120, 'def': 0, 'money': 10, 'experience': 0, 'special': 9},
|
'slimelord': {'name': '怪王', 'hp': 100, 'atk': 120, 'def': 0, 'money': 10, 'experience': 0, 'special': 9},
|
||||||
@ -76,7 +76,7 @@ enemys.prototype.getEnemys = function (enemyId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enemys.prototype.hasSpecial = function (special, test) {
|
enemys.prototype.hasSpecial = function (special, test) {
|
||||||
return special!=0 && (special%100 == test || this.hasSpecial(parseInt(special/100), test));
|
return (special instanceof Array)?special.indexOf(test)>=0:(special!=0&&(special%100==test||this.hasSpecial(parseInt(special/100), test)));
|
||||||
}
|
}
|
||||||
|
|
||||||
enemys.prototype.getSpecialText = function (enemyId) {
|
enemys.prototype.getSpecialText = function (enemyId) {
|
||||||
@ -131,7 +131,7 @@ enemys.prototype.getCritical = function (monsterId) {
|
|||||||
if (this.hasSpecial(monster.special, 3) || this.hasSpecial(monster.special, 10)) return "???";
|
if (this.hasSpecial(monster.special, 3) || this.hasSpecial(monster.special, 10)) return "???";
|
||||||
var last = this.calDamage(core.status.hero.atk, core.status.hero.def, core.status.hero.mdef,
|
var last = this.calDamage(core.status.hero.atk, core.status.hero.def, core.status.hero.mdef,
|
||||||
monster.hp, monster.atk, monster.def, monster.special);
|
monster.hp, monster.atk, monster.def, monster.special);
|
||||||
if (last == 0) return 0;
|
if (last <= 0) return 0;
|
||||||
|
|
||||||
for (var i = core.status.hero.atk + 1; i <= monster.hp + monster.def; i++) {
|
for (var i = core.status.hero.atk + 1; i <= monster.hp + monster.def; i++) {
|
||||||
var damage = this.calDamage(i, core.status.hero.def, core.status.hero.mdef,
|
var damage = this.calDamage(i, core.status.hero.def, core.status.hero.mdef,
|
||||||
@ -147,9 +147,8 @@ enemys.prototype.getCritical = function (monsterId) {
|
|||||||
enemys.prototype.getCriticalDamage = function (monsterId) {
|
enemys.prototype.getCriticalDamage = function (monsterId) {
|
||||||
var c = this.getCritical(monsterId);
|
var c = this.getCritical(monsterId);
|
||||||
if (c == '???') return '???';
|
if (c == '???') return '???';
|
||||||
if (c == 0) return 0;
|
if (c <= 0) return 0;
|
||||||
var monster = core.material.enemys[monsterId];
|
var monster = core.material.enemys[monsterId];
|
||||||
// if (c<=0) return 0;
|
|
||||||
var last = this.calDamage(core.status.hero.atk, core.status.hero.def, core.status.hero.mdef,
|
var last = this.calDamage(core.status.hero.atk, core.status.hero.def, core.status.hero.mdef,
|
||||||
monster.hp, monster.atk, monster.def, monster.special);
|
monster.hp, monster.atk, monster.def, monster.special);
|
||||||
if (last == 999999999) return '???';
|
if (last == 999999999) return '???';
|
||||||
@ -202,11 +201,7 @@ enemys.prototype.calDamage = function (hero_atk, hero_def, hero_mdef, mon_hp, mo
|
|||||||
var ans = damage + turn * per_damage + (turn + 1) * counterDamage;
|
var ans = damage + turn * per_damage + (turn + 1) * counterDamage;
|
||||||
ans -= hero_mdef;
|
ans -= hero_mdef;
|
||||||
|
|
||||||
// 魔防回血
|
return core.flags.enableNegativeDamage?ans:Math.max(0, ans);
|
||||||
// return ans;
|
|
||||||
|
|
||||||
// 魔防不回血
|
|
||||||
return ans <= 0 ? 0 : ans;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获得当前楼层的怪物列表
|
// 获得当前楼层的怪物列表
|
||||||
|
|||||||
610
libs/events.js
@ -20,12 +20,11 @@ events.prototype.init = function () {
|
|||||||
callback();
|
callback();
|
||||||
},
|
},
|
||||||
'changeFloor': function (data, core, callback) {
|
'changeFloor': function (data, core, callback) {
|
||||||
var heroLoc = null;
|
var heroLoc = {};
|
||||||
if (core.isset(data.event.data.loc)) {
|
if (core.isset(data.event.data.loc))
|
||||||
heroLoc = {'x': data.event.data.loc[0], 'y': data.event.data.loc[1]};
|
heroLoc = {'x': data.event.data.loc[0], 'y': data.event.data.loc[1]};
|
||||||
if (core.isset(data.event.data.direction))
|
if (core.isset(data.event.data.direction))
|
||||||
heroLoc.direction = data.event.data.direction;
|
heroLoc.direction = data.event.data.direction;
|
||||||
}
|
|
||||||
core.changeFloor(data.event.data.floorId, data.event.data.stair,
|
core.changeFloor(data.event.data.floorId, data.event.data.stair,
|
||||||
heroLoc, data.event.data.time, callback);
|
heroLoc, data.event.data.time, callback);
|
||||||
},
|
},
|
||||||
@ -66,7 +65,30 @@ events.prototype.startGame = function (hard) {
|
|||||||
|
|
||||||
core.hideStartAnimate(function() {
|
core.hideStartAnimate(function() {
|
||||||
core.drawText(core.clone(core.firstData.startText), function() {
|
core.drawText(core.clone(core.firstData.startText), function() {
|
||||||
|
if (core.flags.showBattleAnimateConfirm) { // 是否提供“开启战斗动画”的选择项
|
||||||
|
core.status.event.selection = core.flags.battleAnimate ? 0 : 1;
|
||||||
|
core.ui.drawConfirmBox("你想开启战斗动画吗?\n之后可以在菜单栏中开启或关闭。\n(强烈建议新手开启此项)", function () {
|
||||||
|
core.flags.battleAnimate = true;
|
||||||
|
core.setLocalStorage('battleAnimate', true);
|
||||||
core.startGame(hard);
|
core.startGame(hard);
|
||||||
|
core.events.setInitData(hard);
|
||||||
|
}, function () {
|
||||||
|
core.flags.battleAnimate = false;
|
||||||
|
core.setLocalStorage('battleAnimate', false);
|
||||||
|
core.startGame(hard);
|
||||||
|
core.events.setInitData(hard);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core.startGame(hard);
|
||||||
|
core.events.setInitData(hard);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
////// 简单难度设置初始福利 //////
|
||||||
|
events.prototype.setInitData = function (hard) {
|
||||||
if (hard=='Easy') { // 简单难度
|
if (hard=='Easy') { // 简单难度
|
||||||
core.setFlag('hard', 1); // 可以用flag:hard来获得当前难度
|
core.setFlag('hard', 1); // 可以用flag:hard来获得当前难度
|
||||||
// 可以在此设置一些初始福利,比如设置初始生命值可以调用:
|
// 可以在此设置一些初始福利,比如设置初始生命值可以调用:
|
||||||
@ -78,8 +100,6 @@ events.prototype.startGame = function (hard) {
|
|||||||
if (hard=='Hard') { // 困难难度
|
if (hard=='Hard') { // 困难难度
|
||||||
core.setFlag('hard', 3); // 可以用flag:hard来获得当前难度
|
core.setFlag('hard', 3); // 可以用flag:hard来获得当前难度
|
||||||
}
|
}
|
||||||
});
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 游戏结束事件 //////
|
////// 游戏结束事件 //////
|
||||||
@ -166,6 +186,7 @@ events.prototype.doAction = function() {
|
|||||||
case "tip":
|
case "tip":
|
||||||
core.drawTip(core.replaceText(data.text));
|
core.drawTip(core.replaceText(data.text));
|
||||||
core.events.doAction();
|
core.events.doAction();
|
||||||
|
break;
|
||||||
case "show": // 显示
|
case "show": // 显示
|
||||||
if (core.isset(data.time) && data.time>0 && (!core.isset(data.floorId) || data.floorId==core.status.floorId)) {
|
if (core.isset(data.time) && data.time>0 && (!core.isset(data.floorId) || data.floorId==core.status.floorId)) {
|
||||||
core.animateBlock(data.loc[0],data.loc[1],'show', data.time, function () {
|
core.animateBlock(data.loc[0],data.loc[1],'show', data.time, function () {
|
||||||
@ -308,7 +329,6 @@ events.prototype.doAction = function() {
|
|||||||
core.status.hero.hp=0;
|
core.status.hero.hp=0;
|
||||||
core.updateStatusBar();
|
core.updateStatusBar();
|
||||||
core.events.lose('damage');
|
core.events.lose('damage');
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.updateStatusBar();
|
core.updateStatusBar();
|
||||||
@ -361,7 +381,7 @@ events.prototype.doAction = function() {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
core.status.event.data.type='text';
|
core.status.event.data.type='text';
|
||||||
core.ui.drawTextBox("\t[警告,]出错啦!\n"+data.type+" 事件不被支持...");
|
core.ui.drawTextBox("\t[警告]出错啦!\n"+data.type+" 事件不被支持...");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -383,9 +403,14 @@ events.prototype.openShop = function(shopId, needVisited) {
|
|||||||
}
|
}
|
||||||
shop.visited = true;
|
shop.visited = true;
|
||||||
|
|
||||||
|
var selection = core.status.event.selection;
|
||||||
core.ui.closePanel();
|
core.ui.closePanel();
|
||||||
core.lockControl();
|
core.lockControl();
|
||||||
core.status.event = {'id': 'shop', 'data': {'id': shopId, 'shop': shop}};
|
// core.status.event = {'id': 'shop', 'data': {'id': shopId, 'shop': shop}};
|
||||||
|
core.status.event.id = 'shop';
|
||||||
|
core.status.event.data = {'id': shopId, 'shop': shop};
|
||||||
|
core.status.event.selection = selection;
|
||||||
|
|
||||||
// 拼词
|
// 拼词
|
||||||
var content = "\t["+shop.name+","+shop.icon+"]";
|
var content = "\t["+shop.name+","+shop.icon+"]";
|
||||||
var times = shop.times, need=eval(shop.need);
|
var times = shop.times, need=eval(shop.need);
|
||||||
@ -402,9 +427,9 @@ events.prototype.openShop = function(shopId, needVisited) {
|
|||||||
var text = choice.text;
|
var text = choice.text;
|
||||||
if (core.isset(choice.need))
|
if (core.isset(choice.need))
|
||||||
text += "("+eval(choice.need)+use+")"
|
text += "("+eval(choice.need)+use+")"
|
||||||
choices.push({"text": text});
|
choices.push(text);
|
||||||
}
|
}
|
||||||
choices.push({"text": "离开"});
|
choices.push("离开");
|
||||||
core.ui.drawChoices(content, choices);
|
core.ui.drawChoices(content, choices);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -462,6 +487,7 @@ events.prototype.useItem = function(itemId) {
|
|||||||
var fillstyle = 'rgba(255,0,0,0.5)';
|
var fillstyle = 'rgba(255,0,0,0.5)';
|
||||||
if (core.canUseItem('centerFly')) fillstyle = 'rgba(0,255,0,0.5)';
|
if (core.canUseItem('centerFly')) fillstyle = 'rgba(0,255,0,0.5)';
|
||||||
core.fillRect('ui',(12-core.getHeroLoc('x'))*32,(12-core.getHeroLoc('y'))*32,32,32,fillstyle);
|
core.fillRect('ui',(12-core.getHeroLoc('x'))*32,(12-core.getHeroLoc('y'))*32,32,32,fillstyle);
|
||||||
|
core.drawTip("请确认当前中心对称飞行器的位置");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -602,6 +628,46 @@ events.prototype.afterLoadData = function(data) {
|
|||||||
/*********** 界面上的点击事件 ***************/
|
/*********** 界面上的点击事件 ***************/
|
||||||
/******************************************/
|
/******************************************/
|
||||||
|
|
||||||
|
events.prototype.keyDownCtrl = function () {
|
||||||
|
if (core.status.event.id=='text') {
|
||||||
|
core.drawText();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (core.status.event.id=='action' && core.status.event.data.type=='text') {
|
||||||
|
this.doAction();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
events.prototype.keyUpConfirmBox = function (keycode) {
|
||||||
|
if (keycode==37) {
|
||||||
|
core.status.event.selection=0;
|
||||||
|
core.ui.drawConfirmBox(core.status.event.ui, core.status.event.data.yes, core.status.event.data.no);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (keycode==39) {
|
||||||
|
core.status.event.selection=1;
|
||||||
|
core.ui.drawConfirmBox(core.status.event.ui, core.status.event.data.yes, core.status.event.data.no);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (keycode==13 || keycode==32 || keycode==67) {
|
||||||
|
if (core.status.event.selection==0 && core.isset(core.status.event.data.yes)) {
|
||||||
|
core.status.event.selection=null;
|
||||||
|
core.status.event.data.yes();
|
||||||
|
}
|
||||||
|
if (core.status.event.selection==1 && core.isset(core.status.event.data.no)) {
|
||||||
|
core.status.event.selection=null;
|
||||||
|
core.status.event.data.no();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
events.prototype.clickConfirmBox = function (x,y) {
|
||||||
|
if ((x == 4 || x == 5) && y == 7 && core.isset(core.status.event.data.yes))
|
||||||
|
core.status.event.data.yes();
|
||||||
|
if ((x == 7 || x == 8) && y == 7 && core.isset(core.status.event.data.no))
|
||||||
|
core.status.event.data.no();
|
||||||
|
}
|
||||||
|
|
||||||
// 正在处理事件时的点击操作...
|
// 正在处理事件时的点击操作...
|
||||||
events.prototype.clickAction = function (x,y) {
|
events.prototype.clickAction = function (x,y) {
|
||||||
|
|
||||||
@ -625,6 +691,42 @@ events.prototype.clickAction = function (x,y) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
events.prototype.keyDownAction = function (keycode) {
|
||||||
|
if (core.status.event.data.type=='choices') {
|
||||||
|
var data = core.status.event.data.current;
|
||||||
|
var choices = data.choices;
|
||||||
|
if (choices.length>0) {
|
||||||
|
if (keycode==38) {
|
||||||
|
core.status.event.selection--;
|
||||||
|
if (core.status.event.selection<0) core.status.event.selection=0;
|
||||||
|
core.ui.drawChoices(core.status.event.ui.text, core.status.event.ui.choices);
|
||||||
|
}
|
||||||
|
if (keycode==40) {
|
||||||
|
core.status.event.selection++;
|
||||||
|
if (core.status.event.selection>=choices.length) core.status.event.selection=choices.length-1;
|
||||||
|
core.ui.drawChoices(core.status.event.ui.text, core.status.event.ui.choices);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
events.prototype.keyUpAction = function (keycode) {
|
||||||
|
if (core.status.event.data.type=='text' && (keycode==13 || keycode==32 || keycode==67)) {
|
||||||
|
this.doAction();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (core.status.event.data.type=='choices') {
|
||||||
|
var data = core.status.event.data.current;
|
||||||
|
var choices = data.choices;
|
||||||
|
if (choices.length>0) {
|
||||||
|
if (keycode==13 || keycode==32 || keycode==67) {
|
||||||
|
this.insertAction(choices[core.status.event.selection].action);
|
||||||
|
this.doAction();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 怪物手册
|
// 怪物手册
|
||||||
events.prototype.clickBook = function(x,y) {
|
events.prototype.clickBook = function(x,y) {
|
||||||
// 上一页
|
// 上一页
|
||||||
@ -642,6 +744,19 @@ events.prototype.clickBook = function(x,y) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
events.prototype.keyDownBook = function (keycode) {
|
||||||
|
if (keycode==37 || keycode==38) core.ui.drawEnemyBook(core.status.event.data - 1);
|
||||||
|
else if (keycode==39 || keycode==40) core.ui.drawEnemyBook(core.status.event.data + 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
events.prototype.keyUpBook = function (keycode) {
|
||||||
|
if (keycode==27 || keycode==88) {
|
||||||
|
core.ui.closePanel(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 飞行器
|
// 飞行器
|
||||||
events.prototype.clickFly = function(x,y) {
|
events.prototype.clickFly = function(x,y) {
|
||||||
if ((x==10 || x==11) && y==9) core.ui.drawFly(core.status.event.data-1);
|
if ((x==10 || x==11) && y==9) core.ui.drawFly(core.status.event.data-1);
|
||||||
@ -657,6 +772,20 @@ events.prototype.clickFly = function(x,y) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
events.prototype.keyDownFly = function (keycode) {
|
||||||
|
if (keycode==37 || keycode==38) core.ui.drawFly(core.status.event.data+1);
|
||||||
|
else if (keycode==39 || keycode==40) core.ui.drawFly(core.status.event.data-1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
events.prototype.keyUpFly = function (keycode) {
|
||||||
|
if (keycode==71 || keycode==27 || keycode==88)
|
||||||
|
core.ui.closePanel();
|
||||||
|
if (keycode==13 || keycode==32 || keycode==67)
|
||||||
|
this.clickFly(5,5);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 商店
|
// 商店
|
||||||
events.prototype.clickShop = function(x,y) {
|
events.prototype.clickShop = function(x,y) {
|
||||||
var shop = core.status.event.data.shop;
|
var shop = core.status.event.data.shop;
|
||||||
@ -687,12 +816,7 @@ events.prototype.clickShop = function(x,y) {
|
|||||||
|
|
||||||
// 更新属性
|
// 更新属性
|
||||||
choice.effect.split(";").forEach(function (t) {
|
choice.effect.split(";").forEach(function (t) {
|
||||||
if (t.indexOf("status:")==0) {
|
core.doEffect(t);
|
||||||
eval(t.replace("status:", "core.status.hero."));
|
|
||||||
}
|
|
||||||
else if (t.indexOf("item:")==0) {
|
|
||||||
eval(t.replace("item:", "core.getItem('").replace("+=", "', ")+")");
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
core.updateStatusBar();
|
core.updateStatusBar();
|
||||||
shop.times++;
|
shop.times++;
|
||||||
@ -709,14 +833,47 @@ events.prototype.clickShop = function(x,y) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
events.prototype.keyDownShop = function (keycode) {
|
||||||
|
var shop = core.status.event.data.shop;
|
||||||
|
var choices = shop.choices;
|
||||||
|
if (keycode==38) {
|
||||||
|
core.status.event.selection--;
|
||||||
|
if (core.status.event.selection<0) core.status.event.selection=0;
|
||||||
|
core.ui.drawChoices(core.status.event.ui.text, core.status.event.ui.choices);
|
||||||
|
}
|
||||||
|
if (keycode==40) {
|
||||||
|
core.status.event.selection++;
|
||||||
|
if (core.status.event.selection>choices.length) core.status.event.selection=choices.length;
|
||||||
|
core.ui.drawChoices(core.status.event.ui.text, core.status.event.ui.choices);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
events.prototype.keyUpShop = function (keycode) {
|
||||||
|
if (keycode==27 || keycode==88) {
|
||||||
|
if (core.status.event.data.fromList) {
|
||||||
|
core.status.boxAnimateObjs = [];
|
||||||
|
core.setBoxAnimate();
|
||||||
|
core.ui.drawQuickShop();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
core.ui.closePanel();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var shop = core.status.event.data.shop;
|
||||||
|
var choices = shop.choices;
|
||||||
|
if (keycode==13 || keycode==32 || keycode==67) {
|
||||||
|
var topIndex = 6 - parseInt(choices.length / 2);
|
||||||
|
this.clickShop(6, topIndex+core.status.event.selection);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 快捷商店
|
// 快捷商店
|
||||||
events.prototype.clickQuickShop = function(x, y) {
|
events.prototype.clickQuickShop = function(x, y) {
|
||||||
if (x >= 5 && x <= 7) {
|
|
||||||
var shopList = core.status.shops, keys = Object.keys(shopList);
|
var shopList = core.status.shops, keys = Object.keys(shopList);
|
||||||
var topIndex = 6 - parseInt((keys.length + 1) / 2);
|
if (x >= 5 && x <= 7) {
|
||||||
var exitIndex = 6 + parseInt((keys.length + 1) / 2);
|
var topIndex = 6 - parseInt(keys.length / 2);
|
||||||
|
if (y>=topIndex && y<topIndex+keys.length) {
|
||||||
if (y >= topIndex && y - topIndex < keys.length) {
|
|
||||||
var reason = core.events.canUseQuickShop(y-topIndex);
|
var reason = core.events.canUseQuickShop(y-topIndex);
|
||||||
if (core.isset(reason)) {
|
if (core.isset(reason)) {
|
||||||
core.drawText(reason);
|
core.drawText(reason);
|
||||||
@ -726,42 +883,146 @@ events.prototype.clickQuickShop = function(x, y) {
|
|||||||
if (core.status.event.id=='shop')
|
if (core.status.event.id=='shop')
|
||||||
core.status.event.data.fromList = true;
|
core.status.event.data.fromList = true;
|
||||||
}
|
}
|
||||||
if (y == exitIndex) {
|
// 离开
|
||||||
|
else if (y==topIndex+keys.length)
|
||||||
core.ui.closePanel();
|
core.ui.closePanel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
events.prototype.keyDownQuickShop = function (keycode) {
|
||||||
|
var shopList = core.status.shops, keys = Object.keys(shopList);
|
||||||
|
if (keycode==38) {
|
||||||
|
core.status.event.selection--;
|
||||||
|
if (core.status.event.selection<0) core.status.event.selection=0;
|
||||||
|
core.ui.drawChoices(core.status.event.ui.text, core.status.event.ui.choices);
|
||||||
|
}
|
||||||
|
if (keycode==40) {
|
||||||
|
core.status.event.selection++;
|
||||||
|
if (core.status.event.selection>keys.length) core.status.event.selection=keys.length;
|
||||||
|
core.ui.drawChoices(core.status.event.ui.text, core.status.event.ui.choices);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
events.prototype.keyUpQuickShop = function (keycode) {
|
||||||
|
if (keycode==27 || keycode==75 || keycode==88) {
|
||||||
|
core.ui.closePanel();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var shopList = core.status.shops, keys = Object.keys(shopList);
|
||||||
|
if (keycode==13 || keycode==32 || keycode==67) {
|
||||||
|
var topIndex = 6 - parseInt(keys.length / 2);
|
||||||
|
this.clickQuickShop(6, topIndex+core.status.event.selection);
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 工具栏
|
// 工具栏
|
||||||
events.prototype.clickToolbox = function(x,y) {
|
events.prototype.clickToolbox = function(x,y) {
|
||||||
|
|
||||||
// 返回
|
// 返回
|
||||||
if (x>=10 && x<=12 && y==12) {
|
if (x>=10 && x<=12 && y==12) {
|
||||||
core.ui.closePanel(false);
|
core.ui.closePanel(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var items = null;
|
|
||||||
|
|
||||||
if (y>=4 && y<=7 && x!=12)
|
|
||||||
items = Object.keys(core.status.hero.items.tools).sort();
|
|
||||||
|
|
||||||
if (y>=9 && y<=12 && x!=12)
|
|
||||||
items = Object.keys(core.status.hero.items.constants).sort();
|
|
||||||
|
|
||||||
if (items==null) return;
|
|
||||||
var index=0;
|
var index=0;
|
||||||
if (y==4||y==5||y==9||y==10) index=parseInt(x/2);
|
if (y==4||y==5||y==9||y==10) index=parseInt(x/2);
|
||||||
else index=6+parseInt(x/2);
|
else index=6+parseInt(x/2);
|
||||||
|
if (y>=9) index+=100;
|
||||||
|
this.clickToolboxIndex(index);
|
||||||
|
}
|
||||||
|
|
||||||
if (index>=items.length) return;
|
events.prototype.clickToolboxIndex = function(index) {
|
||||||
itemId=items[index];
|
var items = null;
|
||||||
|
var ii=index;
|
||||||
|
if (ii<100)
|
||||||
|
items = Object.keys(core.status.hero.items.tools).sort();
|
||||||
|
else {
|
||||||
|
ii-=100;
|
||||||
|
items = Object.keys(core.status.hero.items.constants).sort();
|
||||||
|
}
|
||||||
|
if (items==null) return;
|
||||||
|
if (ii>=items.length) return;
|
||||||
|
var itemId=items[ii];
|
||||||
if (itemId==core.status.event.data) {
|
if (itemId==core.status.event.data) {
|
||||||
core.events.useItem(itemId);
|
core.events.useItem(itemId);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.ui.drawToolbox(itemId);
|
core.ui.drawToolbox(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
events.prototype.keyDownToolbox = function (keycode) {
|
||||||
|
if (!core.isset(core.status.event.data)) return;
|
||||||
|
|
||||||
|
var tools = Object.keys(core.status.hero.items.tools).sort();
|
||||||
|
var constants = Object.keys(core.status.hero.items.constants).sort();
|
||||||
|
var index=core.status.event.selection;
|
||||||
|
|
||||||
|
if (keycode==37) { // left
|
||||||
|
if ((index>0 && index<100) || index>100) {
|
||||||
|
this.clickToolboxIndex(index-1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (index==100 && tools.length>0) {
|
||||||
|
this.clickToolboxIndex(tools.length-1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (keycode==38) { // up
|
||||||
|
if ((index>5 && index<100) || index>105) {
|
||||||
|
this.clickToolboxIndex(index-6);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (index>=100 && index<=105) {
|
||||||
|
if (tools.length>6) {
|
||||||
|
this.clickToolboxIndex(Math.min(tools.length-1, index-100+6));
|
||||||
|
}
|
||||||
|
else if (tools.length>0) {
|
||||||
|
this.clickToolboxIndex(Math.min(tools.length-1, index-100));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (keycode==39) { // right
|
||||||
|
if ((index<tools.length-1) || (index>=100 && index<constants.length+100)) {
|
||||||
|
this.clickToolboxIndex(index+1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (index==tools.length-1 && constants.length>0) {
|
||||||
|
this.clickToolboxIndex(100);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (keycode==40) { // down
|
||||||
|
if (index<=5) {
|
||||||
|
if (tools.length>6) {
|
||||||
|
this.clickToolboxIndex(Math.min(tools.length-1, index+6));
|
||||||
|
}
|
||||||
|
else if (constants.length>0) {
|
||||||
|
this.clickToolboxIndex(100+Math.min(constants.length-1, index));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (index>5 && index<100 && constants.length>0) {
|
||||||
|
this.clickToolboxIndex(100+Math.min(constants.length-1, index-6));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (index>=100 && index<=105 && constants.length>6) {
|
||||||
|
this.clickToolboxIndex(Math.min(100+constants.length-1, index+6));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
events.prototype.keyUpToolbox = function (keycode) {
|
||||||
|
if (keycode==84 || keycode==27 || keycode==88) {
|
||||||
|
core.ui.closePanel();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!core.isset(core.status.event.data)) return;
|
||||||
|
|
||||||
|
if (keycode==13 || keycode==32 || keycode==67) {
|
||||||
|
this.clickToolboxIndex(core.status.event.selection);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -769,11 +1030,11 @@ events.prototype.clickToolbox = function(x,y) {
|
|||||||
events.prototype.clickSL = function(x,y) {
|
events.prototype.clickSL = function(x,y) {
|
||||||
// 上一页
|
// 上一页
|
||||||
if ((x == 3 || x == 4) && y == 12) {
|
if ((x == 3 || x == 4) && y == 12) {
|
||||||
core.ui.drawSLPanel(core.status.event.data - 1);
|
core.ui.drawSLPanel(core.status.event.data - 6);
|
||||||
}
|
}
|
||||||
// 下一页
|
// 下一页
|
||||||
if ((x == 8 || x == 9) && y == 12) {
|
if ((x == 8 || x == 9) && y == 12) {
|
||||||
core.ui.drawSLPanel(core.status.event.data + 1);
|
core.ui.drawSLPanel(core.status.event.data + 6);
|
||||||
}
|
}
|
||||||
// 返回
|
// 返回
|
||||||
if (x>=10 && x<=12 && y==12) {
|
if (x>=10 && x<=12 && y==12) {
|
||||||
@ -784,7 +1045,8 @@ events.prototype.clickSL = function(x,y) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var index=6*core.status.event.data+1;
|
var page=parseInt((core.status.event.data-1)/6);
|
||||||
|
var index=6*page+1;
|
||||||
if (y>=1 && y<=4) {
|
if (y>=1 && y<=4) {
|
||||||
if (x>=1 && x<=3) core.doSL(index, core.status.event.id);
|
if (x>=1 && x<=3) core.doSL(index, core.status.event.id);
|
||||||
if (x>=5 && x<=7) core.doSL(index+1, core.status.event.id);
|
if (x>=5 && x<=7) core.doSL(index+1, core.status.event.id);
|
||||||
@ -797,78 +1059,274 @@ events.prototype.clickSL = function(x,y) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
events.prototype.keyDownSL = function(keycode) {
|
||||||
|
if (keycode==37) { // left
|
||||||
|
core.ui.drawSLPanel(core.status.event.data - 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (keycode==38) { // up
|
||||||
|
core.ui.drawSLPanel(core.status.event.data - 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (keycode==39) { // right
|
||||||
|
core.ui.drawSLPanel(core.status.event.data + 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (keycode==40) { // down
|
||||||
|
core.ui.drawSLPanel(core.status.event.data + 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (keycode==33) { // PAGEUP
|
||||||
|
core.ui.drawSLPanel(core.status.event.data - 6);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (keycode==34) { // PAGEDOWN
|
||||||
|
core.ui.drawSLPanel(core.status.event.data + 6);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
events.prototype.keyUpSL = function (keycode) {
|
||||||
|
if (keycode==27 || keycode==88 || (core.status.event.id == 'save' && keycode==83) || (core.status.event.id == 'load' && keycode==68)) {
|
||||||
|
core.ui.closePanel();
|
||||||
|
if (!core.isPlaying()) {
|
||||||
|
core.showStartAnimate();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (keycode==13 || keycode==32 || keycode==67) {
|
||||||
|
core.doSL(core.status.event.data, core.status.event.id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
events.prototype.clickSwitchs = function (x,y) {
|
events.prototype.clickSwitchs = function (x,y) {
|
||||||
if (x<5 || x>7) return;
|
if (x<5 || x>7) return;
|
||||||
if (y==4) {
|
var choices = [
|
||||||
|
"背景音乐", "战斗动画", "怪物显伤", "领域显伤", "返回主菜单"
|
||||||
|
];
|
||||||
|
var topIndex = 6 - parseInt((choices.length - 1) / 2);
|
||||||
|
if (y>=topIndex && y<topIndex+choices.length) {
|
||||||
|
var selection = y-topIndex;
|
||||||
|
switch (selection) {
|
||||||
|
case 0:
|
||||||
if (core.musicStatus.isIOS) {
|
if (core.musicStatus.isIOS) {
|
||||||
core.drawTip("iOS设备不支持播放音乐");
|
core.drawTip("iOS设备不支持播放音乐");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
core.changeSoundStatus();
|
core.changeSoundStatus();
|
||||||
core.ui.drawSwitchs();
|
core.ui.drawSwitchs();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
if (!core.flags.canOpenBattleAnimate) {
|
||||||
|
core.drawTip("本塔不能开启战斗动画!");
|
||||||
}
|
}
|
||||||
if (y==5) {
|
else {
|
||||||
core.flags.battleAnimate=!core.flags.battleAnimate;
|
core.flags.battleAnimate=!core.flags.battleAnimate;
|
||||||
|
core.setLocalStorage('battleAnimate', core.flags.battleAnimate);
|
||||||
core.ui.drawSwitchs();
|
core.ui.drawSwitchs();
|
||||||
}
|
}
|
||||||
if (y==6) {
|
break;
|
||||||
|
case 2:
|
||||||
core.flags.displayEnemyDamage=!core.flags.displayEnemyDamage;
|
core.flags.displayEnemyDamage=!core.flags.displayEnemyDamage;
|
||||||
core.updateFg();
|
core.updateFg();
|
||||||
|
core.setLocalStorage('enemyDamage', core.flags.displayEnemyDamage);
|
||||||
core.ui.drawSwitchs();
|
core.ui.drawSwitchs();
|
||||||
}
|
break;
|
||||||
if (y==7) {
|
case 3:
|
||||||
core.flags.displayExtraDamage=!core.flags.displayExtraDamage;
|
core.flags.displayExtraDamage=!core.flags.displayExtraDamage;
|
||||||
core.updateFg();
|
core.updateFg();
|
||||||
|
core.setLocalStorage('extraDamage', core.flags.displayExtraDamage);
|
||||||
core.ui.drawSwitchs();
|
core.ui.drawSwitchs();
|
||||||
}
|
break;
|
||||||
if (y==8) {
|
case 4:
|
||||||
|
core.status.event.selection=0;
|
||||||
core.ui.drawSettings(false);
|
core.ui.drawSettings(false);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
events.prototype.keyDownSwitchs = function (keycode) {
|
||||||
|
var choices = [
|
||||||
|
"背景音乐", "战斗动画", "怪物显伤", "领域显伤", "返回主菜单"
|
||||||
|
];
|
||||||
|
if (keycode==38) {
|
||||||
|
core.status.event.selection--;
|
||||||
|
if (core.status.event.selection<0) core.status.event.selection=0;
|
||||||
|
core.ui.drawChoices(core.status.event.ui.text, core.status.event.ui.choices);
|
||||||
|
}
|
||||||
|
if (keycode==40) {
|
||||||
|
core.status.event.selection++;
|
||||||
|
if (core.status.event.selection>=choices.length) core.status.event.selection=choices.length-1;
|
||||||
|
core.ui.drawChoices(core.status.event.ui.text, core.status.event.ui.choices);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
events.prototype.keyUpSwitchs = function (keycode) {
|
||||||
|
if (keycode==27 || keycode==88) {
|
||||||
|
core.status.event.selection=0;
|
||||||
|
core.ui.drawSettings(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var choices = [
|
||||||
|
"背景音乐", "战斗动画", "怪物显伤", "领域显伤", "返回主菜单"
|
||||||
|
];
|
||||||
|
if (keycode==13 || keycode==32 || keycode==67) {
|
||||||
|
var topIndex = 6 - parseInt((choices.length - 1) / 2);
|
||||||
|
this.clickSwitchs(6, topIndex+core.status.event.selection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 菜单栏
|
// 菜单栏
|
||||||
events.prototype.clickSettings = function (x,y) {
|
events.prototype.clickSettings = function (x,y) {
|
||||||
if (x<5 || x>7) return;
|
if (x<5 || x>7) return;
|
||||||
if (y == 3) {
|
var choices = [
|
||||||
|
"系统设置", "快捷商店", "同步存档", "重新开始", "操作帮助", "关于本塔", "返回游戏"
|
||||||
|
];
|
||||||
|
var topIndex = 6 - parseInt((choices.length - 1) / 2);
|
||||||
|
if (y>=topIndex && y<topIndex+choices.length) {
|
||||||
|
var selection = y-topIndex;
|
||||||
|
|
||||||
|
switch (selection) {
|
||||||
|
case 0:
|
||||||
|
core.status.event.selection=0;
|
||||||
core.ui.drawSwitchs();
|
core.ui.drawSwitchs();
|
||||||
}
|
break;
|
||||||
if (y==4) {
|
case 1:
|
||||||
/*
|
core.status.event.selection=0;
|
||||||
core.flags.battleAnimate=!core.flags.battleAnimate;
|
core.ui.drawQuickShop();
|
||||||
core.setLocalStorage('battleAnimate', core.flags.battleAnimate);
|
break;
|
||||||
core.ui.drawSettings(false);
|
case 2:
|
||||||
*/
|
core.status.event.selection=0;
|
||||||
this.decreaseHard();
|
|
||||||
}
|
|
||||||
if (y == 5) core.ui.drawQuickShop();
|
|
||||||
// if (y == 5) this.decreaseHard();
|
|
||||||
if (y == 6) {
|
|
||||||
core.ui.drawSyncSave();
|
core.ui.drawSyncSave();
|
||||||
}
|
break;
|
||||||
/*
|
case 3:
|
||||||
if (y == 6) {
|
core.status.event.selection=1;
|
||||||
core.ui.drawConfirmBox("你确定要清空所有本地存档吗?", function() {
|
|
||||||
localStorage.clear();
|
|
||||||
core.drawText("\t[操作成功]你的本地所有存档已被清空。");
|
|
||||||
}, function() {
|
|
||||||
core.ui.drawSettings(false);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
if (y == 7) {
|
|
||||||
core.ui.drawConfirmBox("你确定要重新开始吗?", function () {
|
core.ui.drawConfirmBox("你确定要重新开始吗?", function () {
|
||||||
core.ui.closePanel();
|
core.ui.closePanel();
|
||||||
core.restart();
|
core.restart();
|
||||||
}, function () {
|
}, function () {
|
||||||
|
core.status.event.selection=3;
|
||||||
core.ui.drawSettings(false);
|
core.ui.drawSettings(false);
|
||||||
});
|
});
|
||||||
}
|
break;
|
||||||
if (y==8) {
|
case 4:
|
||||||
|
core.ui.drawHelp();
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
core.ui.drawAbout();
|
core.ui.drawAbout();
|
||||||
// core.debug();
|
break;
|
||||||
|
case 6:
|
||||||
|
core.ui.closePanel();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (y == 9) core.ui.closePanel();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
events.prototype.keyDownSettings = function (keycode) {
|
||||||
|
var choices = [
|
||||||
|
"系统设置", "快捷商店", "同步存档", "重新开始", "操作帮助", "关于本塔", "返回游戏"
|
||||||
|
];
|
||||||
|
if (keycode==38) {
|
||||||
|
core.status.event.selection--;
|
||||||
|
if (core.status.event.selection<0) core.status.event.selection=0;
|
||||||
|
core.ui.drawChoices(core.status.event.ui.text, core.status.event.ui.choices);
|
||||||
|
}
|
||||||
|
if (keycode==40) {
|
||||||
|
core.status.event.selection++;
|
||||||
|
if (core.status.event.selection>=choices.length) core.status.event.selection=choices.length-1;
|
||||||
|
core.ui.drawChoices(core.status.event.ui.text, core.status.event.ui.choices);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
events.prototype.keyUpSettings = function (keycode) {
|
||||||
|
if (keycode==27 || keycode==88) {
|
||||||
|
core.ui.closePanel();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var choices = [
|
||||||
|
"系统设置", "快捷商店", "同步存档", "重新开始", "操作帮助", "关于本塔", "返回游戏"
|
||||||
|
];
|
||||||
|
if (keycode==13 || keycode==32 || keycode==67) {
|
||||||
|
var topIndex = 6 - parseInt((choices.length - 1) / 2);
|
||||||
|
this.clickSettings(6, topIndex+core.status.event.selection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
events.prototype.clickSyncSave = function (x,y) {
|
||||||
|
if (x<5 || x>7) return;
|
||||||
|
var choices = [
|
||||||
|
"同步存档到服务器", "从服务器加载存档", "清空本地存档", "返回主菜单"
|
||||||
|
];
|
||||||
|
var topIndex = 6 - parseInt((choices.length - 1) / 2);
|
||||||
|
if (y>=topIndex && y<topIndex+choices.length) {
|
||||||
|
var selection = y-topIndex;
|
||||||
|
switch (selection) {
|
||||||
|
case 0:
|
||||||
|
core.syncSave("save");
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
core.syncSave("load");
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
core.status.event.selection=1;
|
||||||
|
core.ui.drawConfirmBox("你确定要清空所有本地存档吗?", function() {
|
||||||
|
localStorage.clear();
|
||||||
|
core.drawText("\t[操作成功]你的本地所有存档已被清空。");
|
||||||
|
}, function() {
|
||||||
|
core.status.event.selection=2;
|
||||||
|
core.ui.drawSyncSave(false);
|
||||||
|
})
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
core.status.event.selection=2;
|
||||||
|
core.ui.drawSettings(false);
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
events.prototype.keyDownSyncSave = function (keycode) {
|
||||||
|
var choices = [
|
||||||
|
"同步存档到服务器", "从服务器加载存档", "清空本地存档", "返回主菜单"
|
||||||
|
];
|
||||||
|
if (keycode==38) {
|
||||||
|
core.status.event.selection--;
|
||||||
|
if (core.status.event.selection<0) core.status.event.selection=0;
|
||||||
|
core.ui.drawChoices(core.status.event.ui.text, core.status.event.ui.choices);
|
||||||
|
}
|
||||||
|
if (keycode==40) {
|
||||||
|
core.status.event.selection++;
|
||||||
|
if (core.status.event.selection>=choices.length) core.status.event.selection=choices.length-1;
|
||||||
|
core.ui.drawChoices(core.status.event.ui.text, core.status.event.ui.choices);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
events.prototype.keyUpSyncSave = function (keycode) {
|
||||||
|
if (keycode==27 || keycode==88) {
|
||||||
|
core.status.event.selection=2;
|
||||||
|
core.ui.drawSettings(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var choices = [
|
||||||
|
"同步存档到服务器", "从服务器加载存档", "清空本地存档", "返回主菜单"
|
||||||
|
];
|
||||||
|
if (keycode==13 || keycode==32 || keycode==67) {
|
||||||
|
var topIndex = 6 - parseInt((choices.length - 1) / 2);
|
||||||
|
this.clickSyncSave(6, topIndex+core.status.event.selection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
events.prototype.clickAbout = function () {
|
||||||
|
if (core.isPlaying())
|
||||||
|
core.ui.closePanel(false);
|
||||||
|
else
|
||||||
|
core.showStartAnimate();
|
||||||
|
}
|
||||||
|
|
||||||
/*********** 点击事件 END ***************/
|
/*********** 点击事件 END ***************/
|
||||||
|
|||||||
@ -4,9 +4,10 @@
|
|||||||
main.floors.MT0 = {
|
main.floors.MT0 = {
|
||||||
"floorId": "MT0", // 楼层唯一标识符,需要和名字完全一致
|
"floorId": "MT0", // 楼层唯一标识符,需要和名字完全一致
|
||||||
"title": "主塔 0 层", // 楼层中文名
|
"title": "主塔 0 层", // 楼层中文名
|
||||||
"name": 0, // 显示在状态栏中的层数
|
"name": "0", // 显示在状态栏中的层数
|
||||||
"canFlyTo": true, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
|
"canFlyTo": true, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
|
||||||
"canUseQuickShop": true, // 该层是否允许使用快捷商店
|
"canUseQuickShop": true, // 该层是否允许使用快捷商店
|
||||||
|
"defaultGround": "ground", // 默认地面的图块ID(terrains中)
|
||||||
"map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成
|
"map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|||||||
@ -4,9 +4,10 @@
|
|||||||
main.floors.sample0 = {
|
main.floors.sample0 = {
|
||||||
"floorId": "sample0", // 楼层唯一标识符,需要和名字完全一致
|
"floorId": "sample0", // 楼层唯一标识符,需要和名字完全一致
|
||||||
"title": "样板 0 层", // 楼层中文名
|
"title": "样板 0 层", // 楼层中文名
|
||||||
"name": 0, // 显示在状态栏中的层数
|
"name": "0", // 显示在状态栏中的层数
|
||||||
"canFlyTo": true, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
|
"canFlyTo": true, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
|
||||||
"canUseQuickShop": true, // 该层是否允许使用快捷商店
|
"canUseQuickShop": true, // 该层是否允许使用快捷商店
|
||||||
|
"defaultGround": "ground", // 默认地面的图块ID(terrains中)
|
||||||
"map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成
|
"map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成
|
||||||
[0, 0, 220, 0, 0, 20, 87, 3, 65, 64, 44, 43, 42],
|
[0, 0, 220, 0, 0, 20, 87, 3, 65, 64, 44, 43, 42],
|
||||||
[0, 246, 0, 246, 0, 20, 0, 3, 58, 59, 60, 61, 41],
|
[0, 246, 0, 246, 0, 20, 0, 3, 58, 59, 60, 61, 41],
|
||||||
|
|||||||
@ -4,23 +4,24 @@
|
|||||||
main.floors.sample1 = {
|
main.floors.sample1 = {
|
||||||
"floorId": "sample1", // 楼层唯一标识符,需要和名字完全一致
|
"floorId": "sample1", // 楼层唯一标识符,需要和名字完全一致
|
||||||
"title": "样板 1 层", // 楼层中文名
|
"title": "样板 1 层", // 楼层中文名
|
||||||
"name": 1, // 显示在状态栏中的层数
|
"name": "1", // 显示在状态栏中的层数
|
||||||
"canFlyTo": true, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
|
"canFlyTo": true, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
|
||||||
"canUseQuickShop": true, // 该层是否允许使用快捷商店
|
"canUseQuickShop": true, // 该层是否允许使用快捷商店
|
||||||
|
"defaultGround": "grass", // 默认地面的图块ID(terrains中)
|
||||||
"map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成
|
"map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成
|
||||||
[7, 131, 8, 2, 9, 130, 10, 2, 166, 165, 132, 165, 166],
|
[7, 131, 8, 152, 9, 130, 10, 152, 166, 165, 132, 165, 166],
|
||||||
[0, 0, 0, 0, 0, 0, 0, 2, 165, 164, 0, 162, 165],
|
[0, 0, 0, 0, 0, 0, 0, 152, 165, 164, 0, 162, 165],
|
||||||
[2, 2, 2, 2, 121, 2, 2, 2, 0, 0, 229, 0, 0],
|
[152, 152, 152, 152, 121, 152, 152, 152, 0, 0, 229, 0, 0],
|
||||||
[43, 33, 44, 1, 0, 0, 0, 2, 165, 161, 0, 163, 165],
|
[43, 33, 44, 151, 0, 0, 0, 152, 165, 161, 0, 163, 165],
|
||||||
[21, 22, 21, 1, 0, 0, 0, 2, 166, 165, 0, 165, 166],
|
[21, 22, 21, 151, 0, 0, 0, 152, 166, 165, 0, 165, 166],
|
||||||
[1, 245, 1, 1, 0, 87, 0, 2, 2, 2, 85, 2, 2],
|
[151, 245, 151, 151, 0, 87, 0, 152, 152, 152, 85, 153, 153],
|
||||||
[0, 246, 0, 1, 0, 0, 0, 2, 2, 221, 0, 221, 2],
|
[0, 246, 0, 151, 0, 0, 0, 152, 152, 221, 0, 221, 153],
|
||||||
[246, 0, 246, 1, 0, 0, 0, 121, 85, 0, 0, 0, 2],
|
[246, 0, 246, 151, 0, 0, 0, 121, 85, 0, 0, 0, 153],
|
||||||
[1, 246, 1, 1, 0, 2, 2, 2, 2, 2, 2, 2, 2],
|
[151, 246, 151, 151, 0, 153, 153, 153, 153, 153, 153, 153, 153],
|
||||||
[0, 0, 0, 0, 0, 0, 0, 164, 0, 0, 163, 0, 0],
|
[0, 0, 0, 0, 0, 0, 0, 164, 0, 0, 163, 0, 0],
|
||||||
[1, 1, 1, 1, 0, 3, 0, 0, 0, 162, 0, 161, 0],
|
[1, 1, 1, 1, 0, 20, 0, 0, 0, 162, 0, 161, 0],
|
||||||
[1, 0, 123, 1, 0, 3, 124, 0, 121, 0, 122, 0, 126],
|
[1, 0, 123, 1, 0, 20, 124, 0, 121, 0, 122, 0, 126],
|
||||||
[1, 0, 0, 1, 88, 3, 86, 0, 0, 0, 0, 0, 0],
|
[1, 0, 0, 1, 88, 20, 86, 0, 0, 0, 0, 0, 0],
|
||||||
],
|
],
|
||||||
"firstArrive": [ // 第一次到该楼层触发的事件
|
"firstArrive": [ // 第一次到该楼层触发的事件
|
||||||
|
|
||||||
@ -272,7 +273,7 @@ main.floors.sample1 = {
|
|||||||
},
|
},
|
||||||
"changeFloor": { // 楼层转换事件;该事件不能和上面的events有冲突(同位置点),否则会被覆盖
|
"changeFloor": { // 楼层转换事件;该事件不能和上面的events有冲突(同位置点),否则会被覆盖
|
||||||
"4,12": {"floorId": "sample0", "loc": [6,0]}, // 由于楼下有多个上楼梯,所以需指定位置而不是简单地写"stair": "upFloor"
|
"4,12": {"floorId": "sample0", "loc": [6,0]}, // 由于楼下有多个上楼梯,所以需指定位置而不是简单地写"stair": "upFloor"
|
||||||
"5,5": {"floorId": "sample2", "stair": "downFloor"}
|
"5,5": {"floorId": "sample2", "stair": "downFloor", "direction": "up"}
|
||||||
},
|
},
|
||||||
"afterBattle": { // 战斗后可能触发的事件列表
|
"afterBattle": { // 战斗后可能触发的事件列表
|
||||||
"9,6": [ // 初级卫兵1
|
"9,6": [ // 初级卫兵1
|
||||||
|
|||||||
@ -4,9 +4,10 @@
|
|||||||
main.floors.sample2 = {
|
main.floors.sample2 = {
|
||||||
"floorId": "sample2", // 楼层唯一标识符,需要和名字完全一致
|
"floorId": "sample2", // 楼层唯一标识符,需要和名字完全一致
|
||||||
"title": "主塔 40 层", // 楼层中文名
|
"title": "主塔 40 层", // 楼层中文名
|
||||||
"name": 40, // 显示在状态栏中的层数
|
"name": "40", // 显示在状态栏中的层数
|
||||||
"canFlyTo": false, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
|
"canFlyTo": false, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
|
||||||
"canUseQuickShop": true, // 该层是否允许使用快捷商店
|
"canUseQuickShop": true, // 该层是否允许使用快捷商店
|
||||||
|
"defaultGround": "snowGround", // 默认地面的图块ID(terrains中)
|
||||||
"map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成
|
"map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成
|
||||||
[5, 5, 5, 5, 5, 5, 87, 5, 5, 5, 5, 5, 5],
|
[5, 5, 5, 5, 5, 5, 87, 5, 5, 5, 5, 5, 5],
|
||||||
[5, 4, 4, 4, 4, 1, 0, 1, 4, 4, 4, 4, 5],
|
[5, 4, 4, 4, 4, 1, 0, 1, 4, 4, 4, 4, 5],
|
||||||
|
|||||||
45
libs/floors/test.js
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
// 这里需要改楼层名,请和文件名及下面的floorId保持完全一致
|
||||||
|
// 楼层唯一标识符仅能由字母、数字、下划线组成,且不能由数字开头
|
||||||
|
// 推荐用法:第20层就用MT20,第38层就用MT38,地下6层就用MT_6(用下划线代替负号),隐藏3层用MT3h(h表示隐藏),等等
|
||||||
|
main.floors.test = {
|
||||||
|
"floorId": "test", // 楼层唯一标识符,需要和名字完全一致
|
||||||
|
"title": "test", // 楼层中文名
|
||||||
|
"name": "", // 显示在状态栏中的层数
|
||||||
|
"canFlyTo": true, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
|
||||||
|
"canUseQuickShop": true, // 该层是否允许使用快捷商店
|
||||||
|
"defaultGround": "ground", // 默认地面的图块ID(terrains中)
|
||||||
|
"map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成
|
||||||
|
[201,201,201,201,201,201,201,201,201,201,201,201,201],
|
||||||
|
[201,201,201,201,201,201,201,201,201,201,201,201,201],
|
||||||
|
[201,201,201,201,201,201,201,201,201,201,201,201,201],
|
||||||
|
[201,201,201,201,201,201,201,201,201,201,201,201,201],
|
||||||
|
[201,201,201,201,201,201,201,201,201,201,201,201,201],
|
||||||
|
[201,201,201,201,201,201,201,201,201,201,201,201,201],
|
||||||
|
[201,201,201,201,201,201,201,201,201,201,201,201,201],
|
||||||
|
[201,201,201,201,201,201,201,201,201,201,201,201,201],
|
||||||
|
[201,201,201,201,201,201,201,201,201,201,201,201,201],
|
||||||
|
[201,201,201,201,201,201,201,201,201,201,201,201,201],
|
||||||
|
[201,201,201,201,201,201,201,201,201,201,201,201,201],
|
||||||
|
[201,201,201,201,201,201, 45,201,201,201,201,201,201],
|
||||||
|
[201,201,201,201,201,201, 0,201,201,201,201,201,201]
|
||||||
|
],
|
||||||
|
"firstArrive": [ // 第一次到该楼层触发的事件
|
||||||
|
|
||||||
|
],
|
||||||
|
"events": { // 该楼的所有可能事件列表
|
||||||
|
|
||||||
|
},
|
||||||
|
"changeFloor": { // 楼层转换事件;该事件不能和上面的events有冲突(同位置点),否则会被覆盖
|
||||||
|
|
||||||
|
},
|
||||||
|
"afterBattle": { // 战斗后可能触发的事件列表
|
||||||
|
|
||||||
|
},
|
||||||
|
"afterGetItem": { // 获得道具后可能触发的事件列表
|
||||||
|
|
||||||
|
},
|
||||||
|
"afterOpenDoor": { // 开完门后可能触发的事件列表
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -12,30 +12,46 @@ icons.prototype.init = function () {
|
|||||||
},
|
},
|
||||||
'terrains': {
|
'terrains': {
|
||||||
'ground': 0,
|
'ground': 0,
|
||||||
'yellowWall': 1,
|
'grass': 1,
|
||||||
'whiteWall': 2,
|
'grass2': 2,
|
||||||
'blueWall': 3,
|
'snowGround': 3,
|
||||||
'star': 4,
|
'ground2': 4,
|
||||||
'lava': 5,
|
'ground3': 5,
|
||||||
'ice': 6,
|
'ground4': 6,
|
||||||
'downFloor': 7,
|
'sand': 7,
|
||||||
'upFloor': 8,
|
'ground5': 8,
|
||||||
'yellowDoor': 9,
|
'yellowWall2': 9,
|
||||||
'blueDoor': 10,
|
'whiteWall2': 10,
|
||||||
'redDoor': 11,
|
'blueWall2': 11,
|
||||||
'greenDoor': 12,
|
'blockWall': 12,
|
||||||
'specialDoor': 13,
|
'grayWall': 13,
|
||||||
'steelDoor': 14,
|
'white': 14,
|
||||||
'blueShop-left': 15,
|
'ground6': 15,
|
||||||
'blueShop-right': 16,
|
'soil': 16,
|
||||||
'pinkShop-left': 17,
|
'yellowWall': 17,
|
||||||
'pinkShop-right': 18,
|
'whiteWall': 18,
|
||||||
'arrowUp': 19,
|
'blueWall': 19,
|
||||||
'arrowDown': 20,
|
'star': 20,
|
||||||
'arrowLeft': 21,
|
'lava': 21,
|
||||||
'arrowRight': 22,
|
'ice': 22,
|
||||||
'light': 23,
|
'downFloor': 23,
|
||||||
'darkLight': 24
|
'upFloor': 24,
|
||||||
|
'yellowDoor': 25,
|
||||||
|
'blueDoor': 26,
|
||||||
|
'redDoor': 27,
|
||||||
|
'greenDoor': 28,
|
||||||
|
'specialDoor': 29,
|
||||||
|
'steelDoor': 30,
|
||||||
|
'blueShop-left': 31,
|
||||||
|
'blueShop-right': 32,
|
||||||
|
'pinkShop-left': 33,
|
||||||
|
'pinkShop-right': 34,
|
||||||
|
'arrowUp': 35,
|
||||||
|
'arrowDown': 36,
|
||||||
|
'arrowLeft': 37,
|
||||||
|
'arrowRight': 38,
|
||||||
|
'light': 39,
|
||||||
|
'darkLight': 40
|
||||||
},
|
},
|
||||||
'animates': {
|
'animates': {
|
||||||
'star': 0,
|
'star': 0,
|
||||||
@ -193,6 +209,12 @@ icons.prototype.init = function () {
|
|||||||
'moneyPocket': 46,
|
'moneyPocket': 46,
|
||||||
'shoes': 47,
|
'shoes': 47,
|
||||||
'hammer': 48
|
'hammer': 48
|
||||||
|
},
|
||||||
|
'autotile': { // 所有的Autotile列表;后面的index简单取0即可
|
||||||
|
'autotile': 0,
|
||||||
|
'autotile1': 0,
|
||||||
|
'autotile2': 0,
|
||||||
|
'autotile3': 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
36
libs/maps.js
@ -34,7 +34,7 @@ maps.prototype.loadFloor = function (floorId, map) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.addEvent(block,j,i,floor.events[j+","+i])
|
this.addEvent(block,j,i,floor.events[j+","+i],floor.defaultGround || "ground")
|
||||||
this.addChangeFloor(block,j,i,floor.changeFloor[j+","+i]);
|
this.addChangeFloor(block,j,i,floor.changeFloor[j+","+i]);
|
||||||
if (core.isset(block.event)) blocks.push(block);
|
if (core.isset(block.event)) blocks.push(block);
|
||||||
}
|
}
|
||||||
@ -61,6 +61,8 @@ maps.prototype.getBlock = function (x, y, id) {
|
|||||||
var tmp = {'x': x, 'y': y, 'id': id};
|
var tmp = {'x': x, 'y': y, 'id': id};
|
||||||
if (enable!=null) tmp.enable = enable;
|
if (enable!=null) tmp.enable = enable;
|
||||||
|
|
||||||
|
////////////////////////// 地形部分 //////////////////////////
|
||||||
|
|
||||||
// 0-20 地形
|
// 0-20 地形
|
||||||
if (id == 1) tmp.event = {'cls': 'terrains', 'id': 'yellowWall'}; // 黄墙
|
if (id == 1) tmp.event = {'cls': 'terrains', 'id': 'yellowWall'}; // 黄墙
|
||||||
if (id == 2) tmp.event = {'cls': 'terrains', 'id': 'whiteWall'}; // 白墙
|
if (id == 2) tmp.event = {'cls': 'terrains', 'id': 'whiteWall'}; // 白墙
|
||||||
@ -77,9 +79,18 @@ maps.prototype.getBlock = function (x, y, id) {
|
|||||||
if (id == 13) tmp.event = {'cls': 'animates', 'id': 'weakNet', 'noPass': false, 'trigger': 'passNet'}; // 衰网
|
if (id == 13) tmp.event = {'cls': 'animates', 'id': 'weakNet', 'noPass': false, 'trigger': 'passNet'}; // 衰网
|
||||||
if (id == 14) tmp.event = {'cls': 'animates', 'id': 'curseNet', 'noPass': false, 'trigger': 'passNet'}; // 咒网
|
if (id == 14) tmp.event = {'cls': 'animates', 'id': 'curseNet', 'noPass': false, 'trigger': 'passNet'}; // 咒网
|
||||||
if (id == 15) tmp.event = {'cls': 'animates', 'id': 'water', 'noPass': true}; // 水
|
if (id == 15) tmp.event = {'cls': 'animates', 'id': 'water', 'noPass': true}; // 水
|
||||||
|
// 在这里添加更多地形
|
||||||
|
// 如果空地不足,可以从180以后开始继续放,只要不和现有的数字冲突即可
|
||||||
|
|
||||||
// autotile: 20
|
// Autotile
|
||||||
if (id == 20) tmp.event = {'cls': 'autotile', 'id': 'autotile', 'noPass': true}; // autotile
|
if (id == 20) tmp.event = {'cls': 'autotile', 'id': 'autotile', 'noPass': true}; // autotile
|
||||||
|
// 更多的autotile从151到160,只要不和现有的数字冲突即可
|
||||||
|
if (id == 151) tmp.event = {'cls': 'autotile', 'id': 'autotile1', 'noPass': true};
|
||||||
|
if (id == 152) tmp.event = {'cls': 'autotile', 'id': 'autotile2', 'noPass': true};
|
||||||
|
if (id == 153) tmp.event = {'cls': 'autotile', 'id': 'autotile3', 'noPass': true};
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////// 物品部分 //////////////////////////
|
||||||
|
|
||||||
// 21-80 物品
|
// 21-80 物品
|
||||||
if (id == 21) tmp.event = {'cls': 'items', 'id': 'yellowKey'}; // 黄钥匙
|
if (id == 21) tmp.event = {'cls': 'items', 'id': 'yellowKey'}; // 黄钥匙
|
||||||
@ -128,6 +139,9 @@ maps.prototype.getBlock = function (x, y, id) {
|
|||||||
if (id == 64) tmp.event = {'cls': 'items', 'id': 'shoes'} // 绿鞋
|
if (id == 64) tmp.event = {'cls': 'items', 'id': 'shoes'} // 绿鞋
|
||||||
if (id == 65) tmp.event = {'cls': 'items', 'id': 'hammer'} // 圣锤
|
if (id == 65) tmp.event = {'cls': 'items', 'id': 'hammer'} // 圣锤
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////// 门、楼梯、传送点部分 //////////////////////////
|
||||||
|
|
||||||
// 81-100 门
|
// 81-100 门
|
||||||
if (id == 81) tmp.event = {'cls': 'terrains', 'id': 'yellowDoor', 'trigger': 'openDoor'}; // 黄门
|
if (id == 81) tmp.event = {'cls': 'terrains', 'id': 'yellowDoor', 'trigger': 'openDoor'}; // 黄门
|
||||||
if (id == 82) tmp.event = {'cls': 'terrains', 'id': 'blueDoor', 'trigger': 'openDoor'}; // 蓝门
|
if (id == 82) tmp.event = {'cls': 'terrains', 'id': 'blueDoor', 'trigger': 'openDoor'}; // 蓝门
|
||||||
@ -145,6 +159,8 @@ maps.prototype.getBlock = function (x, y, id) {
|
|||||||
if (id == 94) tmp.event = {'cls': 'animates', 'id': 'rightPortal', 'noPass': false}; // 右箭头
|
if (id == 94) tmp.event = {'cls': 'animates', 'id': 'rightPortal', 'noPass': false}; // 右箭头
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////// NPC部分 //////////////////////////
|
||||||
|
|
||||||
// 121-150 NPC
|
// 121-150 NPC
|
||||||
if (id == 121) tmp.event = {'cls': 'npcs', 'id': 'man'};
|
if (id == 121) tmp.event = {'cls': 'npcs', 'id': 'man'};
|
||||||
if (id == 122) tmp.event = {'cls': 'npcs', 'id': 'woman'};
|
if (id == 122) tmp.event = {'cls': 'npcs', 'id': 'woman'};
|
||||||
@ -159,6 +175,8 @@ maps.prototype.getBlock = function (x, y, id) {
|
|||||||
if (id == 131) tmp.event = {'cls': 'npcs', 'id': 'blueShop'};
|
if (id == 131) tmp.event = {'cls': 'npcs', 'id': 'blueShop'};
|
||||||
if (id == 132) tmp.event = {'cls': 'npcs', 'id': 'princess'};
|
if (id == 132) tmp.event = {'cls': 'npcs', 'id': 'princess'};
|
||||||
|
|
||||||
|
////////////////////////// 其他部分 //////////////////////////
|
||||||
|
|
||||||
// 161-200 其他(单向箭头、灯、箱子等等)
|
// 161-200 其他(单向箭头、灯、箱子等等)
|
||||||
if (id == 161) tmp.event = {'cls': 'terrains', 'id': 'arrowUp', 'noPass': false}; // 单向上箭头
|
if (id == 161) tmp.event = {'cls': 'terrains', 'id': 'arrowUp', 'noPass': false}; // 单向上箭头
|
||||||
if (id == 162) tmp.event = {'cls': 'terrains', 'id': 'arrowDown', 'noPass': false}; // 单向下箭头
|
if (id == 162) tmp.event = {'cls': 'terrains', 'id': 'arrowDown', 'noPass': false}; // 单向下箭头
|
||||||
@ -167,6 +185,9 @@ maps.prototype.getBlock = function (x, y, id) {
|
|||||||
if (id == 165) tmp.event = {'cls': 'terrains', 'id': 'light', 'trigger': 'changeLight', 'noPass': false}; // 灯
|
if (id == 165) tmp.event = {'cls': 'terrains', 'id': 'light', 'trigger': 'changeLight', 'noPass': false}; // 灯
|
||||||
if (id == 166) tmp.event = {'cls': 'terrains', 'id': 'darkLight', 'noPass': true}; // 暗灯
|
if (id == 166) tmp.event = {'cls': 'terrains', 'id': 'darkLight', 'noPass': true}; // 暗灯
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////// 怪物部分 //////////////////////////
|
||||||
|
|
||||||
// 201-300 怪物
|
// 201-300 怪物
|
||||||
if (id == 201) tmp.event = {'cls': 'enemys', 'id': 'greenSlime'};
|
if (id == 201) tmp.event = {'cls': 'enemys', 'id': 'greenSlime'};
|
||||||
if (id == 202) tmp.event = {'cls': 'enemys', 'id': 'redSlime'};
|
if (id == 202) tmp.event = {'cls': 'enemys', 'id': 'redSlime'};
|
||||||
@ -229,13 +250,16 @@ maps.prototype.getBlock = function (x, y, id) {
|
|||||||
if (id == 259) tmp.event = {'cls': 'enemys', 'id': 'darkFairy'};
|
if (id == 259) tmp.event = {'cls': 'enemys', 'id': 'darkFairy'};
|
||||||
if (id == 260) tmp.event = {'cls': 'enemys', 'id': 'greenKnight'};
|
if (id == 260) tmp.event = {'cls': 'enemys', 'id': 'greenKnight'};
|
||||||
|
|
||||||
|
////////////////////////// 待定... //////////////////////////
|
||||||
|
// 目前ID暂时不要超过400
|
||||||
|
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
maps.prototype.addEvent = function (block, x, y, event) {
|
maps.prototype.addEvent = function (block, x, y, event, ground) {
|
||||||
if (!core.isset(event)) return;
|
if (!core.isset(event)) return;
|
||||||
if (!core.isset(block.event)) { // 本身是空地?
|
if (!core.isset(block.event)) { // 本身是空地?
|
||||||
block.event = {'cls': 'terrains', 'id': 'ground', 'noPass': false};
|
block.event = {'cls': 'terrains', 'id': ground, 'noPass': false};
|
||||||
}
|
}
|
||||||
// event是字符串或数组?
|
// event是字符串或数组?
|
||||||
if (typeof event == "string") {
|
if (typeof event == "string") {
|
||||||
@ -267,9 +291,9 @@ maps.prototype.addEvent = function (block, x, y, event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
maps.prototype.addChangeFloor = function (block, x, y, event) {
|
maps.prototype.addChangeFloor = function (block, x, y, event, ground) {
|
||||||
if (!core.isset(event)) return;
|
if (!core.isset(event)) return;
|
||||||
this.addEvent(block, x, y, {"trigger": "changeFloor", "data": event});
|
this.addEvent(block, x, y, {"trigger": "changeFloor", "data": event}, ground);
|
||||||
}
|
}
|
||||||
|
|
||||||
maps.prototype.initMaps = function (floorIds) {
|
maps.prototype.initMaps = function (floorIds) {
|
||||||
|
|||||||
251
libs/ui.js
@ -26,6 +26,8 @@ ui.prototype.closePanel = function (clearData) {
|
|||||||
core.unLockControl();
|
core.unLockControl();
|
||||||
core.status.event.data = null;
|
core.status.event.data = null;
|
||||||
core.status.event.id = null;
|
core.status.event.id = null;
|
||||||
|
core.status.event.selection = null;
|
||||||
|
core.status.event.ui = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -144,6 +146,8 @@ ui.prototype.drawChoices = function(content, choices) {
|
|||||||
core.setAlpha('ui', 1);
|
core.setAlpha('ui', 1);
|
||||||
core.setFillStyle('ui', background);
|
core.setFillStyle('ui', background);
|
||||||
|
|
||||||
|
core.status.event.ui = {"text": content, "choices": choices};
|
||||||
|
|
||||||
// Step 1: 计算长宽高
|
// Step 1: 计算长宽高
|
||||||
var length = choices.length;
|
var length = choices.length;
|
||||||
var left=85, width = 416-2*left; // 宽度
|
var left=85, width = 416-2*left; // 宽度
|
||||||
@ -258,10 +262,15 @@ ui.prototype.drawChoices = function(content, choices) {
|
|||||||
// 选项
|
// 选项
|
||||||
core.canvas.ui.textAlign = "center";
|
core.canvas.ui.textAlign = "center";
|
||||||
for (var i = 0; i < choices.length; i++) {
|
for (var i = 0; i < choices.length; i++) {
|
||||||
core.fillText('ui', core.replaceText(choices[i].text), 208, choice_top + 32 * i, "#FFFFFF", "bold 17px Verdana");
|
core.fillText('ui', core.replaceText(choices[i].text || choices[i]), 208, choice_top + 32 * i, "#FFFFFF", "bold 17px Verdana");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (choices.length>0) {
|
||||||
|
if (!core.isset(core.status.event.selection)) core.status.event.selection=0;
|
||||||
|
var len = core.canvas.ui.measureText(core.replaceText(choices[core.status.event.selection].text || choices[core.status.event.selection])).width;
|
||||||
|
core.strokeRect('ui', 208-len/2-5, choice_top + 32 * core.status.event.selection - 20, len+10, 28, "#FFD700", 2);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -271,8 +280,13 @@ ui.prototype.drawChoices = function(content, choices) {
|
|||||||
* @param noCallback
|
* @param noCallback
|
||||||
*/
|
*/
|
||||||
ui.prototype.drawConfirmBox = function (text, yesCallback, noCallback) {
|
ui.prototype.drawConfirmBox = function (text, yesCallback, noCallback) {
|
||||||
|
core.lockControl();
|
||||||
|
|
||||||
core.status.event.id = 'confirmBox';
|
core.status.event.id = 'confirmBox';
|
||||||
core.status.event.data = {'yes': yesCallback, 'no': noCallback};
|
core.status.event.data = {'yes': yesCallback, 'no': noCallback};
|
||||||
|
core.status.event.ui = text;
|
||||||
|
|
||||||
|
if (!core.isset(core.status.event.selection)) core.status.event.selection=1;
|
||||||
|
|
||||||
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui', 0, 0, 416, 416);
|
||||||
@ -291,7 +305,9 @@ ui.prototype.drawConfirmBox = function (text, yesCallback, noCallback) {
|
|||||||
var top = 140 - (lines-1)*30;
|
var top = 140 - (lines-1)*30;
|
||||||
var right = 416 - 2 * left, bottom = 416 - 140 - top;
|
var right = 416 - 2 * left, bottom = 416 - 140 - top;
|
||||||
|
|
||||||
|
if (core.isPlaying())
|
||||||
core.fillRect('ui', left, top, right, bottom, background);
|
core.fillRect('ui', left, top, right, bottom, background);
|
||||||
|
if (core.isPlaying())
|
||||||
core.strokeRect('ui', left - 1, top - 1, right + 1, bottom + 1, '#FFFFFF', 2);
|
core.strokeRect('ui', left - 1, top - 1, right + 1, bottom + 1, '#FFFFFF', 2);
|
||||||
core.canvas.ui.textAlign = "center";
|
core.canvas.ui.textAlign = "center";
|
||||||
for (var i in contents) {
|
for (var i in contents) {
|
||||||
@ -300,6 +316,15 @@ ui.prototype.drawConfirmBox = function (text, yesCallback, noCallback) {
|
|||||||
|
|
||||||
core.fillText('ui', "确定", 208 - 38, top + bottom - 35, "#FFFFFF", "bold 17px Verdana");
|
core.fillText('ui', "确定", 208 - 38, top + bottom - 35, "#FFFFFF", "bold 17px Verdana");
|
||||||
core.fillText('ui', "取消", 208 + 38, top + bottom - 35);
|
core.fillText('ui', "取消", 208 + 38, top + bottom - 35);
|
||||||
|
|
||||||
|
var len=core.canvas.ui.measureText("确定").width;
|
||||||
|
if (core.status.event.selection==0) {
|
||||||
|
core.strokeRect('ui', 208-38-len/2-5, top+bottom-35-20, len+10, 28, "#FFD700", 2);
|
||||||
|
}
|
||||||
|
if (core.status.event.selection==1) {
|
||||||
|
core.strokeRect('ui', 208+38-len/2-5, top+bottom-35-20, len+10, 28, "#FFD700", 2);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 绘制开关界面 //////
|
////// 绘制开关界面 //////
|
||||||
@ -308,22 +333,15 @@ ui.prototype.drawSwitchs = function() {
|
|||||||
|
|
||||||
core.status.event.id = 'switchs';
|
core.status.event.id = 'switchs';
|
||||||
|
|
||||||
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
var choices = [
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
"背景音乐:"+(core.musicStatus.soundStatus ? "[ON]" : "[OFF]"),
|
||||||
core.setAlpha('ui', 1);
|
"战斗动画: " + (core.flags.battleAnimate ? "[ON]" : "[OFF]"),
|
||||||
core.setFillStyle('ui', background);
|
"怪物显伤: " + (core.flags.displayEnemyDamage ? "[ON]" : "[OFF]"),
|
||||||
var left = 97, top = 64 + 32, right = 416 - 2 * left, bottom = 416 - 2 * top;
|
"领域显伤: " + (core.flags.displayExtraDamage ? "[ON]" : "[OFF]"),
|
||||||
core.fillRect('ui', left, top, right, bottom, background);
|
"返回主菜单"
|
||||||
core.strokeRect('ui', left - 1, top - 1, right + 1, bottom + 1, '#FFFFFF', 2);
|
];
|
||||||
|
this.drawChoices(null, choices);
|
||||||
|
|
||||||
core.canvas.ui.textAlign = "center";
|
|
||||||
core.fillText('ui', "背景音乐: " + (core.musicStatus.soundStatus ? "[ON]" : "[OFF]"), 208, top + 56, "#FFFFFF", "bold 17px Verdana");
|
|
||||||
// core.fillText('ui', "背景音效" + (core.musicStatus.soundStatus ? "[ON]" : "[OFF]"), 208, top + 88, "#FFFFFF", "bold 17px Verdana")
|
|
||||||
core.fillText('ui', "战斗动画: " + (core.flags.battleAnimate ? "[ON]" : "[OFF]"), 208, top + 88, "#FFFFFF", "bold 17px Verdana")
|
|
||||||
core.fillText('ui', "怪物显伤: " + (core.flags.displayEnemyDamage ? "[ON]" : "[OFF]"), 208, top + 120, "#FFFFFF", "bold 17px Verdana")
|
|
||||||
core.fillText('ui', "领域显伤: " + (core.flags.displayExtraDamage ? "[ON]" : "[OFF]"), 208, top + 152, "#FFFFFF", "bold 17px Verdana")
|
|
||||||
|
|
||||||
core.fillText('ui', "返回上级菜单", 208, top + 184, "#FFFFFF", "bold 17px Verdana");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -334,56 +352,27 @@ ui.prototype.drawSettings = function (need) {
|
|||||||
if (!core.checkStatus('settings', need))
|
if (!core.checkStatus('settings', need))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
this.drawChoices(null, [
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
"系统设置", "快捷商店", "同步存档", "重新开始", "操作帮助", "关于本塔", "返回游戏"
|
||||||
core.setAlpha('ui', 1);
|
]);
|
||||||
core.setFillStyle('ui', background);
|
|
||||||
var left = 97, top = 64, right = 416 - 2 * left, bottom = 416 - 2 * top;
|
|
||||||
core.fillRect('ui', left, top, right, bottom, background);
|
|
||||||
core.strokeRect('ui', left - 1, top - 1, right + 1, bottom + 1, '#FFFFFF', 2);
|
|
||||||
|
|
||||||
core.canvas.ui.textAlign = "center";
|
|
||||||
core.fillText('ui', "系统设置", 208, top + 56, "#FFFFFF", "bold 17px Verdana");
|
|
||||||
core.fillText('ui', "降低难度", 208, top + 88, "#FFFFFF", "bold 17px Verdana")
|
|
||||||
core.fillText('ui', "快捷商店", 208, top + 120, "#FFFFFF", "bold 17px Verdana");
|
|
||||||
core.fillText('ui', "同步存档", 208, top + 152, "#FFFFFF", "bold 17px Verdana");
|
|
||||||
// core.fillText('ui', "清空存档", 208, top + 152, "#FFFFFF", "bold 17px Verdana");
|
|
||||||
core.fillText('ui', "重新开始", 208, top + 184, "#FFFFFF", "bold 17px Verdana");
|
|
||||||
core.fillText('ui', "关于本塔", 208, top + 216, "#FFFFFF", "bold 17px Verdana");
|
|
||||||
core.fillText('ui', "返回游戏", 208, top + 248, "#FFFFFF", "bold 17px Verdana");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 绘制“选择商店”窗口
|
|
||||||
* @param need
|
|
||||||
*/
|
|
||||||
ui.prototype.drawQuickShop = function (need) {
|
ui.prototype.drawQuickShop = function (need) {
|
||||||
|
|
||||||
if (core.isset(need) && !core.checkStatus('selectShop', need))
|
if (core.isset(need) && !core.checkStatus('selectShop', need))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
core.status.event.id = 'selectShop';
|
core.status.event.id = 'selectShop';
|
||||||
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
|
||||||
core.setAlpha('ui', 1);
|
|
||||||
core.setFillStyle('ui', background);
|
|
||||||
|
|
||||||
var shopList = core.status.shops, keys = Object.keys(shopList);
|
var shopList = core.status.shops, keys = Object.keys(shopList);
|
||||||
var len = keys.length + 1;
|
|
||||||
if (len % 2 == 0) len++;
|
|
||||||
|
|
||||||
var left = 97, top = 208 - 32 - 16 * len, right = 416 - 2 * left, bottom = 416 - 2 * top;
|
var choices = [];
|
||||||
core.fillRect('ui', left, top, right, bottom, background);
|
|
||||||
core.strokeRect('ui', left - 1, top - 1, right + 1, bottom + 1, '#FFFFFF', 2);
|
|
||||||
|
|
||||||
core.canvas.ui.textAlign = "center";
|
|
||||||
for (var i=0;i<keys.length;i++) {
|
for (var i=0;i<keys.length;i++) {
|
||||||
core.fillText('ui', shopList[keys[i]].textInList, 208, top + 56 + 32 * i, "#FFFFFF", "bold 17px Verdana");
|
choices.push(shopList[keys[i]].textInList);
|
||||||
|
}
|
||||||
|
choices.push("返回游戏");
|
||||||
|
this.drawChoices(null, choices);
|
||||||
}
|
}
|
||||||
|
|
||||||
core.fillText('ui', "返回游戏", 208, top + bottom - 40, "#FFFFFF", "bold 17px Verdana");
|
|
||||||
}
|
|
||||||
|
|
||||||
ui.prototype.drawBattleAnimate = function(monsterId, callback) {
|
ui.prototype.drawBattleAnimate = function(monsterId, callback) {
|
||||||
|
|
||||||
@ -441,7 +430,10 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) {
|
|||||||
var left=10, right=416-2*left;
|
var left=10, right=416-2*left;
|
||||||
|
|
||||||
|
|
||||||
var lines = core.flags.enableExperience?5:4;
|
// var lines = core.flags.enableExperience?5:4;
|
||||||
|
var lines = 3;
|
||||||
|
if (core.flags.enableMDef || core.flags.enableMoney || core.flags.enableExperience) lines=4;
|
||||||
|
if (core.flags.enableMoney && core.flags.enableExperience) lines=5;
|
||||||
|
|
||||||
var lineHeight = 60;
|
var lineHeight = 60;
|
||||||
var height = lineHeight * lines + 50;
|
var height = lineHeight * lines + 50;
|
||||||
@ -454,6 +446,8 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) {
|
|||||||
core.setAlpha('ui', 1);
|
core.setAlpha('ui', 1);
|
||||||
core.strokeRect('ui', left - 1, top - 1, right + 1, bottom + 1, '#FFFFFF', 2);
|
core.strokeRect('ui', left - 1, top - 1, right + 1, bottom + 1, '#FFFFFF', 2);
|
||||||
core.clearMap('data',0,0,416,416);
|
core.clearMap('data',0,0,416,416);
|
||||||
|
|
||||||
|
clearInterval(core.interval.tipAnimate);
|
||||||
core.setAlpha('data', 1);
|
core.setAlpha('data', 1);
|
||||||
core.setOpacity('data', 1);
|
core.setOpacity('data', 1);
|
||||||
core.status.boxAnimateObjs = [];
|
core.status.boxAnimateObjs = [];
|
||||||
@ -524,7 +518,7 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) {
|
|||||||
if (core.flags.enableMDef) {
|
if (core.flags.enableMDef) {
|
||||||
textTop += lineHeight;
|
textTop += lineHeight;
|
||||||
core.canvas.ui.textAlign='left';
|
core.canvas.ui.textAlign='left';
|
||||||
core.fillText('ui', "魔防", left_start, textTop, '#DDDDDD', '16px Verdana');
|
core.fillText('ui', "护盾", left_start, textTop, '#DDDDDD', '16px Verdana');
|
||||||
core.drawLine('ui', left_start, textTop + 8, left_end, textTop + 8, '#FFFFFF', 2);
|
core.drawLine('ui', left_start, textTop + 8, left_end, textTop + 8, '#FFFFFF', 2);
|
||||||
core.canvas.data.textAlign='right';
|
core.canvas.data.textAlign='right';
|
||||||
core.fillText('data', hero_mdef, left_end, textTop+26, '#DDDDDD', 'bold 16px Verdana');
|
core.fillText('data', hero_mdef, left_end, textTop+26, '#DDDDDD', 'bold 16px Verdana');
|
||||||
@ -552,12 +546,14 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) {
|
|||||||
core.canvas.ui.textAlign='left';
|
core.canvas.ui.textAlign='left';
|
||||||
core.fillText('ui', mon_def, right_start, textTop+26, '#DDDDDD', 'bold 16px Verdana');
|
core.fillText('ui', mon_def, right_start, textTop+26, '#DDDDDD', 'bold 16px Verdana');
|
||||||
|
|
||||||
|
if (core.flags.enableMoney) {
|
||||||
textTop += lineHeight;
|
textTop += lineHeight;
|
||||||
core.canvas.ui.textAlign = 'right';
|
core.canvas.ui.textAlign = 'right';
|
||||||
core.fillText('ui', "金币", right_end, textTop, '#DDDDDD', '16px Verdana');
|
core.fillText('ui', "金币", right_end, textTop, '#DDDDDD', '16px Verdana');
|
||||||
core.drawLine('ui', right_start, textTop + 8, right_end, textTop + 8, '#FFFFFF', 2);
|
core.drawLine('ui', right_start, textTop + 8, right_end, textTop + 8, '#FFFFFF', 2);
|
||||||
core.canvas.ui.textAlign = 'left';
|
core.canvas.ui.textAlign = 'left';
|
||||||
core.fillText('ui', mon_money, right_start, textTop + 26, '#DDDDDD', 'bold 16px Verdana');
|
core.fillText('ui', mon_money, right_start, textTop + 26, '#DDDDDD', 'bold 16px Verdana');
|
||||||
|
}
|
||||||
|
|
||||||
if (core.flags.enableExperience) {
|
if (core.flags.enableExperience) {
|
||||||
textTop += lineHeight;
|
textTop += lineHeight;
|
||||||
@ -573,12 +569,6 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) {
|
|||||||
|
|
||||||
core.canvas.ui.textAlign='right';
|
core.canvas.ui.textAlign='right';
|
||||||
core.fillText("ui", "S", right_start-8, 208+15, "#FFFFFF", "italic bold 40px Verdana");
|
core.fillText("ui", "S", right_start-8, 208+15, "#FFFFFF", "italic bold 40px Verdana");
|
||||||
/*
|
|
||||||
core.drawLine('data', left + right - margin - boxWidth + 6, top+margin+boxWidth-6,
|
|
||||||
left+right-margin-6, top+margin+6, '#FF0000', 4);
|
|
||||||
core.drawLine('data', left + margin + 6, top+margin+heroHeight+(boxWidth-32)-6,
|
|
||||||
left+margin+boxWidth-6, top+margin+6, '#FF0000', 4);
|
|
||||||
*/
|
|
||||||
|
|
||||||
var battleInterval = setInterval(function() {
|
var battleInterval = setInterval(function() {
|
||||||
core.playSound("attack", "ogg");
|
core.playSound("attack", "ogg");
|
||||||
@ -603,8 +593,7 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) {
|
|||||||
|
|
||||||
// 反击
|
// 反击
|
||||||
if (core.enemys.hasSpecial(mon_special, 8)) {
|
if (core.enemys.hasSpecial(mon_special, 8)) {
|
||||||
var counterDamage = parseInt(core.values.counterAttack * hero_atk);
|
hero_mdef -= parseInt(core.values.counterAttack * hero_atk);
|
||||||
hero_mdef -= counterDamage;
|
|
||||||
|
|
||||||
if (hero_mdef<0) {
|
if (hero_mdef<0) {
|
||||||
hero_hp+=hero_mdef;
|
hero_hp+=hero_mdef;
|
||||||
@ -702,20 +691,11 @@ ui.prototype.drawWaiting = function(text) {
|
|||||||
ui.prototype.drawSyncSave = function () {
|
ui.prototype.drawSyncSave = function () {
|
||||||
|
|
||||||
core.status.event.id = 'syncSave';
|
core.status.event.id = 'syncSave';
|
||||||
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
|
||||||
core.setAlpha('ui', 1);
|
|
||||||
core.setFillStyle('ui', background);
|
|
||||||
|
|
||||||
var left = 97, top = 208 - 32 - 16 * 3, right = 416 - 2 * left, bottom = 416 - 2 * top + 32;
|
this.drawChoices(null, [
|
||||||
core.fillRect('ui', left, top, right, bottom, background);
|
"同步存档到服务器", "从服务器加载存档", "清空本地存档", "返回主菜单"
|
||||||
core.strokeRect('ui', left - 1, top - 1, right + 1, bottom + 1, '#FFFFFF', 2);
|
]);
|
||||||
|
|
||||||
core.canvas.ui.textAlign = "center";
|
|
||||||
core.fillText('ui', "同步存档到服务器", 208, top + 56, "#FFFFFF", "bold 17px Verdana");
|
|
||||||
core.fillText('ui', "从服务器加载存档", 208, top + 56 + 32, "#FFFFFF", "bold 17px Verdana");
|
|
||||||
core.fillText('ui', "清空本地存档", 208, top + 56 + 64, "#FFFFFF", "bold 17px Verdana");
|
|
||||||
core.fillText('ui', "返回游戏", 208, top + bottom - 40);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -816,25 +796,34 @@ ui.prototype.drawEnemyBook = function (page) {
|
|||||||
core.fillText('ui', enemy.atk, 285, 62 * i + 32, '#DDDDDD', 'bold 13px Verdana');
|
core.fillText('ui', enemy.atk, 285, 62 * i + 32, '#DDDDDD', 'bold 13px Verdana');
|
||||||
core.fillText('ui', '防御', 335, 62 * i + 32, '#DDDDDD', '13px Verdana');
|
core.fillText('ui', '防御', 335, 62 * i + 32, '#DDDDDD', '13px Verdana');
|
||||||
core.fillText('ui', enemy.def, 365, 62 * i + 32, '#DDDDDD', 'bold 13px Verdana');
|
core.fillText('ui', enemy.def, 365, 62 * i + 32, '#DDDDDD', 'bold 13px Verdana');
|
||||||
|
|
||||||
|
var expOffset = 165;
|
||||||
|
if (core.flags.enableMoney) {
|
||||||
core.fillText('ui', '金币', 165, 62 * i + 50, '#DDDDDD', '13px Verdana');
|
core.fillText('ui', '金币', 165, 62 * i + 50, '#DDDDDD', '13px Verdana');
|
||||||
core.fillText('ui', enemy.money, 195, 62 * i + 50, '#DDDDDD', 'bold 13px Verdana');
|
core.fillText('ui', enemy.money, 195, 62 * i + 50, '#DDDDDD', 'bold 13px Verdana');
|
||||||
|
expOffset = 255;
|
||||||
|
}
|
||||||
|
|
||||||
var damage_offset = 326;
|
|
||||||
if (core.flags.enableExperience) {
|
if (core.flags.enableExperience) {
|
||||||
core.canvas.ui.textAlign = "left";
|
core.canvas.ui.textAlign = "left";
|
||||||
core.fillText('ui', '经验', 255, 62 * i + 50, '#DDDDDD', '13px Verdana');
|
core.fillText('ui', '经验', expOffset, 62 * i + 50, '#DDDDDD', '13px Verdana');
|
||||||
core.fillText('ui', enemy.experience, 285, 62 * i + 50, '#DDDDDD', 'bold 13px Verdana');
|
core.fillText('ui', enemy.experience, expOffset + 30, 62 * i + 50, '#DDDDDD', 'bold 13px Verdana');
|
||||||
damage_offset = 361;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var damageOffet = 281;
|
||||||
|
if (core.flags.enableMoney && core.flags.enableExperience)
|
||||||
|
damageOffet = 361;
|
||||||
|
else if (core.flags.enableMoney || core.flags.enableExperience)
|
||||||
|
damageOffet = 326;
|
||||||
|
|
||||||
|
|
||||||
core.canvas.ui.textAlign = "center";
|
core.canvas.ui.textAlign = "center";
|
||||||
var damage = enemy.damage;
|
var damage = enemy.damage;
|
||||||
var color = '#FFFF00';
|
var color = '#FFFF00';
|
||||||
if (damage >= core.status.hero.hp) color = '#FF0000';
|
if (damage >= core.status.hero.hp) color = '#FF0000';
|
||||||
if (damage == 0) color = '#00FF00';
|
if (damage <= 0) color = '#00FF00';
|
||||||
if (damage >= 999999999) damage = '无法战斗';
|
if (damage >= 999999999) damage = '无法战斗';
|
||||||
var length = core.canvas.ui.measureText(damage).width;
|
core.fillText('ui', damage, damageOffet, 62 * i + 50, color, 'bold 13px Verdana');
|
||||||
core.fillText('ui', damage, damage_offset, 62 * i + 50, color, 'bold 13px Verdana');
|
|
||||||
|
|
||||||
core.canvas.ui.textAlign = "left";
|
core.canvas.ui.textAlign = "left";
|
||||||
|
|
||||||
@ -876,17 +865,29 @@ ui.prototype.drawFly = function(page) {
|
|||||||
if (page>0)
|
if (page>0)
|
||||||
core.fillText('ui', '▼', 356, 247+64, '#FFFFFF', "17px Verdana");
|
core.fillText('ui', '▼', 356, 247+64, '#FFFFFF', "17px Verdana");
|
||||||
core.strokeRect('ui', 20, 100, 273, 273, '#FFFFFF', 2);
|
core.strokeRect('ui', 20, 100, 273, 273, '#FFFFFF', 2);
|
||||||
this.drawThumbnail('ui', core.status.maps[floorId].blocks, 20, 100, 273);
|
this.drawThumbnail(floorId, 'ui', core.status.maps[floorId].blocks, 20, 100, 273);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
ui.prototype.drawToolbox = function(index) {
|
||||||
* 绘制工具栏
|
|
||||||
* @param selectId
|
|
||||||
*/
|
|
||||||
ui.prototype.drawToolbox = function(selectId) {
|
|
||||||
|
|
||||||
if (!core.hasItem(selectId))
|
var tools = Object.keys(core.status.hero.items.tools).sort();
|
||||||
selectId=null;
|
var constants = Object.keys(core.status.hero.items.constants).sort();
|
||||||
|
|
||||||
|
if (!core.isset(index)) {
|
||||||
|
if (tools.length>0) index=0;
|
||||||
|
else if (constants.length>0) index=100;
|
||||||
|
else index=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
core.status.event.selection=index;
|
||||||
|
|
||||||
|
var selectId;
|
||||||
|
if (index<100)
|
||||||
|
selectId = tools[index];
|
||||||
|
else
|
||||||
|
selectId = constants[index-100];
|
||||||
|
|
||||||
|
if (!core.hasItem(selectId)) selectId=null;
|
||||||
core.status.event.data=selectId;
|
core.status.event.data=selectId;
|
||||||
|
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui', 0, 0, 416, 416);
|
||||||
@ -937,7 +938,7 @@ ui.prototype.drawToolbox = function(selectId) {
|
|||||||
core.canvas.ui.textAlign = 'right';
|
core.canvas.ui.textAlign = 'right';
|
||||||
var images = core.material.images.items;
|
var images = core.material.images.items;
|
||||||
// 消耗道具
|
// 消耗道具
|
||||||
var tools = Object.keys(core.status.hero.items.tools).sort();
|
|
||||||
for (var i=0;i<tools.length;i++) {
|
for (var i=0;i<tools.length;i++) {
|
||||||
var tool=tools[i];
|
var tool=tools[i];
|
||||||
var icon=core.material.icons.items[tool];
|
var icon=core.material.icons.items[tool];
|
||||||
@ -959,7 +960,7 @@ ui.prototype.drawToolbox = function(selectId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 永久道具
|
// 永久道具
|
||||||
var constants = Object.keys(core.status.hero.items.constants).sort();
|
|
||||||
for (var i=0;i<constants.length;i++) {
|
for (var i=0;i<constants.length;i++) {
|
||||||
var constant=constants[i];
|
var constant=constants[i];
|
||||||
var icon=core.material.icons.items[constant];
|
var icon=core.material.icons.items[constant];
|
||||||
@ -981,16 +982,18 @@ ui.prototype.drawToolbox = function(selectId) {
|
|||||||
core.fillText('ui', '返回游戏', 370, 403,'#DDDDDD', 'bold 15px Verdana');
|
core.fillText('ui', '返回游戏', 370, 403,'#DDDDDD', 'bold 15px Verdana');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 绘制存档、读档
|
|
||||||
* @param page
|
|
||||||
*/
|
|
||||||
ui.prototype.drawSLPanel = function(page) {
|
|
||||||
|
|
||||||
if (page<0) page=0;
|
ui.prototype.drawSLPanel = function(index) {
|
||||||
if (page>=30) page=29;
|
if (!core.isset(index)) index=1;
|
||||||
core.status.event.data = page;
|
if (index<=0) index=1;
|
||||||
core.status.savePage = page;
|
if (index>180) index=180;
|
||||||
|
|
||||||
|
core.status.event.data=index;
|
||||||
|
|
||||||
|
var page=parseInt((index-1)/6);
|
||||||
|
|
||||||
|
// core.status.event.data = page;
|
||||||
|
// core.status.savePage = page;
|
||||||
|
|
||||||
core.clearMap('ui', 0, 0, 416, 416);
|
core.clearMap('ui', 0, 0, 416, 416);
|
||||||
core.setAlpha('ui', 0.85);
|
core.setAlpha('ui', 0.85);
|
||||||
@ -1007,9 +1010,9 @@ ui.prototype.drawSLPanel = function(page) {
|
|||||||
|
|
||||||
if (i<3) {
|
if (i<3) {
|
||||||
core.fillText('ui', name+id, (2*i+1)*u, 35, '#FFFFFF', "bold 17px Verdana");
|
core.fillText('ui', name+id, (2*i+1)*u, 35, '#FFFFFF', "bold 17px Verdana");
|
||||||
core.strokeRect('ui', (2*i+1)*u-size/2, 50, size, size, '#FFFFFF', 2);
|
core.strokeRect('ui', (2*i+1)*u-size/2, 50, size, size, id==index?'#FFD700':'#FFFFFF', id==index?6:2);
|
||||||
if (core.isset(data) && core.isset(data.floorId)) {
|
if (core.isset(data) && core.isset(data.floorId)) {
|
||||||
this.drawThumbnail('ui', core.maps.load(data.maps, data.floorId).blocks, (2*i+1)*u-size/2, 50, size, data.hero.loc);
|
this.drawThumbnail(data.floorId, 'ui', core.maps.load(data.maps, data.floorId).blocks, (2*i+1)*u-size/2, 50, size, data.hero.loc);
|
||||||
core.fillText('ui', core.formatDate(new Date(data.time)), (2*i+1)*u, 65+size, '#FFFFFF', '10px Verdana');
|
core.fillText('ui', core.formatDate(new Date(data.time)), (2*i+1)*u, 65+size, '#FFFFFF', '10px Verdana');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1019,9 +1022,9 @@ ui.prototype.drawSLPanel = function(page) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.fillText('ui', name+id, (2*i-5)*u, 230, '#FFFFFF', "bold 17px Verdana");
|
core.fillText('ui', name+id, (2*i-5)*u, 230, '#FFFFFF', "bold 17px Verdana");
|
||||||
core.strokeRect('ui', (2*i-5)*u-size/2, 245, size, size, '#FFFFFF', 2);
|
core.strokeRect('ui', (2*i-5)*u-size/2, 245, size, size, id==index?'#FFD700':'#FFFFFF', id==index?6:2);
|
||||||
if (core.isset(data) && core.isset(data.floorId)) {
|
if (core.isset(data) && core.isset(data.floorId)) {
|
||||||
this.drawThumbnail('ui', core.maps.load(data.maps, data.floorId).blocks, (2*i-5)*u-size/2, 245, size, data.hero.loc);
|
this.drawThumbnail(data.floorId, 'ui', core.maps.load(data.maps, data.floorId).blocks, (2*i-5)*u-size/2, 245, size, data.hero.loc);
|
||||||
core.fillText('ui', core.formatDate(new Date(data.time)), (2*i-5)*u, 260+size, '#FFFFFF', '10px Verdana');
|
core.fillText('ui', core.formatDate(new Date(data.time)), (2*i-5)*u, 260+size, '#FFFFFF', '10px Verdana');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1031,16 +1034,16 @@ ui.prototype.drawSLPanel = function(page) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.drawPagination(page+1, 30);
|
this.drawPagination(page+1, 30);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.prototype.drawThumbnail = function(canvas, blocks, x, y, size, heroLoc) {
|
ui.prototype.drawThumbnail = function(floorId, canvas, blocks, x, y, size, heroLoc) {
|
||||||
core.clearMap(canvas, x, y, size, size);
|
core.clearMap(canvas, x, y, size, size);
|
||||||
|
var groundId = core.floors[floorId].defaultGround || "ground";
|
||||||
|
var blockIcon = core.material.icons.terrains[groundId];
|
||||||
|
var blockImage = core.material.images.terrains;
|
||||||
var persize = size/13;
|
var persize = size/13;
|
||||||
for (var i=0;i<13;i++) {
|
for (var i=0;i<13;i++) {
|
||||||
for (var j=0;j<13;j++) {
|
for (var j=0;j<13;j++) {
|
||||||
var blockIcon = core.material.icons.terrains.ground;
|
|
||||||
var blockImage = core.material.images.terrains;
|
|
||||||
core.canvas[canvas].drawImage(blockImage, 0, blockIcon * 32, 32, 32, x + i * persize, y + j * persize, persize, persize);
|
core.canvas[canvas].drawImage(blockImage, 0, blockIcon * 32, 32, 32, x + i * persize, y + j * persize, persize, persize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1050,7 +1053,7 @@ ui.prototype.drawThumbnail = function(canvas, blocks, x, y, size, heroLoc) {
|
|||||||
if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable)) {
|
if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable)) {
|
||||||
if (block.event.cls == 'autotile') {
|
if (block.event.cls == 'autotile') {
|
||||||
// core.drawAutotile();
|
// core.drawAutotile();
|
||||||
autotileMaps[13*block.x + block.y] = true;
|
autotileMaps[13*block.x + block.y] = block.event.id;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1060,7 +1063,7 @@ ui.prototype.drawThumbnail = function(canvas, blocks, x, y, size, heroLoc) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
core.drawAutotile('ui', autotileMaps, x, y, persize);
|
core.drawAutotile(floorId, 'ui', autotileMaps, x, y, persize);
|
||||||
|
|
||||||
if (core.isset(heroLoc)) {
|
if (core.isset(heroLoc)) {
|
||||||
var heroIcon = core.material.icons.hero[heroLoc.direction];
|
var heroIcon = core.material.icons.hero[heroLoc.direction];
|
||||||
@ -1109,3 +1112,27 @@ ui.prototype.drawAbout = function() {
|
|||||||
core.fillText('ui', 'HTML5魔塔交流群:539113091', text_start, top+304);
|
core.fillText('ui', 'HTML5魔塔交流群:539113091', text_start, top+304);
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui.prototype.drawHelp = function () {
|
||||||
|
core.drawText([
|
||||||
|
"\t[键盘快捷键列表]"+
|
||||||
|
"[CTRL] 跳过对话\n" +
|
||||||
|
"[X] 打开/关闭怪物手册\n" +
|
||||||
|
"[G] 打开/关闭楼层传送器\n" +
|
||||||
|
"[S/D] 打开/关闭存/读档页面\n" +
|
||||||
|
"[K] 打开/关闭快捷商店选择列表\n" +
|
||||||
|
"[T] 打开/关闭工具栏\n" +
|
||||||
|
"[ESC] 打开/关闭系统菜单\n" +
|
||||||
|
"[H] 打开帮助页面\n"+
|
||||||
|
"[SPACE] 轻按(仅在轻按开关打开时有效)\n" +
|
||||||
|
"[1] 快捷使用破墙镐\n" +
|
||||||
|
"[2] 快捷使用炸弹/圣锤\n" +
|
||||||
|
"[3] 快捷使用中心对称飞行器",
|
||||||
|
"\t[鼠标操作]"+
|
||||||
|
"点状态栏中图标: 进行对应的操作\n"+
|
||||||
|
"点任意块: 寻路并移动\n"+
|
||||||
|
"点任意块并拖动: 指定寻路路线\n"+
|
||||||
|
"单击勇士: 转向\n"+
|
||||||
|
"双击勇士: 轻按(仅在轻按开关打开时有效)"
|
||||||
|
]);
|
||||||
|
}
|
||||||
27
main.js
@ -20,6 +20,7 @@ function main() {
|
|||||||
'toolBar': document.getElementById('toolBar'),
|
'toolBar': document.getElementById('toolBar'),
|
||||||
'tools': document.getElementsByClassName('tools'),
|
'tools': document.getElementsByClassName('tools'),
|
||||||
'gameCanvas': document.getElementsByClassName('gameCanvas'),
|
'gameCanvas': document.getElementsByClassName('gameCanvas'),
|
||||||
|
'curtain': document.getElementById('curtain'),
|
||||||
'startButtons': document.getElementById('startButtons'),
|
'startButtons': document.getElementById('startButtons'),
|
||||||
'playGame': document.getElementById('playGame'),
|
'playGame': document.getElementById('playGame'),
|
||||||
'loadGame': document.getElementById('loadGame'),
|
'loadGame': document.getElementById('loadGame'),
|
||||||
@ -30,17 +31,21 @@ function main() {
|
|||||||
'hardLevel': document.getElementById('hardLevel'),
|
'hardLevel': document.getElementById('hardLevel'),
|
||||||
'data': document.getElementById('data'),
|
'data': document.getElementById('data'),
|
||||||
'statusLabels': document.getElementsByClassName('statusLabel'),
|
'statusLabels': document.getElementsByClassName('statusLabel'),
|
||||||
|
'floorCol': document.getElementById('floorCol'),
|
||||||
|
'lvCol': document.getElementById('lvCol'),
|
||||||
'mdefCol': document.getElementById('mdefCol'),
|
'mdefCol': document.getElementById('mdefCol'),
|
||||||
|
'moneyCol': document.getElementById('moneyCol'),
|
||||||
'expCol': document.getElementById('expCol'),
|
'expCol': document.getElementById('expCol'),
|
||||||
|
'upCol': document.getElementById('upCol'),
|
||||||
|
'debuffCol': document.getElementById('debuffCol'),
|
||||||
|
'hard': document.getElementById('hard'),
|
||||||
};
|
};
|
||||||
// console.log('加载游戏容器和开始界面dom对象完成 如下');
|
|
||||||
// console.log(this.dom);
|
|
||||||
this.loadList = [
|
this.loadList = [
|
||||||
'items', 'icons', 'maps', 'enemys', 'events', 'data', 'ui', 'core'
|
'items', 'icons', 'maps', 'enemys', 'events', 'data', 'ui', 'core'
|
||||||
];
|
];
|
||||||
// console.log('加载js文件列表加载完成' + this.loadList);
|
|
||||||
this.images = [
|
this.images = [
|
||||||
'animates', 'enemys', 'hero', 'items', 'npcs', 'terrains', "autotile"
|
'animates', 'enemys', 'hero', 'items', 'npcs', 'terrains'
|
||||||
|
// Autotile 动态添加
|
||||||
];
|
];
|
||||||
this.sounds = {
|
this.sounds = {
|
||||||
'mp3': ['bgm-loop', 'floor'],
|
'mp3': ['bgm-loop', 'floor'],
|
||||||
@ -49,12 +54,14 @@ function main() {
|
|||||||
this.statusBar = {
|
this.statusBar = {
|
||||||
'image': {
|
'image': {
|
||||||
'floor': document.getElementById('img-floor'),
|
'floor': document.getElementById('img-floor'),
|
||||||
|
'lv': document.getElementById('img-lv'),
|
||||||
'hp': document.getElementById("img-hp"),
|
'hp': document.getElementById("img-hp"),
|
||||||
'atk': document.getElementById("img-atk"),
|
'atk': document.getElementById("img-atk"),
|
||||||
'def': document.getElementById("img-def"),
|
'def': document.getElementById("img-def"),
|
||||||
'mdef': document.getElementById("img-mdef"),
|
'mdef': document.getElementById("img-mdef"),
|
||||||
'money': document.getElementById("img-money"),
|
'money': document.getElementById("img-money"),
|
||||||
'experience': document.getElementById("img-experience"),
|
'experience': document.getElementById("img-experience"),
|
||||||
|
'up': document.getElementById("img-up"),
|
||||||
'book': document.getElementById("img-book"),
|
'book': document.getElementById("img-book"),
|
||||||
'fly': document.getElementById("img-fly"),
|
'fly': document.getElementById("img-fly"),
|
||||||
'toolbox': document.getElementById("img-toolbox"),
|
'toolbox': document.getElementById("img-toolbox"),
|
||||||
@ -64,12 +71,14 @@ function main() {
|
|||||||
'settings': document.getElementById("img-settings")
|
'settings': document.getElementById("img-settings")
|
||||||
},
|
},
|
||||||
'floor': document.getElementById('floor'),
|
'floor': document.getElementById('floor'),
|
||||||
|
'lv': document.getElementById('lv'),
|
||||||
'hp': document.getElementById('hp'),
|
'hp': document.getElementById('hp'),
|
||||||
'atk': document.getElementById('atk'),
|
'atk': document.getElementById('atk'),
|
||||||
'def': document.getElementById("def"),
|
'def': document.getElementById("def"),
|
||||||
'mdef': document.getElementById('mdef'),
|
'mdef': document.getElementById('mdef'),
|
||||||
'money': document.getElementById("money"),
|
'money': document.getElementById("money"),
|
||||||
'experience': document.getElementById("experience"),
|
'experience': document.getElementById("experience"),
|
||||||
|
'up': document.getElementById('up'),
|
||||||
'yellowKey': document.getElementById("yellowKey"),
|
'yellowKey': document.getElementById("yellowKey"),
|
||||||
'blueKey': document.getElementById("blueKey"),
|
'blueKey': document.getElementById("blueKey"),
|
||||||
'redKey': document.getElementById("redKey"),
|
'redKey': document.getElementById("redKey"),
|
||||||
@ -78,6 +87,8 @@ function main() {
|
|||||||
'curse': document.getElementById('curse'),
|
'curse': document.getElementById('curse'),
|
||||||
'hard': document.getElementById("hard")
|
'hard': document.getElementById("hard")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------ 用户修改内容 ------------------------//
|
||||||
this.version = "0.1"; // 游戏版本号;如果更改了游戏内容建议修改此version以免造成缓存问题。
|
this.version = "0.1"; // 游戏版本号;如果更改了游戏内容建议修改此version以免造成缓存问题。
|
||||||
|
|
||||||
this.useCompress = false; // 是否使用压缩文件
|
this.useCompress = false; // 是否使用压缩文件
|
||||||
@ -86,8 +97,10 @@ function main() {
|
|||||||
// 如果要进行剧本的修改请务必将其改成false。
|
// 如果要进行剧本的修改请务必将其改成false。
|
||||||
|
|
||||||
this.floorIds = [ // 在这里按顺序放所有的楼层;其顺序直接影响到楼层传送器的顺序和上楼器/下楼器的顺序
|
this.floorIds = [ // 在这里按顺序放所有的楼层;其顺序直接影响到楼层传送器的顺序和上楼器/下楼器的顺序
|
||||||
"sample0", "sample1", "sample2"
|
"sample0", "sample1", "sample2", "test"
|
||||||
]
|
]
|
||||||
|
//------------------------ 用户修改内容 END ------------------------//
|
||||||
|
|
||||||
this.floors = {}
|
this.floors = {}
|
||||||
this.instance = {};
|
this.instance = {};
|
||||||
this.canvas = {};
|
this.canvas = {};
|
||||||
@ -193,14 +206,14 @@ window.onresize = function () {
|
|||||||
|
|
||||||
main.dom.body.onkeydown = function(e) {
|
main.dom.body.onkeydown = function(e) {
|
||||||
try {
|
try {
|
||||||
if (main.core.isPlaying())
|
if (main.core.isPlaying() || main.core.status.lockControl)
|
||||||
main.core.onkeyDown(e);
|
main.core.onkeyDown(e);
|
||||||
} catch (ee) {}
|
} catch (ee) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
main.dom.body.onkeyup = function(e) {
|
main.dom.body.onkeyup = function(e) {
|
||||||
try {
|
try {
|
||||||
if (main.core.isPlaying())
|
if (main.core.isPlaying() || main.core.status.lockControl)
|
||||||
main.core.onkeyUp(e);
|
main.core.onkeyUp(e);
|
||||||
} catch (ee) {}
|
} catch (ee) {}
|
||||||
}
|
}
|
||||||
|
|||||||
44
styles.css
@ -21,7 +21,7 @@
|
|||||||
position: fixed;
|
position: fixed;
|
||||||
top: 10px;
|
top: 10px;
|
||||||
left: 10px;
|
left: 10px;
|
||||||
z-index: 12;
|
z-index: 13;
|
||||||
}
|
}
|
||||||
|
|
||||||
#startPanel {
|
#startPanel {
|
||||||
@ -32,7 +32,7 @@
|
|||||||
left: 0;
|
left: 0;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
z-index: 8;
|
z-index: 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
#startTop {
|
#startTop {
|
||||||
@ -42,7 +42,7 @@
|
|||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
background-color: #000;
|
background-color: #000;
|
||||||
z-index: 11;
|
z-index: 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
#startTopProgressBar {
|
#startTopProgressBar {
|
||||||
@ -52,7 +52,7 @@
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
top: 5%;
|
top: 5%;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
z-index: 12;
|
z-index: 13;
|
||||||
}
|
}
|
||||||
|
|
||||||
#startTopProgress {
|
#startTopProgress {
|
||||||
@ -67,7 +67,7 @@
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
top: 8%;
|
top: 8%;
|
||||||
left: 5%;
|
left: 5%;
|
||||||
z-index: 12;
|
z-index: 13;
|
||||||
}
|
}
|
||||||
|
|
||||||
#startBackground {
|
#startBackground {
|
||||||
@ -77,12 +77,12 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
width: auto;
|
width: auto;
|
||||||
transform:translate(-50%,-50%);
|
transform:translate(-50%,-50%);
|
||||||
z-index: 9;
|
z-index: 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
#startLogo {
|
#startLogo {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 9;
|
z-index: 10;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
@ -95,7 +95,7 @@
|
|||||||
|
|
||||||
#startTitle {
|
#startTitle {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 10;
|
z-index: 11;
|
||||||
}
|
}
|
||||||
|
|
||||||
#startButtonGroup {
|
#startButtonGroup {
|
||||||
@ -106,7 +106,7 @@
|
|||||||
background-color: #000;
|
background-color: #000;
|
||||||
opacity: 0.85;
|
opacity: 0.85;
|
||||||
display: none;
|
display: none;
|
||||||
z-index: 9;
|
z-index: 10;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
margin-bottom: 7%;
|
margin-bottom: 7%;
|
||||||
}
|
}
|
||||||
@ -142,7 +142,7 @@
|
|||||||
display: none;
|
display: none;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
background-color: #000;
|
background-color: #000;
|
||||||
z-index: 7;
|
z-index: 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
#logoLabel {
|
#logoLabel {
|
||||||
@ -170,7 +170,7 @@
|
|||||||
-moz-box-sizing: border-box;
|
-moz-box-sizing: border-box;
|
||||||
-webkit-box-sizing: border-box;
|
-webkit-box-sizing: border-box;
|
||||||
background: url(images/ground.png) round;
|
background: url(images/ground.png) round;
|
||||||
z-index: 6;
|
z-index: 7;
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
#statusBar .status{
|
#statusBar .status{
|
||||||
@ -180,8 +180,9 @@
|
|||||||
}
|
}
|
||||||
.status img{
|
.status img{
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
width: 1.6em;
|
width: auto;
|
||||||
height: 1.6em;
|
height: 100%;
|
||||||
|
max-height: 1.6em;
|
||||||
}
|
}
|
||||||
#statusBar span{
|
#statusBar span{
|
||||||
color: white;
|
color: white;
|
||||||
@ -198,7 +199,7 @@
|
|||||||
#toolBar {
|
#toolBar {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
background: url(images/ground.png) round;
|
background: url(images/ground.png) round;
|
||||||
z-index: 5;
|
z-index: 6;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
-moz-box-sizing: border-box;
|
-moz-box-sizing: border-box;
|
||||||
-webkit-box-sizing: border-box;
|
-webkit-box-sizing: border-box;
|
||||||
@ -232,6 +233,13 @@ span#poison, span#weak, span#curse {
|
|||||||
-webkit-box-sizing: border-box;
|
-webkit-box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#curtain {
|
||||||
|
z-index: 5;
|
||||||
|
position: absolute;
|
||||||
|
opacity: 0;
|
||||||
|
background: #000000;
|
||||||
|
}
|
||||||
|
|
||||||
#bg {
|
#bg {
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
@ -240,20 +248,20 @@ span#poison, span#weak, span#curse {
|
|||||||
z-index: 2;
|
z-index: 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
#hero {
|
#fg {
|
||||||
z-index: 3;
|
z-index: 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
#fg {
|
#hero {
|
||||||
z-index: 4;
|
z-index: 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ui {
|
#ui {
|
||||||
z-index: 5;
|
z-index: 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
#data {
|
#data {
|
||||||
z-index: 6;
|
z-index: 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
.clearfix:before,
|
.clearfix:before,
|
||||||
|
|||||||
BIN
常用工具/便捷PS工具.exe
BIN
常用工具/地图生成器.exe
49
快捷键说明.txt
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
快捷键说明:
|
||||||
|
|
||||||
|
=== 全局 ===
|
||||||
|
[↑][↓][←][→] 移动勇士
|
||||||
|
[CTRL] 跳过对话
|
||||||
|
[X] 打开/关闭怪物手册
|
||||||
|
[G] 打开/关闭楼层传送器
|
||||||
|
[S] 打开/关闭存档页面
|
||||||
|
[D] 打开/关闭读档页面
|
||||||
|
[K] 打开/关闭快捷商店选择列表
|
||||||
|
[T] 打开/关闭工具栏
|
||||||
|
[ESC] 打开/关闭系统菜单
|
||||||
|
[H] 打开帮助页面
|
||||||
|
[SPACE] 轻按(仅在轻按开关打开时有效)
|
||||||
|
[1] 快捷使用破墙镐
|
||||||
|
[2] 快捷使用炸弹/圣锤(先检测有没有炸弹,没有再检测圣锤)
|
||||||
|
[3] 快捷使用中心对称飞行器
|
||||||
|
|
||||||
|
=== 文本显示界面 ===
|
||||||
|
[SPACE]/[ENTER] 继续
|
||||||
|
|
||||||
|
=== 选项列表 ===
|
||||||
|
[↑][↓] 移动当前选择项
|
||||||
|
[ESC] 返回
|
||||||
|
[SPACE]/[ENTER] 确认该选项
|
||||||
|
|
||||||
|
=== 怪物手册页面 ===
|
||||||
|
[↑][↓][←][→] 翻页
|
||||||
|
[ESC]/[X] 关闭怪物手册
|
||||||
|
|
||||||
|
=== 楼传器页面 ===
|
||||||
|
[↑][↓][←][→] 更改楼层
|
||||||
|
[SPACE]/[ENTER] 确认传送
|
||||||
|
[ESC]/[G] 关闭楼传器
|
||||||
|
|
||||||
|
=== 道具栏页面 ===
|
||||||
|
[↑][↓][←][→] 更改当前道具
|
||||||
|
[SPACE]/[ENTER] 确认使用道具
|
||||||
|
[ESC]/[T] 关闭道具栏
|
||||||
|
|
||||||
|
=== 存读档页面 ===
|
||||||
|
[↑][↓][←][→] 更改当前存读档位置
|
||||||
|
[PAGEUP][PAGEDOWN] 存读档翻页
|
||||||
|
[SPACE]/[ENTER] 确认存读档
|
||||||
|
[ESC]/[S]/[D] 关闭存读档界面
|
||||||
|
|
||||||
|
=== 正在使用中心对称飞行器时 ===
|
||||||
|
[3]/[SPACE]/[ENTER] 确认飞行
|
||||||
|
其他键 取消飞行
|
||||||