Merge remote-tracking branch 'refs/remotes/ckcz123/v2.0' into refactoring-editor

This commit is contained in:
YouWei Zhao 2019-03-26 14:27:28 -04:00
commit 30d920d8b4
13 changed files with 1250 additions and 1454 deletions

View File

@ -338,7 +338,7 @@ time为可选项代表该自动文本的时间。可以不指定不指定
``` js ``` js
"x,y": [ // 实际执行的事件列表 "x,y": [ // 实际执行的事件列表
{"type": "scrollText", "text": "第一排\n第二牌\n\n空行后的一排", "time": 5000, "async": true}, {"type": "scrollText", "text": "第一排\n第二牌\n\n空行后的一排", "time": 5000, "lineHeight": 1.4, "async": true},
] ]
``` ```
@ -346,6 +346,8 @@ text为正文文本内容。可以使用`${ }`来计算表达式的值,且使
time为可选项代表总的滚动时间。默认为5000毫秒。 time为可选项代表总的滚动时间。默认为5000毫秒。
lineHeight为可选项代表行距。默认为1.4。
async可选如果为true则会异步执行即不等待当前事件执行完毕立刻执行下一个事件 async可选如果为true则会异步执行即不等待当前事件执行完毕立刻执行下一个事件
可以使用下面的[设置剧情文本的属性](event#setText设置剧情文本的属性)来对文字颜色、文字大小、粗体、距离左边的偏移量进行设置。 可以使用下面的[设置剧情文本的属性](event#setText设置剧情文本的属性)来对文字颜色、文字大小、粗体、距离左边的偏移量进行设置。
@ -1059,9 +1061,10 @@ loc可忽略如果忽略则显示为事件当前点。
``` js ``` js
"x,y": [ // 实际执行的事件列表 "x,y": [ // 实际执行的事件列表
{"type": "showImage", "code": 1, "image": "bg.jpg", "loc": [231,297], "dw": 100, "dy" : 100, "opacity": 1, "time" : 0}, // 在(231,297)显示bg.jpg {"type": "showImage", "code": 1, "image": "bg.jpg", "loc": [231,297], "opacity": 1, "time" : 0}, // 在(231,297)显示bg.jpg
{"type": "showImage", "code": 12, "image": "1.png", "loc": [209,267], "dw": 100, "dy" : 100, "opacity": 0.5, "time" : 1000}, // 在(209,267)渐变显示1.png渐变时间为1000毫秒完成时不透明度为0.5,这张图片将遮盖上一张 {"type": "showImage", "code": 12, "image": "1.png", "loc": [209,267], "opacity": 0.5, "time" : 1000}, // 在(209,267)渐变显示1.png渐变时间为1000毫秒完成时不透明度为0.5,这张图片将遮盖上一张
{"type": "showImage", "code": 8, "image": "hero.png", "loc": [349,367], "dw": 50, "dy" : 50, "opacity": 1, "time" : 500, "async": true}, // 在(209,267)渐变显示hero.png大小为原图片的一半渐变时间为500毫秒异步执行这张图片将被上一张遮盖 {"type": "showImage", "code": 8, "image": "hero.png", "loc": [349,367], "opacity": 1, "time" : 500, "async": true}, // 在(209,267)渐变显示hero.png渐变时间为500毫秒异步执行这张图片将被上一张遮盖
{"type": "showImage", "code": 10, "image": "hero.png", "sloc": [100,100,100,100], "loc": [0,0,100,100], "opacity": 1, "time": 0} // 截取原图的一部分绘制到画布上的一部分。
] ]
``` ```
@ -1069,9 +1072,9 @@ code为图片编号如果两张图片重叠编号较大会覆盖编号较
image为图片名。**请确保图片在全塔属性中的images中被定义过。** image为图片名。**请确保图片在全塔属性中的images中被定义过。**
loc为图片左上角坐标以像素为单位进行计算 sloc为可选项如果设置了则是个2或4元组代表裁剪原始图片的左上角像素位置和宽高
dw和dh为图片的横向、纵向放大率默认值为100即不进行缩放 loc为2或4元组代表要绘制的画布上的左上角像素位置和宽高
opacity为图片不透明度在0~1之间默认值为1即不透明。 opacity为图片不透明度在0~1之间默认值为1即不透明。
@ -1097,6 +1100,8 @@ loc为图片左上角坐标以像素为单位进行计算。
opacity为图片不透明度在0~1之间默认值为1即不透明。 opacity为图片不透明度在0~1之间默认值为1即不透明。
lineHeight为可选项代表行距。默认为1.4。
time为渐变时间默认值为0即不渐变直接显示。 time为渐变时间默认值为0即不渐变直接显示。
async可选如果为true则会异步执行即不等待当前事件执行完毕立刻执行下一个事件 async可选如果为true则会异步执行即不等待当前事件执行完毕立刻执行下一个事件

View File

