Merge branch 'ckcz123-master'
@ -6,7 +6,8 @@ HTML5 canvas制作的魔塔样板,支持全平台游戏!
|
||||
**即使完全不会编程的用户,按照模板和说明文档也能很快做出一个魔塔游戏!**
|
||||
|
||||
* [Demo / 样板效果](https://ckcz123.com/games/template/)
|
||||
* [Docs / 使用文档说明](https://ckcz123.github.io/mota-js)
|
||||
* [Docs / 使用文档说明](https://ckcz123.github.io/mota-js/)
|
||||
* [Video / 视频教程](http://www.bilibili.com/video/av17608025/)
|
||||
|
||||

|
||||
|
||||
|
||||
63
_server/editor_file.js
Normal file
@ -0,0 +1,63 @@
|
||||
(function(){
|
||||
|
||||
editor_file = {};
|
||||
editor_file.getFloorFileList = function(editor,callback){
|
||||
if (isset(callback)) callback(['simple0.js','simple1.js','simple2.js'],null);
|
||||
}
|
||||
//callback(Array<String>,err:String)
|
||||
editor_file.loadFloorFile = function(editor,filename,callback){
|
||||
if (isset(callback)) callback('',null);
|
||||
}
|
||||
//callback(String,err:String)
|
||||
editor_file.saveFloorFile = function(editor,callback){
|
||||
if (isset(callback)) callback(null);
|
||||
}
|
||||
//callback(err:String)
|
||||
editor_file.saveFloorFile = function(editor,saveAsFilename,callback){
|
||||
if (isset(callback)) callback(null);
|
||||
}
|
||||
//callback(err:String)
|
||||
editor_file.changeIdAndIdnum = function(editor,id,idnum,callback){
|
||||
if (isset(callback)) callback(null);
|
||||
}
|
||||
//callback(err:String)
|
||||
editor_file.editItem = function(editor,id,callback){
|
||||
if (isset(callback)) callback('',null);
|
||||
}
|
||||
//callback(String,err:String)
|
||||
editor_file.editEnemy = function(editor,id,callback){
|
||||
if (isset(callback)) callback({'name': '初级巫师', 'hp': 100, 'atk': 120, 'def': 0, 'money': 16, 'experience': 0, 'special': 15, 'value': 100},null);
|
||||
}
|
||||
//callback(obj,err:String)
|
||||
editor_file.editLoc = function(editor,x,y,input_value,callback){
|
||||
if (isset(callback)) callback({"events":` [ // 守着道具的老人
|
||||
"\t[老人,man]这些是本样板支持的所有的道具。\n\n道具分为三类:items, constants, tools。\nitems 为即捡即用类道具,例如宝石、血瓶、剑盾等。\nconstants 为永久道具,例如怪物手册、楼层传送器、幸运金币等。\ntools 为消耗类道具,例如破墙镐、炸弹、中心对称飞行器等。\n\n后两类道具在工具栏中可以看到并使用。",
|
||||
"\t[老人,man]有关道具效果,定义在items.js中。\n目前大多数道具已有默认行为,如有自定义的需求则需在items.js中修改代码。",
|
||||
"\t[老人,man]constants 和 tools 各最多只允许12种,多了会导致图标溢出。",
|
||||
"\t[老人,man]拾取道具结束后可触发 afterGetItem 事件。\n\n有关事件的各种信息在下一层会有更为详细的说明。",
|
||||
{"type": "hide", "time": 500} // 消失
|
||||
],`,"changeFloor":"","afterBattle":"","afterGetItem":"","afterOpenDoor":""},null);
|
||||
}
|
||||
//callback(obj,err:String)
|
||||
editor_file.editFloor = function(editor,input_value,callback){
|
||||
if (isset(callback)) callback({"floorId": "sample0",
|
||||
"title": "样板 0 层",
|
||||
"name": "0",
|
||||
"canFlyTo": true,
|
||||
"canUseQuickShop": true,
|
||||
"defaultGround": "ground",
|
||||
"firstArrive":` [ // 第一次到该楼层触发的事件
|
||||
"\t[样板提示]首次到达某层可以触发 firstArrive 事件,该事件可类似于RMXP中的“自动执行脚本”。\n\n本事件支持一切的事件类型,常常用来触发对话,例如:",
|
||||
"\t[hero]我是谁?我从哪来?我又要到哪去?",
|
||||
"\t[仙子,fairy]你问我...?我也不知道啊...",
|
||||
"本层主要对道具、门、怪物等进行介绍,有关事件的各种信息在下一层会有更为详细的说明。",
|
||||
],`},null);
|
||||
}
|
||||
//callback(obj,err:String)
|
||||
var isset = function (val) {
|
||||
if (val == undefined || val == null) {
|
||||
return false;
|
||||
}
|
||||
return true
|
||||
}
|
||||
})();
|
||||
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>
|
||||
<head><meta charset="utf-8"></head>
|
||||
<body>
|
||||
<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 src="./fs.js"></script>
|
||||
<script>
|
||||
fs.writeFile('_test.txt','123中a文bc','utf-8',function(e,d){console.log(e);console.log(d);})
|
||||
setTimeout(function() {
|
||||
|
||||
247
_server/vm.js
Normal file
@ -0,0 +1,247 @@
|
||||
// vue 相关处理
|
||||
|
||||
document.body.onmousedown = function(e){
|
||||
selectBox.isSelected = false;
|
||||
editor.info = {};
|
||||
}
|
||||
iconLib.onmousedown = function(e){
|
||||
e.stopPropagation();
|
||||
}
|
||||
var exportM = new Vue({
|
||||
el: '#exportM',
|
||||
|
||||
methods: {
|
||||
exportMap: function(){
|
||||
editor.updateMap();
|
||||
if(editArea.error) {
|
||||
tip.whichShow = 3;
|
||||
|
||||
return;
|
||||
}
|
||||
var filestr='';
|
||||
for (var yy = 0; yy < 13; yy++){
|
||||
filestr+='['
|
||||
for (var xx = 0; xx < 13; xx++) {
|
||||
var mapxy=editor.map[yy][xx];
|
||||
if(typeof(mapxy)==typeof({})){
|
||||
if ('idnum' in mapxy)mapxy=mapxy.idnum;
|
||||
else {
|
||||
// mapxy='!!?';
|
||||
tip.whichShow = 3;
|
||||
return;
|
||||
}
|
||||
}else if(typeof(mapxy)=='undefined'){
|
||||
tip.whichShow = 3;
|
||||
return;
|
||||
}
|
||||
mapxy=String(mapxy);
|
||||
mapxy=Array(Math.max(4-mapxy.length,0)).join(' ')+mapxy;
|
||||
filestr+=mapxy+(xx==12?'':',')
|
||||
}
|
||||
|
||||
filestr += ']'+(yy==12?'':',\n');
|
||||
}
|
||||
pout.value = filestr;
|
||||
|
||||
tip.whichShow = 2;
|
||||
}
|
||||
}
|
||||
})
|
||||
var editArea = new Vue({
|
||||
el: '#editArea',
|
||||
data: {
|
||||
mapArr: '',
|
||||
errors: [ // 编号1,2,3,4
|
||||
"格式错误!请使用正确格式(13*13数组,如不清楚,可先点击生成地图查看正确格式)",
|
||||
"当前有未定义ID(在地图区域显示红块),请修改ID或者到icons.js和maps.js中进行定义!",
|
||||
"ID越界(在地图区域显示红块),当前编辑器暂时支持编号小于400,请修改编号!",
|
||||
// "发生错误!",
|
||||
],
|
||||
error: 0,
|
||||
formatTimer: null,
|
||||
},
|
||||
watch: {
|
||||
mapArr: function (val, oldval) {
|
||||
var that = this;
|
||||
if(val=='') return;
|
||||
if(that.formatArr()){
|
||||
that.error = 0;
|
||||
clearTimeout(that.formatTimer);
|
||||
setTimeout(function(){
|
||||
that.drawMap();
|
||||
tip.whichShow = 8
|
||||
}, 1000);
|
||||
that.formatTimer = setTimeout(function(){
|
||||
pout.value = that.formatArr();
|
||||
}, 5000); //5s后再格式化,不然光标跳到最后很烦
|
||||
}else{
|
||||
that.error = 1;
|
||||
}
|
||||
},
|
||||
error: function(){
|
||||
// console.log(editArea.mapArr);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
drawMap: function(){
|
||||
var that = this;
|
||||
|
||||
// var mapArray = that.mapArr.split(/\D+/).join(' ').trim().split(' ');
|
||||
var mapArray = JSON.parse('['+that.mapArr+']');
|
||||
for(var y=0; y<13; y++)
|
||||
for(var x=0; x<13; x++){
|
||||
var num = mapArray[y][x];
|
||||
if(num == 0 )
|
||||
editor.map[y][x] = 0;
|
||||
else if(num >= 400){
|
||||
that.error = 3;
|
||||
editor.map[y][x] = undefined;
|
||||
}else if(typeof(editor.indexs[num][0]) == 'undefined'){
|
||||
that.error = 2;
|
||||
editor.map[y][x] = undefined;
|
||||
}else editor.map[y][x] = editor.ids[[editor.indexs[num][0]]];
|
||||
}
|
||||
|
||||
editor.updateMap();
|
||||
|
||||
},
|
||||
formatArr: function(){
|
||||
var formatArrStr = '';
|
||||
|
||||
if(this.mapArr.split(/\D+/).join(' ').trim().split(' ').length != 169) return false;
|
||||
var arr = this.mapArr.replace(/\s+/g, '').split('],[');
|
||||
|
||||
if(arr.length != 13) return ;
|
||||
for(var i =0; i<13; i++){
|
||||
var a = [];
|
||||
formatArrStr +='[';
|
||||
if(i==0||i==12) a = arr[i].split(/\D+/).join(' ').trim().split(' ');
|
||||
else a = arr[i].split(/\D+/);
|
||||
if(a.length != 13){
|
||||
formatArrStr = '';
|
||||
return ;
|
||||
}
|
||||
|
||||
for(var k=0; k<13; k++){
|
||||
var num = parseInt(a[k]);
|
||||
formatArrStr += Array(Math.max(4-String(num).length,0)).join(' ')+num+(k==12?'':',');
|
||||
}
|
||||
formatArrStr += ']'+(i==12?'':',\n');
|
||||
}
|
||||
|
||||
return formatArrStr;
|
||||
}
|
||||
}
|
||||
});
|
||||
var editTip = new Vue({
|
||||
el: '#editTip',
|
||||
data: {
|
||||
err: ''
|
||||
},
|
||||
methods: {
|
||||
copyMap: function(){
|
||||
|
||||
tip.whichShow = 0;
|
||||
if(pout.value.trim() != ''){
|
||||
if(editArea.error) {
|
||||
this.err = editArea.errors[editArea.error-1];
|
||||
tip.whichShow = 5
|
||||
return;
|
||||
}
|
||||
try{
|
||||
pout.select();
|
||||
document.execCommand("Copy");
|
||||
tip.whichShow = 6;
|
||||
}catch(e){
|
||||
this.err= e;
|
||||
tip.whichShow = 5;
|
||||
}
|
||||
}else{
|
||||
tip.whichShow = 7;
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
var clear = new Vue({
|
||||
el: '#clear',
|
||||
|
||||
methods: {
|
||||
clearMap: function(){
|
||||
editor.mapInit();
|
||||
clearTimeout(editArea.formatTimer);
|
||||
clearTimeout(tip.timer);
|
||||
pout.value = '';
|
||||
editArea.mapArr = '';
|
||||
tip.whichShow = 4;
|
||||
editArea.error = 0;
|
||||
}
|
||||
}
|
||||
})
|
||||
var tip = new Vue({
|
||||
el: '#tip',
|
||||
data: {
|
||||
infos: {},
|
||||
hasId: true,
|
||||
isAutotile: false,
|
||||
isSelectedBlock: false,
|
||||
geneMapSuccess: false,
|
||||
timer: null,
|
||||
msgs: [ //分别编号1,2,3,4,5,6,7,8;奇数警告,偶数成功
|
||||
"当前未选择任何图块,请先在右边选择要画的图块!",
|
||||
"生成地图成功!可点击复制按钮复制地图数组到剪切板",
|
||||
"生成失败! 地图中有未定义的图块,建议先用其他有效图块覆盖或点击清除地图!",
|
||||
"地图清除成功!",
|
||||
"复制失败!",
|
||||
"复制成功!可直接粘贴到楼层文件的地图数组中。",
|
||||
"复制失败!当前还没有数据",
|
||||
"修改成功!可点击复制按钮复制地图数组到剪切板"
|
||||
],
|
||||
mapMsg: '',
|
||||
whichShow: 0,
|
||||
},
|
||||
watch: {
|
||||
infos: {
|
||||
handler: function(val, oldval){
|
||||
if(typeof(val) != 'undefined'){
|
||||
this.infos = val;
|
||||
if('id' in val){
|
||||
this.hasId = true;
|
||||
}else{
|
||||
this.hasId = false;
|
||||
}
|
||||
this.isAutotile = false;
|
||||
if(this.infos.images == "autotile" && this.hasId) this.isAutotile = true;
|
||||
}
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
|
||||
whichShow: function(){
|
||||
var that = this;
|
||||
that.mapMsg = '';
|
||||
that.msgs[4] = "复制失败!"+editTip.err;
|
||||
clearTimeout(that.timer);
|
||||
if(that.whichShow){
|
||||
that.mapMsg = that.msgs[that.whichShow-1];
|
||||
that.timer = setTimeout(function() {
|
||||
if(!(that.whichShow%2))
|
||||
that.whichShow = 0;
|
||||
}, 5000); //5秒后自动清除success,warn不清除
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
var selectBox = new Vue({
|
||||
el: '#selectBox',
|
||||
data: {
|
||||
isSelected: false
|
||||
},
|
||||
watch: {
|
||||
isSelected: function(){
|
||||
tip.isSelectedBlock = this.isSelected;
|
||||
tip.whichShow = 0;
|
||||
clearTimeout(tip.timer);
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -251,7 +251,7 @@ value是一个表达式,将通过这个表达式计算出的结果赋值给nam
|
||||
{"type": "setValue", "name": "status:money", "value": "1000" } // 将金币数设为1000(不是+1000)
|
||||
{"type": "setValue", "name": "status:hp", "value": "status:hp*2" } // 生命值翻倍
|
||||
{"type": "setValue", "name": "item:yellowKey", "value": "item:yellowKey+3" } // 黄钥匙个数加3
|
||||
{"type": "setValue", "name": "item:boom", "value": "item:boom+10" } // 炸弹个数+10
|
||||
{"type": "setValue", "name": "item:bomb", "value": "item:bomb+10" } // 炸弹个数+10
|
||||
{"type": "setValue", "name": "flag:man_times", "value": "0" } // 将变量man_times设为0
|
||||
{"type": "setValue", "name": "flag:man_times", "value": "flag:man_times+2*status:atk" } // 将变量man_times的值加上勇士的攻击数值的两倍
|
||||
]
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
|
||||
继续查看文档的详细介绍,让你学会如何使用这一个样板来制作属于自己的HTML5魔塔。
|
||||
|
||||
视频教程地址:http://www.bilibili.com/video/av17608025/ ,配合本教程观看效果更佳~
|
||||
|
||||
==========================================================================================
|
||||
|
||||
[继续阅读下一章:现在就做出自己的第一部H5魔塔!](start)
|
||||
|
||||
@ -80,7 +80,7 @@ if (id == 65) tmp.event = {'cls': 'items', 'id': 'hammer'} // 圣锤
|
||||
1. 指定一个唯一的英文ID,不能和enemys中现有的重复。
|
||||
2. 进入icons.js,在enemys分类下进行添加(对应图标在图片上的位置,即index)
|
||||
3. 在maps.js的getBlock下继续进行添加。请注意其ID为200开始的顺序,即如果新增一行为261,依次类推
|
||||
4. 在items.js中仿照其他道具,来添加道具的信息。
|
||||
4. 在enemys.js中仿照其他怪物,来添加怪物的信息。
|
||||
|
||||
``` js
|
||||
if (id == 258) tmp.event = {'cls': 'enemys', 'id': 'octopus'};
|
||||
|
||||
1054
drawMapGUI.html
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 27 KiB |
|
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 |
320
libs/core.js
@ -76,13 +76,18 @@ function core() {
|
||||
'mouseOutCheck': 1,
|
||||
'moveStepBeforeStop': [],
|
||||
|
||||
// 勇士状态;中心对称飞行器
|
||||
|
||||
// event事件
|
||||
'savePage': null,
|
||||
'saveIndex': null,
|
||||
'shops': {},
|
||||
'event': {
|
||||
'id': null,
|
||||
'data': null
|
||||
'data': null,
|
||||
'selection': null,
|
||||
'ui': null,
|
||||
},
|
||||
'usingCenterFly':false,
|
||||
'openingDoor': null,
|
||||
|
||||
// 动画
|
||||
@ -131,6 +136,11 @@ core.prototype.init = function (dom, statusBar, canvas, images, sounds, floorIds
|
||||
core.musicStatus.soundStatus = false;
|
||||
}
|
||||
|
||||
// switchs
|
||||
core.flags.battleAnimate = core.getLocalStorage('battleAnimate', core.flags.battleAnimate);
|
||||
core.flags.displayEnemyDamage = core.getLocalStorage('enemyDamage', core.flags.displayEnemyDamage);
|
||||
core.flags.displayExtraDamage = core.getLocalStorage('extraDamage', core.flags.displayExtraDamage);
|
||||
|
||||
core.material.ground = new Image();
|
||||
core.material.ground.src = "images/ground.png";
|
||||
|
||||
@ -297,7 +307,7 @@ core.prototype.clearStatus = function() {
|
||||
core.resize(main.dom.body.clientWidth, main.dom.body.clientHeight);
|
||||
}
|
||||
|
||||
core.prototype.resetStatus = function(hero, hard, floorId, flags, maps) {
|
||||
core.prototype.resetStatus = function(hero, hard, floorId, maps) {
|
||||
|
||||
// 停止各个Timeout和Interval
|
||||
for (var i in core.interval) {
|
||||
@ -315,19 +325,16 @@ core.prototype.resetStatus = function(hero, hard, floorId, flags, maps) {
|
||||
// 初始化人物属性
|
||||
core.status.hero = core.clone(hero);
|
||||
core.status.hard = hard;
|
||||
if (core.isset(flags))
|
||||
core.flags = core.clone(flags);
|
||||
// 保存页面
|
||||
core.status.savePage = core.getLocalStorage('savePage', 0);
|
||||
// 保存的Index
|
||||
core.status.saveIndex = core.getLocalStorage('saveIndex', 1);
|
||||
|
||||
core.resize(main.dom.body.clientWidth, main.dom.body.clientHeight);
|
||||
|
||||
}
|
||||
|
||||
core.prototype.startGame = function (hard, callback) {
|
||||
console.log('开始游戏');
|
||||
|
||||
core.resetStatus(core.firstData.hero, hard, core.firstData.floorId, core.flags, core.initStatus.maps);
|
||||
core.resetStatus(core.firstData.hero, hard, core.firstData.floorId, core.initStatus.maps);
|
||||
|
||||
core.changeFloor(core.status.floorId, null, core.firstData.hero.loc, null, function() {
|
||||
core.setHeroMoveTriggerInterval();
|
||||
@ -350,7 +357,7 @@ core.prototype.restart = function() {
|
||||
core.prototype.onkeyDown = function(e) {
|
||||
if (!core.isset(core.status.holdingKeys))core.status.holdingKeys=[];
|
||||
var isArrow={37:true,38:true,39:true,40:true}[e.keyCode]
|
||||
if(isArrow){
|
||||
if(isArrow && !core.status.lockControl){
|
||||
for(var ii =0;ii<core.status.holdingKeys.length;ii++){
|
||||
if (core.status.holdingKeys[ii]===e.keyCode){
|
||||
return;
|
||||
@ -365,7 +372,7 @@ core.prototype.onkeyDown = function(e) {
|
||||
|
||||
core.prototype.onkeyUp = function(e) {
|
||||
var isArrow={37:true,38:true,39:true,40:true}[e.keyCode]
|
||||
if(isArrow){
|
||||
if(isArrow && !core.status.lockControl){
|
||||
for(var ii =0;ii<core.status.holdingKeys.length;ii++){
|
||||
if (core.status.holdingKeys[ii]===e.keyCode){
|
||||
core.status.holdingKeys= core.status.holdingKeys.slice(0,ii).concat(core.status.holdingKeys.slice(ii+1));
|
||||
@ -373,7 +380,8 @@ core.prototype.onkeyUp = function(e) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
core.stopHero();
|
||||
//core.stopHero();
|
||||
core.keyUp(e.keyCode);
|
||||
} else {
|
||||
core.keyUp(e.keyCode);
|
||||
}
|
||||
@ -387,28 +395,66 @@ core.prototype.pressKey = function (keyCode) {
|
||||
}
|
||||
|
||||
core.prototype.keyDown = function(keyCode) {
|
||||
if(!core.status.played) {
|
||||
return;
|
||||
}
|
||||
if(core.status.automaticRouting || core.status.automaticRouted) {
|
||||
core.stopAutomaticRoute();
|
||||
}
|
||||
if (core.status.lockControl) {
|
||||
// Ctrl跳过对话
|
||||
if (keyCode==17) {
|
||||
core.events.keyDownCtrl();
|
||||
return;
|
||||
}
|
||||
if (core.status.event.id == 'action') {
|
||||
core.events.keyDownAction(keyCode);
|
||||
return;
|
||||
}
|
||||
if (core.status.event.id == 'book') {
|
||||
if (keyCode==37) core.ui.drawEnemyBook(core.status.event.data - 1);
|
||||
else if (keyCode==39) core.ui.drawEnemyBook(core.status.event.data + 1);
|
||||
core.events.keyDownBook(keyCode);
|
||||
return;
|
||||
}
|
||||
if (core.status.event.id == 'fly') {
|
||||
if (keyCode==38) core.ui.drawFly(core.status.event.data+1);
|
||||
else if (keyCode==40) core.ui.drawFly(core.status.event.data-1);
|
||||
core.events.keyDownFly(keyCode);
|
||||
return;
|
||||
}
|
||||
if (core.status.event.id=='shop') {
|
||||
core.events.keyDownShop(keyCode);
|
||||
return;
|
||||
}
|
||||
if (core.status.event.id=='selectShop') {
|
||||
core.events.keyDownQuickShop(keyCode);
|
||||
return;
|
||||
}
|
||||
if (core.status.event.id=='toolbox') {
|
||||
core.events.keyDownToolbox(keyCode);
|
||||
return;
|
||||
}
|
||||
if (core.status.event.id=='save' || core.status.event.id=='load') {
|
||||
core.events.keyDownSL(keyCode);
|
||||
return;
|
||||
}
|
||||
if (core.status.event.id=='switchs') {
|
||||
core.events.keyDownSwitchs(keyCode);
|
||||
return;
|
||||
}
|
||||
if (core.status.event.id=='settings') {
|
||||
core.events.keyDownSettings(keyCode);
|
||||
return;
|
||||
}
|
||||
if (core.status.event.id=='syncSave') {
|
||||
core.events.keyDownSyncSave(keyCode);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
if (core.status.event.id == 'save' || core.status.event.id == 'load') {
|
||||
if (keyCode==37) core.ui.drawSLPanel(core.status.event.data-1);
|
||||
else if (keyCode==39) core.ui.drawSLPanel(core.status.event.data+1);
|
||||
return;
|
||||
}
|
||||
*/
|
||||
return;
|
||||
}
|
||||
if(!core.status.played) {
|
||||
return;
|
||||
}
|
||||
switch(keyCode) {
|
||||
@ -424,53 +470,99 @@ core.prototype.keyDown = function(keyCode) {
|
||||
case 40:
|
||||
core.moveHero('down');
|
||||
break;
|
||||
case 13: case 32: case 51: // 快捷键3:飞
|
||||
// 因为加入了两次的检测机制,从keydown转移到keyup,同时保证位置信息正确,但以下情况会触发作图的bug:
|
||||
// 在鼠标的路线移动中使用飞,绿块会滞后一格,显示的位置不对,同时也不会倍以下的代码清除
|
||||
if (core.status.heroStop && core.hasItem('centerFly')) {
|
||||
if (core.status.usingCenterFly) {
|
||||
if (core.canUseItem('centerFly')) {
|
||||
core.useItem('centerFly');
|
||||
core.clearMap('ui', core.getHeroLoc('x')*32,core.getHeroLoc('y')*32,32,32);
|
||||
}
|
||||
else {
|
||||
core.drawTip('当前不能使用中心对称飞行器');
|
||||
core.clearMap('ui', (12-core.getHeroLoc('x'))*32,(12-core.getHeroLoc('y'))*32,32,32);
|
||||
}
|
||||
core.status.usingCenterFly = false;
|
||||
} else if (keyCode==51) {
|
||||
core.status.usingCenterFly = true;
|
||||
var fillstyle = 'rgba(255,0,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.drawTip("请确认当前中心对称飞行器的位置");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (core.status.usingCenterFly && keyCode!=51) {
|
||||
core.clearMap('ui', (12-core.getHeroLoc('x'))*32,(12-core.getHeroLoc('y'))*32,32,32);
|
||||
core.status.usingCenterFly= false;
|
||||
}
|
||||
}
|
||||
|
||||
core.prototype.keyUp = function(keyCode) {
|
||||
if(!core.status.played)
|
||||
return;
|
||||
|
||||
if (core.status.lockControl) {
|
||||
if (core.status.event.id == 'book' && (keyCode==27 || keyCode==88))
|
||||
core.ui.closePanel(true);
|
||||
if (core.status.event.id == 'fly' && (keyCode==71 || keyCode==27))
|
||||
core.ui.closePanel();
|
||||
if (core.status.event.id == 'fly' && keyCode==13) {
|
||||
var index=core.status.hero.flyRange.indexOf(core.status.floorId);
|
||||
var stair=core.status.event.data<index?"upFloor":"downFloor";
|
||||
var floorId=core.status.event.data;
|
||||
core.ui.closePanel();
|
||||
core.changeFloor(core.status.hero.flyRange[floorId], stair);
|
||||
}
|
||||
if (core.status.event.id == 'save' && (keyCode==83 || keyCode==27))
|
||||
core.ui.closePanel();
|
||||
if (core.status.event.id == 'load' && (keyCode==68 || keyCode==27))
|
||||
core.ui.closePanel();
|
||||
if ((core.status.event.id == 'settings' || core.status.event.id == 'selectShop') && keyCode==27)
|
||||
core.ui.closePanel();
|
||||
if (core.status.event.id == 'selectShop' && keyCode==75)
|
||||
core.ui.closePanel();
|
||||
if (core.status.event.id == 'shop' && keyCode==27) {
|
||||
core.status.boxAnimateObjs = [];
|
||||
core.setBoxAnimate();
|
||||
if (core.status.event.data.fromList)
|
||||
core.ui.drawQuickShop();
|
||||
else core.ui.closePanel();
|
||||
}
|
||||
if (core.status.event.id == 'toolbox' && (keyCode==84 || keyCode==27))
|
||||
core.ui.closePanel();
|
||||
if (core.status.event.id == 'about' && (keyCode==13 || keyCode==32))
|
||||
core.ui.closePanel();
|
||||
if (core.status.event.id == 'text' && (keyCode==13 || keyCode==32))
|
||||
core.status.holdingKeys = [];
|
||||
// 全键盘操作部分
|
||||
if (core.status.event.id == 'text' && (keyCode==13 || keyCode==32 || keyCode==67)) {
|
||||
core.drawText();
|
||||
if (core.status.event.id == 'action' && core.isset(core.status.event.data.current)
|
||||
&& core.status.event.data.type=='text' && (keyCode==13 || keyCode==32))
|
||||
core.events.doAction();
|
||||
|
||||
return;
|
||||
}
|
||||
if (core.status.event.id=='confirmBox') {
|
||||
core.events.keyUpConfirmBox(keyCode);
|
||||
return;
|
||||
}
|
||||
if (core.status.event.id == 'action') {
|
||||
core.events.keyUpAction(keyCode);
|
||||
return;
|
||||
}
|
||||
if (core.status.event.id=='about' && (keyCode==13 || keyCode==32 || keyCode==67)) {
|
||||
core.events.clickAbout();
|
||||
return;
|
||||
}
|
||||
if (core.status.event.id=='book') {
|
||||
core.events.keyUpBook(keyCode);
|
||||
return;
|
||||
}
|
||||
if (core.status.event.id=='fly') {
|
||||
core.events.keyUpFly(keyCode);
|
||||
return;
|
||||
}
|
||||
if (core.status.event.id=='shop') {
|
||||
core.events.keyUpShop(keyCode);
|
||||
return;
|
||||
}
|
||||
if (core.status.event.id=='selectShop') {
|
||||
core.events.keyUpQuickShop(keyCode);
|
||||
return;
|
||||
}
|
||||
if (core.status.event.id=='toolbox') {
|
||||
core.events.keyUpToolbox(keyCode);
|
||||
return;
|
||||
}
|
||||
if (core.status.event.id=='save' || core.status.event.id=='load') {
|
||||
core.events.keyUpSL(keyCode);
|
||||
return;
|
||||
}
|
||||
if (core.status.event.id=='switchs') {
|
||||
core.events.keyUpSwitchs(keyCode);
|
||||
return;
|
||||
}
|
||||
if (core.status.event.id=='settings') {
|
||||
core.events.keyUpSettings(keyCode);
|
||||
return;
|
||||
}
|
||||
if (core.status.event.id=='syncSave') {
|
||||
core.events.keyUpSyncSave(keyCode);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if(!core.status.played)
|
||||
return;
|
||||
|
||||
switch (keyCode) {
|
||||
case 27: // ESC
|
||||
if (core.status.heroStop)
|
||||
@ -508,6 +600,10 @@ core.prototype.keyUp = function(keyCode) {
|
||||
if (!core.status.lockControl && core.status.heroStop)
|
||||
core.getNextItem();
|
||||
break;
|
||||
case 72: // H
|
||||
if (!core.status.lockControl && core.status.heroStop)
|
||||
core.ui.drawHelp();
|
||||
break;
|
||||
case 37: // UP
|
||||
break;
|
||||
case 38: // DOWN
|
||||
@ -547,17 +643,9 @@ core.prototype.keyUp = function(keyCode) {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 51: // 快捷键3:飞
|
||||
if (core.status.heroStop && core.hasItem('centerFly')) {
|
||||
if (core.canUseItem('centerFly')) {
|
||||
core.useItem('centerFly');
|
||||
}
|
||||
else {
|
||||
core.drawTip('当前不能使用中心对称飞行器');
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
core.stopHero();
|
||||
}
|
||||
|
||||
@ -649,6 +737,24 @@ core.prototype.onclick = function (x, y, stepPostfix) {
|
||||
// 非游戏屏幕内
|
||||
if (x<0 || y<0 || x>12 || y>12) return;
|
||||
|
||||
// 中心对称飞行器
|
||||
if (core.status.usingCenterFly) {
|
||||
if (x!=12-core.getHeroLoc('x') || y!=12-core.getHeroLoc('y')) {
|
||||
core.clearMap('ui', (12-core.getHeroLoc('x'))*32,(12-core.getHeroLoc('y'))*32,32,32);
|
||||
} else {
|
||||
if (core.canUseItem('centerFly')) {
|
||||
core.useItem('centerFly');
|
||||
core.clearMap('ui', core.getHeroLoc('x')*32,core.getHeroLoc('y')*32,32,32);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
core.drawTip('当前不能使用中心对称飞行器');
|
||||
core.clearMap('ui', (12-core.getHeroLoc('x'))*32,(12-core.getHeroLoc('y'))*32,32,32);
|
||||
}
|
||||
}
|
||||
core.status.usingCenterFly= false;
|
||||
}
|
||||
|
||||
// 寻路
|
||||
if (!core.status.lockControl) {
|
||||
core.setAutomaticRoute(x, y, stepPostfix);
|
||||
@ -705,19 +811,13 @@ core.prototype.onclick = function (x, y, stepPostfix) {
|
||||
|
||||
// 选项
|
||||
if (core.status.event.id == 'confirmBox') {
|
||||
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();
|
||||
core.events.clickConfirmBox(x,y);
|
||||
return;
|
||||
}
|
||||
|
||||
// 关于
|
||||
if (core.status.event.id == 'about') {
|
||||
if (core.isPlaying())
|
||||
core.ui.closePanel(false);
|
||||
else
|
||||
core.showStartAnimate();
|
||||
core.events.clickAbout(x,y);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -734,26 +834,8 @@ core.prototype.onclick = function (x, y, stepPostfix) {
|
||||
|
||||
// 同步存档
|
||||
if (core.status.event.id == 'syncSave') {
|
||||
if (x>=4 && x<=8) {
|
||||
if (y==5) {
|
||||
core.syncSave("save");
|
||||
}
|
||||
if (y==6) {
|
||||
core.syncSave("load");
|
||||
}
|
||||
}
|
||||
if (x>=5 && x<=7) {
|
||||
if (y==7) {
|
||||
core.ui.drawConfirmBox("你确定要清空所有本地存档吗?", function() {
|
||||
localStorage.clear();
|
||||
core.drawText("\t[操作成功]你的本地所有存档已被清空。");
|
||||
}, function() {
|
||||
core.ui.drawSettings(false);
|
||||
})
|
||||
}
|
||||
if (y==8)
|
||||
core.ui.drawSettings(false);
|
||||
}
|
||||
core.events.clickSyncSave(x,y);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
@ -777,8 +859,8 @@ core.prototype.onmousewheel = function (direct) {
|
||||
|
||||
// 存读档
|
||||
if (core.status.lockControl && (core.status.event.id == 'save' || core.status.event.id == 'load')) {
|
||||
if (direct==1) core.ui.drawSLPanel(core.status.event.data - 1);
|
||||
if (direct==-1) core.ui.drawSLPanel(core.status.event.data + 1);
|
||||
if (direct==1) core.ui.drawSLPanel(core.status.event.data - 6);
|
||||
if (direct==-1) core.ui.drawSLPanel(core.status.event.data + 6);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1675,13 +1757,13 @@ core.prototype.drawMap = function (mapName, callback) {
|
||||
var mapBlocks = mapData.blocks;
|
||||
core.status.floorId = mapName;
|
||||
core.status.thisMap = mapData;
|
||||
var blockIcon, blockImage;
|
||||
core.clearMap('all');
|
||||
core.removeGlobalAnimate(null, null, true);
|
||||
var groundId = core.floors[mapName].defaultGround || "ground";
|
||||
var blockIcon = core.material.icons.terrains[groundId];
|
||||
var blockImage = core.material.images.terrains;
|
||||
for (var x = 0; x < 13; x++) {
|
||||
for (var y = 0; y < 13; y++) {
|
||||
blockIcon = core.material.icons.terrains.ground;
|
||||
blockImage = core.material.images.terrains;
|
||||
core.canvas.bg.drawImage(blockImage, 0, blockIcon * 32, 32, 32, x * 32, y * 32, 32, 32);
|
||||
}
|
||||
}
|
||||
@ -1703,14 +1785,14 @@ core.prototype.drawMap = function (mapName, callback) {
|
||||
}
|
||||
}
|
||||
}
|
||||
core.drawAutotile('event', autotileMaps, 0, 0, 32);
|
||||
core.drawAutotile(mapName, 'event', autotileMaps, 0, 0, 32);
|
||||
core.setGlobalAnimate(core.values.animateSpeed);
|
||||
|
||||
if (core.isset(callback))
|
||||
callback();
|
||||
}
|
||||
|
||||
core.prototype.drawAutotile = function (canvas, autotileMaps, left, top, size) {
|
||||
core.prototype.drawAutotile = function (floorId, canvas, autotileMaps, left, top, size) {
|
||||
var isAutotile = function(x, y) {
|
||||
if (x<0 || x>12 || y<0 || y>12) return 0;
|
||||
return autotileMaps[13*x+y]?1:0;
|
||||
@ -1720,7 +1802,7 @@ core.prototype.drawAutotile = function (canvas, autotileMaps, left, top, size) {
|
||||
if (isAutotile(xx, yy)) {
|
||||
// 绘制autotile
|
||||
var id=isAutotile(xx, yy - 1) + 2 * isAutotile(xx - 1, yy) + 4 * isAutotile(xx, yy + 1) + 8 * isAutotile(xx + 1, yy);
|
||||
core.drawAutotileBlock(canvas, left + xx * size, top + yy * size, size, core.material.images.autotile, id);
|
||||
core.drawAutotileBlock(floorId, canvas, left + xx * size, top + yy * size, size, core.material.images.autotile, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1728,24 +1810,25 @@ core.prototype.drawAutotile = function (canvas, autotileMaps, left, top, size) {
|
||||
for (var yy=0;yy<13;yy++) {
|
||||
if (isAutotile(xx, yy) + isAutotile(xx + 1, yy) + isAutotile(xx + 1, yy + 1) + isAutotile(xx, yy + 1) != 3) continue;
|
||||
if (!isAutotile(xx, yy)) {
|
||||
core.drawAutotileBlock(canvas, left + xx * size + size, top + yy * size + size, size, core.material.images.autotile, 16);
|
||||
core.drawAutotileBlock(floorId, canvas, left + xx * size + size, top + yy * size + size, size, core.material.images.autotile, 16);
|
||||
}
|
||||
if (!isAutotile(xx + 1, yy)) {
|
||||
core.drawAutotileBlock(canvas, left + xx * size + size / 2, top + yy * size + size, size, core.material.images.autotile, 17);
|
||||
core.drawAutotileBlock(floorId, canvas, left + xx * size + size / 2, top + yy * size + size, size, core.material.images.autotile, 17);
|
||||
}
|
||||
if (!isAutotile(xx + 1, yy + 1)) {
|
||||
core.drawAutotileBlock(canvas, left + xx * size + size / 2, top + yy * size + size / 2, size, core.material.images.autotile, 18);
|
||||
core.drawAutotileBlock(floorId, canvas, left + xx * size + size / 2, top + yy * size + size / 2, size, core.material.images.autotile, 18);
|
||||
}
|
||||
if (!isAutotile(xx, yy + 1)) {
|
||||
core.drawAutotileBlock(canvas, left + xx * size + size, top + yy * size + size / 2, size, core.material.images.autotile, 19);
|
||||
core.drawAutotileBlock(floorId, canvas, left + xx * size + size, top + yy * size + size / 2, size, core.material.images.autotile, 19);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
core.prototype.drawAutotileBlock = function (map, x, y, size, autotile, index) {
|
||||
core.prototype.drawAutotileBlock = function (floorId, map, x, y, size, autotile, index) {
|
||||
var canvas = core.canvas[map];
|
||||
var blockIcon = core.material.icons.terrains.ground;
|
||||
var groundId = core.floors[floorId].defaultGround || "ground";
|
||||
var blockIcon = core.material.icons.terrains[groundId];
|
||||
var blockImage = core.material.images.terrains;
|
||||
switch (index) {
|
||||
case 0:
|
||||
@ -2858,7 +2941,7 @@ core.prototype.openToolbox = function (need) {
|
||||
core.prototype.save = function(need) {
|
||||
if (!core.checkStatus('save', need))
|
||||
return;
|
||||
core.ui.drawSLPanel(core.status.savePage);
|
||||
core.ui.drawSLPanel(core.status.saveIndex);
|
||||
}
|
||||
|
||||
core.prototype.load = function (need) {
|
||||
@ -2868,22 +2951,22 @@ core.prototype.load = function (need) {
|
||||
core.status.event = {'id': 'load', 'data': null};
|
||||
core.status.lockControl = true;
|
||||
core.dom.startPanel.style.display = 'none';
|
||||
var page = core.getLocalStorage('savePage', 0);
|
||||
core.ui.drawSLPanel(page);
|
||||
core.ui.drawSLPanel(core.getLocalStorage('saveIndex', 1));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!core.checkStatus('load', need))
|
||||
return;
|
||||
core.ui.drawSLPanel(core.status.savePage);
|
||||
core.ui.drawSLPanel(core.status.saveIndex);
|
||||
}
|
||||
|
||||
core.prototype.doSL = function (id, type) {
|
||||
core.status.saveIndex=id;
|
||||
if (type=='save') {
|
||||
if (core.saveData("save"+id)) {
|
||||
core.ui.closePanel();
|
||||
core.drawTip('存档成功!');
|
||||
core.setLocalStorage('savePage', core.status.savePage);
|
||||
core.setLocalStorage('saveIndex', core.status.saveIndex);
|
||||
}
|
||||
else {
|
||||
core.drawTip('存储空间不足,请覆盖已有的存档或在菜单栏中进行清理');
|
||||
@ -2902,7 +2985,8 @@ core.prototype.doSL = function (id, type) {
|
||||
}
|
||||
core.ui.closePanel();
|
||||
core.loadData(data, function() {
|
||||
core.setLocalStorage('savePage', core.status.savePage);
|
||||
core.status.saveIndex=id;
|
||||
core.setLocalStorage('saveIndex', core.status.saveIndex);
|
||||
core.drawTip("读档成功");
|
||||
});
|
||||
return;
|
||||
@ -2911,6 +2995,7 @@ core.prototype.doSL = function (id, type) {
|
||||
|
||||
core.prototype.syncSave = function(type) {
|
||||
if (type=='save') {
|
||||
core.status.event.selection=1;
|
||||
core.ui.drawConfirmBox("你确定要将本地存档同步到服务器吗?", function(){
|
||||
// console.log("同步存档...");
|
||||
core.ui.drawWaiting("正在同步,请稍后...");
|
||||
@ -2957,11 +3042,12 @@ core.prototype.syncSave = function(type) {
|
||||
}
|
||||
xhr.send(formData);
|
||||
}, function() {
|
||||
core.status.event.selection=0;
|
||||
core.ui.drawSyncSave();
|
||||
})
|
||||
}
|
||||
else if (type=='load') {
|
||||
|
||||
core.status.event.selection=1;
|
||||
core.ui.drawConfirmBox("你确定要从服务器加载存档吗?\n该操作将覆盖所有本地存档且不可逆!", function(){
|
||||
var id = prompt("请输入存档编号:");
|
||||
if (id==null || id=="") {
|
||||
@ -3028,6 +3114,7 @@ core.prototype.syncSave = function(type) {
|
||||
}
|
||||
xhr.send(formData);
|
||||
}, function() {
|
||||
core.status.event.selection=1;
|
||||
core.ui.drawSyncSave();
|
||||
})
|
||||
}
|
||||
@ -3041,7 +3128,6 @@ core.prototype.saveData = function(dataId) {
|
||||
'hard': core.status.hard,
|
||||
'maps': core.maps.save(core.status.maps),
|
||||
'shops': {},
|
||||
'flags': core.flags,
|
||||
'version': core.firstData.version,
|
||||
"time": new Date().getTime()
|
||||
};
|
||||
@ -3059,7 +3145,7 @@ core.prototype.saveData = function(dataId) {
|
||||
|
||||
core.prototype.loadData = function (data, callback) {
|
||||
|
||||
core.resetStatus(data.hero, data.hard, data.floorId, data.flags, core.maps.load(data.maps));
|
||||
core.resetStatus(data.hero, data.hard, data.floorId, core.maps.load(data.maps));
|
||||
|
||||
// load shop times
|
||||
for (var shop in core.status.shops) {
|
||||
|
||||
@ -78,7 +78,7 @@ data.prototype.init = function() {
|
||||
{"text": "攻击+5", "need": "30", "effect": "status:atk+=5"},
|
||||
{"text": "防御+5", "need": "30", "effect": "status:def+=5"},
|
||||
]
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
// 各种数值;一些数值可以在这里设置
|
||||
@ -128,6 +128,7 @@ data.prototype.init = function() {
|
||||
"bigKeyIsBox": false, // 如果此项为true,则视为钥匙盒,红黄蓝钥匙+1;若为false,则视为大黄门钥匙
|
||||
/****** 系统相关 ******/
|
||||
"startDirectly": false, // 点击“开始游戏”后是否立刻开始游戏而不显示难度选择界面
|
||||
"showBattleAnimateConfirm": true, // 是否在游戏开始时提供“是否开启战斗动画”的选项
|
||||
"battleAnimate": true, // 是否默认显示战斗动画;用户可以手动在菜单栏中开关
|
||||
"displayEnemyDamage": true, // 是否地图怪物显伤;用户可以手动在菜单栏中开关
|
||||
"displayExtraDamage": false, // 是否地图高级显伤(领域、夹击等);用户可以手动在菜单栏中开关
|
||||
|
||||
667
libs/events.js
@ -66,22 +66,43 @@ events.prototype.startGame = function (hard) {
|
||||
|
||||
core.hideStartAnimate(function() {
|
||||
core.drawText(core.clone(core.firstData.startText), function() {
|
||||
core.startGame(hard);
|
||||
if (hard=='Easy') { // 简单难度
|
||||
core.setFlag('hard', 1); // 可以用flag:hard来获得当前难度
|
||||
// 可以在此设置一些初始福利,比如设置初始生命值可以调用:
|
||||
// core.setStatus("hp", 10000);
|
||||
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.events.setInitData(hard);
|
||||
}, function () {
|
||||
core.flags.battleAnimate = false;
|
||||
core.setLocalStorage('battleAnimate', false);
|
||||
core.startGame(hard);
|
||||
core.events.setInitData(hard);
|
||||
});
|
||||
}
|
||||
if (hard=='Normal') { // 普通难度
|
||||
core.setFlag('hard', 2); // 可以用flag:hard来获得当前难度
|
||||
}
|
||||
if (hard=='Hard') { // 困难难度
|
||||
core.setFlag('hard', 3); // 可以用flag:hard来获得当前难度
|
||||
else {
|
||||
core.startGame(hard);
|
||||
core.events.setInitData(hard);
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
////// 简单难度设置初始福利 //////
|
||||
events.prototype.setInitData = function (hard) {
|
||||
if (hard=='Easy') { // 简单难度
|
||||
core.setFlag('hard', 1); // 可以用flag:hard来获得当前难度
|
||||
// 可以在此设置一些初始福利,比如设置初始生命值可以调用:
|
||||
// core.setStatus("hp", 10000);
|
||||
}
|
||||
if (hard=='Normal') { // 普通难度
|
||||
core.setFlag('hard', 2); // 可以用flag:hard来获得当前难度
|
||||
}
|
||||
if (hard=='Hard') { // 困难难度
|
||||
core.setFlag('hard', 3); // 可以用flag:hard来获得当前难度
|
||||
}
|
||||
}
|
||||
|
||||
////// 游戏结束事件 //////
|
||||
events.prototype.win = function(reason) {
|
||||
// 获胜
|
||||
@ -166,6 +187,7 @@ events.prototype.doAction = function() {
|
||||
case "tip":
|
||||
core.drawTip(core.replaceText(data.text));
|
||||
core.events.doAction();
|
||||
break;
|
||||
case "show": // 显示
|
||||
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 () {
|
||||
@ -361,7 +383,7 @@ events.prototype.doAction = function() {
|
||||
break;
|
||||
default:
|
||||
core.status.event.data.type='text';
|
||||
core.ui.drawTextBox("\t[警告,]出错啦!\n"+data.type+" 事件不被支持...");
|
||||
core.ui.drawTextBox("\t[警告]出错啦!\n"+data.type+" 事件不被支持...");
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -383,9 +405,14 @@ events.prototype.openShop = function(shopId, needVisited) {
|
||||
}
|
||||
shop.visited = true;
|
||||
|
||||
var selection = core.status.event.selection;
|
||||
core.ui.closePanel();
|
||||
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 times = shop.times, need=eval(shop.need);
|
||||
@ -402,9 +429,9 @@ events.prototype.openShop = function(shopId, needVisited) {
|
||||
var text = choice.text;
|
||||
if (core.isset(choice.need))
|
||||
text += "("+eval(choice.need)+use+")"
|
||||
choices.push({"text": text});
|
||||
choices.push(text);
|
||||
}
|
||||
choices.push({"text": "离开"});
|
||||
choices.push("离开");
|
||||
core.ui.drawChoices(content, choices);
|
||||
}
|
||||
|
||||
@ -457,8 +484,16 @@ events.prototype.useItem = function(itemId) {
|
||||
core.useFly(false);
|
||||
return;
|
||||
}
|
||||
if (itemId=='centerFly') {
|
||||
core.status.usingCenterFly= true;
|
||||
var fillstyle = 'rgba(255,0,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.drawTip("请确认当前中心对称飞行器的位置");
|
||||
return;
|
||||
}
|
||||
|
||||
if (core.canUseItem(itemId)) core.useItem(itemId);
|
||||
if (core.canUseItem(itemId))core.useItem(itemId);
|
||||
else core.drawTip("当前无法使用"+core.material.items[itemId].name);
|
||||
}
|
||||
|
||||
@ -595,6 +630,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) {
|
||||
|
||||
@ -618,6 +693,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) {
|
||||
// 上一页
|
||||
@ -635,6 +746,19 @@ events.prototype.clickBook = function(x,y) {
|
||||
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) {
|
||||
if ((x==10 || x==11) && y==9) core.ui.drawFly(core.status.event.data-1);
|
||||
@ -650,6 +774,20 @@ events.prototype.clickFly = function(x,y) {
|
||||
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) {
|
||||
var shop = core.status.event.data.shop;
|
||||
@ -702,14 +840,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) {
|
||||
var shopList = core.status.shops, keys = Object.keys(shopList);
|
||||
if (x >= 5 && x <= 7) {
|
||||
var shopList = core.status.shops, keys = Object.keys(shopList);
|
||||
var topIndex = 6 - parseInt((keys.length + 1) / 2);
|
||||
var exitIndex = 6 + parseInt((keys.length + 1) / 2);
|
||||
|
||||
if (y >= topIndex && y - topIndex < keys.length) {
|
||||
var topIndex = 6 - parseInt(keys.length / 2);
|
||||
if (y>=topIndex && y<topIndex+keys.length) {
|
||||
var reason = core.events.canUseQuickShop(y-topIndex);
|
||||
if (core.isset(reason)) {
|
||||
core.drawText(reason);
|
||||
@ -719,42 +890,146 @@ events.prototype.clickQuickShop = function(x, y) {
|
||||
if (core.status.event.id=='shop')
|
||||
core.status.event.data.fromList = true;
|
||||
}
|
||||
if (y == exitIndex) {
|
||||
// 离开
|
||||
else if (y==topIndex+keys.length)
|
||||
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) {
|
||||
|
||||
// 返回
|
||||
if (x>=10 && x<=12 && y==12) {
|
||||
core.ui.closePanel(false);
|
||||
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;
|
||||
if (y==4||y==5||y==9||y==10) index=parseInt(x/2);
|
||||
else index=6+parseInt(x/2);
|
||||
if (y>=9) index+=100;
|
||||
this.clickToolboxIndex(index);
|
||||
}
|
||||
|
||||
if (index>=items.length) return;
|
||||
itemId=items[index];
|
||||
|
||||
events.prototype.clickToolboxIndex = function(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) {
|
||||
core.events.useItem(itemId);
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -762,11 +1037,11 @@ events.prototype.clickToolbox = function(x,y) {
|
||||
events.prototype.clickSL = function(x,y) {
|
||||
// 上一页
|
||||
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) {
|
||||
core.ui.drawSLPanel(core.status.event.data + 1);
|
||||
core.ui.drawSLPanel(core.status.event.data + 6);
|
||||
}
|
||||
// 返回
|
||||
if (x>=10 && x<=12 && y==12) {
|
||||
@ -777,7 +1052,8 @@ events.prototype.clickSL = function(x,y) {
|
||||
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 (x>=1 && x<=3) core.doSL(index, core.status.event.id);
|
||||
if (x>=5 && x<=7) core.doSL(index+1, core.status.event.id);
|
||||
@ -790,78 +1066,269 @@ events.prototype.clickSL = function(x,y) {
|
||||
}
|
||||
}
|
||||
|
||||
events.prototype.clickSwitchs = function (x,y) {
|
||||
if (x<5 || x>7) return;
|
||||
if (y==4) {
|
||||
if (core.musicStatus.isIOS) {
|
||||
core.drawTip("iOS设备不支持播放音乐");
|
||||
return;
|
||||
}
|
||||
core.changeSoundStatus();
|
||||
core.ui.drawSwitchs();
|
||||
events.prototype.keyDownSL = function(keycode) {
|
||||
if (keycode==37) { // left
|
||||
core.ui.drawSLPanel(core.status.event.data - 1);
|
||||
return;
|
||||
}
|
||||
if (y==5) {
|
||||
core.flags.battleAnimate=!core.flags.battleAnimate;
|
||||
core.ui.drawSwitchs();
|
||||
if (keycode==38) { // up
|
||||
core.ui.drawSLPanel(core.status.event.data - 3);
|
||||
return;
|
||||
}
|
||||
if (y==6) {
|
||||
core.flags.displayEnemyDamage=!core.flags.displayEnemyDamage;
|
||||
core.updateFg();
|
||||
core.ui.drawSwitchs();
|
||||
if (keycode==39) { // right
|
||||
core.ui.drawSLPanel(core.status.event.data + 1);
|
||||
return;
|
||||
}
|
||||
if (y==7) {
|
||||
core.flags.displayExtraDamage=!core.flags.displayExtraDamage;
|
||||
core.updateFg();
|
||||
core.ui.drawSwitchs();
|
||||
if (keycode==40) { // down
|
||||
core.ui.drawSLPanel(core.status.event.data + 3);
|
||||
return;
|
||||
}
|
||||
if (y==8) {
|
||||
core.ui.drawSettings(false);
|
||||
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) {
|
||||
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:
|
||||
if (core.musicStatus.isIOS) {
|
||||
core.drawTip("iOS设备不支持播放音乐");
|
||||
return;
|
||||
}
|
||||
core.changeSoundStatus();
|
||||
core.ui.drawSwitchs();
|
||||
break;
|
||||
case 1:
|
||||
core.flags.battleAnimate=!core.flags.battleAnimate;
|
||||
core.setLocalStorage('battleAnimate', core.flags.battleAnimate);
|
||||
core.ui.drawSwitchs();
|
||||
break;
|
||||
case 2:
|
||||
core.flags.displayEnemyDamage=!core.flags.displayEnemyDamage;
|
||||
core.updateFg();
|
||||
core.setLocalStorage('enemyDamage', core.flags.displayEnemyDamage);
|
||||
core.ui.drawSwitchs();
|
||||
break;
|
||||
case 3:
|
||||
core.flags.displayExtraDamage=!core.flags.displayExtraDamage;
|
||||
core.updateFg();
|
||||
core.setLocalStorage('extraDamage', core.flags.displayExtraDamage);
|
||||
core.ui.drawSwitchs();
|
||||
break;
|
||||
case 4:
|
||||
core.status.event.selection=0;
|
||||
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) {
|
||||
if (x<5 || x>7) return;
|
||||
if (y == 3) {
|
||||
core.ui.drawSwitchs();
|
||||
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();
|
||||
break;
|
||||
case 1:
|
||||
core.status.event.selection=0;
|
||||
core.ui.drawQuickShop();
|
||||
break;
|
||||
case 2:
|
||||
core.status.event.selection=0;
|
||||
core.ui.drawSyncSave();
|
||||
break;
|
||||
case 3:
|
||||
core.status.event.selection=1;
|
||||
core.ui.drawConfirmBox("你确定要重新开始吗?", function () {
|
||||
core.ui.closePanel();
|
||||
core.restart();
|
||||
}, function () {
|
||||
core.status.event.selection=3;
|
||||
core.ui.drawSettings(false);
|
||||
});
|
||||
break;
|
||||
case 4:
|
||||
core.ui.drawHelp();
|
||||
break;
|
||||
case 5:
|
||||
core.ui.drawAbout();
|
||||
break;
|
||||
case 6:
|
||||
core.ui.closePanel();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (y==4) {
|
||||
/*
|
||||
core.flags.battleAnimate=!core.flags.battleAnimate;
|
||||
core.setLocalStorage('battleAnimate', core.flags.battleAnimate);
|
||||
core.ui.drawSettings(false);
|
||||
*/
|
||||
this.decreaseHard();
|
||||
}
|
||||
if (y == 5) core.ui.drawQuickShop();
|
||||
// if (y == 5) this.decreaseHard();
|
||||
if (y == 6) {
|
||||
core.ui.drawSyncSave();
|
||||
}
|
||||
/*
|
||||
if (y == 6) {
|
||||
core.ui.drawConfirmBox("你确定要清空所有本地存档吗?", function() {
|
||||
localStorage.clear();
|
||||
core.drawText("\t[操作成功]你的本地所有存档已被清空。");
|
||||
}, function() {
|
||||
core.ui.drawSettings(false);
|
||||
})
|
||||
}
|
||||
*/
|
||||
if (y == 7) {
|
||||
core.ui.drawConfirmBox("你确定要重新开始吗?", function () {
|
||||
core.ui.closePanel();
|
||||
core.restart();
|
||||
}, function () {
|
||||
core.ui.drawSettings(false);
|
||||
});
|
||||
}
|
||||
if (y==8) {
|
||||
core.ui.drawAbout();
|
||||
// core.debug();
|
||||
}
|
||||
if (y == 9) core.ui.closePanel();
|
||||
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 ***************/
|
||||
|
||||
@ -7,6 +7,7 @@ main.floors.MT0 = {
|
||||
"name": 0, // 显示在状态栏中的层数
|
||||
"canFlyTo": true, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
|
||||
"canUseQuickShop": true, // 该层是否允许使用快捷商店
|
||||
"defaultGround": "ground", // 默认地面的图块ID(terrains中)
|
||||
"map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成
|
||||
|
||||
],
|
||||
|
||||
@ -7,6 +7,7 @@ main.floors.sample0 = {
|
||||
"name": 0, // 显示在状态栏中的层数
|
||||
"canFlyTo": true, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
|
||||
"canUseQuickShop": true, // 该层是否允许使用快捷商店
|
||||
"defaultGround": "ground", // 默认地面的图块ID(terrains中)
|
||||
"map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成
|
||||
[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],
|
||||
@ -15,8 +16,8 @@ main.floors.sample0 = {
|
||||
[216, 247, 256, 235, 248, 6, 0, 3, 49, 50, 51, 52, 38],
|
||||
[6, 6, 125, 6, 6, 6, 0, 1, 45, 46, 47, 48, 37],
|
||||
[224, 254, 212, 232, 204, 5, 0, 1, 31, 32, 34, 33, 36],
|
||||
[201, 205, 217, 215, 207, 5, 0, 1, 27, 28, 29, 30, 35],
|
||||
[5, 5, 125, 5, 5, 5, 0, 1, 21, 22, 23, 24, 25],
|
||||
[201, 205, 217, 215, 207, 5, 50, 1, 27, 28, 29, 30, 35],
|
||||
[5, 5, 125, 5, 5, 5, 50, 1, 21, 22, 23, 24, 25],
|
||||
[0, 0, 0, 0, 0, 0, 45, 1, 1, 1, 121, 1, 1],
|
||||
[4, 4, 126, 4, 4, 4, 0, 0, 0, 0, 0, 85, 124],
|
||||
[87, 11, 12, 13, 14, 4, 4, 2, 2, 2, 122, 2, 2],
|
||||
|
||||
@ -7,6 +7,7 @@ main.floors.sample1 = {
|
||||
"name": 1, // 显示在状态栏中的层数
|
||||
"canFlyTo": true, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
|
||||
"canUseQuickShop": true, // 该层是否允许使用快捷商店
|
||||
"defaultGround": "grass", // 默认地面的图块ID(terrains中)
|
||||
"map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成
|
||||
[7, 131, 8, 2, 9, 130, 10, 2, 166, 165, 132, 165, 166],
|
||||
[0, 0, 0, 0, 0, 0, 0, 2, 165, 164, 0, 162, 165],
|
||||
|
||||
@ -7,6 +7,7 @@ main.floors.sample2 = {
|
||||
"name": 40, // 显示在状态栏中的层数
|
||||
"canFlyTo": false, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
|
||||
"canUseQuickShop": true, // 该层是否允许使用快捷商店
|
||||
"defaultGround": "soil", // 默认地面的图块ID(terrains中)
|
||||
"map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成
|
||||
[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],
|
||||
|
||||
@ -12,30 +12,46 @@ icons.prototype.init = function () {
|
||||
},
|
||||
'terrains': {
|
||||
'ground': 0,
|
||||
'yellowWall': 1,
|
||||
'whiteWall': 2,
|
||||
'blueWall': 3,
|
||||
'star': 4,
|
||||
'lava': 5,
|
||||
'ice': 6,
|
||||
'downFloor': 7,
|
||||
'upFloor': 8,
|
||||
'yellowDoor': 9,
|
||||
'blueDoor': 10,
|
||||
'redDoor': 11,
|
||||
'greenDoor': 12,
|
||||
'specialDoor': 13,
|
||||
'steelDoor': 14,
|
||||
'blueShop-left': 15,
|
||||
'blueShop-right': 16,
|
||||
'pinkShop-left': 17,
|
||||
'pinkShop-right': 18,
|
||||
'arrowUp': 19,
|
||||
'arrowDown': 20,
|
||||
'arrowLeft': 21,
|
||||
'arrowRight': 22,
|
||||
'light': 23,
|
||||
'darkLight': 24
|
||||
'grass': 1,
|
||||
'grass2': 2,
|
||||
'snowGround': 3,
|
||||
'ground2': 4,
|
||||
'ground3': 5,
|
||||
'ground4': 6,
|
||||
'sand': 7,
|
||||
'ground5': 8,
|
||||
'yellowWall2': 9,
|
||||
'whiteWall2': 10,
|
||||
'blueWall2': 11,
|
||||
'blockWall': 12,
|
||||
'grayWall': 13,
|
||||
'white': 14,
|
||||
'ground6': 15,
|
||||
'soil': 16,
|
||||
'yellowWall': 17,
|
||||
'whiteWall': 18,
|
||||
'blueWall': 19,
|
||||
'star': 20,
|
||||
'lava': 21,
|
||||
'ice': 22,
|
||||
'downFloor': 23,
|
||||
'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': {
|
||||
'star': 0,
|
||||
@ -193,6 +209,12 @@ icons.prototype.init = function () {
|
||||
'moneyPocket': 46,
|
||||
'shoes': 47,
|
||||
'hammer': 48
|
||||
},
|
||||
'autotile': { // 所有的Autotile列表;后面的index简单取0即可
|
||||
'autotile': 0,
|
||||
'autotile1': 0,
|
||||
'autotile2': 0,
|
||||
'autotile3': 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
18
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]);
|
||||
if (core.isset(block.event)) blocks.push(block);
|
||||
}
|
||||
@ -78,8 +78,14 @@ maps.prototype.getBlock = function (x, y, id) {
|
||||
if (id == 14) tmp.event = {'cls': 'animates', 'id': 'curseNet', 'noPass': false, 'trigger': 'passNet'}; // 咒网
|
||||
if (id == 15) tmp.event = {'cls': 'animates', 'id': 'water', 'noPass': true}; // 水
|
||||
|
||||
// autotile: 20
|
||||
|
||||
// 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 物品
|
||||
if (id == 21) tmp.event = {'cls': 'items', 'id': 'yellowKey'}; // 黄钥匙
|
||||
@ -232,10 +238,10 @@ maps.prototype.getBlock = function (x, y, id) {
|
||||
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(block.event)) { // 本身是空地?
|
||||
block.event = {'cls': 'terrains', 'id': 'ground', 'noPass': false};
|
||||
block.event = {'cls': 'terrains', 'id': ground, 'noPass': false};
|
||||
}
|
||||
// event是字符串或数组?
|
||||
if (typeof event == "string") {
|
||||
@ -267,9 +273,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;
|
||||
this.addEvent(block, x, y, {"trigger": "changeFloor", "data": event});
|
||||
this.addEvent(block, x, y, {"trigger": "changeFloor", "data": event}, ground);
|
||||
}
|
||||
|
||||
maps.prototype.initMaps = function (floorIds) {
|
||||
|
||||
212
libs/ui.js
@ -26,6 +26,8 @@ ui.prototype.closePanel = function (clearData) {
|
||||
core.unLockControl();
|
||||
core.status.event.data = 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.setFillStyle('ui', background);
|
||||
|
||||
core.status.event.ui = {"text": content, "choices": choices};
|
||||
|
||||
// Step 1: 计算长宽高
|
||||
var length = choices.length;
|
||||
var left=85, width = 416-2*left; // 宽度
|
||||
@ -258,10 +262,15 @@ ui.prototype.drawChoices = function(content, choices) {
|
||||
// 选项
|
||||
core.canvas.ui.textAlign = "center";
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -271,8 +280,13 @@ ui.prototype.drawChoices = function(content, choices) {
|
||||
* @param noCallback
|
||||
*/
|
||||
ui.prototype.drawConfirmBox = function (text, yesCallback, noCallback) {
|
||||
core.lockControl();
|
||||
|
||||
core.status.event.id = 'confirmBox';
|
||||
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");
|
||||
core.clearMap('ui', 0, 0, 416, 416);
|
||||
@ -291,8 +305,10 @@ ui.prototype.drawConfirmBox = function (text, yesCallback, noCallback) {
|
||||
var top = 140 - (lines-1)*30;
|
||||
var right = 416 - 2 * left, bottom = 416 - 140 - top;
|
||||
|
||||
core.fillRect('ui', left, top, right, bottom, background);
|
||||
core.strokeRect('ui', left - 1, top - 1, right + 1, bottom + 1, '#FFFFFF', 2);
|
||||
if (core.isPlaying())
|
||||
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.canvas.ui.textAlign = "center";
|
||||
for (var i in contents) {
|
||||
core.fillText('ui', contents[i], 208, top + 50 + i*30, "#FFFFFF");
|
||||
@ -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);
|
||||
|
||||
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';
|
||||
|
||||
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 = 64 + 32, 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);
|
||||
var choices = [
|
||||
"背景音乐:"+(core.musicStatus.soundStatus ? "[ON]" : "[OFF]"),
|
||||
"战斗动画: " + (core.flags.battleAnimate ? "[ON]" : "[OFF]"),
|
||||
"怪物显伤: " + (core.flags.displayEnemyDamage ? "[ON]" : "[OFF]"),
|
||||
"领域显伤: " + (core.flags.displayExtraDamage ? "[ON]" : "[OFF]"),
|
||||
"返回主菜单"
|
||||
];
|
||||
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,57 +352,28 @@ ui.prototype.drawSettings = function (need) {
|
||||
if (!core.checkStatus('settings', need))
|
||||
return;
|
||||
|
||||
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 = 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");
|
||||
|
||||
this.drawChoices(null, [
|
||||
"系统设置", "快捷商店", "同步存档", "重新开始", "操作帮助", "关于本塔", "返回游戏"
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制“选择商店”窗口
|
||||
* @param need
|
||||
*/
|
||||
ui.prototype.drawQuickShop = function (need) {
|
||||
|
||||
if (core.isset(need) && !core.checkStatus('selectShop', need))
|
||||
return;
|
||||
|
||||
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 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;
|
||||
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++) {
|
||||
core.fillText('ui', shopList[keys[i]].textInList, 208, top + 56 + 32 * i, "#FFFFFF", "bold 17px Verdana");
|
||||
var choices = [];
|
||||
for (var i=0;i<keys.length;i++) {
|
||||
choices.push(shopList[keys[i]].textInList);
|
||||
}
|
||||
|
||||
core.fillText('ui', "返回游戏", 208, top + bottom - 40, "#FFFFFF", "bold 17px Verdana");
|
||||
choices.push("返回游戏");
|
||||
this.drawChoices(null, choices);
|
||||
}
|
||||
|
||||
|
||||
ui.prototype.drawBattleAnimate = function(monsterId, callback) {
|
||||
|
||||
// UI层
|
||||
@ -702,20 +691,11 @@ ui.prototype.drawWaiting = function(text) {
|
||||
ui.prototype.drawSyncSave = function () {
|
||||
|
||||
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;
|
||||
core.fillRect('ui', left, top, right, bottom, background);
|
||||
core.strokeRect('ui', left - 1, top - 1, right + 1, bottom + 1, '#FFFFFF', 2);
|
||||
this.drawChoices(null, [
|
||||
"同步存档到服务器", "从服务器加载存档", "清空本地存档", "返回主菜单"
|
||||
]);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -876,17 +856,29 @@ ui.prototype.drawFly = function(page) {
|
||||
if (page>0)
|
||||
core.fillText('ui', '▼', 356, 247+64, '#FFFFFF', "17px Verdana");
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制工具栏
|
||||
* @param selectId
|
||||
*/
|
||||
ui.prototype.drawToolbox = function(selectId) {
|
||||
ui.prototype.drawToolbox = function(index) {
|
||||
|
||||
if (!core.hasItem(selectId))
|
||||
selectId=null;
|
||||
var tools = Object.keys(core.status.hero.items.tools).sort();
|
||||
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.clearMap('ui', 0, 0, 416, 416);
|
||||
@ -937,7 +929,7 @@ ui.prototype.drawToolbox = function(selectId) {
|
||||
core.canvas.ui.textAlign = 'right';
|
||||
var images = core.material.images.items;
|
||||
// 消耗道具
|
||||
var tools = Object.keys(core.status.hero.items.tools).sort();
|
||||
|
||||
for (var i=0;i<tools.length;i++) {
|
||||
var tool=tools[i];
|
||||
var icon=core.material.icons.items[tool];
|
||||
@ -959,7 +951,7 @@ ui.prototype.drawToolbox = function(selectId) {
|
||||
}
|
||||
|
||||
// 永久道具
|
||||
var constants = Object.keys(core.status.hero.items.constants).sort();
|
||||
|
||||
for (var i=0;i<constants.length;i++) {
|
||||
var constant=constants[i];
|
||||
var icon=core.material.icons.items[constant];
|
||||
@ -981,16 +973,18 @@ ui.prototype.drawToolbox = function(selectId) {
|
||||
core.fillText('ui', '返回游戏', 370, 403,'#DDDDDD', 'bold 15px Verdana');
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制存档、读档
|
||||
* @param page
|
||||
*/
|
||||
ui.prototype.drawSLPanel = function(page) {
|
||||
|
||||
if (page<0) page=0;
|
||||
if (page>=30) page=29;
|
||||
core.status.event.data = page;
|
||||
core.status.savePage = page;
|
||||
ui.prototype.drawSLPanel = function(index) {
|
||||
if (!core.isset(index)) index=1;
|
||||
if (index<=0) index=1;
|
||||
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.setAlpha('ui', 0.85);
|
||||
@ -1007,9 +1001,9 @@ ui.prototype.drawSLPanel = function(page) {
|
||||
|
||||
if (i<3) {
|
||||
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)) {
|
||||
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');
|
||||
}
|
||||
else {
|
||||
@ -1019,9 +1013,9 @@ ui.prototype.drawSLPanel = function(page) {
|
||||
}
|
||||
else {
|
||||
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)) {
|
||||
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');
|
||||
}
|
||||
else {
|
||||
@ -1031,16 +1025,16 @@ ui.prototype.drawSLPanel = function(page) {
|
||||
}
|
||||
}
|
||||
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);
|
||||
var groundId = core.floors[floorId].defaultGround || "ground";
|
||||
var blockIcon = core.material.icons.terrains[groundId];
|
||||
var blockImage = core.material.images.terrains;
|
||||
var persize = size/13;
|
||||
for (var i=0;i<13;i++) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -1060,7 +1054,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)) {
|
||||
var heroIcon = core.material.icons.hero[heroLoc.direction];
|
||||
@ -1108,4 +1102,28 @@ ui.prototype.drawAbout = function() {
|
||||
core.fillText('ui', '打Dota的喵', text_start+len, top+272);
|
||||
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"+
|
||||
"双击勇士: 轻按(仅在轻按开关打开时有效)"
|
||||
]);
|
||||
}
|
||||
4
main.js
@ -193,14 +193,14 @@ window.onresize = function () {
|
||||
|
||||
main.dom.body.onkeydown = function(e) {
|
||||
try {
|
||||
if (main.core.isPlaying())
|
||||
if (main.core.isPlaying() || main.core.status.lockControl)
|
||||
main.core.onkeyDown(e);
|
||||
} catch (ee) {}
|
||||
}
|
||||
|
||||
main.dom.body.onkeyup = function(e) {
|
||||
try {
|
||||
if (main.core.isPlaying())
|
||||
if (main.core.isPlaying() || main.core.status.lockControl)
|
||||
main.core.onkeyUp(e);
|
||||
} catch (ee) {}
|
||||
}
|
||||
|
||||
BIN
常用工具/便捷PS工具.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] 确认飞行
|
||||
其他键 取消飞行
|
||||