Merge remote-tracking branch 'refs/remotes/origin/events' into refactoring-editor

This commit is contained in:
YouWei Zhao 2019-03-30 11:18:58 -04:00
commit f2cda09f12
21 changed files with 2190 additions and 2082 deletions

View File

@ -338,7 +338,7 @@ time为可选项代表该自动文本的时间。可以不指定不指定
``` js
"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毫秒。
lineHeight为可选项代表行距。默认为1.4。
async可选如果为true则会异步执行即不等待当前事件执行完毕立刻执行下一个事件
可以使用下面的[设置剧情文本的属性](event#setText设置剧情文本的属性)来对文字颜色、文字大小、粗体、距离左边的偏移量进行设置。
@ -1059,9 +1061,10 @@ loc可忽略如果忽略则显示为事件当前点。
``` js
"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": 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": 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": 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], "opacity": 0.5, "time" : 1000}, // 在(209,267)渐变显示1.png渐变时间为1000毫秒完成时不透明度为0.5,这张图片将遮盖上一张
{"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中被定义过。**
loc为图片左上角坐标以像素为单位进行计算
sloc为可选项如果设置了则是个2或4元组代表裁剪原始图片的左上角像素位置和宽高
dw和dh为图片的横向、纵向放大率默认值为100即不进行缩放
loc为2或4元组代表要绘制的画布上的左上角像素位置和宽高
opacity为图片不透明度在0~1之间默认值为1即不透明。
@ -1097,6 +1100,8 @@ loc为图片左上角坐标以像素为单位进行计算。
opacity为图片不透明度在0~1之间默认值为1即不透明。
lineHeight为可选项代表行距。默认为1.4。
time为渐变时间默认值为0即不渐变直接显示。
async可选如果为true则会异步执行即不等待当前事件执行完毕立刻执行下一个事件

View File

@ -65,6 +65,7 @@ return code;
shoplist
: shopsub
| shopcommonevent
| emptyshop
;
@ -77,6 +78,24 @@ var code = ' \n';
return code;
*/;
shopcommonevent
: '商店 id' IdString '快捷商店栏中名称' EvalString BGNL? '未开启状态则不显示在列表中' Bool BGNL? '执行的公共事件 id' EvalString '参数列表' EvalString?
/* shopcommonevent
tooltip : 全局商店, 执行一个公共事件
helpUrl : https://h5mota.com/games/template/docs/#/
default : ["shop1","回收钥匙商店",false,"回收钥匙商店",""]
var code = {
'id': IdString_0,
'textInList': EvalString_0,
'mustEnable': Bool_0,
'commonEvent': EvalString_1,
'args': EvalString_2
}
code=JSON.stringify(code,null,2)+',\n';
return code;
*/;
shopsub
: '商店 id' IdString '标题' EvalString '图标' IdString BGNL? Newline '快捷商店栏中名称' EvalString '共用times' Bool BGNL? Newline '未开启状态则不显示在列表中' Bool BGNL? NewLine '使用' ShopUse_List '消耗' EvalString BGNL? Newline '显示文字' EvalString BGNL? Newline shopChoices+ BEND
@ -268,6 +287,7 @@ action
| animate_s
| vibrate_s
| showImage_s
| showImage_1_s
| hideImage_s
| showTextImage_s
| moveImage_s
@ -302,6 +322,7 @@ action
| callBook_s
| callSave_s
| callLoad_s
| unknow_s
| function_s
| pass_s
;
@ -380,27 +401,28 @@ return code;
*/;
scrollText_s
: '滚动剧情文本:' '时间' Int '不等待执行完毕' Bool? BGNL? EvalString Newline
: '滚动剧情文本:' '时间' Int '行距' Number '不等待执行完毕' Bool? BGNL? EvalString Newline
/* scrollText_s
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
default : [5000,false,"时间是总时间可以使用setText事件来控制字体、颜色、大小、偏移量等"]
default : [5000,1.4,false,"时间是总时间可以使用setText事件来控制字体、颜色、大小、偏移量等"]
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;
*/;
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
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
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+'"';
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)?$/;
if (EvalString_0) {
if (!/^\d+$/.test(EvalString_0))throw new Error('像素偏移量必须是整数或不填');
@ -438,7 +460,7 @@ if (EvalString_6) {
EvalString_6 = ', "time": '+EvalString_6;
}
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;
*/;
@ -1132,34 +1154,54 @@ return code;
*/;
showImage_s
: '显示图片' '图片编号' Int '图片' EvalString '起点像素位置' 'x' PosString 'y' PosString BGNL?
'放大率 : x' Int '% y' Int '% 不透明度' Number '时间' Int '不等待执行完毕' Bool Newline
: '显示图片' '图片编号' Int '图片' EvalString BGNL?
'绘制的起点像素' 'x' PosString 'y' PosString '不透明度' Number '时间' Int '不等待执行完毕' Bool Newline
/* showImage_s
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
default : [1,"bg.jpg","0","0",100,100,1,0,false]
default : [1,"bg.jpg","0","0",1,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+'", "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;
*/;
showTextImage_s
: '显示图片化文本' '文本内容' EvalString BGNL?
'图片编号' Int '起点像素位置' 'x' PosString 'y' PosString '不透明度' Number '时间' Int '不等待执行完毕' Bool Newline
'图片编号' Int '起点像素' 'x' PosString 'y' PosString '行距' Number '不透明度' Number '时间' Int '不等待执行完毕' Bool Newline
/* showTextImage_s
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
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之间');
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;
*/;
@ -1704,6 +1746,19 @@ var code = '{"type": "callLoad"},\n';
return code;
*/;
unknow_s
: '自定义事件' BGNL? RawEvalString
/* unknow_s
tooltip : 通过脚本自定义的事件类型, 以及编辑器不识别的事件类型
helpUrl : https://h5mota.com/games/template/docs/#/
default : ['{"type":"eventType1"}']
colour : this.dataColor
var tempobj={};
eval("tempobj='"+RawEvalString_0+"'");
var code = tempobj +',\n';
return code;
*/;
function_s
: '自定义JS脚本' '不自动执行下一个事件' Bool BGNL? Newline RawEvalString Newline BEND Newline
@ -1872,6 +1927,10 @@ SetTextPosition_List
: '不改变'|'距离顶部'|'居中'|'距离底部'
/*SetTextPosition_List ['null','up','center','down']*/;
SetTextAlign_List
: '不改变'|'左对齐'|'左右居中'|'右对齐'
/*SetTextAlign_List ['null','left','center','right']*/;
ShopUse_List
: '金币' | '经验'
/*ShopUse_List ['money','experience']*/;
@ -2088,10 +2147,21 @@ ActionParser.prototype.parse = function (obj,type) {
obj.id,obj.name,obj.icon,obj.textInList,obj.commonTimes,obj.mustEnable,obj.use,obj.need,parser.EvalString(obj.text),text_choices,next
]);
}
var buildcommentevent = function(obj,parser,next){
return MotaActionBlocks['shopcommonevent'].xmlText([
obj.id,parser.EvalString(obj.textInList),obj.mustEnable,parser.EvalString(obj.commonEvent),parser.EvalString(obj.args),next
]);
}
var next=null;
if(!obj)obj=[];
while(obj.length){
next=buildsub(obj.pop(),this,next);
var shopobj=obj.pop()
if(shopobj.choices)
next=buildsub(shopobj,this,next);
else if(shopobj.commonEvent)
next=buildcommentevent(shopobj,this,next);
else
throw new Error("[警告]出错啦!\n"+shopobj.id+" 无效的商店");
}
return MotaActionBlocks['shop_m'].xmlText([next]);
@ -2151,7 +2221,7 @@ ActionParser.prototype.parseAction = function() {
break;
case "scrollText":
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;
case "comment": // 注释
this.next = MotaActionBlocks['comment_s'].xmlText([this.EvalString(data.text),this.next],null,data.text);
@ -2163,7 +2233,7 @@ ActionParser.prototype.parseAction = function() {
if (!/^\w+\.png$/.test(data.background))
data.background=setTextfunc(data.background);
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.bold,data.titlefont,data.textfont,data.time,this.next]);
break;
@ -2308,8 +2378,16 @@ ActionParser.prototype.parseAction = function() {
break;
case "showImage": // 显示图片
data.loc=data.loc||['','']
this.next = MotaActionBlocks['showImage_s'].xmlText([
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]);
if (data.sloc) {
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;
case "hideImage": // 清除图片
this.next = MotaActionBlocks['hideImage_s'].xmlText([
@ -2318,7 +2396,7 @@ ActionParser.prototype.parseAction = function() {
case "showTextImage": // 显示图片化文本
data.loc=data.loc||['','']
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;
case "moveImage": // 移动图片
data.to=data.to||['','']
@ -2573,7 +2651,13 @@ ActionParser.prototype.parseAction = function() {
case "animateImage": // 兼容 animateImage
break;
default:
throw new Error("[警告]出错啦!\n"+data.type+" 事件不被支持...");
var rawdata = JSON.stringify(data,function(k,v){
if(typeof(v)=='string')return v.split('\n').join('\\n');
else return v;
},2);
rawdata=rawdata.split('\n').join('\\n');
this.next = MotaActionBlocks['unknow_s'].xmlText([
rawdata,this.next]);
}
this.parseAction();
return;

View File

@ -227,8 +227,8 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
"openDoor",
"passNet",
"changeLight",
"ski",
"pushBox"
"pushBox",
"custom"
]
},
"_data": "该图块的默认触发器"

View File

@ -37,6 +37,11 @@ editor_blockly = function () {
{"text": "防御+4", "effect": "status:def+=4"},
{"text": "魔防+10", "effect": "status:mdef+=10"}
]
},{
"id": "keyShop1",
"textInList": "回收钥匙商店",
"commonEvent": "回收钥匙商店",
"args": ""
}],'shop'),
MotaActionBlocks['afterBattle_m'].xmlText(),
MotaActionBlocks['afterGetItem_m'].xmlText(),
@ -54,6 +59,7 @@ editor_blockly = function () {
MotaActionBlocks['scrollText_s'].xmlText(),
MotaActionBlocks['setText_s'].xmlText(),
MotaActionBlocks['showImage_s'].xmlText(),
MotaActionBlocks['showImage_1_s'].xmlText(),
MotaActionBlocks['hideImage_s'].xmlText(),
MotaActionBlocks['showTextImage_s'].xmlText(),
MotaActionBlocks['moveImage_s'].xmlText(),
@ -582,6 +588,7 @@ function omitedcheckUpdateFunction(event) {
'showTextImage_s': 'EvalString_0',
'function_s': 'RawEvalString_0',
'shopsub': 'EvalString_3',
'unknow_s': 'RawEvalString_0',
}
var f = b ? textStringDict[b.type] : null;
if (f) {

File diff suppressed because it is too large Load Diff

View File

@ -33,6 +33,7 @@ control.prototype._init = function () {
this.registerReplayAction("fly", this._replayAction_fly);
this.registerReplayAction("shop", this._replayAction_shop);
this.registerReplayAction("turn", this._replayAction_turn);
this.registerReplayAction("common", this._replayAction_common);
this.registerReplayAction("getNext", this._replayAction_getNext);
this.registerReplayAction("moveDirectly", this._replayAction_moveDirectly);
this.registerReplayAction("key", this._replayAction_key);
@ -625,6 +626,7 @@ control.prototype.moveAction = function (callback) {
}
control.prototype._moveAction_noPass = function (canMove, callback) {
core.status.route.push(core.getHeroLoc('direction'));
core.status.automaticRoute.moveStepBeforeStop = [];
core.status.automaticRoute.lastDirection = core.getHeroLoc('direction');
if (canMove) core.events._trigger(core.nextX(), core.nextY());
@ -641,6 +643,7 @@ control.prototype._moveAction_moving = function (callback) {
core.setHeroMoveInterval(function () {
var direction = core.getHeroLoc('direction');
core.control._moveAction_popAutomaticRoute();
core.status.route.push(direction);
// 无事件的道具(如血瓶)需要优先于阻激夹域判定
var nowx = core.getHeroLoc('x'), nowy = core.getHeroLoc('y');
@ -793,7 +796,7 @@ control.prototype.tryMoveDirectly = function (destX, destY) {
////// 绘制勇士 //////
control.prototype.drawHero = function (status, offset) {
if (!core.isPlaying() || !core.status.floorId) return;
if (!core.isPlaying() || !core.status.floorId || core.status.gameOver) return;
var x = core.getHeroLoc('x'), y = core.getHeroLoc('y'), direction = core.getHeroLoc('direction');
status = status || 'stop';
offset = offset || 0;
@ -1299,8 +1302,12 @@ control.prototype._replay_save = function () {
control.prototype._replay_error = function (action) {
core.status.replay.replaying = false;
main.log("录像文件出错,当前操作:" + action +
"\n接下来10个操作是"+core.status.replay.toReplay.slice(0, 10).toString());
var len = core.status.replay.toReplay.length;
var prevList = core.status.replay.totalList.slice(-len - 11, -len - 1);
var nextList = core.status.replay.toReplay.slice(0, 10);
main.log("录像文件出错,当前操作:" + action);
main.log("之前的10个操作是\n" + prevList.toString());
main.log("接下来10个操作是\n" + nextList.toString());
core.ui.drawConfirmBox("录像文件出错,你想回到上个节点吗?", function () {
core.ui.closePanel();
if (core.status.replay.save.length > 0) {
@ -1439,6 +1446,16 @@ control.prototype._replayAction_turn = function (action) {
return true;
}
control.prototype._replayAction_common = function (action) {
if (action.indexOf("common:") != 0) return false;
var name = core.decodeBase64(action.substring(7));
if (core.getFlag("__commonEventList__").indexOf(name) == -1) return false;
core.status.route.push(action);
core.insertAction(name);
setTimeout(core.replay);
return true;
}
control.prototype._replayAction_getNext = function (action) {
if (action != "getNext") return false;
if (!core.getNextItem()) return false;
@ -1606,13 +1623,13 @@ control.prototype._doSL_replayLoad_afterGet = function (id, data) {
////// 同步存档到服务器 //////
control.prototype.syncSave = function (type) {
core.ui.drawWaiting("正在同步,请稍后...");
core.control.getSaves(type=='all'?null:core.saves.saveIndex, function (saves) {
core.getAllSaves(type=='all'?null:core.saves.saveIndex, function (saves) {
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();
formData.append('type', 'save');
formData.append('name', core.firstData.name);
@ -1700,32 +1717,54 @@ control.prototype.loadData = function (data, callback) {
return this.controldata.loadData(data, callback);
}
control.prototype.getSaves = function (index, callback) {
if (index != null) {
core.getLocalForage("save"+index, null, function(data) {
if (callback) callback(data);
}, function(err) {
main.log(err);
if (callback) callback(null);
})
control.prototype.getSave = function (index, callback) {
if (index == 0) {
// --- 自动存档先从缓存中获取
if (core.saves.autosave.data != null)
callback(core.clone(core.saves.autosave.data));
else {
core.getLocalForage("autoSave", null, function(data) {
callback(data);
}, function(err) {
main.log(err);
callback(null);
});
}
return;
}
var ids = Object.keys(core.saves.ids).filter(function(x){return x!=0;})
.sort(function(a,b) {return a-b;}), number = ids.length, saves = [];
var load = function (index, callback) {
if (index > number) {
if (callback) callback(saves);
return;
}
core.getLocalForage("save"+ids[index], null, function (data) {
saves.push(data);
load(index+1, callback);
}, function(err) {
main.log(err);
load(index+1, callback);
})
core.getLocalForage("save"+index, null, function(data) {
if (callback) callback(data);
}, function(err) {
main.log(err);
if (callback) callback(null);
});
}
control.prototype.getSaves = function (ids, callback) {
if (!(ids instanceof Array)) return this.getSave(ids, callback);
var count = ids.length, data = {};
for (var i = 0; i < ids.length; ++i) {
(function (i) {
core.getSave(ids[i], function (result) {
data[i] = result;
if (Object.keys(data).length == count)
callback(data);
})
})(i);
}
load(0, callback);
}
control.prototype.getAllSaves = function (id, callback) {
if (id != null) return this.getSave(id, callback);
var ids = Object.keys(core.saves.ids).filter(function(x){return x!=0;})
.sort(function(a,b) {return a-b;}), saves = [];
this.getSaves(ids, function (data) {
for (var i = 0; i < ids.length; ++i) {
if (data[i] != null)
saves.push(data[i]);
}
callback(saves);
});
}
////// 获得所有存在存档的存档位 //////
@ -1759,6 +1798,43 @@ control.prototype.hasSave = function (index) {
return core.saves.ids[index] || false;
}
////// 删除一个或多个存档
control.prototype.removeSave = function (index, callback) {
if (index == 0 || index == "autoSave") {
index = "autoSave";
core.removeLocalForage(index, function () {
core.saves.autosave.data = null;
core.saves.autosave.updated = false;
if (callback) callback();
});
return;
}
core.removeLocalForage("save" + index, function () {
core.saves.favorite = core.saves.favorite.filter(function (i) { return core.hasSave(i); });
delete core.saves.favoriteName[index];
core.control._updateFavoriteSaves();
if (callback) callback();
}, function () {
core.drawTip("无法删除存档!");
if (callback) callback();
});
}
////// 读取收藏信息
control.prototype._loadFavoriteSaves = function () {
core.saves.favorite = core.getLocalStorage("favorite", []);
// --- 移除不存在的收藏
core.saves.favorite = core.saves.favorite.filter(function (i) { return core.hasSave(i); });
core.saves.favoriteName = core.getLocalStorage("favoriteName", {});
}
control.prototype._updateFavoriteSaves = function () {
core.setLocalStorage("favorite", core.saves.favorite);
core.setLocalStorage("favoriteName", core.saves.favoriteName);
}
////// 加载某个存档
// ------ 属性状态位置buff变量锁定控制等 ------ //
////// 设置勇士属性 //////
@ -1780,7 +1856,7 @@ control.prototype.addStatus = function (name, value) {
control.prototype.getStatus = function (name) {
if (!core.status.hero) return null;
if (name == 'x' || name == 'y' || name == 'direction')
return this.getHeroLoc('x');
return this.getHeroLoc(name);
if (name == 'exp') name = 'experience';
return core.status.hero[name];
}
@ -1804,12 +1880,12 @@ control.prototype.getRealStatusOrDefault = function (status, name) {
////// 设置某个属性的增幅值 //////
control.prototype.setBuff = function (name, value) {
this.setFlag('flag:__'+name+'_buff__', value);
this.setFlag('__'+name+'_buff__', value);
}
////// 加减某个属性的增幅值 //////
control.prototype.addBuff = function (name, value) {
this.setFlag('flag:__'+name+'_buff__', this.getBuff(name) + value);
this.setFlag('__'+name+'_buff__', this.getBuff(name) + value);
}
////// 获得某个属性的增幅值 //////

View File

@ -67,6 +67,7 @@ function core() {
'isPC': true, // 是否是PC
'isAndroid': false, // 是否是Android
'isIOS': false, // 是否是iOS
'string': 'PC',
'isWeChat': false, // 是否是微信
'isQQ': false, // 是否是QQ
'isChrome': false, // 是否是Chrome
@ -102,7 +103,9 @@ function core() {
"data": null,
"time": 0,
"updated": false,
}
},
"favorite": [],
"favoriteName": {}
}
this.initStatus = {
'played': false,
@ -227,13 +230,7 @@ core.prototype._init_flags = function () {
core.flags = core.clone(core.data.flags);
core.values = core.clone(core.data.values);
core.firstData = core.clone(core.data.firstData);
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);
this._init_sys_flags();
core.dom.versionLabel.innerHTML = core.firstData.version;
core.dom.logoLabel.innerHTML = core.firstData.title;
@ -248,6 +245,15 @@ core.prototype._init_flags = function () {
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.platform.isOnline = location.protocol.indexOf("http") == 0;
if (!core.platform.isOnline) alert("请勿直接打开html文件使用启动服务或者APP进行离线游戏。");
@ -269,6 +275,7 @@ core.prototype._init_platform = function () {
core.platform.isPC = false;
}
});
core.platform.string = core.platform.isPC ? "PC" : core.platform.isAndroid ? "Android" : core.platform.isIOS ? "iOS" : "";
core.platform.supportCopy = document.queryCommandSupported || document.queryCommandSupported("copy");
var chrome = /Chrome\/(\d+)\./i.exec(navigator.userAgent);
if (chrome && parseInt(chrome[1]) >= 50) core.platform.isChrome = true;
@ -290,7 +297,7 @@ core.prototype._init_platform = function () {
}
core.prototype._init_checkLocalForage = function () {
core.platform.useLocalForage = core.getLocalStorage('useLocalForage', !core.platform.isIOS);
core.platform.useLocalForage = core.getLocalStorage('useLocalForage', true);
var _error = function (e) {
main.log(e);
core.platform.useLocalForage = false;
@ -379,13 +386,16 @@ core.prototype._forwardFunc = function (name, funcname) {
}
if (core[funcname]) {
console.error("ERROR: Cannot forward function " + funcname + " from " + name + "!");
console.error("ERROR: 无法转发 "+name+" 中的函数 "+funcname+" 到 core 中!同名函数已存在。");
return;
}
var parameterInfo = /^\s*function\s*[\w_$]*\(([\w_,$\s]*)\)\s*\{/.exec(core[name][funcname].toString());
var parameters = (parameterInfo == null ? "" : parameterInfo[1]).replace(/\s*/g, '').replace(/,/g, ', ');
// core[funcname] = new Function(parameters, "return core."+name+"."+funcname+"("+parameters+");");
eval("core." + funcname + " = function (" + parameters + ") {\n\treturn core." + name + "." + funcname + "(" + parameters + ");\n}");
if (name == 'plugin') {
main.log("插件函数转发core."+funcname+" = core.plugin."+funcname);
}
}
core.prototype.doFunc = function (func, _this) {

View File

@ -16,7 +16,7 @@ events.prototype._init = function () {
/// 初始化游戏
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.showStatusBar();
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();
}
@ -85,7 +89,7 @@ events.prototype._startGame_upload = function () {
formData.append('type', 'people');
formData.append('name', core.firstData.name);
formData.append('version', core.firstData.version);
formData.append('platform', core.platform.isPC ? "PC" : core.platform.isAndroid ? "Android" : core.platform.isIOS ? "iOS" : "");
formData.append('platform', core.platform.string);
formData.append('hard', core.encodeBase64(core.status.hard));
formData.append('hardCode', core.getFlag('hard', 0));
formData.append('base64', 1);
@ -167,7 +171,7 @@ events.prototype._gameOver_doUpload = function (username, ending, norank) {
formData.append('type', 'score');
formData.append('name', core.firstData.name);
formData.append('version', core.firstData.version);
formData.append('platform', core.platform.isPC ? "PC" : core.platform.isAndroid ? "Android" : core.platform.isIOS ? "iOS" : "");
formData.append('platform', core.platform.string);
formData.append('hard', core.encodeBase64(core.status.hard));
formData.append('username', core.encodeBase64(username || ""));
formData.append('ending', core.encodeBase64(ending));
@ -247,7 +251,7 @@ events.prototype.unregisterSystemEvent = function (type) {
events.prototype.doSystemEvent = function (type, data, callback) {
if (this.systemEvents[type]) {
try {
return core.doFunc(this.systemEvents[type], this, data, data, callback);
return core.doFunc(this.systemEvents[type], this, data, callback);
}
catch (e) {
main.log(e);
@ -684,6 +688,11 @@ events.prototype._sys_action = function (data, callback) {
this.insertAction(ev, ex, ey, callback);
}
events.prototype._sys_custom = function (data, callback) {
core.insertAction(["请使用\r[yellow]core.registerSystemEvent('custom', func)\r来处理自己添加的系统触发器"],
data.x, data.y, callback);
}
// ------ 自定义事件的处理 ------ //
////// 注册一个自定义事件 //////
@ -797,7 +806,10 @@ events.prototype.insertAction = function (action, x, y, callback, addToLast) {
// ------ 判定commonEvent
var commonEvent = this.getCommonEvent(action);
if (commonEvent instanceof Array) action = commonEvent;
if (commonEvent instanceof Array) {
this._addCommentEventToList(action, commonEvent);
action = commonEvent;
}
if (!action) return;
if (core.status.event.id != 'action') {
@ -818,6 +830,22 @@ events.prototype.getCommonEvent = function (name) {
return this.commonEvent[name] || null;
}
events.prototype._addCommentEventToList = function (name, list) {
if (list == null) list = this.getCommonEvent(name);
if (!list || !core.flags.quickCommonEvents) return;
var addToList = false;
for (var x in list) {
if (list[x].type == 'addToList') {
addToList = true;
break;
}
}
if (!addToList) return;
var obj = core.getFlag("__commonEventList__", []);
if (obj.indexOf(name) == -1) obj.push(name);
core.setFlag("__commonEventList__", obj);
}
////// 恢复一个事件 //////
events.prototype.recoverEvents = function (data) {
if (data) {
@ -885,7 +913,7 @@ events.prototype._action_autoText = function (data, x, y, prefix) {
events.prototype._action_scrollText = function (data, x, y, prefix) {
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) {
@ -893,7 +921,7 @@ events.prototype._action_comment = 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];
});
["background", "title", "text"].forEach(function (t) {
@ -1030,10 +1058,9 @@ events.prototype._action_changePos = 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;
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) {
@ -1160,13 +1187,14 @@ events.prototype._action_insert = function (data, x, y, prefix) {
if (data.args instanceof Array) {
for (var i = 0; i < data.args.length; ++i) {
try {
core.setFlag('arg'+(i+1), core.calValue(data.args[i], prefix));
if (data.args[i] != null)
core.setFlag('arg'+(i+1), data.args[i]);
} catch (e) { main.log(e); }
}
}
if (data.name) { // 公共事件
core.setFlag('arg0', data.name);
core.insertAction(this.getCommonEvent(data.name));
core.insertAction(data.name);
}
else {
var loc = this.__action_getLoc(data.loc, x, y, prefix);
@ -1179,6 +1207,10 @@ events.prototype._action_insert = function (data, x, y, prefix) {
core.doAction();
}
events.prototype._action_addToList = function (data, x, y, prefix) {
core.doAction();
}
events.prototype._action_playBgm = function (data, x, y, prefix) {
core.playBgm(data.name);
core.doAction();
@ -1815,21 +1847,27 @@ events.prototype.closeDoor = function (x, y, id, callback) {
}
////// 显示图片 //////
events.prototype.showImage = function (code, image, x, y, dw, dh, opacityVal, time, callback) {
dw /= 100;
dh /= 100;
x = core.calValue(x) || 0;
y = core.calValue(y) || 0;
events.prototype.showImage = function (code, image, sloc, loc, opacityVal, time, callback) {
if (typeof image == 'string') image = core.material.images.images[image];
if (!image) {
if (callback) callback();
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;
time = time || 0;
var name = "image" + zIndex;
var ctx = core.createCanvas(name, x, y, image.width * dw, image.height * dh, zIndex);
ctx.drawImage(image, 0, 0, image.width * dw, image.height * dh);
var ctx = core.createCanvas(name, x, y, w, h, zIndex);
ctx.drawImage(image, sx, sy, sw, sh, 0, 0, w, h);
if (time == 0) {
core.setOpacity(name, opacityVal);
if (callback) callback();
@ -2190,7 +2228,7 @@ events.prototype.uploadCurrent = function (username) {
formData.append('type', 'score');
formData.append('name', core.firstData.name);
formData.append('version', core.firstData.version);
formData.append('platform', core.platform.isPC ? "PC" : core.platform.isAndroid ? "Android" : core.platform.isIOS ? "iOS" : "");
formData.append('platform', core.platform.string);
formData.append('hard', core.encodeBase64(core.status.hard));
formData.append('username', core.encodeBase64(username || "current"));
formData.append('lv', core.status.hero.lv);

View File

@ -311,20 +311,17 @@ items.prototype.unloadEquip = function (equipType, callback) {
}
items.prototype.compareEquipment = function (compareEquipId, beComparedEquipId) {
var compareAtk = 0, compareDef = 0, compareMdef = 0;
if (compareEquipId) {
var compareEquip = core.material.items[compareEquipId];
compareAtk += (compareEquip.equip || {}).atk || 0;
compareDef += (compareEquip.equip || {}).def || 0;
compareMdef += (compareEquip.equip || {}).mdef || 0;
var result = {};
var first = core.material.items[compareEquipId], second = core.material.items[beComparedEquipId];
for (var name in core.status.hero) {
if (typeof core.status.hero[name] == 'number') {
var ans = 0;
if (first) ans += (first.equip || {})[name] || 0;
if (second) ans -= (second.equip || {})[name] || 0;
if (ans != 0) result[name] = ans;
}
}
if (beComparedEquipId) {
var beComparedEquip = core.material.items[beComparedEquipId];
compareAtk -= (beComparedEquip.equip || {}).atk || 0;
compareDef -= (beComparedEquip.equip || {}).def || 0;
compareMdef -= (beComparedEquip.equip || {}).mdef || 0;
}
return {"atk": compareAtk, "def": compareDef, "mdef": compareMdef};
return result;
}
////// 实际换装的效果 //////
@ -349,7 +346,7 @@ items.prototype._realLoadEquip = function (type, loadId, unloadId, callback) {
var loadPercentage = loadEquip.equip.percentage, unloadPercentage = unloadEquip.equip.percentage;
if (loadPercentage != null && unloadPercentage != null && loadPercentage != unloadPercentage) {
if (loadId && unloadId && (loadPercentage || false) != (unloadPercentage || false)) {
this.unloadEquip(type);
this.loadEquip(loadId);
if (callback) callback();

View File

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

View File

@ -30,11 +30,14 @@ maps.prototype.loadFloor = function (floorId, map) {
map = {"map": map};
}
var content = {};
["floorId", "title", "name", "canFlyTo", "canUseQuickShop", "cannotViewMap", "cannotMoveDirectly", "color", "weather",
"defaultGround", "images", "item_ratio", "upFloor", "bgm", "downFloor", "underGround"].forEach(function (e) {
if (map[e] != null) content[e] = core.clone(map[e]);
else content[e] = core.clone(floor[e]);
});
for (var name in floor) {
if (name != 'map' && name != 'bgmap' && name != 'fgmap' && floor[name] != null)
content[name] = core.clone(floor[name]);
}
for (var name in map) {
if (name != 'map' && name != 'bgmap' && name != 'fgmap' && map[name] != null)
content[name] = core.clone(map[name]);
}
map = this.decompressMap(map.map, floorId);
// 事件处理
content['blocks'] = this._mapIntoBlocks(map, floor, floorId);
@ -412,7 +415,7 @@ maps.prototype._canMoveHero_checkPoint = function (x, y, direction, floorId, ext
return false;
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;
// 2. 检查该点素材的 cannotOut 和下一个点的 cannotIn
@ -1696,6 +1699,7 @@ maps.prototype.animateBlock = function (loc, type, time, callback) {
var isHide = type == 'hide';
if (typeof loc[0] == 'number' && typeof loc[1] == 'number')
loc = [loc];
// --- 检测所有是0的点
var list = this._animateBlock_getList(loc);
if (list.length == 0) {
if (callback) callback();
@ -1714,7 +1718,8 @@ maps.prototype._animateBlock_doAnimate = function (loc, list, isHide, delta, cal
delete core.animateFrame.asyncId[animate];
clearInterval(animate);
list.forEach(function (t) {
core.maps._deleteDetachedBlock(t.canvases);
if (t.blockInfo)
core.maps._deleteDetachedBlock(t.canvases);
});
loc.forEach(function (t) {
if (isHide) core.removeBlock(t[0], t[1]);
@ -1735,7 +1740,10 @@ maps.prototype._animateBlock_getList = function (loc) {
block = block.block;
var blockInfo = core.maps.getBlockInfo(block);
if (blockInfo == null) return;
if (blockInfo == null) {
list.push({ 'x': t[0], 'y': t[1] });
return;
}
var canvases = core.maps._initDetachedBlock(blockInfo, t[0], t[1], block.event.displayDamage !== false);
list.push({
@ -1748,7 +1756,8 @@ maps.prototype._animateBlock_getList = function (loc) {
maps.prototype._animateBlock_drawList = function (list, opacity) {
list.forEach(function (t) {
core.maps._moveDetachedBlock(t.blockInfo, t.x * 32, t.y * 32, opacity, t.canvases);
if (t.blockInfo)
core.maps._moveDetachedBlock(t.blockInfo, t.x * 32, t.y * 32, opacity, t.canvases);
});
}

2909
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) {
size = size || 32;
utils.prototype.splitImage = function (image, width, height) {
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 context = canvas.getContext("2d");
canvas.width = size;
canvas.height = size;
canvas.width = width;
canvas.height = height;
var ans = [];
for (var i = 0; i < image.height; i += size) {
context.drawImage(image, 0, i, size, size, 0, 0, size, size);
var img = new Image();
img.src = canvas.toDataURL("image/png");
ans.push(img);
context.clearRect(0, 0, size, size);
for (var j = 0; j < image.height; j += height) {
for (var i = 0; i < image.width; i += width) {
context.drawImage(image, i, j, width, height, 0, 0, width, height);
var img = new Image();
img.src = canvas.toDataURL("image/png");
ans.push(img);
context.clearRect(0, 0, width, height);
}
}
return ans;
}
@ -342,6 +348,12 @@ utils.prototype.formatDate2 = function (date) {
+ core.setTwoDigits(date.getHours()) + core.setTwoDigits(date.getMinutes()) + core.setTwoDigits(date.getSeconds());
}
utils.prototype.formatTime = function (time) {
return core.setTwoDigits(parseInt(time/3600000))
+":"+core.setTwoDigits(parseInt(time/60000)%60)
+":"+core.setTwoDigits(parseInt(time/1000)%60);
}
////// 两位数显示 //////
utils.prototype.setTwoDigits = function (x) {
return parseInt(x) < 10 ? "0" + x : x;
@ -455,6 +467,8 @@ utils.prototype._encodeRoute_encodeOne = function (t) {
return "P" + t.substring(6);
else if (t.indexOf('input2:') == 0)
return "Q" + t.substring(7) + ":";
else if (t.indexOf('common:') == 0)
return "c" + t.substring(7) + ":";
else if (t == 'no')
return 'N';
else if (t.indexOf('move:') == 0)
@ -513,7 +527,7 @@ utils.prototype._decodeRoute_number2id = function (number) {
}
utils.prototype._decodeRoute_decodeOne = function (decodeObj, c) {
var nxt = (c == 'I' || c == 'e' || c == 'F' || c == 'S' || c == 'Q' || c == 't') ?
var nxt = (c == 'I' || c == 'e' || c == 'F' || c == 'S' || c == 'Q' || c == 't' || c == 'c') ?
this._decodeRoute_getString(decodeObj) : this._decodeRoute_getNumber(decodeObj);
var mp = {"U": "up", "D": "down", "L": "left", "R": "right"};
@ -558,6 +572,9 @@ utils.prototype._decodeRoute_decodeOne = function (decodeObj, c) {
case "Q":
decodeObj.ans.push("input2:" + nxt);
break;
case "c":
decodeObj.ans.push("common:" + nxt);
break;
case "N":
decodeObj.ans.push("no");
break;

View File

@ -675,7 +675,7 @@ window.onblur = function () {
if (main.core && main.core.control) {
try {
main.core.control.checkAutosave();
} catch (e) {main.log(e);}
} catch (e) {}
}
}

View File

@ -249,6 +249,8 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"name": "贪婪之神",
"icon": "blueShop",
"textInList": "1F金币商店",
"commonTimes": false,
"mustEnable": false,
"use": "money",
"need": "20+10*times*(times+1)",
"text": "勇敢的武士啊,给我${need}金币就可以:",
@ -276,6 +278,8 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"name": "经验之神",
"icon": "pinkShop",
"textInList": "1F经验商店",
"commonTimes": false,
"mustEnable": false,
"use": "experience",
"need": "-1",
"text": "勇敢的武士啊,给我若干经验就可以:",
@ -296,6 +300,13 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"effect": "status:def+=5"
}
]
},
{
"id": "keyShop1",
"textInList": "1F回收钥匙商店",
"mustEnable": false,
"commonEvent": "回收钥匙商店",
"args": ""
}
],
"levelUp": [
@ -397,6 +408,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"enableMoveDirectly": true,
"enableDisabledShop": true,
"disableShopOnDamage": false,
"quickCommonEvents": false,
"checkConsole": false
}
}

View File

@ -237,6 +237,100 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 =
],
"false": []
}
],
"回收钥匙商店": [
{
"type": "comment",
"text": "此事件在全局商店中被引用了(全局商店keyShop1)"
},
{
"type": "comment",
"text": "解除引用前勿删除此事件"
},
{
"type": "comment",
"text": "玩家在快捷列表V键中可以使用本公共事件"
},
{
"type": "while",
"condition": "1",
"data": [
{
"type": "choices",
"text": "\t[商人,woman]你有多余的钥匙想要出售吗?",
"choices": [
{
"text": "黄钥匙10金币",
"color": [
255,
255,
0,
1
],
"action": [
{
"type": "if",
"condition": "item:yellowKey >= 1",
"true": [
{
"type": "addValue",
"name": "item:yellowKey",
"value": "-1"
},
{
"type": "addValue",
"name": "status:money",
"value": "10"
}
],
"false": [
"\t[商人,woman]你没有黄钥匙!"
]
}
]
},
{
"text": "蓝钥匙50金币",
"color": [
0,
0,
255,
1
],
"action": [
{
"type": "if",
"condition": "item:blueKey >= 1",
"true": [
{
"type": "addValue",
"name": "item:blueKey",
"value": "-1"
},
{
"type": "addValue",
"name": "status:money",
"value": "50"
}
],
"false": [
"\t[商人,woman]你没有蓝钥匙!"
]
}
]
},
{
"text": "离开",
"action": [
{
"type": "exit"
}
]
}
]
}
]
}
]
}
}

View File

@ -34,6 +34,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
var globalFlags = core.getFlag("globalFlags", {});
for (var key in globalFlags)
core.flags[key] = globalFlags[key];
core._init_sys_flags();
// 初始化界面,状态栏等
core.resize();
core.updateGlobalAttribute();
@ -698,7 +699,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
gid = guards[i][2];
// 递归计算支援怪伤害信息这里不传x,y保证不会重复调用
// 这里的mdef传0因为护盾应该只会被计算一次
var info = core.enemys.getDamageInfo(core.material.enemys[gid], origin_hero_hp, origin_hero_atk, origin_hero_def, 0);
var info = core.enemys.getDamageInfo(core.material.enemys[gid], { hp: origin_hero_hp, atk: origin_hero_atk, def: origin_hero_def, mdef: 0 });
if (info == null) { // 小队中任何一个怪物不可战斗直接返回null
return null;
}

View File

@ -259,7 +259,7 @@ var icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1 =
"hammer": 48,
"jumpShoes": 49,
"skill1": 30,
"I73": 10
"wand": 10
},
"autotile": {
"autotile": 0,

View File

@ -303,7 +303,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"text": "可以打开或关闭主动技能二倍斩",
"hideInReplay": true
},
"I73": {
"wand": {
"cls": "items",
"name": "新物品"
}

View File

@ -67,7 +67,7 @@ var maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
"70": {"cls":"items","id":"sword0"},
"71": {"cls":"items","id":"shield0"},
"72": {"cls":"items","id":"skill1"},
"73": {"cls":"items","id":"I73"},
"73": {"cls":"items","id":"wand"},
"81": {"cls":"terrains","id":"yellowDoor","trigger":"openDoor"},
"82": {"cls":"terrains","id":"blueDoor","trigger":"openDoor"},
"83": {"cls":"terrains","id":"redDoor","trigger":"openDoor"},

View File

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