@ -268,6 +268,7 @@ action
| animate_s | animate_s
| vibrate_s | vibrate_s
| showImage_s | showImage_s
| showImage_1_s
| hideImage_s | hideImage_s
| showTextImage_s | showTextImage_s
| moveImage_s | moveImage_s
@ -380,27 +381,28 @@ return code;
*/; */;
scrollText_s scrollText_s
: '滚动剧情文本:' '时间' Int '不等待执行完毕' Bool? BGNL? EvalString Newline : '滚动剧情文本:' '时间' Int '行距' Number '不等待执行完毕' Bool? BGNL? EvalString Newline
/* scrollText_s /* scrollText_s
tooltip : scrollText滚动剧情文本将从下到上进行滚动显示。 tooltip : scrollText滚动剧情文本将从下到上进行滚动显示。
helpUrl : https://h5mota.com/games/template/docs/#/event?id=scrollText%ef%bc%9a%e6%bb%9a%e5%8a%a8%e5%89%a7%e6%83%85%e6%96%87%e6%9c%ac helpUrl : https://h5mota.com/games/template/docs/#/event?id=scrollText%ef%bc%9a%e6%bb%9a%e5%8a%a8%e5%89%a7%e6%83%85%e6%96%87%e6%9c%ac
default : [5000,false,"时间是总时间可以使用setText事件来控制字体、颜色、大小、偏移量等"] default : [5000,1.4,false,"时间是总时间可以使用setText事件来控制字体、颜色、大小、偏移量等"]
Bool_0 = Bool_0?', "async": true':''; Bool_0 = Bool_0?', "async": true':'';
var code = '{"type": "scrollText", "text": "'+EvalString_0+'"'+Bool_0+', "time" :'+Int_0+'},\n'; var code = '{"type": "scrollText", "text": "'+EvalString_0+'"'+Bool_0+', "time" :'+Int_0+', "lineHeight": '+Number_0+'},\n';
return code; return code;
*/; */;
setText_s setText_s
: '设置剧情文本的属性' '位置' SetTextPosition_List '偏移像素' EvalString? BGNL? '标题颜色' EvalString? Colour '正文颜色' EvalString? Colour '背景色' EvalString? Colour BGNL? '粗体' B_1_List '标题字体大小' EvalString? '正文字体大小' EvalString? '打字间隔' EvalString? Newline : '设置剧情文本的属性' '位置' SetTextPosition_List '偏移像素' EvalString? '对齐' SetTextAlign_List? BGNL? '标题颜色' EvalString? Colour '正文颜色' EvalString? Colour '背景色' EvalString? Colour BGNL? '粗体' B_1_List '标题字体大小' EvalString? '正文字体大小' EvalString? '打字间隔' EvalString? Newline
/* setText_s /* setText_s
tooltip : setText设置剧情文本的属性,颜色为RGB三元组或RGBA四元组,打字间隔为剧情文字添加的时间间隔,为整数或不填 tooltip : setText设置剧情文本的属性,颜色为RGB三元组或RGBA四元组,打字间隔为剧情文字添加的时间间隔,为整数或不填
helpUrl : https://h5mota.com/games/template/docs/#/event?id=settext%EF%BC%9A%E8%AE%BE%E7%BD%AE%E5%89%A7%E6%83%85%E6%96%87%E6%9C%AC%E7%9A%84%E5%B1%9E%E6%80%A7 helpUrl : https://h5mota.com/games/template/docs/#/event?id=settext%EF%BC%9A%E8%AE%BE%E7%BD%AE%E5%89%A7%E6%83%85%E6%96%87%E6%9C%AC%E7%9A%84%E5%B1%9E%E6%80%A7
default : [null,"","",'rgba(255,255,255,1)',"",'rgba(255,255,255,1)',"",'rgba(255,255,255,1)',null,"","",""] default : [null,"",null,"",'rgba(255,255,255,1)',"",'rgba(255,255,255,1)',"",'rgba(255,255,255,1)',null,"","",""]
SetTextPosition_List_0 =SetTextPosition_List_0==='null'?'': ', "position": "'+SetTextPosition_List_0+'"'; SetTextPosition_List_0 =SetTextPosition_List_0==='null'?'': ', "position": "'+SetTextPosition_List_0+'"';
SetTextAlign_List_0 =SetTextAlign_List_0==='null'?'': ', "align": "'+SetTextAlign_List_0+'"';
var colorRe = /^(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(,0(\.\d+)?|,1)?$/; var colorRe = /^(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(,0(\.\d+)?|,1)?$/;
if (EvalString_0) { if (EvalString_0) {
if (!/^\d+$/.test(EvalString_0))throw new Error('像素偏移量必须是整数或不填'); if (!/^\d+$/.test(EvalString_0))throw new Error('像素偏移量必须是整数或不填');
@ -438,7 +440,7 @@ if (EvalString_6) {
EvalString_6 = ', "time": '+EvalString_6; EvalString_6 = ', "time": '+EvalString_6;
} }
B_1_List_0 = B_1_List_0==='null'?'':', "bold": '+B_1_List_0; B_1_List_0 = B_1_List_0==='null'?'':', "bold": '+B_1_List_0;
var code = '{"type": "setText"'+SetTextPosition_List_0+EvalString_0+EvalString_1+EvalString_2+B_1_List_0+EvalString_3+EvalString_4+EvalString_5+EvalString_6+'},\n'; var code = '{"type": "setText"'+SetTextPosition_List_0+EvalString_0+SetTextAlign_List_0+EvalString_1+EvalString_2+B_1_List_0+EvalString_3+EvalString_4+EvalString_5+EvalString_6+'},\n';
return code; return code;
*/; */;
@ -1132,34 +1134,54 @@ return code;
*/; */;
showImage_s showImage_s
: '显示图片' '图片编号' Int '图片' EvalString '起点像素位置' 'x' PosString 'y' PosString BGNL? : '显示图片' '图片编号' Int '图片' EvalString BGNL?
'放大率 : x' Int '% y' Int '% 不透明度' Number '时间' Int '不等待执行完毕' Bool Newline '绘制的起点像素' 'x' PosString 'y' PosString '不透明度' Number '时间' Int '不等待执行完毕' Bool Newline
/* showImage_s /* showImage_s
tooltip : showImage显示图片 tooltip : showImage显示图片
helpUrl : https://h5mota.com/games/template/docs/#/event?id=showImage%ef%bc%9a%e6%98%be%e7%a4%ba%e5%9b%be%e7%89%87 helpUrl : https://h5mota.com/games/template/docs/#/event?id=showImage%ef%bc%9a%e6%98%be%e7%a4%ba%e5%9b%be%e7%89%87
default : [1,"bg.jpg","0","0",100,100,1,0,false] default : [1,"bg.jpg","0","0",1,0,false]
colour : this.printColor colour : this.printColor
if(Int_0<=0 || Int_0>50) throw new Error('图片编号在1~50之间'); if(Int_0<=0 || Int_0>50) throw new Error('图片编号在1~50之间');
var async = Bool_0?', "async": true':''; var async = Bool_0?', "async": true':'';
var code = '{"type": "showImage", "code": '+Int_0+', "image": "'+EvalString_0+'", "loc": ['+PosString_0+','+PosString_1+'], "dw": '+Int_1+', "dh": '+Int_2+', "opacity": '+Number_0+', "time": '+Int_3+async+'},\n'; var code = '{"type": "showImage", "code": '+Int_0+', "image": "'+EvalString_0+'", "loc": ['+PosString_0+','+PosString_1+'], "opacity": '+Number_0+', "time": '+Int_1+async+'},\n';
return code;
*/;
showImage_1_s
: '显示图片' '图片编号' Int '图片' EvalString BGNL?
'裁剪的起点像素' 'x' PosString 'y' PosString '宽' PosString? '高' PosString? '不透明度' Number BGNL?
'绘制的起点像素' 'x' PosString 'y' PosString '宽' PosString? '高' PosString? '时间' Int '不等待执行完毕' Bool Newline
/* showImage_1_s
tooltip : showImage_1显示图片
helpUrl : https://h5mota.com/games/template/docs/#/event?id=showImage%ef%bc%9a%e6%98%be%e7%a4%ba%e5%9b%be%e7%89%87
default : [1,"bg.jpg","0","0","","",1,"0","0","","",0,false]
colour : this.printColor
if(Int_0<=0 || Int_0>50) throw new Error('图片编号在1~50之间');
var async = Bool_0?', "async": true':'';
var code = '{"type": "showImage", "code": '+Int_0+', "image": "'+EvalString_0+'", '+
'"sloc": ['+PosString_0+','+PosString_1+','+PosString_2+','+PosString_3+'], '+
'"loc": ['+PosString_4+','+PosString_5+','+PosString_6+','+PosString_7+'], '+
'"opacity": '+Number_0+', "time": '+Int_1+async+'},\n';
return code; return code;
*/; */;
showTextImage_s showTextImage_s
: '显示图片化文本' '文本内容' EvalString BGNL? : '显示图片化文本' '文本内容' EvalString BGNL?
'图片编号' Int '起点像素位置' 'x' PosString 'y' PosString '不透明度' Number '时间' Int '不等待执行完毕' Bool Newline '图片编号' Int '起点像素' 'x' PosString 'y' PosString '行距' Number '不透明度' Number '时间' Int '不等待执行完毕' Bool Newline
/* showTextImage_s /* showTextImage_s
tooltip : showTextImage显示图片化文本 tooltip : showTextImage显示图片化文本
helpUrl : https://h5mota.com/games/template/docs/#/event?id=showTextImage%ef%bc%9a%e6%98%be%e7%a4%ba%e6%96%87%e6%9c%ac%e5%8c%96%e5%9b%be%e7%89%87 helpUrl : https://h5mota.com/games/template/docs/#/event?id=showTextImage%ef%bc%9a%e6%98%be%e7%a4%ba%e6%96%87%e6%9c%ac%e5%8c%96%e5%9b%be%e7%89%87
colour : this.printColor colour : this.printColor
default : ["可以使用setText事件来控制字体、颜色、大小、偏移量等",1,"0","0",1,0,false] default : ["可以使用setText事件来控制字体、颜色、大小、偏移量等",1,"0","0",1.4,1,0,false]
if(Int_0<=0 || Int_0>50) throw new Error('图片编号在1~50之间'); if(Int_0<=0 || Int_0>50) throw new Error('图片编号在1~50之间');
var async = Bool_0?', "async": true':''; var async = Bool_0?', "async": true':'';
var code = '{"type": "showTextImage", "code": '+Int_0+', "text": "'+EvalString_0+'", "loc": ['+PosString_0+','+PosString_1+'], "opacity": '+Number_0+', "time": '+Int_1+async+'},\n'; var code = '{"type": "showTextImage", "code": '+Int_0+', "text": "'+EvalString_0+'", "loc": ['+PosString_0+','+PosString_1+'], "lineHeight": '+Number_0+', "opacity": '+Number_1+', "time": '+Int_1+async+'},\n';
return code; return code;
*/; */;
@ -1872,6 +1894,10 @@ SetTextPosition_List
: '不改变'|'距离顶部'|'居中'|'距离底部' : '不改变'|'距离顶部'|'居中'|'距离底部'
/*SetTextPosition_List ['null','up','center','down']*/; /*SetTextPosition_List ['null','up','center','down']*/;
SetTextAlign_List
: '不改变'|'左对齐'|'左右居中'|'右对齐'
/*SetTextAlign_List ['null','left','center','right']*/;
ShopUse_List ShopUse_List
: '金币' | '经验' : '金币' | '经验'
/*ShopUse_List ['money','experience']*/; /*ShopUse_List ['money','experience']*/;
@ -2151,7 +2177,7 @@ ActionParser.prototype.parseAction = function() {
break; break;
case "scrollText": case "scrollText":
this.next = MotaActionBlocks['scrollText_s'].xmlText([ this.next = MotaActionBlocks['scrollText_s'].xmlText([
data.time, data.async||false, this.EvalString(data.text), this.next]); data.time, data.lineHeight||1.4, data.async||false, this.EvalString(data.text), this.next]);
break; break;
case "comment": // 注释 case "comment": // 注释
this.next = MotaActionBlocks['comment_s'].xmlText([this.EvalString(data.text),this.next],null,data.text); this.next = MotaActionBlocks['comment_s'].xmlText([this.EvalString(data.text),this.next],null,data.text);
@ -2163,7 +2189,7 @@ ActionParser.prototype.parseAction = function() {
if (!/^\w+\.png$/.test(data.background)) if (!/^\w+\.png$/.test(data.background))
data.background=setTextfunc(data.background); data.background=setTextfunc(data.background);
this.next = MotaActionBlocks['setText_s'].xmlText([ this.next = MotaActionBlocks['setText_s'].xmlText([
data.position,data.offset,data.title,'rgba('+data.title+')', data.position,data.offset,data.align,data.title,'rgba('+data.title+')',
data.text,'rgba('+data.text+')',data.background,'rgba('+data.background+')', data.text,'rgba('+data.text+')',data.background,'rgba('+data.background+')',
data.bold,data.titlefont,data.textfont,data.time,this.next]); data.bold,data.titlefont,data.textfont,data.time,this.next]);
break; break;
@ -2308,8 +2334,16 @@ ActionParser.prototype.parseAction = function() {
break; break;
case "showImage": // 显示图片 case "showImage": // 显示图片
data.loc=data.loc||['',''] data.loc=data.loc||['','']
this.next = MotaActionBlocks['showImage_s'].xmlText([ if (data.sloc) {
data.code,data.image||data.name,data.loc[0],data.loc[1],data.dw,data.dh,data.opacity,data.time||0,data.async||false,this.next]); this.next = MotaActionBlocks['showImage_1_s'].xmlText([
data.code,data.image||data.name,data.sloc[0],data.sloc[1],data.sloc[2],data.sloc[3],data.opacity,
data.loc[0],data.loc[1],data.loc[2],data.loc[3],data.time||0,data.async||false,this.next
]);
}
else {
this.next = MotaActionBlocks['showImage_s'].xmlText([
data.code,data.image||data.name,data.loc[0],data.loc[1],data.opacity,data.time||0,data.async||false,this.next]);
}
break; break;
case "hideImage": // 清除图片 case "hideImage": // 清除图片
this.next = MotaActionBlocks['hideImage_s'].xmlText([ this.next = MotaActionBlocks['hideImage_s'].xmlText([
@ -2318,7 +2352,7 @@ ActionParser.prototype.parseAction = function() {
case "showTextImage": // 显示图片化文本 case "showTextImage": // 显示图片化文本
data.loc=data.loc||['',''] data.loc=data.loc||['','']
this.next = MotaActionBlocks['showTextImage_s'].xmlText([ this.next = MotaActionBlocks['showTextImage_s'].xmlText([
this.EvalString(data.text),data.code,data.loc[0],data.loc[1],data.opacity,data.time||0,data.async||false,this.next]); this.EvalString(data.text),data.code,data.loc[0],data.loc[1],data.lineHeight||1.4,data.opacity,data.time||0,data.async||false,this.next]);
break; break;
case "moveImage": // 移动图片 case "moveImage": // 移动图片
data.to=data.to||['',''] data.to=data.to||['','']

View File

@ -54,6 +54,7 @@ editor_blockly = function () {
MotaActionBlocks['scrollText_s'].xmlText(), MotaActionBlocks['scrollText_s'].xmlText(),
MotaActionBlocks['setText_s'].xmlText(), MotaActionBlocks['setText_s'].xmlText(),
MotaActionBlocks['showImage_s'].xmlText(), MotaActionBlocks['showImage_s'].xmlText(),
MotaActionBlocks['showImage_1_s'].xmlText(),
MotaActionBlocks['hideImage_s'].xmlText(), MotaActionBlocks['hideImage_s'].xmlText(),
MotaActionBlocks['showTextImage_s'].xmlText(), MotaActionBlocks['showTextImage_s'].xmlText(),
MotaActionBlocks['moveImage_s'].xmlText(), MotaActionBlocks['moveImage_s'].xmlText(),

View File

@ -7,6 +7,11 @@ actions.js用户交互的事件的处理
function actions() { function actions() {
this._init(); this._init();
this.SIZE = core.__SIZE__;
this.HSIZE = core.__HALF_SIZE__;
this.LAST = this.SIZE - 1;
this.CHOICES_LEFT = 5; // choices
this.CHOICES_RIGHT = this.LAST - this.CHOICES_LEFT;
} }
actions.prototype._init = function () { actions.prototype._init = function () {
@ -109,7 +114,7 @@ actions.prototype.checkReplaying = function () {
////// 检查是否在录像播放中,如果是,则停止交互 ////// 检查是否在录像播放中,如果是,则停止交互
actions.prototype._sys_checkReplay = function () { actions.prototype._sys_checkReplay = function () {
if (core.actions.checkReplaying()) return true; if (this.checkReplaying()) return true;
} }
////// 按下某个键时 ////// ////// 按下某个键时 //////
@ -127,10 +132,10 @@ actions.prototype._sys_onkeyDown = function (e) {
} }
} }
core.status.holdingKeys.push(e.keyCode); core.status.holdingKeys.push(e.keyCode);
core.actions.pressKey(e.keyCode); this.pressKey(e.keyCode);
} else { } else {
if (e.keyCode == 17) core.status.ctrlDown = true; if (e.keyCode == 17) core.status.ctrlDown = true;
core.actions.keyDown(e.keyCode); this.keyDown(e.keyCode);
} }
} }
@ -140,7 +145,7 @@ actions.prototype.onkeyUp = function (e) {
} }
actions.prototype._sys_onkeyUp_replay = function (e) { actions.prototype._sys_onkeyUp_replay = function (e) {
if (core.actions.checkReplaying()) { if (this.checkReplaying()) {
if (e.keyCode == 27) // ESCAPE if (e.keyCode == 27) // ESCAPE
core.stopReplay(); core.stopReplay();
else if (e.keyCode == 90) // Z else if (e.keyCode == 90) // Z
@ -179,10 +184,10 @@ actions.prototype._sys_onkeyUp = function (e) {
break; break;
} }
} }
core.actions.keyUp(e.keyCode, e.altKey); this.keyUp(e.keyCode, e.altKey);
} else { } else {
if (e.keyCode == 17) core.status.ctrlDown = false; if (e.keyCode == 17) core.status.ctrlDown = false;
core.actions.keyUp(e.keyCode, e.altKey); this.keyUp(e.keyCode, e.altKey);
} }
} }
@ -209,32 +214,32 @@ actions.prototype._sys_keyDown_lockControl = function (keyCode) {
if (!core.status.lockControl) return false; if (!core.status.lockControl) return false;
// Ctrl跳过对话 // Ctrl跳过对话
if (keyCode == 17) { if (keyCode == 17) {
core.actions.keyDownCtrl(); this.keyDownCtrl();
return true; return true;
} }
switch (core.status.event.id) { switch (core.status.event.id) {
case 'action': case 'action':
core.actions._keyDownAction(keyCode); this._keyDownAction(keyCode);
break; break;
case 'book': case 'book':
core.actions._keyDownBook(keyCode); this._keyDownBook(keyCode);
break; break;
case 'fly': case 'fly':
core.actions._keyDownFly(keyCode); this._keyDownFly(keyCode);
break; break;
case 'viewMaps': case 'viewMaps':
core.actions._keyDownViewMaps(keyCode); this._keyDownViewMaps(keyCode);
break; break;
case 'equipbox': case 'equipbox':
core.actions._keyDownEquipbox(keyCode); this._keyDownEquipbox(keyCode);
break; break;
case 'toolbox': case 'toolbox':
core.actions._keyDownToolbox(keyCode); this._keyDownToolbox(keyCode);
break; break;
case 'save': case 'save':
case 'load': case 'load':
case 'replayLoad': case 'replayLoad':
core.actions._keyDownSL(keyCode); this._keyDownSL(keyCode);
break; break;
case 'shop': case 'shop':
case 'selectShop': case 'selectShop':
@ -246,10 +251,10 @@ actions.prototype._sys_keyDown_lockControl = function (keyCode) {
case 'storageRemove': case 'storageRemove':
case 'replay': case 'replay':
case 'gameInfo': case 'gameInfo':
core.actions._keyDownChoices(keyCode); this._keyDownChoices(keyCode);
break; break;
case 'cursor': case 'cursor':
core.actions._keyDownCursor(keyCode); this._keyDownCursor(keyCode);
break; break;
} }
return true; return true;
@ -271,7 +276,6 @@ actions.prototype._sys_keyDown = function (keyCode) {
case 40: case 40:
core.moveHero('down'); core.moveHero('down');
break; break;
break;
} }
return true; return true;
} }
@ -282,7 +286,7 @@ actions.prototype.keyUp = function (keyCode, altKey, fromReplay) {
} }
actions.prototype._sys_keyUp_replay = function (keyCode, altKey, fromReplay) { actions.prototype._sys_keyUp_replay = function (keyCode, altKey, fromReplay) {
if (!fromReplay && core.actions.checkReplaying()) return true; if (!fromReplay && this.checkReplaying()) return true;
} }
actions.prototype._sys_keyUp_lockControl = function (keyCode, altKey) { actions.prototype._sys_keyUp_lockControl = function (keyCode, altKey) {
@ -298,81 +302,81 @@ actions.prototype._sys_keyUp_lockControl = function (keyCode, altKey) {
ok() && core.drawText(); ok() && core.drawText();
break; break;
case 'confirmBox': case 'confirmBox':
core.actions._keyUpConfirmBox(keyCode); this._keyUpConfirmBox(keyCode);
break; break;
case 'action': case 'action':
core.actions._keyUpAction(keyCode); this._keyUpAction(keyCode);
break; break;
case 'about': case 'about':
ok() && core.ui.closePanel(); ok() && core.closePanel();
break; break;
case 'help': case 'help':
ok() && core.ui.closePanel(); ok() && core.closePanel();
break; break;
case 'book': case 'book':
core.actions._keyUpBook(keyCode); this._keyUpBook(keyCode);
break; break;
case 'book-detail': case 'book-detail':
ok() && core.actions._clickBookDetail(); ok() && this._clickBookDetail();
break; break;
case 'fly': case 'fly':
this._keyUpFly(keyCode); this._keyUpFly(keyCode);
break; break;
case 'viewMaps': case 'viewMaps':
core.actions._keyUpViewMaps(keyCode); this._keyUpViewMaps(keyCode);
break; break;
case 'shop': case 'shop':
core.actions._keyUpShop(keyCode); this._keyUpShop(keyCode);
break; break;
case 'selectShop': case 'selectShop':
core.actions._keyUpQuickShop(keyCode); this._keyUpQuickShop(keyCode);
break; break;
case 'toolbox': case 'toolbox':
core.actions._keyUpToolbox(keyCode); this._keyUpToolbox(keyCode);
break; break;
case 'equipbox': case 'equipbox':
core.actions._keyUpEquipbox(keyCode, altKey); this._keyUpEquipbox(keyCode, altKey);
break; break;
case 'save': case 'save':
case 'load': case 'load':
case 'replayLoad': case 'replayLoad':
core.actions._keyUpSL(keyCode); this._keyUpSL(keyCode);
break; break;
case 'keyBoard': case 'keyBoard':
ok() && core.ui.closePanel(); ok() && core.closePanel();
break; break;
case 'switchs': case 'switchs':
core.actions._keyUpSwitchs(keyCode); this._keyUpSwitchs(keyCode);
break; break;
case 'settings': case 'settings':
core.actions._keyUpSettings(keyCode); this._keyUpSettings(keyCode);
break; break;
case 'syncSave': case 'syncSave':
core.actions._keyUpSyncSave(keyCode); this._keyUpSyncSave(keyCode);
break; break;
case 'syncSelect': case 'syncSelect':
core.actions._keyUpSyncSelect(keyCode); this._keyUpSyncSelect(keyCode);
break; break;
case 'localSaveSelect': case 'localSaveSelect':
core.actions._keyUpLocalSaveSelect(keyCode); this._keyUpLocalSaveSelect(keyCode);
break; break;
case 'storageRemove': case 'storageRemove':
core.actions._keyUpStorageRemove(keyCode); this._keyUpStorageRemove(keyCode);
break; break;
case 'cursor': case 'cursor':
core.actions._keyUpCursor(keyCode); this._keyUpCursor(keyCode);
break; break;
case 'replay': case 'replay':
core.actions._keyUpReplay(keyCode); this._keyUpReplay(keyCode);
break; break;
case 'gameInfo': case 'gameInfo':
core.actions._keyUpGameInfo(keyCode); this._keyUpGameInfo(keyCode);
break; break;
case 'centerFly': case 'centerFly':
core.actions._keyUpCenterFly(keyCode); this._keyUpCenterFly(keyCode);
break; break;
case 'paint': case 'paint':
core.actions._keyUpPaint(keyCode); this._keyUpPaint(keyCode);
break; break;
} }
return true; return true;
@ -399,7 +403,7 @@ actions.prototype.ondown = function (loc) {
actions.prototype._sys_ondown_paint = function (x, y, px, py) { actions.prototype._sys_ondown_paint = function (x, y, px, py) {
// 画板 // 画板
if (core.status.played && (core.status.event || {}).id == 'paint') { if (core.status.played && (core.status.event || {}).id == 'paint') {
core.actions._ondownPaint(px, py); this._ondownPaint(px, py);
return true; return true;
} }
} }
@ -492,7 +496,7 @@ actions.prototype.onup = function () {
actions.prototype._sys_onup_paint = function () { actions.prototype._sys_onup_paint = function () {
// 画板 // 画板
if (core.status.played && (core.status.event || {}).id == 'paint') { if (core.status.played && (core.status.event || {}).id == 'paint') {
core.actions._onupPaint(); this._onupPaint();
return true; return true;
} }
} }
@ -567,75 +571,75 @@ actions.prototype._sys_onclick_lockControl = function (x, y) {
if (!core.status.lockControl) return false; if (!core.status.lockControl) return false;
switch (core.status.event.id) { switch (core.status.event.id) {
case 'centerFly': case 'centerFly':
core.actions._clickCenterFly(x, y); this._clickCenterFly(x, y);
break; break;
case 'book': case 'book':
core.actions._clickBook(x, y); this._clickBook(x, y);
break; break;
case 'book-detail': case 'book-detail':
core.actions._clickBookDetail(x, y); this._clickBookDetail(x, y);
break; break;
case 'fly': case 'fly':
core.actions._clickFly(x, y); this._clickFly(x, y);
break; break;
case 'viewMaps': case 'viewMaps':
core.actions._clickViewMaps(x, y); this._clickViewMaps(x, y);
break; break;
case 'switchs': case 'switchs':
core.actions._clickSwitchs(x, y); this._clickSwitchs(x, y);
break; break;
case 'settings': case 'settings':
core.actions._clickSettings(x, y); this._clickSettings(x, y);
break; break;
case 'shop': case 'shop':
core.actions._clickShop(x, y); this._clickShop(x, y);
break; break;
case 'selectShop': case 'selectShop':
core.actions._clickQuickShop(x, y); this._clickQuickShop(x, y);
break; break;
case 'equipbox': case 'equipbox':
core.actions._clickEquipbox(x, y); this._clickEquipbox(x, y);
break; break;
case 'toolbox': case 'toolbox':
core.actions._clickToolbox(x, y); this._clickToolbox(x, y);
break; break;
case 'save': case 'save':
case 'load': case 'load':
case 'replayLoad': case 'replayLoad':
core.actions._clickSL(x, y); this._clickSL(x, y);
break; break;
case 'confirmBox': case 'confirmBox':
core.actions._clickConfirmBox(x, y); this._clickConfirmBox(x, y);
break; break;
case 'keyBoard': case 'keyBoard':
core.actions._clickKeyBoard(x, y); this._clickKeyBoard(x, y);
break; break;
case 'action': case 'action':
core.actions._clickAction(x, y); this._clickAction(x, y);
break; break;
case 'text': case 'text':
core.drawText(); core.drawText();
break; break;
case 'syncSave': case 'syncSave':
core.actions._clickSyncSave(x, y); this._clickSyncSave(x, y);
break; break;
case 'syncSelect': case 'syncSelect':
core.actions._clickSyncSelect(x, y); this._clickSyncSelect(x, y);
break; break;
case 'localSaveSelect': case 'localSaveSelect':
core.actions._clickLocalSaveSelect(x, y); this._clickLocalSaveSelect(x, y);
break; break;
case 'storageRemove': case 'storageRemove':
core.actions._clickStorageRemove(x, y); this._clickStorageRemove(x, y);
break; break;
case 'cursor': case 'cursor':
core.actions._clickCursor(x, y); this._clickCursor(x, y);
break; break;
case 'replay': case 'replay':
core.actions._clickReplay(x, y); this._clickReplay(x, y);
break; break;
case 'gameInfo': case 'gameInfo':
core.actions._clickGameInfo(x, y); this._clickGameInfo(x, y);
break; break;
case 'about': case 'about':
case 'help': case 'help':
@ -668,15 +672,15 @@ actions.prototype._sys_onmousewheel = function (direct) {
// 楼层飞行器 // 楼层飞行器
if (core.status.lockControl && core.status.event.id == 'fly') { if (core.status.lockControl && core.status.event.id == 'fly') {
if (direct == 1) core.ui.drawFly(core.actions._getNextFlyFloor(1)); if (direct == 1) core.ui.drawFly(this._getNextFlyFloor(1));
if (direct == -1) core.ui.drawFly(core.actions._getNextFlyFloor(-1)); if (direct == -1) core.ui.drawFly(this._getNextFlyFloor(-1));
return; return;
} }
// 怪物手册 // 怪物手册
if (core.status.lockControl && core.status.event.id == 'book') { if (core.status.lockControl && core.status.event.id == 'book') {
if (direct == 1) core.ui.drawBook(core.status.event.data - 6); if (direct == 1) core.ui.drawBook(core.status.event.data - this.HSIZE);
if (direct == -1) core.ui.drawBook(core.status.event.data + 6); if (direct == -1) core.ui.drawBook(core.status.event.data + this.HSIZE);
return; return;
} }
@ -689,8 +693,8 @@ actions.prototype._sys_onmousewheel = function (direct) {
// 浏览地图 // 浏览地图
if (core.status.lockControl && core.status.event.id == 'viewMaps') { if (core.status.lockControl && core.status.event.id == 'viewMaps') {
if (direct == 1) core.actions._clickViewMaps(6, 3); if (direct == 1) this._clickViewMaps(this.HSIZE, this.HSIZE - 3);
if (direct == -1) core.actions._clickViewMaps(6, 9); if (direct == -1) this._clickViewMaps(this.HSIZE, this.HSIZE + 3);
return; return;
} }
@ -740,7 +744,7 @@ actions.prototype._sys_longClick_lockControl = function (x, y) {
// 长按楼传器的箭头可以快速翻页 // 长按楼传器的箭头可以快速翻页
if (core.status.event.id == 'fly') { if (core.status.event.id == 'fly') {
if ((x == 10 || x == 11) && (y == 5 || y == 9)) { if ((x == 10 || x == 11) && (y == 5 || y == 9)) {
core.actions._clickFly(x, y); this._clickFly(x, y);
return true; return true;
} }
} }
@ -772,14 +776,14 @@ actions.prototype._sys_longClick = function (x, y, fromEvent) {
// 数字键快速选择选项 // 数字键快速选择选项
actions.prototype._selectChoices = function (length, keycode, callback) { actions.prototype._selectChoices = function (length, keycode, callback) {
var topIndex = 6 - parseInt((length - 1) / 2); var topIndex = this.HSIZE - parseInt((length - 1) / 2);
if (keycode == 13 || keycode == 32 || keycode == 67) { if (keycode == 13 || keycode == 32 || keycode == 67) {
callback.apply(this, [6, topIndex + core.status.event.selection]); callback.apply(this, [this.HSIZE, topIndex + core.status.event.selection]);
} }
if (keycode >= 49 && keycode <= 57) { if (keycode >= 49 && keycode <= 57) {
var index = keycode - 49; var index = keycode - 49;
if (index < length) { if (index < length) {
callback.apply(this, [6, topIndex + index]); callback.apply(this, [this.HSIZE, topIndex + index]);
} }
} }
} }
@ -824,9 +828,9 @@ actions.prototype._keyUpCenterFly = function (keycode) {
////// 点击确认框时 ////// ////// 点击确认框时 //////
actions.prototype._clickConfirmBox = function (x, y) { actions.prototype._clickConfirmBox = function (x, y) {
if ((x == 4 || x == 5) && y == 7 && core.status.event.data.yes) if ((x == this.HSIZE-2 || x == this.HSIZE-1) && y == this.HSIZE+1 && core.status.event.data.yes)
core.status.event.data.yes(); core.status.event.data.yes();
if ((x == 7 || x == 8) && y == 7 && core.status.event.data.no) if ((x == this.HSIZE+2 || x == this.HSIZE+1) && y == this.HSIZE+1 && core.status.event.data.no)
core.status.event.data.no(); core.status.event.data.no();
} }
@ -877,8 +881,8 @@ actions.prototype._clickAction = function (x, y) {
var data = core.status.event.data.current; var data = core.status.event.data.current;
var choices = data.choices; var choices = data.choices;
if (choices.length == 0) return; if (choices.length == 0) return;
if (x >= 5 && x <= 7) { if (x >= this.CHOICES_LEFT && x <= this.CHOICES_RIGHT) {
var topIndex = 6 - parseInt((choices.length - 1) / 2); var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2);
if (y >= topIndex && y < topIndex + choices.length) { if (y >= topIndex && y < topIndex + choices.length) {
// 选择 // 选择
core.status.route.push("choices:" + (y - topIndex)); core.status.route.push("choices:" + (y - topIndex));
@ -925,17 +929,17 @@ actions.prototype._keyUpAction = function (keycode) {
////// 怪物手册界面的点击操作 ////// ////// 怪物手册界面的点击操作 //////
actions.prototype._clickBook = function (x, y) { actions.prototype._clickBook = function (x, y) {
// 上一页 // 上一页
if ((x == 3 || x == 4) && y == 12) { if ((x == this.HSIZE-2 || x == this.HSIZE-3) && y == this.LAST) {
core.ui.drawBook(core.status.event.data - 6); core.ui.drawBook(core.status.event.data - this.HSIZE);
return; return;
} }
// 下一页 // 下一页
if ((x == 8 || x == 9) && y == 12) { if ((x == this.HSIZE+2 || x == this.HSIZE+3) && y == this.LAST) {
core.ui.drawBook(core.status.event.data + 6); core.ui.drawBook(core.status.event.data + this.HSIZE);
return; return;
} }
// 返回 // 返回
if (x >= 10 && x <= 12 && y == 12) { if (x >= this.LAST-2 && y == this.LAST) {
if (core.events.recoverEvents(core.status.event.interval)) { if (core.events.recoverEvents(core.status.event.interval)) {
return; return;
} }
@ -948,9 +952,9 @@ actions.prototype._clickBook = function (x, y) {
} }
// 怪物信息 // 怪物信息
var data = core.status.event.data; var data = core.status.event.data;
if (data != null && y < 12) { if (data != null && y < this.LAST) {
var page = parseInt(data / 6); var page = parseInt(data / this.HSIZE);
var index = 6 * page + parseInt(y / 2); var index = this.HSIZE * page + parseInt(y / 2);
core.ui.drawBook(index); core.ui.drawBook(index);
core.ui.drawBookDetail(index); core.ui.drawBookDetail(index);
} }
@ -959,12 +963,12 @@ actions.prototype._clickBook = function (x, y) {
////// 怪物手册界面时,按下某个键的操作 ////// ////// 怪物手册界面时,按下某个键的操作 //////
actions.prototype._keyDownBook = function (keycode) { actions.prototype._keyDownBook = function (keycode) {
if (keycode == 37) core.ui.drawBook(core.status.event.data - 6); if (keycode == 37) core.ui.drawBook(core.status.event.data - this.HSIZE);
if (keycode == 38) core.ui.drawBook(core.status.event.data - 1); if (keycode == 38) core.ui.drawBook(core.status.event.data - 1);
if (keycode == 39) core.ui.drawBook(core.status.event.data + 6); if (keycode == 39) core.ui.drawBook(core.status.event.data + this.HSIZE);
if (keycode == 40) core.ui.drawBook(core.status.event.data + 1); if (keycode == 40) core.ui.drawBook(core.status.event.data + 1);
if (keycode == 33) core.ui.drawBook(core.status.event.data - 6); if (keycode == 33) core.ui.drawBook(core.status.event.data - this.HSIZE);
if (keycode == 34) core.ui.drawBook(core.status.event.data + 6); if (keycode == 34) core.ui.drawBook(core.status.event.data + this.HSIZE);
return; return;
} }
@ -984,7 +988,7 @@ actions.prototype._keyUpBook = function (keycode) {
if (keycode == 13 || keycode == 32 || keycode == 67) { if (keycode == 13 || keycode == 32 || keycode == 67) {
var data = core.status.event.data; var data = core.status.event.data;
if (data != null) { if (data != null) {
this._clickBook(6, 2 * (data % 6)); this._clickBook(this.HSIZE, 2 * (data % this.HSIZE));
} }
return; return;
} }
@ -998,12 +1002,12 @@ actions.prototype._clickBookDetail = function () {
////// 楼层传送器界面时的点击操作 ////// ////// 楼层传送器界面时的点击操作 //////
actions.prototype._clickFly = function (x, y) { actions.prototype._clickFly = function (x, y) {
if ((x == 10 || x == 11) && y == 9) core.ui.drawFly(this._getNextFlyFloor(-1)); if ((x == this.SIZE-2 || x == this.SIZE-3) && y == this.HSIZE+3) core.ui.drawFly(this._getNextFlyFloor(-1));
if ((x == 10 || x == 11) && y == 5) core.ui.drawFly(this._getNextFlyFloor(1)); if ((x == this.SIZE-2 || x == this.SIZE-3) && y == this.HSIZE-1) core.ui.drawFly(this._getNextFlyFloor(1));
if ((x == 10 || x == 11) && y == 10) core.ui.drawFly(this._getNextFlyFloor(-10)); if ((x == this.SIZE-2 || x == this.SIZE-3) && y == this.HSIZE+4) core.ui.drawFly(this._getNextFlyFloor(-10));
if ((x == 10 || x == 11) && y == 4) core.ui.drawFly(this._getNextFlyFloor(10)); if ((x == this.SIZE-2 || x == this.SIZE-3) && y == this.HSIZE-2) core.ui.drawFly(this._getNextFlyFloor(10));
if (x >= 5 && x <= 7 && y == 12) core.ui.closePanel(); if (x >= this.HSIZE-1 && x <= this.HSIZE+1 && y == this.LAST) core.ui.closePanel();
if (x >= 0 && x <= 9 && y >= 3 && y <= 11) if (x >= 0 && x <= this.HSIZE+3 && y >= 3 && y <= this.LAST - 1)
core.flyTo(core.floorIds[core.status.event.data]); core.flyTo(core.floorIds[core.status.event.data]);
return; return;
} }
@ -1041,7 +1045,7 @@ actions.prototype._keyUpFly = function (keycode) {
if (keycode == 71 || keycode == 27 || keycode == 88) if (keycode == 71 || keycode == 27 || keycode == 88)
core.ui.closePanel(); core.ui.closePanel();
if (keycode == 13 || keycode == 32 || keycode == 67) if (keycode == 13 || keycode == 32 || keycode == 67)
this._clickFly(5, 5); this._clickFly(this.HSIZE-1, this.HSIZE-1);
return; return;
} }
@ -1051,60 +1055,60 @@ actions.prototype._clickViewMaps = function (x, y) {
core.ui.drawMaps(core.floorIds.indexOf(core.status.floorId)); core.ui.drawMaps(core.floorIds.indexOf(core.status.floorId));
return; return;
} }
var now = core.floorIds.indexOf(core.status.floorId); var now = core.floorIds.indexOf(core.status.floorId);
var index = core.status.event.data.index; var index = core.status.event.data.index;
var cx = core.status.event.data.x, cy = core.status.event.data.y; var cx = core.status.event.data.x, cy = core.status.event.data.y;
var floorId = core.floorIds[index], mw = core.floors[floorId].width, mh = core.floors[floorId].height; var floorId = core.floorIds[index], mw = core.floors[floorId].width, mh = core.floors[floorId].height;
var per = this.HSIZE - 4;
if (x == 0 && y == 0) { if (x <= per - 2 && y <= per - 2) {
core.status.event.data.damage = !core.status.event.data.damage; core.status.event.data.damage = !core.status.event.data.damage;
core.ui.drawMaps(index, cx, cy); core.ui.drawMaps(index, cx, cy);
return; return;
} }
if (x == 0 && y == 12) { if (x <= per - 2 && y >= this.SIZE + 1 - per) {
core.status.event.data.paint = !core.status.event.data.paint; core.status.event.data.paint = !core.status.event.data.paint;
core.ui.drawMaps(index, cx, cy); core.ui.drawMaps(index, cx, cy);
return; return;
} }
if (x == 12 && y == 0) { if (x >= this.SIZE + 1 - per && y <= per - 2) {
core.status.event.data.all = !core.status.event.data.all; core.status.event.data.all = !core.status.event.data.all;
core.ui.drawMaps(index, cx, cy); core.ui.drawMaps(index, cx, cy);
return; return;
} }
if (x >= 2 && x <= 10 && y <= 1 && mh > 13) { if (x >= per && x <= this.LAST - per && y <= per - 1 && mh > this.SIZE) {
core.ui.drawMaps(index, cx, cy - 1); core.ui.drawMaps(index, cx, cy - 1);
return; return;
} }
if (x >= 2 && x <= 10 && y >= 11 && mh > 13) { if (x >= per && x <= this.LAST - per && y >= this.SIZE - per && mh > this.SIZE) {
core.ui.drawMaps(index, cx, cy + 1); core.ui.drawMaps(index, cx, cy + 1);
return; return;
} }
if (x <= 1 && y >= 2 && y <= 10) { if (x <= per - 1 && y >= per && y <= this.LAST - per) {
core.ui.drawMaps(index, cx - 1, cy); core.ui.drawMaps(index, cx - 1, cy);
return; return;
} }
if (x >= 11 && y >= 2 && y <= 10) { if (x >= this.SIZE - per && y >= per && y <= this.LAST - per) {
core.ui.drawMaps(index, cx + 1, cy); core.ui.drawMaps(index, cx + 1, cy);
return; return;
} }
if (y <= 4 && (mh == 13 || (x >= 2 && x <= 10))) { if (y <= this.HSIZE - 2 && (mh == this.SIZE || (x >= per && x <= this.LAST - per))) {
index++; index++;
while (index < core.floorIds.length && index != now && core.status.maps[core.floorIds[index]].cannotViewMap) while (index < core.floorIds.length && index != now && core.status.maps[core.floorIds[index]].cannotViewMap)
index++; index++;
if (index < core.floorIds.length) if (index < core.floorIds.length)
core.ui.drawMaps(index); core.ui.drawMaps(index);
} }
else if (y >= 8 && (mh == 13 || (x >= 2 && x <= 10))) { else if (y >= this.HSIZE + 2 && (mh == this.SIZE || (x >= per && x <= this.LAST - per))) {
index--; index--;
while (index >= 0 && index != now && core.status.maps[core.floorIds[index]].cannotViewMap) while (index >= 0 && index != now && core.status.maps[core.floorIds[index]].cannotViewMap)
index--; index--;
if (index >= 0) if (index >= 0)
core.ui.drawMaps(index); core.ui.drawMaps(index);
} }
else if (x >= 2 && x <= 10 && y >= 5 && y <= 7) { else if (x >= per && x <= this.LAST - per && y >= this.HSIZE - 1 && y <= this.HSIZE + 1) {
core.clearMap('data'); core.clearMap('data');
core.ui.closePanel(); core.ui.closePanel();
} }
@ -1116,12 +1120,12 @@ actions.prototype._keyDownViewMaps = function (keycode) {
var floorId = core.floorIds[core.status.event.data.index], mh = core.floors[floorId].height; var floorId = core.floorIds[core.status.event.data.index], mh = core.floors[floorId].height;
if (keycode == 38 || keycode == 33) this._clickViewMaps(6, 3); if (keycode == 38 || keycode == 33) this._clickViewMaps(this.HSIZE, this.HSIZE - 3);
if (keycode == 40 || keycode == 34) this._clickViewMaps(6, 9); if (keycode == 40 || keycode == 34) this._clickViewMaps(this.HSIZE, this.HSIZE + 3);
if (keycode == 87 && mh > 13) this._clickViewMaps(6, 0); if (keycode == 87 && mh > this.SIZE) this._clickViewMaps(this.HSIZE, 0);
if (keycode == 65) this._clickViewMaps(0, 6); if (keycode == 65) this._clickViewMaps(0, this.HSIZE);
if (keycode == 83 && mh > 13) this._clickViewMaps(6, 12); if (keycode == 83 && mh > this.SIZE) this._clickViewMaps(this.HSIZE, this.LAST);
if (keycode == 68) this._clickViewMaps(12, 6); if (keycode == 68) this._clickViewMaps(this.LAST, this.HSIZE);
return; return;
} }
@ -1167,8 +1171,8 @@ actions.prototype._keyUpViewMaps = function (keycode) {
actions.prototype._clickShop = function (x, y) { actions.prototype._clickShop = function (x, y) {
var shop = core.status.event.data.shop; var shop = core.status.event.data.shop;
var choices = shop.choices; var choices = shop.choices;
if (x >= 5 && x <= 7) { if (x >= this.CHOICES_LEFT && x <= this.CHOICES_RIGHT) {
var topIndex = 6 - parseInt(choices.length / 2); var topIndex = this.HSIZE - parseInt(choices.length / 2);
if (y >= topIndex && y < topIndex + choices.length) { if (y >= topIndex && y < topIndex + choices.length) {
return core.events._useShop(shop, y - topIndex); return core.events._useShop(shop, y - topIndex);
} }
@ -1196,8 +1200,8 @@ actions.prototype._clickQuickShop = function (x, y) {
var shopList = core.status.shops, keys = Object.keys(shopList).filter(function (shopId) { var shopList = core.status.shops, keys = Object.keys(shopList).filter(function (shopId) {
return shopList[shopId].visited || !shopList[shopId].mustEnable return shopList[shopId].visited || !shopList[shopId].mustEnable
}); });
if (x >= 5 && x <= 7) { if (x >= this.CHOICES_LEFT && x <= this.CHOICES_RIGHT) {
var topIndex = 6 - parseInt(keys.length / 2); var topIndex = this.HSIZE - parseInt(keys.length / 2);
if (y >= topIndex && y < topIndex + keys.length) { if (y >= topIndex && y < topIndex + keys.length) {
var reason = core.events.canUseQuickShop(keys[y - topIndex]); var reason = core.events.canUseQuickShop(keys[y - topIndex]);
if (!core.flags.enableDisabledShop && reason) { if (!core.flags.enableDisabledShop && reason) {
@ -1749,9 +1753,9 @@ actions.prototype._keyUpSL = function (keycode) {
////// 系统设置界面时的点击操作 ////// ////// 系统设置界面时的点击操作 //////
actions.prototype._clickSwitchs = function (x, y) { actions.prototype._clickSwitchs = function (x, y) {
if (x < 5 || x > 7) return; if (x < this.CHOICES_LEFT || x > this.CHOICES_RIGHT) return;
var choices = core.status.event.ui.choices; var choices = core.status.event.ui.choices;
var topIndex = 6 - parseInt((choices.length - 1) / 2); var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2);
if (y >= topIndex && y < topIndex + choices.length) { if (y >= topIndex && y < topIndex + choices.length) {
var selection = y - topIndex; var selection = y - topIndex;
core.status.event.selection = selection; core.status.event.selection = selection;
@ -1844,11 +1848,11 @@ actions.prototype._keyUpSwitchs = function (keycode) {
this._selectChoices(core.status.event.ui.choices.length, keycode, this._clickSwitchs); this._selectChoices(core.status.event.ui.choices.length, keycode, this._clickSwitchs);
} }
////// 系统菜单栏界面时的点击事件 ////// ////// 系统菜单栏界面时的点击操作 //////
actions.prototype._clickSettings = function (x, y) { actions.prototype._clickSettings = function (x, y) {
if (x < 5 || x > 7) return; if (x < this.CHOICES_LEFT || x > this.CHOICES_RIGHT) return;
var choices = core.status.event.ui.choices; var choices = core.status.event.ui.choices;
var topIndex = 6 - parseInt((choices.length - 1) / 2); var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2);
if (y >= topIndex && y < topIndex + choices.length) { if (y >= topIndex && y < topIndex + choices.length) {
var selection = y - topIndex; var selection = y - topIndex;
core.status.event.selection = selection; core.status.event.selection = selection;
@ -1897,9 +1901,9 @@ actions.prototype._keyUpSettings = function (keycode) {
////// 同步存档界面时的点击操作 ////// ////// 同步存档界面时的点击操作 //////
actions.prototype._clickSyncSave = function (x, y) { actions.prototype._clickSyncSave = function (x, y) {
if (x < 5 || x > 7) return; if (x < this.CHOICES_LEFT || x > this.CHOICES_RIGHT) return;
var choices = core.status.event.ui.choices; var choices = core.status.event.ui.choices;
var topIndex = 6 - parseInt((choices.length - 1) / 2); var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2);
if (y >= topIndex && y < topIndex + choices.length) { if (y >= topIndex && y < topIndex + choices.length) {
var selection = y - topIndex; var selection = y - topIndex;
core.status.event.selection = selection; core.status.event.selection = selection;
@ -1979,10 +1983,10 @@ actions.prototype._keyUpSyncSave = function (keycode) {
////// 同步存档选择界面时的点击操作 ////// ////// 同步存档选择界面时的点击操作 //////
actions.prototype._clickSyncSelect = function (x, y) { actions.prototype._clickSyncSelect = function (x, y) {
if (x < 5 || x > 7) return; if (x < this.CHOICES_LEFT || x > this.CHOICES_RIGHT) return;
var choices = core.status.event.ui.choices; var choices = core.status.event.ui.choices;
var topIndex = 6 - parseInt((choices.length - 1) / 2); var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2);
if (y >= topIndex && y < topIndex + choices.length) { if (y >= topIndex && y < topIndex + choices.length) {
var selection = y - topIndex; var selection = y - topIndex;
core.status.event.selection = selection; core.status.event.selection = selection;
@ -2013,10 +2017,10 @@ actions.prototype._keyUpSyncSelect = function (keycode) {
////// 存档下载界面时的点击操作 ////// ////// 存档下载界面时的点击操作 //////
actions.prototype._clickLocalSaveSelect = function (x, y) { actions.prototype._clickLocalSaveSelect = function (x, y) {
if (x < 5 || x > 7) return; if (x < this.CHOICES_LEFT || x > this.CHOICES_RIGHT) return;
var choices = core.status.event.ui.choices; var choices = core.status.event.ui.choices;
var topIndex = 6 - parseInt((choices.length - 1) / 2); var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2);
if (y >= topIndex && y < topIndex + choices.length) { if (y >= topIndex && y < topIndex + choices.length) {
var selection = y - topIndex; var selection = y - topIndex;
@ -2051,10 +2055,10 @@ actions.prototype._keyUpLocalSaveSelect = function (keycode) {
////// 存档删除界面时的点击操作 ////// ////// 存档删除界面时的点击操作 //////
actions.prototype._clickStorageRemove = function (x, y) { actions.prototype._clickStorageRemove = function (x, y) {
if (x < 5 || x > 7) return; if (x < this.CHOICES_LEFT || x > this.CHOICES_RIGHT) return;
var choices = core.status.event.ui.choices; var choices = core.status.event.ui.choices;
var topIndex = 6 - parseInt((choices.length - 1) / 2); var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2);
if (y >= topIndex && y < topIndex + choices.length) { if (y >= topIndex && y < topIndex + choices.length) {
var selection = y - topIndex; var selection = y - topIndex;
@ -2132,10 +2136,10 @@ actions.prototype._keyUpStorageRemove = function (keycode) {
////// 回放选择界面时的点击操作 ////// ////// 回放选择界面时的点击操作 //////
actions.prototype._clickReplay = function (x, y) { actions.prototype._clickReplay = function (x, y) {
if (x < 5 || x > 7) return; if (x < this.CHOICES_LEFT || x > this.CHOICES_RIGHT) return;
var choices = core.status.event.ui.choices; var choices = core.status.event.ui.choices;
var topIndex = 6 - parseInt((choices.length - 1) / 2); var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2);
if (y >= topIndex && y < topIndex + choices.length) { if (y >= topIndex && y < topIndex + choices.length) {
var selection = y - topIndex; var selection = y - topIndex;
@ -2186,10 +2190,10 @@ actions.prototype._keyUpReplay = function (keycode) {
////// 游戏信息界面时的点击操作 ////// ////// 游戏信息界面时的点击操作 //////
actions.prototype._clickGameInfo = function (x, y) { actions.prototype._clickGameInfo = function (x, y) {
if (x < 5 || x > 7) return; if (x < this.CHOICES_LEFT || x > this.CHOICES_RIGHT) return;
var choices = core.status.event.ui.choices; var choices = core.status.event.ui.choices;
var topIndex = 6 - parseInt((choices.length - 1) / 2); var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2);
if (y >= topIndex && y < topIndex + choices.length) { if (y >= topIndex && y < topIndex + choices.length) {
var selection = y - topIndex; var selection = y - topIndex;
@ -2248,11 +2252,12 @@ actions.prototype._keyUpGameInfo = function (keycode) {
////// “虚拟键盘”界面时的点击操作 ////// ////// “虚拟键盘”界面时的点击操作 //////
actions.prototype._clickKeyBoard = function (x, y) { actions.prototype._clickKeyBoard = function (x, y) {
if (y == 3 && x >= 1 && x <= 11) { var m = this.HSIZE;
if (y == m - 3 && x >= m - 5 && x <= m + 5) {
core.ui.closePanel(); core.ui.closePanel();
core.keyUp(112 + x - 1); // F1-F12: 112-122 core.keyUp(112 + x + 5 - m);
} }
if (y == 3 && x == 12) { if (y == m - 3 && x == m + 6) {
var val = prompt(); var val = prompt();
if (val != null) { if (val != null) {
try { try {
@ -2262,9 +2267,9 @@ actions.prototype._clickKeyBoard = function (x, y) {
} }
} }
} }
if (y == 4 && x >= 1 && x <= 10) { if (y == m - 2 && x >= m - 5 && x <= m + 4) {
core.ui.closePanel(); core.ui.closePanel();
core.keyUp(x == 10 ? 48 : 48 + x); // 1-9: 49-57; 0: 48 core.keyUp(x == m + 4 ? 48 : 49 + x + 5 - m); // 1-9: 49-57; 0: 48
} }
// 字母 // 字母
var lines = [ var lines = [
@ -2272,46 +2277,46 @@ actions.prototype._clickKeyBoard = function (x, y) {
["A", "S", "D", "F", "G", "H", "J", "K", "L"], ["A", "S", "D", "F", "G", "H", "J", "K", "L"],
["Z", "X", "C", "V", "B", "N", "M"], ["Z", "X", "C", "V", "B", "N", "M"],
]; ];
if (y == 5 && x >= 1 && x <= 10) { if (y == m - 1 && x >= m - 5 && x <= m + 4) {
core.ui.closePanel(); core.ui.closePanel();
core.keyUp(lines[0][x - 1].charCodeAt(0)); core.keyUp(lines[0][x + 5 - m].charCodeAt(0));
} }
if (y == 6 && x >= 1 && x <= 9) { if (y == m && x >= m - 5 && x <= m + 3) {
core.ui.closePanel(); core.ui.closePanel();
core.keyUp(lines[1][x - 1].charCodeAt(0)); core.keyUp(lines[1][x + 5 - m].charCodeAt(0));
} }
if (y == 7 && x >= 1 && x <= 7) { if (y == m + 1 && x >= m - 5 && x <= m + 1) {
core.ui.closePanel(); core.ui.closePanel();
core.keyUp(lines[2][x - 1].charCodeAt(0)); core.keyUp(lines[2][x + 5 - m].charCodeAt(0));
} }
if (y == 8 && x >= 1 && x <= 11) { if (y == m + 2 && x >= m - 5 && x <= m + 5) {
core.ui.closePanel(); core.ui.closePanel();
if (x == 1) core.keyUp(189); // - if (x == m - 5) core.keyUp(189); // -
if (x == 2) core.keyUp(187); // = if (x == m - 4) core.keyUp(187); // =
if (x == 3) core.keyUp(219); // [ if (x == m - 3) core.keyUp(219); // [
if (x == 4) core.keyUp(221); // ] if (x == m - 2) core.keyUp(221); // ]
if (x == 5) core.keyUp(220); // \ if (x == m - 1) core.keyUp(220); // \
if (x == 6) core.keyUp(186); // ; if (x == m) core.keyUp(186); // ;
if (x == 7) core.keyUp(222); // ' if (x == m + 1) core.keyUp(222); // '
if (x == 8) core.keyUp(188); // , if (x == m + 2) core.keyUp(188); // ,
if (x == 9) core.keyUp(190); // . if (x == m + 3) core.keyUp(190); // .
if (x == 10) core.keyUp(191); // / if (x == m + 4) core.keyUp(191); // /
if (x == 11) core.keyUp(192); // ` if (x == m + 5) core.keyUp(192); // `
} }
if (y == 9 && x >= 1 && x <= 10) { if (y == m + 3 && x >= m - 5 && x <= m + 4) {
core.ui.closePanel(); core.ui.closePanel();
if (x == 1) core.keyUp(27); // ESC if (x == m - 5) core.keyUp(27); // ESC
if (x == 2) core.keyUp(9); // TAB if (x == m - 4) core.keyUp(9); // TAB
if (x == 3) core.keyUp(20); // CAPS if (x == m - 3) core.keyUp(20); // CAPS
if (x == 4) core.keyUp(16); // SHIFT if (x == m - 2) core.keyUp(16); // SHIFT
if (x == 5) core.keyUp(17); // CTRL if (x == m - 1) core.keyUp(17); // CTRL
if (x == 6) core.keyUp(18); // ALT if (x == m) core.keyUp(18); // ALT
if (x == 7) core.keyUp(32); // SPACE if (x == m + 1) core.keyUp(32); // SPACE
if (x == 8) core.keyUp(8); // BACKSPACE if (x == m + 2) core.keyUp(8); // BACKSPACE
if (x == 9) core.keyUp(13); // ENTER if (x == m + 3) core.keyUp(13); // ENTER
if (x == 10) core.keyUp(46); // DEL if (x == m + 4) core.keyUp(46); // DEL
} }
if (y == 10 && x >= 9 && x <= 11) if (y == m + 4 && x >= m + 3 && x <= m + 5)
core.ui.closePanel(); core.ui.closePanel();
} }

View File

@ -625,6 +625,7 @@ control.prototype.moveAction = function (callback) {
} }
control.prototype._moveAction_noPass = function (canMove, callback) { control.prototype._moveAction_noPass = function (canMove, callback) {
core.status.route.push(core.getHeroLoc('direction'));
core.status.automaticRoute.moveStepBeforeStop = []; core.status.automaticRoute.moveStepBeforeStop = [];
core.status.automaticRoute.lastDirection = core.getHeroLoc('direction'); core.status.automaticRoute.lastDirection = core.getHeroLoc('direction');
if (canMove) core.events._trigger(core.nextX(), core.nextY()); if (canMove) core.events._trigger(core.nextX(), core.nextY());
@ -641,6 +642,7 @@ control.prototype._moveAction_moving = function (callback) {
core.setHeroMoveInterval(function () { core.setHeroMoveInterval(function () {
var direction = core.getHeroLoc('direction'); var direction = core.getHeroLoc('direction');
core.control._moveAction_popAutomaticRoute(); core.control._moveAction_popAutomaticRoute();
core.status.route.push(direction);
// 无事件的道具(如血瓶)需要优先于阻激夹域判定 // 无事件的道具(如血瓶)需要优先于阻激夹域判定
var nowx = core.getHeroLoc('x'), nowy = core.getHeroLoc('y'); var nowx = core.getHeroLoc('x'), nowy = core.getHeroLoc('y');
@ -1608,11 +1610,11 @@ control.prototype.syncSave = function (type) {
core.ui.drawWaiting("正在同步,请稍后..."); core.ui.drawWaiting("正在同步,请稍后...");
core.control.getSaves(type=='all'?null:core.saves.saveIndex, function (saves) { core.control.getSaves(type=='all'?null:core.saves.saveIndex, function (saves) {
if (!saves) return core.drawText("没有要同步的存档"); if (!saves) return core.drawText("没有要同步的存档");
core.control._syncSave_http(saves); core.control._syncSave_http(type, saves);
}) })
} }
control.prototype._syncSave_http = function (saves) { control.prototype._syncSave_http = function (type, saves) {
var formData = new FormData(); var formData = new FormData();
formData.append('type', 'save'); formData.append('type', 'save');
formData.append('name', core.firstData.name); formData.append('name', core.firstData.name);

View File

@ -227,13 +227,7 @@ core.prototype._init_flags = function () {
core.flags = core.clone(core.data.flags); core.flags = core.clone(core.data.flags);
core.values = core.clone(core.data.values); core.values = core.clone(core.data.values);
core.firstData = core.clone(core.data.firstData); core.firstData = core.clone(core.data.firstData);
this._init_sys_flags();
if (!core.flags.enableExperience) core.flags.enableLevelUp = false;
if (!core.flags.enableLevelUp) core.flags.levelUpLeftMode = false;
if (core.flags.equipboxButton) core.flags.equipment = true;
core.flags.displayEnemyDamage = core.getLocalStorage('enemyDamage', core.flags.displayEnemyDamage);
core.flags.displayCritical = core.getLocalStorage('critical', core.flags.displayCritical);
core.flags.displayExtraDamage = core.getLocalStorage('extraDamage', core.flags.displayExtraDamage);
core.dom.versionLabel.innerHTML = core.firstData.version; core.dom.versionLabel.innerHTML = core.firstData.version;
core.dom.logoLabel.innerHTML = core.firstData.title; core.dom.logoLabel.innerHTML = core.firstData.title;
@ -248,6 +242,15 @@ core.prototype._init_flags = function () {
core.material.icons = core.icons.getIcons(); core.material.icons = core.icons.getIcons();
} }
core.prototype._init_sys_flags = function () {
if (!core.flags.enableExperience) core.flags.enableLevelUp = false;
if (!core.flags.enableLevelUp) core.flags.levelUpLeftMode = false;
if (core.flags.equipboxButton) core.flags.equipment = true;
core.flags.displayEnemyDamage = core.getLocalStorage('enemyDamage', core.flags.displayEnemyDamage);
core.flags.displayCritical = core.getLocalStorage('critical', core.flags.displayCritical);
core.flags.displayExtraDamage = core.getLocalStorage('extraDamage', core.flags.displayExtraDamage);
}
core.prototype._init_platform = function () { core.prototype._init_platform = function () {
core.platform.isOnline = location.protocol.indexOf("http") == 0; core.platform.isOnline = location.protocol.indexOf("http") == 0;
if (!core.platform.isOnline) alert("请勿直接打开html文件使用启动服务或者APP进行离线游戏。"); if (!core.platform.isOnline) alert("请勿直接打开html文件使用启动服务或者APP进行离线游戏。");

View File

@ -16,7 +16,7 @@ events.prototype._init = function () {
/// 初始化游戏 /// 初始化游戏
events.prototype.resetGame = function (hero, hard, floorId, maps, values) { events.prototype.resetGame = function (hero, hard, floorId, maps, values) {
return this.eventdata.resetGame(hero, hard, floorId, maps, values); this.eventdata.resetGame(hero, hard, floorId, maps, values);
} }
////// 游戏开始事件 ////// ////// 游戏开始事件 //////
@ -75,7 +75,11 @@ events.prototype._startGame_afterStart = function (nowLoc, callback) {
core.ui.closePanel(); core.ui.closePanel();
core.showStatusBar(); core.showStatusBar();
core.dom.musicBtn.style.display = 'none'; core.dom.musicBtn.style.display = 'none';
core.changeFloor(core.firstData.floorId, null, nowLoc, null, callback); core.changeFloor(core.firstData.floorId, null, nowLoc, null, function () {
// 插入一个空事件避免直接回放录像出错
core.insertAction([]);
if (callback) callback();
});
this._startGame_upload(); this._startGame_upload();
} }
@ -885,7 +889,7 @@ events.prototype._action_autoText = function (data, x, y, prefix) {
events.prototype._action_scrollText = function (data, x, y, prefix) { events.prototype._action_scrollText = function (data, x, y, prefix) {
if (this.__action_checkReplaying()) return; if (this.__action_checkReplaying()) return;
this.__action_doAsyncFunc(data.async, core.ui.drawScrollText, data.text, data.time || 5000); this.__action_doAsyncFunc(data.async, core.ui.drawScrollText, data.text, data.lineHeight || 1.4, data.time || 5000);
} }
events.prototype._action_comment = function (data, x, y, prefix) { events.prototype._action_comment = function (data, x, y, prefix) {
@ -893,7 +897,7 @@ events.prototype._action_comment = function (data, x, y, prefix) {
} }
events.prototype._action_setText = function (data, x, y, prefix) { events.prototype._action_setText = function (data, x, y, prefix) {
["position", "offset", "bold", "titlefont", "textfont", "time"].forEach(function (t) { ["position", "offset", "align", "bold", "titlefont", "textfont", "time"].forEach(function (t) {
if (data[t] != null) core.status.textAttribute[t] = data[t]; if (data[t] != null) core.status.textAttribute[t] = data[t];
}); });
["background", "title", "text"].forEach(function (t) { ["background", "title", "text"].forEach(function (t) {
@ -1030,10 +1034,9 @@ events.prototype._action_changePos = function (data, x, y, prefix) {
} }
events.prototype._action_showImage = function (data, x, y, prefix) { events.prototype._action_showImage = function (data, x, y, prefix) {
var loc = this.__action_getLoc(data.loc, 0, 0, prefix);
if (core.isReplaying()) data.time = 0; if (core.isReplaying()) data.time = 0;
this.__action_doAsyncFunc(data.async || data.time == 0, this.showImage, this.__action_doAsyncFunc(data.async || data.time == 0, this.showImage,
data.code, data.image, loc[0], loc[1], data.dw, data.dh, data.opacity, data.time); data.code, data.image, data.sloc, data.loc, data.opacity, data.time);
} }
events.prototype._action_showTextImage = function (data, x, y, prefix) { events.prototype._action_showTextImage = function (data, x, y, prefix) {
@ -1815,21 +1818,27 @@ events.prototype.closeDoor = function (x, y, id, callback) {
} }
////// 显示图片 ////// ////// 显示图片 //////
events.prototype.showImage = function (code, image, x, y, dw, dh, opacityVal, time, callback) { events.prototype.showImage = function (code, image, sloc, loc, opacityVal, time, callback) {
dw /= 100;
dh /= 100;
x = core.calValue(x) || 0;
y = core.calValue(y) || 0;
if (typeof image == 'string') image = core.material.images.images[image]; if (typeof image == 'string') image = core.material.images.images[image];
if (!image) { if (!image) {
if (callback) callback(); if (callback) callback();
return; return;
} }
sloc = sloc || [];
var sx = core.calValue(sloc[0]) || 0, sy = core.calValue(sloc[1]) || 0;
var sw = core.calValue(sloc[2]), sh = core.calValue(sloc[3]);
if (sw == null) sw = image.width;
if (sh == null) sh = image.height;
loc = loc || [];
var x = core.calValue(loc[0]) || 0, y = core.calValue(loc[1]) || 0;
var w = core.calValue(loc[2]), h = core.calValue(loc[3]);
if (w == null) w = sw;
if (h == null) h = sh;
var zIndex = code + 100; var zIndex = code + 100;
time = time || 0; time = time || 0;
var name = "image" + zIndex; var name = "image" + zIndex;
var ctx = core.createCanvas(name, x, y, image.width * dw, image.height * dh, zIndex); var ctx = core.createCanvas(name, x, y, w, h, zIndex);
ctx.drawImage(image, 0, 0, image.width * dw, image.height * dh); ctx.drawImage(image, sx, sy, sw, sh, 0, 0, w, h);
if (time == 0) { if (time == 0) {
core.setOpacity(name, opacityVal); core.setOpacity(name, opacityVal);
if (callback) callback(); if (callback) callback();

View File

@ -38,7 +38,7 @@ loader.prototype._load = function (callback) {
loader.prototype._loadIcons = function () { loader.prototype._loadIcons = function () {
this.loadImage("icons.png", function (id, image) { this.loadImage("icons.png", function (id, image) {
var images = core.cropImage(image); var images = core.splitImage(image);
for (var key in core.statusBar.icons) { for (var key in core.statusBar.icons) {
if (typeof core.statusBar.icons[key] == 'number') { if (typeof core.statusBar.icons[key] == 'number') {
core.statusBar.icons[key] = images[core.statusBar.icons[key]]; core.statusBar.icons[key] = images[core.statusBar.icons[key]];

View File

@ -412,7 +412,7 @@ maps.prototype._canMoveHero_checkPoint = function (x, y, direction, floorId, ext
return false; return false;
var nx = x + core.utils.scan[direction].x, ny = y + core.utils.scan[direction].y; var nx = x + core.utils.scan[direction].x, ny = y + core.utils.scan[direction].y;
if (nx < 0 || ny < 0 || nx >= core.floors[floorId].width || ny >= core.floors[floorId].width) if (nx < 0 || ny < 0 || nx >= core.floors[floorId].width || ny >= core.floors[floorId].height)
return false; return false;
// 2. 检查该点素材的 cannotOut 和下一个点的 cannotIn // 2. 检查该点素材的 cannotOut 和下一个点的 cannotIn

2174
libs/ui.js

File diff suppressed because it is too large Load Diff

View File

@ -311,19 +311,25 @@ utils.prototype.clone = function (data) {
} }
////// 裁剪图片 ////// ////// 裁剪图片 //////
utils.prototype.cropImage = function (image, size) { utils.prototype.splitImage = function (image, width, height) {
size = size || 32; if (typeof image == "string")
image = core.material.images.images[image];
if (!image) return [];
width = width || 32;
height = height || width;
var canvas = document.createElement("canvas"); var canvas = document.createElement("canvas");
var context = canvas.getContext("2d"); var context = canvas.getContext("2d");
canvas.width = size; canvas.width = width;
canvas.height = size; canvas.height = height;
var ans = []; var ans = [];
for (var i = 0; i < image.height; i += size) { for (var j = 0; j < image.height; j += height) {
context.drawImage(image, 0, i, size, size, 0, 0, size, size); for (var i = 0; i < image.width; i += width) {
var img = new Image(); context.drawImage(image, i, j, width, height, 0, 0, width, height);
img.src = canvas.toDataURL("image/png"); var img = new Image();
ans.push(img); img.src = canvas.toDataURL("image/png");
context.clearRect(0, 0, size, size); ans.push(img);
context.clearRect(0, 0, width, height);
}
} }
return ans; return ans;
} }

View File

@ -34,6 +34,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
var globalFlags = core.getFlag("globalFlags", {}); var globalFlags = core.getFlag("globalFlags", {});
for (var key in globalFlags) for (var key in globalFlags)
core.flags[key] = globalFlags[key]; core.flags[key] = globalFlags[key];
core._init_sys_flags();
// 初始化界面,状态栏等 // 初始化界面,状态栏等
core.resize(); core.resize();
core.updateGlobalAttribute(); core.updateGlobalAttribute();

View File

@ -312,7 +312,7 @@ p#name {
} }
#ui { #ui {
z-index: 160; z-index: 140;
} }
#data { #data {