@ -283,6 +283,7 @@ if (Floor_List_0!='floorId') toFloorId = Floor_List_0;
|
||||
var loc = ', "loc": ['+Number_0+', '+Number_1+']';
|
||||
if (Stair_List_0===':now') loc = '';
|
||||
else if (Stair_List_0!=='loc')loc = ', "stair": "'+Stair_List_0+'"';
|
||||
if (DirectionEx_List_0 == 'null') DirectionEx_List_0 = '';
|
||||
DirectionEx_List_0 = DirectionEx_List_0 && (', "direction": "'+DirectionEx_List_0+'"');
|
||||
IntString_0 = IntString_0 ?(', "time": '+IntString_0):'';
|
||||
if (IgnoreChangeFloor_List_0!='null') {
|
||||
@ -341,6 +342,7 @@ action
|
||||
| insert_2_s
|
||||
| exit_s
|
||||
| setBlock_s
|
||||
| turnBlock_s
|
||||
| showFloorImg_s
|
||||
| hideFloorImg_s
|
||||
| showBgFgMap_s
|
||||
@ -383,6 +385,7 @@ action
|
||||
| screenFlash_s
|
||||
| setWeather_s
|
||||
| move_s
|
||||
| moveAction_s
|
||||
| moveHero_s
|
||||
| jump_s
|
||||
| jumpHero_s
|
||||
@ -696,13 +699,13 @@ return code;
|
||||
*/;
|
||||
|
||||
hide_s
|
||||
: '隐藏事件' 'x' EvalString? ',' 'y' EvalString? '楼层' IdString? '动画时间' IntString? '不等待执行完毕' Bool? Newline
|
||||
: '隐藏事件' 'x' EvalString? ',' 'y' EvalString? '楼层' IdString? '同时删除' Bool '动画时间' IntString? '不等待执行完毕' Bool? Newline
|
||||
|
||||
|
||||
/* hide_s
|
||||
tooltip : hide: 将一个启用事件禁用,所有参数均可不填,代表禁用事件自身,xy可用逗号分隔表示多个点
|
||||
tooltip : hide: 隐藏事件,同时可删除
|
||||
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=hide%EF%BC%9A%E5%B0%86%E4%B8%80%E4%B8%AA%E5%90%AF%E7%94%A8%E4%BA%8B%E4%BB%B6%E7%A6%81%E7%94%A8
|
||||
default : ["","","","",false]
|
||||
default : ["","","",true,"",false]
|
||||
colour : this.mapColor
|
||||
var floorstr = '';
|
||||
if (EvalString_0 && EvalString_1) {
|
||||
@ -723,22 +726,26 @@ if (EvalString_0 && EvalString_1) {
|
||||
}
|
||||
IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"');
|
||||
IntString_0 = IntString_0 ?(', "time": '+IntString_0):'';
|
||||
Bool_0 = Bool_0 ?', "async": true':'';
|
||||
var code = '{"type": "hide"'+floorstr+IdString_0+''+IntString_0+Bool_0+'},\n';
|
||||
Bool_0 = Bool_0 ?', "remove": true':'';
|
||||
Bool_1 = Bool_1 ?', "async": true':'';
|
||||
var code = '{"type": "hide"'+floorstr+IdString_0+Bool_0+IntString_0+Bool_1+'},\n';
|
||||
return code;
|
||||
*/;
|
||||
|
||||
trigger_s
|
||||
: '触发事件' 'x' PosString ',' 'y' PosString '不结束当前事件' Bool Newline
|
||||
: '触发系统事件' 'x' PosString? ',' 'y' PosString? Newline
|
||||
|
||||
|
||||
/* trigger_s
|
||||
tooltip : trigger: 立即触发另一个地点的事件
|
||||
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=trigger%EF%BC%9A%E7%AB%8B%E5%8D%B3%E8%A7%A6%E5%8F%91%E5%8F%A6%E4%B8%80%E4%B8%AA%E5%9C%B0%E7%82%B9%E7%9A%84%E4%BA%8B%E4%BB%B6
|
||||
default : ["0","0",false]
|
||||
default : ["",""]
|
||||
colour : this.eventColor
|
||||
Bool_0 = Bool_0 ?', "keep": true':'';
|
||||
var code = '{"type": "trigger", "loc": ['+PosString_0+','+PosString_1+']'+Bool_0+'},\n';
|
||||
var floorstr = '';
|
||||
if (PosString_0 && PosString_1) {
|
||||
floorstr = ', "loc": ['+PosString_0+','+PosString_1+']';
|
||||
}
|
||||
var code = '{"type": "trigger"'+floorstr+'},\n';
|
||||
return code;
|
||||
*/;
|
||||
|
||||
@ -761,7 +768,7 @@ return code;
|
||||
*/;
|
||||
|
||||
insert_2_s
|
||||
: '插入事件' 'x' PosString ',' 'y' PosString Event_List? '楼层' IdString? '参数列表' JsonEvalString? Newline
|
||||
: '插入事件' 'x' PosString? ',' 'y' PosString? Event_List? '楼层' IdString? '参数列表' JsonEvalString? Newline
|
||||
|
||||
|
||||
/* insert_2_s
|
||||
@ -778,7 +785,11 @@ if (JsonEvalString_0) {
|
||||
if (Event_List_0 && Event_List_0 !=='null')
|
||||
Event_List_0 = ', "which": "'+Event_List_0+'"';
|
||||
else Event_List_0 = '';
|
||||
var code = '{"type": "insert", "loc": ['+PosString_0+','+PosString_1+']'+Event_List_0+IdString_0+JsonEvalString_0+'},\n';
|
||||
var floorstr = '';
|
||||
if (PosString_0 && PosString_1) {
|
||||
floorstr = ', "loc": ['+PosString_0+','+PosString_1+']';
|
||||
}
|
||||
var code = '{"type": "insert"'+floorstr+Event_List_0+IdString_0+JsonEvalString_0+'},\n';
|
||||
return code;
|
||||
*/;
|
||||
|
||||
@ -825,6 +836,39 @@ var code = '{"type": "setBlock", "number": "'+EvalString_0+'"'+floorstr+IdString
|
||||
return code;
|
||||
*/;
|
||||
|
||||
turnBlock_s
|
||||
: '事件转向' DirectionEx_List 'x' EvalString? ',' 'y' EvalString? '楼层' IdString? Newline
|
||||
|
||||
|
||||
/* turnBlock_s
|
||||
tooltip : turnBlock:事件转向;自动检索faceIds
|
||||
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=setblock%EF%BC%9A%E8%AE%BE%E7%BD%AE%E6%9F%90%E4%B8%AA%E5%9B%BE%E5%9D%97
|
||||
colour : this.mapColor
|
||||
default : [null,"","",""]
|
||||
var floorstr = '';
|
||||
if (EvalString_0 && EvalString_1) {
|
||||
var pattern1 = MotaActionFunctions.pattern.id;
|
||||
if(pattern1.test(EvalString_0) || pattern1.test(EvalString_1)){
|
||||
EvalString_0=MotaActionFunctions.PosString_pre(EvalString_0);
|
||||
EvalString_1=MotaActionFunctions.PosString_pre(EvalString_1);
|
||||
EvalString_0=[EvalString_0,EvalString_1]
|
||||
} else {
|
||||
var pattern2 = /^([+-]?\d+)(,[+-]?\d+)*$/;
|
||||
if(!pattern2.test(EvalString_0) || !pattern2.test(EvalString_1))throw new Error('坐标格式错误,请右键点击帮助查看格式');
|
||||
EvalString_0=EvalString_0.split(',');
|
||||
EvalString_1=EvalString_1.split(',');
|
||||
if(EvalString_0.length!==EvalString_1.length)throw new Error('坐标格式错误,请右键点击帮助查看格式');
|
||||
for(var ii=0;ii<EvalString_0.length;ii++)EvalString_0[ii]='['+EvalString_0[ii]+','+EvalString_1[ii]+']';
|
||||
}
|
||||
floorstr = ', "loc": ['+EvalString_0.join(',')+']';
|
||||
}
|
||||
if (DirectionEx_List_0 == 'null') DirectionEx_List_0 = '';
|
||||
DirectionEx_List_0 = DirectionEx_List_0 && (', "direction": "'+DirectionEx_List_0+'"');
|
||||
IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"');
|
||||
var code = '{"type": "turnBlock"'+DirectionEx_List_0+floorstr+IdString_0+'},\n';
|
||||
return code;
|
||||
*/;
|
||||
|
||||
showFloorImg_s
|
||||
: '显示贴图' 'x' EvalString? ',' 'y' EvalString? '楼层' IdString? Newline
|
||||
|
||||
@ -1143,21 +1187,24 @@ return code;
|
||||
*/;
|
||||
|
||||
changeFloor_s
|
||||
: '楼层切换' IdString? 'x' PosString? ',' 'y' PosString? '朝向' DirectionEx_List '动画时间' IntString? Newline
|
||||
: '楼层切换' Floor_List IdString? Stair_List 'x' Number ',' 'y' Number '朝向' DirectionEx_List '动画时间' IntString? Newline
|
||||
|
||||
|
||||
/* changeFloor_s
|
||||
tooltip : changeFloor: 楼层切换,动画时间可不填
|
||||
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=changefloor%EF%BC%9A%E6%A5%BC%E5%B1%82%E5%88%87%E6%8D%A2
|
||||
default : ["MTx","0","0",null,""]
|
||||
default : [null,"",null,"","",null,"",null]
|
||||
colour : this.dataColor
|
||||
var toFloorId = IdString_0;
|
||||
if (Floor_List_0!='floorId') toFloorId = Floor_List_0;
|
||||
toFloorId = toFloorId ? (', "floorId": ' + toFloorId) : '';
|
||||
var loc = ', "loc": ['+Number_0+', '+Number_1+']';
|
||||
if (Stair_List_0===':now') loc = '';
|
||||
else if (Stair_List_0!=='loc')loc = ', "stair": "'+Stair_List_0+'"';
|
||||
if (DirectionEx_List_0 == 'null') DirectionEx_List_0 = '';
|
||||
DirectionEx_List_0 = DirectionEx_List_0 && (', "direction": "'+DirectionEx_List_0+'"');
|
||||
IntString_0 = IntString_0 ?(', "time": '+IntString_0):'';
|
||||
var floorstr = '';
|
||||
if (PosString_0 && PosString_1) {
|
||||
floorstr = ', "loc": ['+PosString_0+','+PosString_1+']';
|
||||
}
|
||||
var code = '{"type": "changeFloor", "floorId": "'+IdString_0+'"'+floorstr+DirectionEx_List_0+IntString_0+' },\n';
|
||||
var code = '{"type": "changeFloor"'+toFloorId+loc+DirectionEx_List_0+IntString_0+' }\n';
|
||||
return code;
|
||||
*/;
|
||||
|
||||
@ -1171,6 +1218,7 @@ helpUrl : https://h5mota.com/games/template/_docs/#/event?id=changepos%EF%BC%9A%
|
||||
default : ["","",null]
|
||||
colour : this.dataColor
|
||||
var loc = (PosString_0 && PosString_1) ? (', "loc": ['+PosString_0+','+PosString_1+']') : '';
|
||||
if (DirectionEx_List_0 == 'null') DirectionEx_List_0 = '';
|
||||
DirectionEx_List_0 = DirectionEx_List_0 && (', "direction": "'+DirectionEx_List_0+'"');
|
||||
var code = '{"type": "changePos"'+loc+DirectionEx_List_0+'},\n';
|
||||
return code;
|
||||
@ -1526,8 +1574,21 @@ var code = '{"type": "move"'+floorstr+IntString_0+Bool_0+Bool_1+', "steps": '+JS
|
||||
return code;
|
||||
*/;
|
||||
|
||||
moveAction_s
|
||||
: '勇士前进一格或撞击' Newline
|
||||
|
||||
|
||||
/* moveAction_s
|
||||
tooltip : moveAction: 前进一格或撞击
|
||||
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=move%EF%BC%9A%E8%AE%A9%E6%9F%90%E4%B8%AAnpc%E6%80%AA%E7%89%A9%E7%A7%BB%E5%8A%A8
|
||||
colour : this.dataColor
|
||||
return '{"type": "moveAction"},\n';
|
||||
*/;
|
||||
|
||||
|
||||
|
||||
moveHero_s
|
||||
: '移动勇士' '动画时间' IntString? '不等待执行完毕' Bool BGNL? StepString Newline
|
||||
: '无视地形移动勇士' '动画时间' IntString? '不等待执行完毕' Bool BGNL? StepString Newline
|
||||
|
||||
|
||||
/* moveHero_s
|
||||
@ -2654,8 +2715,8 @@ FontString
|
||||
;
|
||||
|
||||
Floor_List
|
||||
: '楼层ID'|'前一楼'|'后一楼'
|
||||
/*Floor_List ['floorId',':before',':next']*/;
|
||||
: '楼层ID'|'前一楼'|'后一楼'|'当前楼'
|
||||
/*Floor_List ['floorId',':before',':next',':now']*/;
|
||||
|
||||
Stair_List
|
||||
: '坐标'|'上楼梯'|'下楼梯'|'保持不变'|'中心对称点'|'x对称点'|'y对称点'
|
||||
@ -2757,8 +2818,8 @@ Direction_List
|
||||
/*Direction_List ['up','down','left','right']*/;
|
||||
|
||||
DirectionEx_List
|
||||
: '不变'|'上'|'下'|'左'|'右'
|
||||
/*DirectionEx_List ['','up','down','left','right']*/;
|
||||
: '不变'|'朝上'|'朝下'|'朝左'|'朝右'|'左转'|'右转'|'背对'
|
||||
/*DirectionEx_List ['null','up','down','left','right',':left',':right',':back']*/;
|
||||
|
||||
StepString
|
||||
: (Direction_List Int?)+
|
||||
@ -2875,7 +2936,7 @@ ActionParser.prototype.parse = function (obj,type) {
|
||||
obj.loc=[0,0];
|
||||
if (!this.isset(obj.stair)) obj.stair=':now';
|
||||
}
|
||||
if (obj.floorId==':before'||obj.floorId==':next') {
|
||||
if (obj.floorId==':before'||obj.floorId==':next'||obj.floorId==':now') {
|
||||
obj.floorType=obj.floorId;
|
||||
delete obj.floorId;
|
||||
}
|
||||
@ -3052,7 +3113,7 @@ ActionParser.prototype.parseAction = function() {
|
||||
y_str.push(t[1]);
|
||||
})
|
||||
this.next = MotaActionBlocks['hide_s'].xmlText([
|
||||
x_str.join(','),y_str.join(','),data.floorId||'',data.time,data.async||false,this.next]);
|
||||
x_str.join(','),y_str.join(','),data.floorId||'',data.remove||false,data.time,data.async||false,this.next]);
|
||||
break;
|
||||
case "setBlock": // 设置图块
|
||||
data.loc=data.loc||[];
|
||||
@ -3066,6 +3127,18 @@ ActionParser.prototype.parseAction = function() {
|
||||
this.next = MotaActionBlocks['setBlock_s'].xmlText([
|
||||
data.number||0,x_str.join(','),y_str.join(','),data.floorId||'',this.next]);
|
||||
break;
|
||||
case "turnBlock": // 事件转向
|
||||
data.loc=data.loc||[];
|
||||
if (!(data.loc[0] instanceof Array))
|
||||
data.loc = [data.loc];
|
||||
var x_str=[],y_str=[];
|
||||
data.loc.forEach(function (t) {
|
||||
x_str.push(t[0]);
|
||||
y_str.push(t[1]);
|
||||
})
|
||||
this.next = MotaActionBlocks['turnBlock_s'].xmlText([
|
||||
data.direction,x_str.join(','),y_str.join(','),data.floorId||'',this.next]);
|
||||
break;
|
||||
case "showFloorImg": // 显示贴图
|
||||
data.loc=data.loc||[];
|
||||
if (!(data.loc[0] instanceof Array))
|
||||
@ -3135,7 +3208,10 @@ ActionParser.prototype.parseAction = function() {
|
||||
this.next = MotaActionBlocks['move_s'].xmlText([
|
||||
data.loc[0],data.loc[1],data.time,data.keep||false,data.async||false,this.StepString(data.steps),this.next]);
|
||||
break;
|
||||
case "moveHero": // 移动勇士
|
||||
case "moveAction": // 前进一格或撞击
|
||||
this.next = MotaActionBlocks['moveAction_s'].xmlText([this.next]);
|
||||
break;
|
||||
case "moveHero": // 无视地形移动勇士
|
||||
this.next = MotaActionBlocks['moveHero_s'].xmlText([
|
||||
data.time,data.async||false,this.StepString(data.steps),this.next]);
|
||||
break;
|
||||
@ -3151,9 +3227,17 @@ ActionParser.prototype.parseAction = function() {
|
||||
data.loc[0],data.loc[1],data.time,data.async||false,this.next]);
|
||||
break;
|
||||
case "changeFloor": // 楼层转换
|
||||
data.loc=data.loc||['','']
|
||||
this.next = MotaActionBlocks['changeFloor_s'].xmlText([
|
||||
data.floorId,data.loc[0],data.loc[1],data.direction,data.time,this.next]);
|
||||
if (!data.loc) {
|
||||
data.loc = data.loc || ['',''];
|
||||
data.stair = data.stair || ':now';
|
||||
}
|
||||
if (data.floorId==':before'||data.floorId==':next'||data.floorId==':now') {
|
||||
data.floorType=data.floorId;
|
||||
delete data.floorId;
|
||||
}
|
||||
return MotaActionBlocks['changeFloor_s'].xmlText([
|
||||
data.floorType||'floorId',data.floorId,data.stair||'loc',data.loc[0],data.loc[1],obj.direction,
|
||||
data.time, this.next]);
|
||||
break;
|
||||
case "changePos": // 直接更换勇士位置, 不切换楼层
|
||||
data.loc=data.loc||['','']
|
||||
@ -3276,9 +3360,10 @@ ActionParser.prototype.parseAction = function() {
|
||||
data.loc[0],data.loc[1],this.next]);
|
||||
}
|
||||
break;
|
||||
case "trigger": // 触发另一个事件;当前事件会被立刻结束。需要另一个地点的事件是有效的
|
||||
case "trigger": // 触发另一个事件
|
||||
data.loc = data.loc || [];
|
||||
this.next = MotaActionBlocks['trigger_s'].xmlText([
|
||||
data.loc[0],data.loc[1],data.keep,this.next]);
|
||||
data.loc[0],data.loc[1],this.next]);
|
||||
break;
|
||||
case "insert": // 强制插入另一个点的事件在当前事件列表执行,当前坐标和楼层不会改变
|
||||
if (data.args instanceof Array) {
|
||||
@ -3290,6 +3375,7 @@ ActionParser.prototype.parseAction = function() {
|
||||
data.name, data.args||"", this.next]);
|
||||
}
|
||||
else {
|
||||
data.loc = data.loc || [];
|
||||
this.next = MotaActionBlocks['insert_2_s'].xmlText([
|
||||
data.loc[0],data.loc[1],data.which,data.floorId||'',data.args||"",this.next]);
|
||||
}
|
||||
|
||||
@ -170,7 +170,7 @@ body {
|
||||
|
||||
#tip {
|
||||
float: right;
|
||||
width: 50%;
|
||||
width: 48%;
|
||||
height: 95%;
|
||||
padding: 5px 10px 10px 10px;
|
||||
margin-right: 0;
|
||||
|
||||
@ -26,6 +26,7 @@ function editor() {
|
||||
brushMod:document.getElementById('brushMod'),
|
||||
brushMod2:document.getElementById('brushMod2'),
|
||||
brushMod3:document.getElementById('brushMod3'),
|
||||
brushMod4:document.getElementById('brushMod4'),
|
||||
bgc : document.getElementById('bg'),
|
||||
bgCtx : document.getElementById('bg').getContext('2d'),
|
||||
fgc : document.getElementById('fg'),
|
||||
@ -49,6 +50,7 @@ function editor() {
|
||||
selectAppend : document.getElementById('selectAppend'),
|
||||
selectFileBtn :document.getElementById('selectFileBtn'),
|
||||
changeFloorId :document.getElementById('changeFloorId'),
|
||||
changeFloorSize: document.getElementById('changeFloorSize'),
|
||||
left1 : document.getElementById('left1'),
|
||||
editModeSelect :document.getElementById('editModeSelect'),
|
||||
mid2 : document.getElementById('mid2'),
|
||||
@ -149,7 +151,7 @@ editor.prototype.init = function (callback) {
|
||||
var useCompress = main.useCompress;
|
||||
main.useCompress = false;
|
||||
editor.airwallImg = new Image();
|
||||
editor.airwallImg.src = './project/images/airwall.png';
|
||||
editor.airwallImg.src = './project/materials/airwall.png';
|
||||
|
||||
main.init('editor', function () {
|
||||
editor.config = new editor_config();
|
||||
|
||||
@ -107,6 +107,7 @@ editor_blockly = function () {
|
||||
MotaActionBlocks['input_s'].xmlText(),
|
||||
MotaActionBlocks['input2_s'].xmlText(),
|
||||
MotaActionBlocks['update_s'].xmlText(),
|
||||
MotaActionBlocks['moveAction_s'].xmlText(),
|
||||
MotaActionBlocks['moveHero_s'].xmlText(),
|
||||
MotaActionBlocks['jumpHero_s'].xmlText(),
|
||||
MotaActionBlocks['changeFloor_s'].xmlText(),
|
||||
@ -128,6 +129,7 @@ editor_blockly = function () {
|
||||
MotaActionBlocks['show_s'].xmlText(),
|
||||
MotaActionBlocks['hide_s'].xmlText(),
|
||||
MotaActionBlocks['setBlock_s'].xmlText(),
|
||||
MotaActionBlocks['turnBlock_s'].xmlText(),
|
||||
MotaActionBlocks['move_s'].xmlText(),
|
||||
MotaActionBlocks['jump_s'].xmlText(),
|
||||
MotaActionBlocks['showBgFgMap_s'].xmlText(),
|
||||
@ -826,7 +828,7 @@ function omitedcheckUpdateFunction(event) {
|
||||
var selectPointBlocks = {
|
||||
"changeFloor_m": ["Number_0", "Number_1", "IdString_0", true],
|
||||
"jumpHero_s": ["PosString_0", "PosString_1"],
|
||||
"changeFloor_s": ["PosString_0", "PosString_1", "IdString_0", true],
|
||||
"changeFloor_s": ["Number_0", "Number_1", "IdString_0", true],
|
||||
"changePos_s": ["PosString_0", "PosString_1"],
|
||||
"battle_1_s": ["PosString_0", "PosString_1"],
|
||||
"openDoor_s": ["PosString_0", "PosString_1", "IdString_0"],
|
||||
@ -834,6 +836,7 @@ function omitedcheckUpdateFunction(event) {
|
||||
"show_s": ["EvalString_0", "EvalString_1", "IdString_0"],
|
||||
"hide_s": ["EvalString_0", "EvalString_1", "IdString_0"],
|
||||
"setBlock_s": ["EvalString_1", "EvalString_2", "IdString_0"],
|
||||
"turnBlock_s": ["EvalString_1", "EvalString_2", "IdString_0"],
|
||||
"move_s": ["PosString_0", "PosString_1"],
|
||||
"jump_s": ["PosString_2", "PosString_3"], // 跳跃暂时只考虑终点
|
||||
"showBgFgMap_s": ["EvalString_0", "EvalString_1", "IdString_0"],
|
||||
@ -874,7 +877,7 @@ function omitedcheckUpdateFunction(event) {
|
||||
block.setFieldValue(xv+"", arr[0]);
|
||||
block.setFieldValue(yv+"", arr[1]);
|
||||
}
|
||||
if (block.type == 'changeFloor_m') {
|
||||
if (block.type == 'changeFloor_m' || block.type == 'changeFloor_s') {
|
||||
block.setFieldValue("floorId", "Floor_List_0");
|
||||
block.setFieldValue("loc", "Stair_List_0");
|
||||
}
|
||||
@ -988,6 +991,7 @@ function omitedcheckUpdateFunction(event) {
|
||||
var allBgms = Object.keys(core.material.bgms);
|
||||
var allSounds = Object.keys(core.material.sounds);
|
||||
var allShops = Object.keys(core.status.shops);
|
||||
var allFloorIds = core.floorIds;
|
||||
var allColors = ["aqua(青色)", "black(黑色)", "blue(蓝色)", "fuchsia(品红色)", "gray(灰色)", "green(深绿色)", "lime(绿色)",
|
||||
"maroon(深红色)", "navy(深蓝色)", "gold(金色)", "olive(黄褐色)", "orange(橙色)", "purple(品红色)",
|
||||
"red(红色)", "silver(淡灰色)", "teal(深青色)", "white(白色)", "yellow(黄色)"];
|
||||
@ -1042,6 +1046,14 @@ function omitedcheckUpdateFunction(event) {
|
||||
return filter(allShops, content);
|
||||
}
|
||||
|
||||
// 对楼层名进行补全
|
||||
if ((type == 'setFloor_s' || type == 'show_s' || type == 'hide_s' || type == 'insert_2_s'
|
||||
|| type == 'setBlock_s' || type == 'turnBlock_s' || type == 'showFloorImg_s' || type == 'hideFloorImg_s'
|
||||
|| type == 'showBgFgMap_s' || type == 'hideBgFgMap_s' || type == 'setBgFgBlock_s'
|
||||
|| type == 'openDoor_s' || type == 'changeFloor_m') && name == "IdString_0") {
|
||||
return filter(allFloorIds, content);
|
||||
}
|
||||
|
||||
// 对\f进行自动补全
|
||||
index = Math.max(content.lastIndexOf("\f["), content.lastIndexOf("\\f["));
|
||||
if (index >= 0) {
|
||||
|
||||
@ -503,8 +503,77 @@ editor_datapanel_wrapper = function (editor) {
|
||||
}
|
||||
}
|
||||
|
||||
editor.uifunctions.changeFloorSize_func = function () {
|
||||
var children = editor.dom.changeFloorSize.children;
|
||||
children[4].onclick = function () {
|
||||
var width = parseInt(children[0].value);
|
||||
var height = parseInt(children[1].value);
|
||||
var x = parseInt(children[2].value);
|
||||
var y = parseInt(children[3].value);
|
||||
if (!(width >= core.__SIZE__ && height >= core.__SIZE__ && x >=0 && y >=0)) {
|
||||
printe("参数错误!宽高不得小于"+core.__SIZE__+",偏移量不得小于0");
|
||||
return;
|
||||
}
|
||||
var currentFloorData = editor.currentFloorData;
|
||||
var currWidth = currentFloorData.width;
|
||||
var currHeight = currentFloorData.height;
|
||||
if (width < currWidth) x = -x;
|
||||
if (height < currHeight) y = -y;
|
||||
// Step 1:创建一个新的地图
|
||||
var newFloorData = core.clone(currentFloorData);
|
||||
newFloorData.width = width;
|
||||
newFloorData.height = height;
|
||||
|
||||
// Step 2:更新map, bgmap和fgmap
|
||||
["bgmap", "fgmap", "map"].forEach(function (name) {
|
||||
newFloorData[name] = [];
|
||||
if (currentFloorData[name] && currentFloorData[name].length > 0) {
|
||||
for (var j = 0; j < height; ++j) {
|
||||
newFloorData[name][j] = [];
|
||||
for (var i = 0; i < width; ++i) {
|
||||
var oi = i - x;
|
||||
var oj = j - y;
|
||||
if (oi >= 0 && oi < currWidth && oj >= 0 && oj < currHeight) {
|
||||
newFloorData[name][j].push(currentFloorData[name][oj][oi]);
|
||||
} else {
|
||||
newFloorData[name][j].push(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Step 3:更新所有坐标
|
||||
["events", "afterBattle", "afterGetItem", "afterOpenDoor", "changeFloor", "autoEvent", "cannotMove"].forEach(function (name) {
|
||||
newFloorData[name] = {};
|
||||
if (!currentFloorData[name]) return;
|
||||
for (var loc in currentFloorData[name]) {
|
||||
var oxy = loc.split(','), ox = parseInt(oxy[0]), oy = parseInt(oxy[1]);
|
||||
var nx = ox + x, ny = oy + y;
|
||||
if (nx >= 0 && nx < width && ny >= 0 && ny < height) {
|
||||
newFloorData[name][nx+","+ny] = core.clone(currentFloorData[name][loc]);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Step 4:上楼点&下楼点
|
||||
["upFloor", "downFloor"].forEach(function (name) {
|
||||
if (newFloorData[name] && newFloorData[name].length == 2) {
|
||||
newFloorData[name][0]+=x;
|
||||
newFloorData[name][1]+=y;
|
||||
}
|
||||
});
|
||||
|
||||
editor.file.saveFloor(newFloorData, function (err) {
|
||||
if (err) {
|
||||
printe(err);
|
||||
throw(err)
|
||||
}
|
||||
;alert('地图更改大小成功,即将刷新地图...\n请检查所有点的事件是否存在问题。');
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -41,6 +41,7 @@ editor_listen_wrapper = function (editor) {
|
||||
editor.dom.brushMod.onchange = editor.uifunctions.brushMod_onchange
|
||||
if (editor.dom.brushMod2) editor.dom.brushMod2.onchange = editor.uifunctions.brushMod2_onchange;
|
||||
if (editor.dom.brushMod3) editor.dom.brushMod3.onchange = editor.uifunctions.brushMod3_onchange;
|
||||
if (editor.dom.brushMod4) editor.dom.brushMod4.onchange = editor.uifunctions.brushMod4_onchange;
|
||||
|
||||
editor.dom.layerMod.onchange = editor.uifunctions.layerMod_onchange
|
||||
if (editor.dom.layerMod2) editor.dom.layerMod2.onchange = editor.uifunctions.layerMod2_onchange;
|
||||
@ -148,6 +149,7 @@ editor_listen_wrapper = function (editor) {
|
||||
editor.uifunctions.createNewMaps_func()
|
||||
|
||||
editor.uifunctions.changeFloorId_func()
|
||||
editor.uifunctions.changeFloorSize_func()
|
||||
|
||||
editor.uifunctions.fixCtx_func()
|
||||
|
||||
|
||||
@ -247,6 +247,11 @@ editor_mappanel_wrapper = function (editor) {
|
||||
editor[editor.layerMod][editor.uivalues.stepPostfix[ii].y][editor.uivalues.stepPostfix[ii].x] = editor.ids[editor.indexs[idnum + editor.uivalues.stepPostfix[ii].x - x0]];
|
||||
}
|
||||
} else {
|
||||
// 检测是否是填充模式
|
||||
if (editor.uivalues.stepPostfix.length == 1 && editor.brushMod == 'fill') {
|
||||
editor.uivalues.stepPostfix = editor.uifunctions._fillMode_bfs(editor[editor.layerMod], editor.uivalues.stepPostfix[0].x, editor.uivalues.stepPostfix[0].y,
|
||||
editor[editor.layerMod][0].length, editor[editor.layerMod].length);
|
||||
}
|
||||
for (var ii = 0; ii < editor.uivalues.stepPostfix.length; ii++)
|
||||
editor[editor.layerMod][editor.uivalues.stepPostfix[ii].y][editor.uivalues.stepPostfix[ii].x] = editor.info;
|
||||
}
|
||||
@ -263,6 +268,32 @@ editor_mappanel_wrapper = function (editor) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* bfs找寻和某点相连的全部相同图块坐标
|
||||
*/
|
||||
editor.uifunctions._fillMode_bfs = function (array, x, y, maxWidth, maxHeight) {
|
||||
var _getNumber = function (x, y) {
|
||||
if (x<0 || y<0 || x>=maxWidth || y>=maxHeight) return null;
|
||||
return array[y][x].idnum || array[y][x] || 0;
|
||||
}
|
||||
var number = _getNumber(x, y) || 0;
|
||||
var visited = {}, result = [];
|
||||
var list = [{x:x, y:y}];
|
||||
while (list.length != 0) {
|
||||
var next = list.shift(), key = next.x+","+next.y;
|
||||
if (visited[key]) continue;
|
||||
visited[key] = true;
|
||||
result.push(next);
|
||||
[[-1,0],[1,0],[0,-1],[0,1]].forEach(function (dir) {
|
||||
var nx = next.x + dir[0], ny = next.y + dir[1];
|
||||
if (_getNumber(nx, ny) == number) {
|
||||
list.push({x: nx, y: ny});
|
||||
}
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* editor.dom.mid.onmousewheel
|
||||
* 在地图编辑区域滚轮切换楼层
|
||||
@ -586,6 +617,11 @@ editor_mappanel_wrapper = function (editor) {
|
||||
*/
|
||||
editor.uifunctions.brushMod_onchange = function () {
|
||||
editor.brushMod = editor.dom.brushMod.value;
|
||||
if (editor.brushMod == 'fill') {
|
||||
tip.isSelectedBlock(false);
|
||||
tip.msgs[11] = String('填充模式下,将会用选中的素材替换所有和目标点联通的相同素材');
|
||||
tip.whichShow(12);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -612,6 +648,13 @@ editor_mappanel_wrapper = function (editor) {
|
||||
editor.brushMod = editor.dom.brushMod3.value;
|
||||
}
|
||||
|
||||
editor.uifunctions.brushMod4_onchange = function () {
|
||||
tip.isSelectedBlock(false);
|
||||
tip.msgs[11] = String('填充模式下,将会用选中的素材替换所有和目标点联通的相同素材');
|
||||
tip.whichShow(12);
|
||||
editor.brushMod = editor.dom.brushMod4.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* editor.dom.layerMod.onchange
|
||||
* 切换编辑的层
|
||||
|
||||
@ -18,7 +18,7 @@ editor_mode = function (editor) {
|
||||
this._ids = {}
|
||||
this.dom = {}
|
||||
this.actionList = [];
|
||||
this.mode = '';
|
||||
this.mode = 'tower'; // 初始默认显示全塔属性
|
||||
this.info = {};
|
||||
this.appendPic = {};
|
||||
this.doubleClickMode = 'change';
|
||||
@ -176,6 +176,7 @@ editor_mode = function (editor) {
|
||||
printe(err);
|
||||
throw Error(err);
|
||||
}
|
||||
var notExist = null;
|
||||
thiseval.map(function (v) {
|
||||
var name = v.indexOf('.') < 0 ? (v+'.png') : v;
|
||||
if (data.indexOf(name) < 0) notExist = name;
|
||||
|
||||
@ -57,11 +57,21 @@ editor_table_wrapper = function (editor) {
|
||||
}
|
||||
|
||||
editor_table.prototype.gap = function (field) {
|
||||
return /* html */`<tr><td>----</td><td>----</td><td>${field}</td><td>----</td></tr>\n`
|
||||
var tokenlist = field.slice(2, -2).split("']['");
|
||||
var rule = tokenlist.join("-");
|
||||
tokenlist.pop();
|
||||
var self = tokenlist.join("-");
|
||||
var status = !!tokenPool[rule];
|
||||
return /* html */`<tr data-gap="${rule}" data-field="${self}">
|
||||
<td>----</td>
|
||||
<td>----</td>
|
||||
<td>${field}</td>
|
||||
<td><button style="background: #FFCCAA" onclick='editor.table.onFoldBtnClick(this)' data-fold="${ status ? "true" : "false" }">${ status ? "展开" : "折叠" }</button></td>
|
||||
</tr>\n`
|
||||
}
|
||||
|
||||
editor_table.prototype.tr = function (guid, field, shortField, commentHTMLescape, cobjstr, shortComment, tdstr, type) {
|
||||
return /* html */`<tr id="${guid}">
|
||||
return /* html */`<tr id="${guid}" data-field="${field.slice(2, -2).split("']['").join("-")}">
|
||||
<td title="${field}">${shortField}</td>
|
||||
<td title="${commentHTMLescape}" cobj="${cobjstr}">${shortComment || commentHTMLescape}</td>
|
||||
<td><div class="etableInputDiv ${type}">${tdstr}</div></td>
|
||||
@ -348,6 +358,36 @@ editor_table_wrapper = function (editor) {
|
||||
}
|
||||
}
|
||||
|
||||
var tokenPool = {};
|
||||
var tokenstyle = document.createElement("style");
|
||||
document.body.appendChild(tokenstyle);
|
||||
|
||||
tokenPoolRender = function() {
|
||||
var content = "";
|
||||
Object.keys(tokenPool).forEach(function(k) {
|
||||
content += /* CSS */`[data-field|=${k}]{ display: none }`;
|
||||
})
|
||||
tokenstyle.innerHTML = content;
|
||||
}
|
||||
|
||||
/**
|
||||
* 当"折叠"被按下时
|
||||
*/
|
||||
editor_table.prototype.onFoldBtnClick = function (button) {
|
||||
var tr = button.parentNode.parentNode;
|
||||
if (button.dataset.fold == "true") {
|
||||
delete tokenPool[tr.dataset.gap];
|
||||
tokenPoolRender();
|
||||
button.dataset.fold = "false";
|
||||
button.innerText = "折叠";
|
||||
} else {
|
||||
tokenPool[tr.dataset.gap] = true;
|
||||
tokenPoolRender();
|
||||
button.dataset.fold = "true";
|
||||
button.innerText = "展开";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 当"显示完整注释"被按下时
|
||||
*/
|
||||
@ -363,8 +403,10 @@ editor_table_wrapper = function (editor) {
|
||||
var tr = button.parentNode.parentNode;
|
||||
var guid = tr.getAttribute('id');
|
||||
var cobj = JSON.parse(tr.children[1].getAttribute('cobj'));
|
||||
var input = tr.children[2].children[0].children[0];
|
||||
if (cobj._type === 'event') editor_blockly.import(guid, { type: cobj._event });
|
||||
if (cobj._type === 'textarea') editor_multi.import(guid, { lint: cobj._lint, string: cobj._string });
|
||||
if (cobj._type === 'material') editor.table.selectMaterial(input, cobj);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -378,6 +420,7 @@ editor_table_wrapper = function (editor) {
|
||||
if (editor_mode.doubleClickMode === 'change') {
|
||||
if (cobj._type === 'event') editor_blockly.import(guid, { type: cobj._event });
|
||||
if (cobj._type === 'textarea') editor_multi.import(guid, { lint: cobj._lint, string: cobj._string });
|
||||
if (cobj._type === 'material') editor.table.selectMaterial(input, cobj);
|
||||
} else if (editor_mode.doubleClickMode === 'add') {
|
||||
editor_mode.doubleClickMode = 'change';
|
||||
editor.table.addfunc(guid, obj, commentObj, thisTr, input, field, cobj, modeNode)
|
||||
@ -387,6 +430,17 @@ editor_table_wrapper = function (editor) {
|
||||
}
|
||||
}
|
||||
|
||||
editor_table.prototype.selectMaterial = function (input, cobj) {
|
||||
editor.uievent.selectMaterial(input.value, cobj._docs || cobj._data || '请选择素材', cobj._directory, function (one) {
|
||||
if (!/^[-A-Za-z0-9_.]+$/.test(one)) return null;
|
||||
if (cobj._transform) return eval("("+cobj._transform+")(one)");
|
||||
return one;
|
||||
}, function (data) {
|
||||
input.value = JSON.stringify(cobj._onconfirm ? eval("("+cobj._onconfirm+")(JSON.parse(input.value), data)") : data);
|
||||
input.onchange();
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除表格项
|
||||
*/
|
||||
|
||||
@ -220,7 +220,7 @@ editor_ui_wrapper = function (editor) {
|
||||
var clickpath = editor.uifunctions.getClickpath(e);
|
||||
|
||||
var unselect = true;
|
||||
for (var ii = 0, thisId; thisId = ['edit', 'tip', 'brushMod', 'brushMod2', 'brushMod3', 'layerMod', 'layerMod2', 'layerMod3', 'viewportButtons'][ii]; ii++) {
|
||||
for (var ii = 0, thisId; thisId = ['edit', 'tip', 'brushMod', 'brushMod2', 'brushMod3', 'brushMode4', 'layerMod', 'layerMod2', 'layerMod3', 'viewportButtons'][ii]; ii++) {
|
||||
if (clickpath.indexOf(thisId) !== -1) {
|
||||
unselect = false;
|
||||
break;
|
||||
@ -468,16 +468,7 @@ editor_ui_wrapper = function (editor) {
|
||||
uievent.elements.canvas = document.getElementById('uievent');
|
||||
uievent.elements.usedFlags = document.getElementById('uieventUsedFlags');
|
||||
uievent.elements.usedFlagList = document.getElementById('uieventUsedFlagList');
|
||||
|
||||
uievent.confirm = function () {
|
||||
var callback = uievent.values.callback, floorId = uievent.values.floorId,
|
||||
x = uievent.values.x, y = uievent.values.y;
|
||||
uievent.close();
|
||||
if (callback) {
|
||||
callback(floorId, x, y);
|
||||
}
|
||||
}
|
||||
uievent.elements.yes.onclick = uievent.confirm;
|
||||
uievent.elements.materialList = document.getElementById('uieventMaterialList');
|
||||
|
||||
uievent.close = function () {
|
||||
uievent.isOpen = false;
|
||||
@ -534,7 +525,6 @@ editor_ui_wrapper = function (editor) {
|
||||
|
||||
uievent.selectPoint = function (floorId, x, y, hideFloor, callback) {
|
||||
uievent.values.hideFloor = hideFloor;
|
||||
uievent.values.callback = callback;
|
||||
uievent.values.size = editor.isMobile ? window.innerWidth / core.__SIZE__ : 32;
|
||||
uievent.elements.selectPointBox.style.width = (uievent.values.size - 6) + "px";
|
||||
uievent.elements.selectPointBox.style.height = (uievent.values.size - 6) + "px";
|
||||
@ -552,6 +542,13 @@ editor_ui_wrapper = function (editor) {
|
||||
uievent.elements.usedFlags.style.display = 'none';
|
||||
uievent.elements.usedFlagList.style.display = 'none';
|
||||
uievent.elements.body.style.overflow = "hidden";
|
||||
uievent.elements.yes.onclick = function () {
|
||||
var floorId = uievent.values.floorId, x = uievent.values.x, y = uievent.values.y;
|
||||
uievent.close();
|
||||
if (callback) {
|
||||
callback(floorId, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
// Append children
|
||||
var floors = "";
|
||||
@ -745,6 +742,101 @@ editor_ui_wrapper = function (editor) {
|
||||
return list;
|
||||
}
|
||||
|
||||
// ------ 素材选择框 ------ //
|
||||
uievent.selectMaterial = function (value, title, directory, transform, callback) {
|
||||
fs.readdir(directory, function (err, data) {
|
||||
if (err) {
|
||||
printe(directory + '不存在!');
|
||||
throw (directory + '不存在!');
|
||||
}
|
||||
if (!(data instanceof Array)) {
|
||||
printe('没有可显示的内容')
|
||||
return;
|
||||
}
|
||||
value = value || [];
|
||||
data = (transform ? data.map(transform) : data).filter(function (one) {return one;}).sort();
|
||||
|
||||
uievent.isOpen = true;
|
||||
uievent.elements.div.style.display = 'block';
|
||||
uievent.mode = 'selectMaterial';
|
||||
uievent.elements.selectPoint.style.display = 'none';
|
||||
uievent.elements.yes.style.display = 'block';
|
||||
uievent.elements.title.innerText = title;
|
||||
uievent.elements.selectBackground.style.display = 'none';
|
||||
uievent.elements.selectFloor.style.display = 'none';
|
||||
uievent.elements.selectPointBox.style.display = 'none';
|
||||
uievent.elements.canvas.style.display = 'none';
|
||||
uievent.elements.usedFlags.style.display = 'none';
|
||||
uievent.elements.usedFlagList.style.display = 'none';
|
||||
uievent.elements.materialList.style.display = 'block';
|
||||
uievent.elements.body.style.overflow = "auto";
|
||||
|
||||
uievent.elements.yes.onclick = function () {
|
||||
var list = Array.from(document.getElementsByClassName('materialCheckbox')).filter(function (one) {
|
||||
return one.checked;
|
||||
}).map(function (one) {return one.getAttribute('key'); });
|
||||
uievent.close();
|
||||
if (callback) callback(list);
|
||||
}
|
||||
|
||||
// 显示每一项内容
|
||||
var html = "<p style='margin-left: 10px; line-height: 25px'>";
|
||||
html += "<button onclick='editor.uievent._selectAllMaterial(true)'>全选</button>"+
|
||||
"<button style='margin-left: 10px' onclick='editor.uievent._selectAllMaterial(false)'>全不选</button><br/>";
|
||||
data.forEach(function (one) {
|
||||
html += `<input type="checkbox" key="${one}" class="materialCheckbox" ${value.indexOf(one) >= 0? 'checked' : ''} /> ${one}`;
|
||||
// 预览图片
|
||||
if (one.endsWith('.png') || one.endsWith('.jpg') || one.endsWith('.jpeg') || one.endsWith('.gif')) {
|
||||
html += "<button onclick='editor.uievent._previewMaterialImage(this)' style='margin-left: 10px'>预览</button>";
|
||||
html += '<br style="display:none"/><img key="'+directory+one+'" style="display:none; max-width: 100%"/>';
|
||||
}
|
||||
// 试听音频
|
||||
if (one.endsWith('.mp3') || one.endsWith('.wmv') || one.endsWith('.ogg') || one.endsWith('.wav')) {
|
||||
html += "<button onclick='editor.uievent._previewMaterialAudio(this)' style='margin-left: 10px'>试听</button>";
|
||||
html += '<br style="display:none"/><audio controls preload="none" src="'+directory+one+'" style="display:none; max-width: 100%"></audio>';
|
||||
}
|
||||
html += '<br/>';
|
||||
});
|
||||
html += "</p>";
|
||||
uievent.elements.materialList.innerHTML = html;
|
||||
});
|
||||
}
|
||||
|
||||
uievent._selectAllMaterial = function (checked) {
|
||||
Array.from(document.getElementsByClassName('materialCheckbox')).forEach(function (one) {
|
||||
one.checked = checked;
|
||||
})
|
||||
}
|
||||
|
||||
uievent._previewMaterialImage = function (button) {
|
||||
var br = button.nextElementSibling;
|
||||
var img = br.nextElementSibling;
|
||||
if (br.style.display == 'none') {
|
||||
button.innerText = '折叠';
|
||||
br.style.display = 'block';
|
||||
img.style.display = 'block';
|
||||
img.src = img.getAttribute('key');
|
||||
} else {
|
||||
button.innerText = '预览';
|
||||
br.style.display = 'none';
|
||||
img.style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
uievent._previewMaterialAudio = function (button) {
|
||||
var br = button.nextElementSibling;
|
||||
var audio = br.nextElementSibling;
|
||||
if (br.style.display == 'none') {
|
||||
button.innerText = '折叠';
|
||||
br.style.display = 'block';
|
||||
audio.style.display = 'block';
|
||||
} else {
|
||||
button.innerText = '试听';
|
||||
br.style.display = 'none';
|
||||
audio.style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
editor.constructor.prototype.uievent=uievent;
|
||||
|
||||
}
|
||||
@ -251,7 +251,8 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_range": "false",
|
||||
"_data": "图块ID"
|
||||
"_docs": "图块ID",
|
||||
"_data": "图块唯一ID,可在页面底部修改"
|
||||
},
|
||||
"idnum": {
|
||||
"_leaf": true,
|
||||
@ -361,7 +362,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"_type": "textarea",
|
||||
"_range": "false",
|
||||
"_docs": "楼层ID",
|
||||
"_data": "文件名和floorId需要保持完全一致 \n楼层唯一标识符仅能由字母、数字、下划线组成,且不能由数字开头 \n推荐用法:第20层就用MT20,第38层就用MT38,地下6层就用MT_6(用下划线代替负号),隐藏3层用MT3h(h表示隐藏),等等 \n楼层唯一标识符,需要和名字完全一致 \n这里不能更改floorId,请通过另存为来实现"
|
||||
"_data": "文件名和floorId需要保持完全一致,可在页面底部修改 \n楼层唯一标识符仅能由字母、数字、下划线组成,且不能由数字开头 \n推荐用法:第20层就用MT20,第38层就用MT38,地下6层就用MT_6(用下划线代替负号),隐藏3层用MT3h(h表示隐藏),等等"
|
||||
},
|
||||
"title": {
|
||||
"_leaf": true,
|
||||
@ -380,14 +381,14 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"_type": "textarea",
|
||||
"_range": "false",
|
||||
"_docs": "宽度",
|
||||
"_data": "地图x方向大小,这里不能更改,仅能在新建地图时设置,null视为13"
|
||||
"_data": "地图x方向大小,请在表格最下方修改,null视为13"
|
||||
},
|
||||
"height": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_range": "false",
|
||||
"_docs": "高度",
|
||||
"_data": "地图y方向大小,这里不能更改,仅能在新建地图时设置,null视为13"
|
||||
"_data": "地图y方向大小,请在表格最下方修改,null视为13"
|
||||
},
|
||||
"canFlyTo": {
|
||||
"_leaf": true,
|
||||
|
||||
@ -19,36 +19,75 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
},
|
||||
"images": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_type": "material",
|
||||
"_range": "editor.mode.checkImages(thiseval)",
|
||||
"_directory": "./project/images/",
|
||||
"_transform": (function (one) {
|
||||
if (one.endsWith('.png') || one.endsWith('.jpg') || one.endsWith('.jpeg') || end.endsWith('.gif'))
|
||||
return one;
|
||||
return null;
|
||||
}).toString(),
|
||||
"_docs": "本塔使用图片",
|
||||
"_data": "在此存放所有可能使用的图片(tilesets除外) \n图片可以被作为背景图(的一部分),也可以直接用自定义事件进行显示。 \n 图片名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好 \n 建议对于较大的图片,在网上使用在线的“图片压缩工具(http://compresspng.com/zh/)”来进行压缩,以节省流量 \n 依次向后添加"
|
||||
"_data": "在此存放所有可能使用的图片(tilesets除外) \n图片可以被作为背景图(的一部分),也可以直接用自定义事件进行显示。 \n 图片名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好 \n 建议对于较大的图片,在网上使用在线的“图片压缩工具(http://compresspng.com/zh/)”来进行压缩,以节省流量 \n 依次向后添加",
|
||||
},
|
||||
"tilesets": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_type": "material",
|
||||
"_range": "editor.mode.checkImages(thiseval)",
|
||||
"_directory": "./project/images/",
|
||||
"_transform": (function (one) {
|
||||
if (one.endsWith('.png'))
|
||||
return one;
|
||||
return null;
|
||||
}).toString(),
|
||||
"_onconfirm": (function (previous, current) {
|
||||
// 额外素材是有序的,因此根据之前的内容进行排序,然后在之后追加新的
|
||||
previous = previous || [];
|
||||
return current.sort(function (a, b) {
|
||||
var i = previous.indexOf(a);
|
||||
var j = previous.indexOf(b);
|
||||
if (i >= 0 && j >= 0) return i - j;
|
||||
return j >= 0 ? 1 : -1;
|
||||
});
|
||||
}).toString(),
|
||||
"_docs": "本塔额外素材",
|
||||
"_data": "在此存放额外素材的图片名, \n可以自定导入任意张素材图片,无需PS,无需注册,即可直接在游戏中使用 \n 形式如[\"1.png\", \"2.png\"] ,将需要的素材图片放在images目录下 \n 素材的宽高必须都是32的倍数,且图片上的总图块数不超过1000(即最多有1000个32*32的图块在该图片上)"
|
||||
},
|
||||
"animates": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_type": "material",
|
||||
"_range": "editor.mode.checkUnique(thiseval)",
|
||||
"_directory": "./project/animates/",
|
||||
"_transform": (function (one) {
|
||||
if (one.endsWith(".animate")) return one.substring(0, one.lastIndexOf('.'));
|
||||
return null;
|
||||
}).toString(),
|
||||
"_docs": "本塔使用动画",
|
||||
"_data": "在此存放所有可能使用的动画,必须是animate格式,在这里不写后缀名 \n动画必须放在animates目录下;文件名不能使用中文,不能带空格或特殊字符 \n \"jianji\", \"thunder\" 根据需求自行添加"
|
||||
},
|
||||
"bgms": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_type": "material",
|
||||
"_range": "editor.mode.checkUnique(thiseval)",
|
||||
"_directory": "./project/sounds/",
|
||||
"_transform": (function (one) {
|
||||
if (one.endsWith('.mp3') || one.endsWith('.wmv') || one.endsWith('.ogg') || end.endsWith('.wav'))
|
||||
return one;
|
||||
return null;
|
||||
}).toString(),
|
||||
"_docs": "本塔使用音乐",
|
||||
"_data": "在此存放所有的bgm,和文件名一致。 \n音频名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好"
|
||||
},
|
||||
"sounds": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_type": "material",
|
||||
"_range": "editor.mode.checkUnique(thiseval)",
|
||||
"_directory": "./project/sounds/",
|
||||
"_transform": (function (one) {
|
||||
if (one.endsWith('.mp3') || one.endsWith('.wmv') || one.endsWith('.ogg') || end.endsWith('.wav'))
|
||||
return one;
|
||||
return null;
|
||||
}).toString(),
|
||||
"_docs": "本塔使用音效",
|
||||
"_data": "在此存放所有的SE,和文件名一致 \n音频名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好"
|
||||
},
|
||||
@ -95,8 +134,10 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
},
|
||||
"startBgm": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_string": true,
|
||||
"_type": "select",
|
||||
"_select": {
|
||||
"values": [null].concat(Object.keys(editor.core.material.bgms))
|
||||
},
|
||||
"_docs": "标题音乐",
|
||||
"_data": "在标题界面应该播放的bgm内容"
|
||||
},
|
||||
@ -203,6 +244,14 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"hero": {
|
||||
"_type": "object",
|
||||
"_data": {
|
||||
"image": {
|
||||
"_leaf": true,
|
||||
"_type": "select",
|
||||
"_select": {
|
||||
"values": [null].concat(Object.keys(editor.core.material.images))
|
||||
},
|
||||
"_data": "勇士行走图"
|
||||
},
|
||||
"name": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
@ -218,7 +267,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"hpmax": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_data": "初始上限"
|
||||
"_data": "生命上限"
|
||||
},
|
||||
"hp": {
|
||||
"_leaf": true,
|
||||
@ -464,7 +513,14 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"_type": "textarea",
|
||||
"_docs": "全局动画时间",
|
||||
"_data": "全局动画时间,即怪物振动频率,一般300比较合适"
|
||||
}
|
||||
},
|
||||
"statusCanvasRowsOnMobile": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_range": "thiseval==null || (thiseval>0 && thiseval<=4)",
|
||||
"_docs": "竖屏自绘行数",
|
||||
"_data": "竖屏模式下,顶端状态栏canvas化后的行数。\n此项将决定竖屏的状态栏高度,如果设置则不小于1且不大于4。\n仅在statusCanvas开启时才有效"
|
||||
},
|
||||
}
|
||||
},
|
||||
"flags": {
|
||||
@ -589,13 +645,6 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"_docs": "自绘状态栏",
|
||||
"_data": "是否状态栏canvas化,即手动自定义绘制状态栏。\n如果此项开启,则可在脚本编辑的drawStatusBar中自定义绘制菜单栏。"
|
||||
},
|
||||
"statusCanvasRowsOnMobile": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_range": "thiseval==null || (thiseval>0 && thiseval<=4)",
|
||||
"_docs": "竖屏自绘行数",
|
||||
"_data": "竖屏模式下,顶端状态栏canvas化后的行数。\n此项将决定竖屏的状态栏高度,如果设置则不小于1且不大于4。\n仅在statusCanvas开启时才有效"
|
||||
},
|
||||
"displayEnemyDamage": {
|
||||
"_leaf": true,
|
||||
"_type": "checkbox",
|
||||
|
||||
@ -25,13 +25,6 @@ var events_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"_event": "commonEvent",
|
||||
"_data": "毒衰咒处理"
|
||||
},
|
||||
"滑冰事件": {
|
||||
"_leaf": true,
|
||||
"_type": "event",
|
||||
"_range": "thiseval instanceof Array",
|
||||
"_event": "commonEvent",
|
||||
"_data": "滑冰事件"
|
||||
},
|
||||
}
|
||||
if (obj[key]) return obj[key];
|
||||
return {
|
||||
|
||||
1
_server/thirdparty/awesomplete.css
vendored
@ -101,4 +101,3 @@
|
||||
background: hsl(86, 100%, 21%);
|
||||
color: inherit;
|
||||
}
|
||||
/*# sourceMappingURL=awesomplete.css.map */
|
||||
1
_server/thirdparty/awesomplete.min.js
vendored
@ -173,6 +173,11 @@
|
||||
<input placeholder="修改floorId为"/>
|
||||
<button>save</button>
|
||||
</div>
|
||||
<div id='changeFloorSize' style="font-size: 13px;">
|
||||
修改地图大小:宽<input style="width: 25px;" value="13" />,高<input style="width: 25px;" value="13" />,
|
||||
偏移x<input style="width: 25px;" value="0" /> y<input style="width: 25px;" value="0" />
|
||||
<button>save</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="left5" class='leftTab' style="z-index:-1;opacity: 0;"><!-- tower -->
|
||||
@ -379,6 +384,7 @@
|
||||
<option value="line">画线</option>
|
||||
<option value="rectangle">画矩形</option>
|
||||
<option value="tileset">tileset贴图</option>
|
||||
<option value="fill">填充模式</option>
|
||||
</select>
|
||||
<select id="layerMod" style="float:left;margin-right:3px">
|
||||
<option value="bgmap">背景层</option>
|
||||
@ -565,6 +571,7 @@
|
||||
<canvas class='gameCanvas' id='uievent' width='416' height='416'></canvas>
|
||||
<div id="selectPointBox"></div>
|
||||
<div id="uieventUsedFlagList" style="display: none"></div>
|
||||
<div id="uieventMaterialList" style="display: none"></div>
|
||||
</div>
|
||||
<div id="selectPoint">
|
||||
<select id="selectPointFloor"></select>
|
||||
|
||||
14
editor.html
@ -169,6 +169,11 @@
|
||||
<input placeholder="修改floorId为"/>
|
||||
<button>save</button>
|
||||
</div>
|
||||
<div id='changeFloorSize' style="font-size: 13px;">
|
||||
修改地图大小:宽<input style="width: 25px;" value="13" />,高<input style="width: 25px;" value="13" />,
|
||||
偏移x<input style="width: 25px;" value="0" /> y<input style="width: 25px;" value="0" />
|
||||
<button>save</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="left5" class='leftTab' style="z-index:-1;opacity: 0;"><!-- tower -->
|
||||
@ -336,9 +341,11 @@
|
||||
<span style="font-size: 12px"><input type="checkbox" id="lockMode"/>锁定模式</span>
|
||||
<br/>
|
||||
<span style="font-size: 12px;">
|
||||
<input type="radio" id="brushMod" name="brushMod" value="line" checked="checked" />画线
|
||||
<input type="radio" id="brushMod2" name="brushMod" value="rectangle" />画矩形
|
||||
<input type="radio" id="brushMod" name="brushMod" value="line" checked="checked" />线
|
||||
<input type="radio" id="brushMod2" name="brushMod" value="rectangle" />矩形
|
||||
<input type="radio" id="brushMod3" name="brushMod" value="tileset" />tileset贴图
|
||||
<input type="radio" id="brushMod4" name="brushMod" value="fill" />填充
|
||||
|
||||
</span>
|
||||
<br/>
|
||||
<span style="font-size: 12px">
|
||||
@ -546,7 +553,8 @@
|
||||
<div id='uieventBody'>
|
||||
<canvas class='gameCanvas' id='uievent' width='416' height='416'></canvas>
|
||||
<div id="selectPointBox"></div>
|
||||
<div id="uieventUsedFlagList" style="display: none"></div>
|
||||
<div id="uieventUsedFlagList" style="display: none; margin-top: -10px"></div>
|
||||
<div id="uieventMaterialList" style="display: none; margin-top: -10px"></div>
|
||||
</div>
|
||||
<div id="selectPoint">
|
||||
<select id="selectPointFloor"></select>
|
||||
|
||||
@ -584,7 +584,6 @@ control.prototype.setAutoHeroMove = function (steps) {
|
||||
control.prototype.setHeroMoveInterval = function (callback) {
|
||||
if (core.status.heroMoving > 0) return;
|
||||
if (core.status.replay.speed == 24) {
|
||||
core.moveOneStep(core.nextX(), core.nextY());
|
||||
if (callback) callback();
|
||||
return;
|
||||
}
|
||||
@ -601,15 +600,14 @@ control.prototype.setHeroMoveInterval = function (callback) {
|
||||
if (core.status.heroMoving>=8) {
|
||||
clearInterval(core.interval.heroMoveInterval);
|
||||
core.status.heroMoving = 0;
|
||||
core.moveOneStep(core.nextX(), core.nextY());
|
||||
if (callback) callback();
|
||||
}
|
||||
}, core.values.moveSpeed / 8 * toAdd / core.status.replay.speed);
|
||||
}
|
||||
|
||||
////// 每移动一格后执行的事件 //////
|
||||
control.prototype.moveOneStep = function(x, y) {
|
||||
return this.controldata.moveOneStep(x, y);
|
||||
control.prototype.moveOneStep = function (callback) {
|
||||
return this.controldata.moveOneStep(callback);
|
||||
}
|
||||
|
||||
////// 实际每一步的行走过程 //////
|
||||
@ -625,7 +623,7 @@ 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());
|
||||
if (canMove) core.trigger(core.nextX(), core.nextY());
|
||||
core.drawHero();
|
||||
|
||||
if (core.status.automaticRoute.moveStepBeforeStop.length==0) {
|
||||
@ -637,31 +635,14 @@ control.prototype._moveAction_noPass = function (canMove, callback) {
|
||||
|
||||
control.prototype._moveAction_moving = function (callback) {
|
||||
core.setHeroMoveInterval(function () {
|
||||
core.setHeroLoc('x', core.nextX(), true);
|
||||
core.setHeroLoc('y', core.nextY(), true);
|
||||
|
||||
var direction = core.getHeroLoc('direction');
|
||||
core.control._moveAction_popAutomaticRoute();
|
||||
core.status.route.push(direction);
|
||||
|
||||
// 无事件的道具(如血瓶)需要优先于阻激夹域判定
|
||||
var nowx = core.getHeroLoc('x'), nowy = core.getHeroLoc('y');
|
||||
var block = core.getBlock(nowx,nowy);
|
||||
var hasTrigger = false;
|
||||
if (block!=null && block.block.event.trigger=='getItem' &&
|
||||
!core.floors[core.status.floorId].afterGetItem[nowx+","+nowy]) {
|
||||
hasTrigger = true;
|
||||
core.events._trigger(nowx, nowy);
|
||||
}
|
||||
// 执行该点的阻激夹域事件
|
||||
core.checkBlock();
|
||||
|
||||
// 执行该点事件
|
||||
if (!hasTrigger)
|
||||
core.events._trigger(nowx, nowy);
|
||||
|
||||
// 检查该点是否是滑冰
|
||||
if (core.onSki()) {
|
||||
core.insertAction("滑冰事件", null, null, null, true);
|
||||
}
|
||||
|
||||
core.moveOneStep();
|
||||
if (callback) callback();
|
||||
});
|
||||
}
|
||||
@ -756,8 +737,7 @@ control.prototype.turnHero = function(direction) {
|
||||
core.status.route.push("turn:"+direction);
|
||||
return;
|
||||
}
|
||||
var dirs = {'up':'right','right':'down','down':'left','left':'up'};
|
||||
core.setHeroLoc('direction', dirs[core.getHeroLoc('direction')]);
|
||||
core.setHeroLoc('direction', core.turnDirection(':right'));
|
||||
core.drawHero();
|
||||
core.status.route.push("turn");
|
||||
}
|
||||
@ -2672,7 +2652,7 @@ control.prototype.resize = function() {
|
||||
}
|
||||
|
||||
var statusDisplayArr = this._shouldDisplayStatus(), count = statusDisplayArr.length;
|
||||
var statusCanvas = core.flags.statusCanvas, statusCanvasRows = core.flags.statusCanvasRowsOnMobile || 3;
|
||||
var statusCanvas = core.flags.statusCanvas, statusCanvasRows = core.values.statusCanvasRowsOnMobile || 3;
|
||||
var col = statusCanvas ? statusCanvasRows : Math.ceil(count / 3);
|
||||
if (col > 4) {
|
||||
if (statusCanvas) alert("自绘状态栏的在竖屏下的行数应不超过4!");
|
||||
|
||||
14
libs/core.js
@ -190,9 +190,9 @@ function core() {
|
||||
},
|
||||
"globalAttribute": {
|
||||
'equipName': main.equipName || [],
|
||||
"statusLeftBackground": main.statusLeftBackground || "url(project/images/ground.png) repeat",
|
||||
"statusTopBackground": main.statusTopBackground || "url(project/images/ground.png) repeat",
|
||||
"toolsBackground": main.toolsBackground || "url(project/images/ground.png) repeat",
|
||||
"statusLeftBackground": main.statusLeftBackground || "url(project/materials/ground.png) repeat",
|
||||
"statusTopBackground": main.statusTopBackground || "url(project/materials/ground.png) repeat",
|
||||
"toolsBackground": main.toolsBackground || "url(project/images/materials.png) repeat",
|
||||
"borderColor": main.borderColor || "white",
|
||||
"statusBarColor": main.statusBarColor || "white",
|
||||
"hardLabelColor": main.hardLabelColor || "red",
|
||||
@ -240,6 +240,10 @@ core.prototype._init_flags = function () {
|
||||
core.firstData = core.clone(core.data.firstData);
|
||||
this._init_sys_flags();
|
||||
|
||||
// 让你总是拼错!
|
||||
window.on = true;
|
||||
window.off = false;
|
||||
|
||||
core.dom.versionLabel.innerText = core.firstData.version;
|
||||
core.dom.logoLabel.innerText = core.firstData.title;
|
||||
document.title = core.firstData.title + " - HTML5魔塔";
|
||||
@ -370,8 +374,8 @@ core.prototype._init_others = function () {
|
||||
core.material.groundCanvas.canvas.width = core.material.groundCanvas.canvas.height = 32;
|
||||
core.material.groundPattern = core.material.groundCanvas.createPattern(core.material.groundCanvas.canvas, 'repeat');
|
||||
core.bigmap.tempCanvas = document.createElement('canvas').getContext('2d');
|
||||
core.loadImage('fog', function (name, img) { core.animateFrame.weather.fog = img; });
|
||||
core.loadImage('keyboard', function (name, img) {core.material.images.keyboard = img; });
|
||||
core.loadImage("materials", 'fog', function (name, img) { core.animateFrame.weather.fog = img; });
|
||||
core.loadImage("materials", 'keyboard', function (name, img) {core.material.images.keyboard = img; });
|
||||
// 记录存档编号
|
||||
core.saves.saveIndex = core.getLocalStorage('saveIndex', 1);
|
||||
core.control.getSaveIndexes(function (indexes) { core.saves.ids = indexes; });
|
||||
|
||||
@ -86,7 +86,7 @@ enemys.prototype.getSpecialHint = function (enemy, special) {
|
||||
var hints = [];
|
||||
for (var i = 0; i < specials.length; i++) {
|
||||
if (this.hasSpecial(enemy, specials[i][0]))
|
||||
hints.push(this._calSpecialContent(enemy, specials[i][1]) + ":" + this._calSpecialContent(enemy, specials[i][2]));
|
||||
hints.push("\r[#FF6A6A]\\d"+this._calSpecialContent(enemy, specials[i][1]) + ":\\d\r[]" + this._calSpecialContent(enemy, specials[i][2]));
|
||||
}
|
||||
return hints;
|
||||
}
|
||||
@ -94,7 +94,7 @@ enemys.prototype.getSpecialHint = function (enemy, special) {
|
||||
if (specials == null) return "";
|
||||
for (var i = 0; i < specials.length; i++) {
|
||||
if (special == specials[i][0])
|
||||
return this._calSpecialContent(enemy, specials[i][1]) + ":" + this._calSpecialContent(enemy, specials[i][2]);
|
||||
return "\r[#FF6A6A]\\d"+this._calSpecialContent(enemy, specials[i][1]) + ":\\d\r[]" + this._calSpecialContent(enemy, specials[i][2]);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
153
libs/events.js
@ -300,16 +300,22 @@ events.prototype.doSystemEvent = function (type, data, callback) {
|
||||
}
|
||||
|
||||
////// 触发(x,y)点的事件 //////
|
||||
events.prototype._trigger = function (x, y) {
|
||||
if (core.status.gameOver) return;
|
||||
if (core.status.event.id == 'action') {
|
||||
core.insertAction({"type": "trigger", "loc": [x, y]}, x, y, null, true);
|
||||
events.prototype.trigger = function (x, y, callback) {
|
||||
var _executeCallback = function () {
|
||||
// 因为trigger之后还有可能触发其他同步脚本(比如阻激夹域检测)
|
||||
// 所以这里强制callback被异步触发
|
||||
if (callback) {
|
||||
setTimeout(callback, 1); // +1是为了录像检测系统
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (core.status.event.id) return;
|
||||
if (core.status.gameOver) return _executeCallback();
|
||||
if (core.status.event.id && core.status.event.id != 'action') return _executeCallback();
|
||||
|
||||
var inAction = core.status.event.id == 'action';
|
||||
|
||||
var block = core.getBlock(x, y);
|
||||
if (block == null) return;
|
||||
if (block == null) return _executeCallback();
|
||||
block = block.block;
|
||||
|
||||
// 执行该点的脚本
|
||||
@ -322,12 +328,25 @@ events.prototype._trigger = function (x, y) {
|
||||
if (noPass) core.clearAutomaticRouteNode(x, y);
|
||||
|
||||
// 转换楼层能否穿透
|
||||
if (trigger == 'changeFloor' && !noPass && this._trigger_ignoreChangeFloor(block))
|
||||
if (!inAction && trigger == 'changeFloor' && !noPass && this._trigger_ignoreChangeFloor(block))
|
||||
return;
|
||||
core.status.automaticRoute.moveDirectly = false;
|
||||
if (inAction) {
|
||||
// 切换事件点的坐标
|
||||
this.setEvents(null, block.x, block.y);
|
||||
if (block.event.trigger == 'action') {
|
||||
this.insertAction(block.event.data);
|
||||
}
|
||||
else {
|
||||
this.doSystemEvent(block.event.trigger, block, _executeCallback);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
this.doSystemEvent(trigger, block);
|
||||
}
|
||||
}
|
||||
return _executeCallback();
|
||||
}
|
||||
|
||||
events.prototype._trigger_ignoreChangeFloor = function (block) {
|
||||
var able = core.flags.ignoreChangeFloor;
|
||||
@ -370,7 +389,8 @@ events.prototype.battle = function (id, x, y, force, callback) {
|
||||
if (!this.beforeBattle(id, x, y))
|
||||
return core.clearContinueAutomaticRoute(callback);
|
||||
// 战后事件
|
||||
this.afterBattle(id, x, y, callback);
|
||||
this.afterBattle(id, x, y);
|
||||
if (callback) callback();
|
||||
}
|
||||
|
||||
////// 战斗前触发的事件 //////
|
||||
@ -379,8 +399,8 @@ events.prototype.beforeBattle = function (enemyId, x, y) {
|
||||
}
|
||||
|
||||
////// 战斗结束后触发的事件 //////
|
||||
events.prototype.afterBattle = function (enemyId, x, y, callback) {
|
||||
return this.eventdata.afterBattle(enemyId, x, y, callback);
|
||||
events.prototype.afterBattle = function (enemyId, x, y) {
|
||||
return this.eventdata.afterBattle(enemyId, x, y);
|
||||
}
|
||||
|
||||
events.prototype._sys_openDoor = function (data, callback) {
|
||||
@ -408,7 +428,7 @@ events.prototype.openDoor = function (x, y, needKey, callback) {
|
||||
setTimeout(function () {
|
||||
core.status.replay.animate = false;
|
||||
core.events.afterOpenDoor(id, x, y, callback);
|
||||
});
|
||||
}, 1); // +1是为了录像检测系统
|
||||
} else {
|
||||
this._openDoor_animate(id, x, y, callback);
|
||||
}
|
||||
@ -472,7 +492,8 @@ events.prototype._openDoor_animate = function (id, x, y, callback) {
|
||||
delete core.animateFrame.asyncId[animate];
|
||||
if (!locked) core.unLockControl();
|
||||
core.status.replay.animate = false;
|
||||
core.events.afterOpenDoor(id, x, y, callback);
|
||||
core.events.afterOpenDoor(id, x, y);
|
||||
if (callback) callback();
|
||||
return;
|
||||
}
|
||||
core.drawImage('event', core.material.images.animates, 32 * state, 32 * door, 32, 32, 32 * x, 32 * y, 32, 32);
|
||||
@ -481,8 +502,8 @@ events.prototype._openDoor_animate = function (id, x, y, callback) {
|
||||
}
|
||||
|
||||
////// 开一个门后触发的事件 //////
|
||||
events.prototype.afterOpenDoor = function (doorId, x, y, callback) {
|
||||
return this.eventdata.afterOpenDoor(doorId, x, y, callback);
|
||||
events.prototype.afterOpenDoor = function (doorId, x, y) {
|
||||
return this.eventdata.afterOpenDoor(doorId, x, y);
|
||||
}
|
||||
|
||||
events.prototype._sys_getItem = function (data, callback) {
|
||||
@ -519,11 +540,12 @@ events.prototype.getItem = function (id, num, x, y, isGentleClick, callback) {
|
||||
itemHint.push(id);
|
||||
}
|
||||
|
||||
this.afterGetItem(id, x, y, isGentleClick, callback);
|
||||
this.afterGetItem(id, x, y, isGentleClick);
|
||||
if (callback) callback();
|
||||
}
|
||||
|
||||
events.prototype.afterGetItem = function (id, x, y, isGentleClick, callback) {
|
||||
this.eventdata.afterGetItem(id, x, y, isGentleClick, callback);
|
||||
events.prototype.afterGetItem = function (id, x, y, isGentleClick) {
|
||||
this.eventdata.afterGetItem(id, x, y, isGentleClick);
|
||||
}
|
||||
|
||||
////// 获得面前的物品(轻按) //////
|
||||
@ -599,6 +621,8 @@ events.prototype._changeFloor_getInfo = function (floorId, stair, heroLoc, time)
|
||||
var index = core.floorIds.indexOf(core.status.floorId);
|
||||
if (index < core.floorIds.length - 1) floorId = core.floorIds[index + 1];
|
||||
else floorId = core.status.floorId;
|
||||
} else if (floorId == ':now') {
|
||||
floorId = core.status.floorId;
|
||||
}
|
||||
if (!core.status.maps[floorId]) {
|
||||
main.log("不存在的楼层:" + floorId);
|
||||
@ -734,30 +758,17 @@ events.prototype.pushBox = function (data) {
|
||||
var nextId = core.getBlockId(nx, ny);
|
||||
if (nextId != null && nextId != 'flower') return;
|
||||
|
||||
core.setBlock(nextId == null ? 169 : 170, nx, ny);
|
||||
core.setBlock(nextId == null ? 'box' : 'boxed', nx, ny);
|
||||
|
||||
if (data.event.id == 'box')
|
||||
core.removeBlock(data.x, data.y);
|
||||
else
|
||||
core.setBlock(168, data.x, data.y);
|
||||
this._pushBox_moveHero(direction);
|
||||
}
|
||||
|
||||
events.prototype._pushBox_moveHero = function (direction) {
|
||||
core.status.replay.animate = true;
|
||||
core.lockControl();
|
||||
setTimeout(function () {
|
||||
core.moveHero(direction, function () {
|
||||
core.status.replay.animate = false;
|
||||
core.status.route.pop();
|
||||
core.events.afterPushBox();
|
||||
// 可能有阻击...
|
||||
if (core.status.event.id == null) {
|
||||
core.unLockControl();
|
||||
core.replay();
|
||||
}
|
||||
});
|
||||
});
|
||||
core.setBlock('flower', data.x, data.y);
|
||||
// 勇士前进一格,然后触发推箱子后事件
|
||||
core.insertAction([
|
||||
{"type": "moveAction"},
|
||||
{"type": "function", "function": "function() { core.afterPushBox(); }"}
|
||||
]);
|
||||
}
|
||||
|
||||
////// 推箱子后的事件 //////
|
||||
@ -766,7 +777,8 @@ events.prototype.afterPushBox = function () {
|
||||
}
|
||||
|
||||
events.prototype._sys_ski = function (data, callback) {
|
||||
core.insertAction(["V2.6后,请将滑冰放在背景层!"], data.x, data.y, callback);
|
||||
core.insertAction(["V2.6后,请将滑冰放在背景层!"], data.x, data.y);
|
||||
if (callback) callback();
|
||||
}
|
||||
|
||||
/// 当前是否在冰上
|
||||
@ -780,7 +792,7 @@ events.prototype._sys_action = function (data, callback) {
|
||||
var ev = core.clone(data.event.data), ex = data.x, ey = data.y;
|
||||
// 检查是否需要改变朝向
|
||||
if (ex == core.nextX() && ey == core.nextY()) {
|
||||
var dir = core.reverseDirection();
|
||||
var dir = core.turnDirection(":back");
|
||||
var id = data.event.id, toId = (data.event.faceIds || {})[dir];
|
||||
if (toId && id != toId) {
|
||||
var number = core.getNumberById(toId);
|
||||
@ -793,7 +805,8 @@ events.prototype._sys_action = function (data, callback) {
|
||||
|
||||
events.prototype._sys_custom = function (data, callback) {
|
||||
core.insertAction(["请使用\r[yellow]core.registerSystemEvent('custom', func)\r来处理自己添加的系统触发器!"],
|
||||
data.x, data.y, callback);
|
||||
data.x, data.y);
|
||||
if (callback) callback();
|
||||
}
|
||||
|
||||
// ------ 自定义事件的处理 ------ //
|
||||
@ -1249,14 +1262,12 @@ events.prototype._action_show = function (data, x, y, prefix) {
|
||||
events.prototype._action_hide = function (data, x, y, prefix) {
|
||||
data.loc = this.__action_getLoc2D(data.loc, x, y, prefix);
|
||||
if (data.time > 0 && data.floorId == core.status.floorId) {
|
||||
data.loc.forEach(function (t) {
|
||||
core.hideBlock(t[0], t[1], data.floorId);
|
||||
});
|
||||
this.__action_doAsyncFunc(data.async, core.animateBlock, data.loc, 'hide', data.time);
|
||||
this.__action_doAsyncFunc(data.async, core.animateBlock, data.loc, data.remove ? 'remove' : 'hide', data.time);
|
||||
}
|
||||
else {
|
||||
data.loc.forEach(function (t) {
|
||||
core.removeBlock(t[0], t[1], data.floorId)
|
||||
if (data.remove) core.removeBlock(t[0], t[1], data.floorId);
|
||||
else core.hideBlock(t[0], t[1], data.floorId);
|
||||
});
|
||||
core.doAction();
|
||||
}
|
||||
@ -1270,6 +1281,14 @@ events.prototype._action_setBlock = function (data, x, y, prefix) {
|
||||
core.doAction();
|
||||
}
|
||||
|
||||
events.prototype._action_turnBlock = function (data, x, y, prefix) {
|
||||
data.loc = this.__action_getLoc2D(data.loc, x, y, prefix);
|
||||
data.loc.forEach(function (t) {
|
||||
core.turnBlock(data.number, t[0], t[1], data.floorId);
|
||||
});
|
||||
core.doAction();
|
||||
}
|
||||
|
||||
events.prototype._action_showFloorImg = function (data, x, y, prefix) {
|
||||
core.maps.showFloorImage(this.__action_getLoc2D(data.loc, x, y, prefix), data.floorId, core.doAction);
|
||||
}
|
||||
@ -1333,6 +1352,26 @@ events.prototype._action_move = function (data, x, y, prefix) {
|
||||
this.__action_doAsyncFunc(data.async, core.moveBlock, loc[0], loc[1], data.steps, data.time, data.keep);
|
||||
}
|
||||
|
||||
events.prototype._action_moveAction = function (data, x, y, prefix) {
|
||||
// 检查下一个点是否可通行
|
||||
if (core.canMoveHero()) {
|
||||
var nx = core.nextX(), ny = core.nextY();
|
||||
// 检查noPass决定是撞击还是移动
|
||||
if (core.noPass(nx, ny)) {
|
||||
core.insertAction([
|
||||
{"type": "trigger", "loc": [nx, ny]}
|
||||
]);
|
||||
} else {
|
||||
// 先移动一格,然后尝试触发事件
|
||||
core.insertAction([
|
||||
{"type": "moveHero", "steps": ["forward"]},
|
||||
{"type": "function", "function": "function() { core.moveOneStep(core.doAction); }", "async": true},
|
||||
]);
|
||||
}
|
||||
}
|
||||
core.doAction();
|
||||
}
|
||||
|
||||
events.prototype._action_moveHero = function (data, x, y, prefix) {
|
||||
this.__action_doAsyncFunc(data.async, core.eventMoveHero, data.steps, data.time);
|
||||
}
|
||||
@ -1363,7 +1402,7 @@ events.prototype._action_changeFloor = function (data, x, y, prefix) {
|
||||
events.prototype._action_changePos = function (data, x, y, prefix) {
|
||||
core.clearMap('hero');
|
||||
if (data.x == null && data.y == null && data.direction) {
|
||||
core.setHeroLoc('direction', data.direction, true);
|
||||
core.setHeroLoc('direction', core.turnDirection(data.direction), true);
|
||||
core.drawHero();
|
||||
return core.doAction();
|
||||
}
|
||||
@ -1371,7 +1410,7 @@ events.prototype._action_changePos = function (data, x, y, prefix) {
|
||||
var loc = this.__action_getHeroLoc(data.loc, prefix);
|
||||
core.setHeroLoc('x', loc[0]);
|
||||
core.setHeroLoc('y', loc[1]);
|
||||
if (data.direction) core.setHeroLoc('direction', data.direction);
|
||||
if (data.direction) core.setHeroLoc('direction', core.turnDirection(data.direction));
|
||||
core.drawHero();
|
||||
core.doAction();
|
||||
}
|
||||
@ -1508,18 +1547,7 @@ events.prototype._action_battle = function (data, x, y, prefix) {
|
||||
|
||||
events.prototype._action_trigger = function (data, x, y, prefix) {
|
||||
var loc = this.__action_getLoc(data.loc, x, y, prefix);
|
||||
var block = core.getBlock(loc[0], loc[1]);
|
||||
if (block != null && block.block.event.trigger) {
|
||||
block = block.block;
|
||||
this.setEvents(data.keep ? null : [], block.x, block.y);
|
||||
if (block.event.trigger == 'action')
|
||||
this.insertAction(block.event.data);
|
||||
else {
|
||||
core.doSystemEvent(block.event.trigger, block, core.doAction);
|
||||
return;
|
||||
}
|
||||
}
|
||||
core.doAction();
|
||||
core.trigger(loc[0], loc[1], core.doAction);
|
||||
}
|
||||
|
||||
events.prototype._action_insert = function (data, x, y, prefix) {
|
||||
@ -2843,8 +2871,11 @@ events.prototype._jumpHero_finished = function (animate, ex, ey, callback) {
|
||||
events.prototype.setHeroIcon = function (name, noDraw) {
|
||||
name = core.getMappedName(name);
|
||||
var img = core.material.images.images[name];
|
||||
if (!img) return;
|
||||
core.setFlag("heroIcon", name);
|
||||
if (!img) {
|
||||
console.error("找不到图片: "+img);
|
||||
return;
|
||||
}
|
||||
core.status.hero.image = name;
|
||||
core.material.images.hero = img;
|
||||
core.material.icons.hero.width = img.width / 4;
|
||||
core.material.icons.hero.height = img.height / 4;
|
||||
|
||||
@ -39,7 +39,7 @@ loader.prototype._load = function (callback) {
|
||||
}
|
||||
|
||||
loader.prototype._loadIcons = function () {
|
||||
this.loadImage("icons.png", function (id, image) {
|
||||
this.loadImage("materials", "icons.png", function (id, image) {
|
||||
var images = core.splitImage(image);
|
||||
for (var key in core.statusBar.icons) {
|
||||
if (typeof core.statusBar.icons[key] == 'number') {
|
||||
@ -54,9 +54,9 @@ loader.prototype._loadIcons = function () {
|
||||
loader.prototype._loadMaterialImages = function (callback) {
|
||||
this._setStartLoadTipText("正在加载资源文件...");
|
||||
if (main.useCompress) {
|
||||
this.loadImagesFromZip('project/images/materials.h5data', core.materials, core.material.images, callback);
|
||||
this.loadImagesFromZip('project/materials/materials.h5data', core.materials, core.material.images, callback);
|
||||
} else {
|
||||
this.loadImages(core.materials, core.material.images, callback);
|
||||
this.loadImages("materials", core.materials, core.material.images, callback);
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,8 +64,6 @@ loader.prototype._loadExtraImages = function (callback) {
|
||||
core.material.images.images = {};
|
||||
|
||||
var images = core.clone(core.images);
|
||||
if (images.indexOf("hero.png") < 0)
|
||||
images.push("hero.png");
|
||||
|
||||
this._setStartLoadTipText("正在加载图片文件...");
|
||||
if (main.useCompress) {
|
||||
@ -79,14 +77,14 @@ loader.prototype._loadExtraImages = function (callback) {
|
||||
|
||||
this.loadImagesFromZip('project/images/images.h5data', images, core.material.images.images, callback);
|
||||
gifs.forEach(function (gif) {
|
||||
this.loadImage(gif, function (id, image) {
|
||||
this.loadImage("images", gif, function (id, image) {
|
||||
if (image != null) {
|
||||
core.material.images.images[gif] = image;
|
||||
}
|
||||
});
|
||||
}, this);
|
||||
} else {
|
||||
this.loadImages(images, core.material.images.images, callback);
|
||||
this.loadImages("images", images, core.material.images.images, callback);
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,9 +105,9 @@ loader.prototype._loadAutotiles = function (callback) {
|
||||
}
|
||||
this._setStartLoadTipText("正在加载自动元件...");
|
||||
if (main.useCompress) {
|
||||
this.loadImagesFromZip('project/images/autotiles.h5data', keys, autotiles, _callback);
|
||||
this.loadImagesFromZip('project/autotiles/autotiles.h5data', keys, autotiles, _callback);
|
||||
} else {
|
||||
this.loadImages(keys, autotiles, _callback);
|
||||
this.loadImages("autotiles", keys, autotiles, _callback);
|
||||
}
|
||||
}
|
||||
|
||||
@ -131,20 +129,20 @@ loader.prototype._loadTilesets = function (callback) {
|
||||
}
|
||||
this._setStartLoadTipText("正在加载额外素材...");
|
||||
if (main.useCompress) {
|
||||
this.loadImagesFromZip('project/images/tilesets.h5data', core.tilesets, core.material.images.tilesets, _callback);
|
||||
this.loadImagesFromZip('project/tilesets/tilesets.h5data', core.tilesets, core.material.images.tilesets, _callback);
|
||||
} else {
|
||||
this.loadImages(core.tilesets, core.material.images.tilesets, _callback);
|
||||
this.loadImages("tilesets", core.tilesets, core.material.images.tilesets, _callback);
|
||||
}
|
||||
}
|
||||
|
||||
loader.prototype.loadImages = function (names, toSave, callback) {
|
||||
loader.prototype.loadImages = function (dir, names, toSave, callback) {
|
||||
if (!names || names.length == 0) {
|
||||
if (callback) callback();
|
||||
return;
|
||||
}
|
||||
var items = 0;
|
||||
for (var i = 0; i < names.length; i++) {
|
||||
this.loadImage(names[i], function (id, image) {
|
||||
this.loadImage(dir, names[i], function (id, image) {
|
||||
core.loader._setStartLoadTipText('正在加载图片 ' + id + "...");
|
||||
if (toSave[id] !== undefined) {
|
||||
if (image != null)
|
||||
@ -192,7 +190,7 @@ loader.prototype.loadImagesFromZip = function (url, names, toSave, callback) {
|
||||
});
|
||||
}
|
||||
|
||||
loader.prototype.loadImage = function (imgName, callback) {
|
||||
loader.prototype.loadImage = function (dir, imgName, callback) {
|
||||
try {
|
||||
var name = imgName;
|
||||
if (name.indexOf(".") < 0)
|
||||
@ -204,7 +202,7 @@ loader.prototype.loadImage = function (imgName, callback) {
|
||||
image.onerror = function () {
|
||||
callback(imgName, null);
|
||||
}
|
||||
image.src = 'project/images/' + name + "?v=" + main.version;
|
||||
image.src = 'project/' + dir + '/' + name + "?v=" + main.version;
|
||||
if (name.endsWith('.gif'))
|
||||
callback(imgName, null);
|
||||
}
|
||||
@ -313,7 +311,7 @@ loader.prototype.loadOneMusic = function (name) {
|
||||
var music = new Audio();
|
||||
music.preload = 'none';
|
||||
if (main.bgmRemote) music.src = main.bgmRemoteRoot + core.firstData.name + '/' + name;
|
||||
else music.src = 'project/sounds/' + name;
|
||||
else music.src = 'project/bgms/' + name;
|
||||
music.loop = 'loop';
|
||||
core.material.bgms[name] = music;
|
||||
}
|
||||
|
||||
102
libs/maps.js
@ -516,7 +516,7 @@ maps.prototype._canMoveHero_checkCannotInOut = function (number, name, direction
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (name == 'cannotIn') direction = core.reverseDirection(direction);
|
||||
if (name == 'cannotIn') direction = core.turnDirection(":back", direction);
|
||||
return core.inArray((this.getBlockByNumber(number).event || {})[name], direction);
|
||||
}
|
||||
|
||||
@ -1238,7 +1238,7 @@ maps.prototype._drawThumbnail_realDrawTempCanvas = function (floorId, blocks, op
|
||||
this.drawEvents(floorId, blocks, tempCanvas);
|
||||
// 缩略图:勇士
|
||||
if (options.heroLoc) {
|
||||
options.heroIcon = options.heroIcon || core.getFlag("heroIcon", "hero.png");
|
||||
options.heroIcon = options.heroIcon || core.status.hero.image;
|
||||
options.heroIcon = core.getMappedName(options.heroIcon);
|
||||
var icon = core.material.icons.hero[options.heroLoc.direction];
|
||||
var height = core.material.images.images[options.heroIcon].height / 4;
|
||||
@ -1464,11 +1464,29 @@ maps.prototype.hideBlock = function (x, y, floorId) {
|
||||
core.clearMap('event2', x * 32, y * 32 + 32 - height, 32, height - 32);
|
||||
}
|
||||
|
||||
block.block.disable = true;
|
||||
core.hideBlockByIndex(block.index, floorId);
|
||||
core.updateStatusBar();
|
||||
}
|
||||
|
||||
////// 将某个块从启用变成禁用状态 //////
|
||||
////// 根据图块的索引来隐藏图块 //////
|
||||
maps.prototype.hideBlockByIndex = function (index, floorId) {
|
||||
floorId = floorId || core.status.floorId;
|
||||
if (!floorId) return;
|
||||
|
||||
var blocks = core.status.maps[floorId].blocks, block = blocks[index];
|
||||
block.disable = true;
|
||||
}
|
||||
|
||||
////// 一次性隐藏多个block //////
|
||||
maps.prototype.hideBlockByIndexes = function (indexes, floorId) {
|
||||
indexes.sort(function (a, b) {
|
||||
return b - a;
|
||||
}).forEach(function (index) {
|
||||
core.hideBlockByIndex(index, floorId);
|
||||
});
|
||||
}
|
||||
|
||||
////// 删除某个图块 //////
|
||||
maps.prototype.removeBlock = function (x, y, floorId) {
|
||||
floorId = floorId || core.status.floorId;
|
||||
if (!floorId) return false;
|
||||
@ -1476,8 +1494,6 @@ maps.prototype.removeBlock = function (x, y, floorId) {
|
||||
var block = core.getBlock(x, y, floorId, true);
|
||||
if (block == null) return false; // 不存在
|
||||
|
||||
var index = block.index;
|
||||
|
||||
// 删除动画,清除地图
|
||||
if (floorId == core.status.floorId) {
|
||||
core.removeGlobalAnimate(x, y);
|
||||
@ -1487,8 +1503,7 @@ maps.prototype.removeBlock = function (x, y, floorId) {
|
||||
core.clearMap('event2', x * 32, y * 32 + 32 - height, 32, height - 32);
|
||||
}
|
||||
|
||||
// 删除Index
|
||||
core.removeBlockByIndex(index, floorId);
|
||||
core.removeBlockByIndex(block.index, floorId);
|
||||
core.updateStatusBar();
|
||||
return true;
|
||||
}
|
||||
@ -1499,14 +1514,8 @@ maps.prototype.removeBlockByIndex = function (index, floorId) {
|
||||
if (!floorId) return;
|
||||
|
||||
var blocks = core.status.maps[floorId].blocks, block = blocks[index];
|
||||
|
||||
if (this.canRemoveBlock(block, floorId)) { // 能否彻底删除该图块
|
||||
blocks.splice(index, 1);
|
||||
}
|
||||
else {
|
||||
block.disable = true;
|
||||
}
|
||||
}
|
||||
|
||||
////// 一次性删除多个block //////
|
||||
maps.prototype.removeBlockByIndexes = function (indexes, floorId) {
|
||||
@ -1517,19 +1526,6 @@ maps.prototype.removeBlockByIndexes = function (indexes, floorId) {
|
||||
});
|
||||
}
|
||||
|
||||
////// 能否彻底从地图中删除一个图块 //////
|
||||
maps.prototype.canRemoveBlock = function (block, floorId) {
|
||||
var x = block.x, y = block.y;
|
||||
// 检查该点是否存在事件
|
||||
if (core.floors[floorId].events[x + "," + y] || core.floors[floorId].changeFloor[x + "," + y])
|
||||
return false;
|
||||
// 检查是否存在重生
|
||||
if (block.event && block.event.cls.indexOf('enemy') == 0 && core.hasSpecial(block.event.id, 23))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
////// 显示前景/背景地图 //////
|
||||
maps.prototype.showBgFgMap = function (name, loc, floorId, callback) {
|
||||
this._triggerBgFgMap('show', name, loc, floorId, callback);
|
||||
@ -1612,7 +1608,7 @@ maps.prototype.setBlock = function (number, x, y, floorId) {
|
||||
|
||||
var block = this.initBlock(x, y, number, true, core.floors[floorId]);
|
||||
if (block.id == 0 && !block.event.trigger) {
|
||||
// 转变图块为0且该点无事件,视为隐藏
|
||||
// 转变图块为0且该点无事件,视为删除
|
||||
core.removeBlock(x, y, floorId);
|
||||
return;
|
||||
}
|
||||
@ -1642,6 +1638,26 @@ maps.prototype.setBlock = function (number, x, y, floorId) {
|
||||
}
|
||||
}
|
||||
|
||||
////// 事件转向 //////
|
||||
maps.prototype.turnBlock = function (direction, x, y, floorId) {
|
||||
var id = core.getBlockId(x, y, floorId, true);
|
||||
var blockInfo = core.getBlockInfo(id);
|
||||
if (blockInfo == null) return;
|
||||
var faceIds = blockInfo.faceIds || {};
|
||||
var currDirection = null;
|
||||
for (var dir in core.utils.scan) {
|
||||
if (faceIds[dir] == id) {
|
||||
currDirection = dir;
|
||||
}
|
||||
}
|
||||
if (currDirection == null) return;
|
||||
var nextDirection = core.turnDirection(direction, currDirection);
|
||||
var nextId = faceIds[nextDirection];
|
||||
if (nextId != null && nextId != id) {
|
||||
this.setBlock(nextId, x, y, floorId);
|
||||
}
|
||||
}
|
||||
|
||||
////// 将地图中所有某个图块替换成另一个图块 //////
|
||||
maps.prototype.replaceBlock = function (fromNumber, toNumber, floorId) {
|
||||
floorId = floorId || core.status.floorId;
|
||||
@ -1942,24 +1958,23 @@ maps.prototype._moveJumpBlock_finished = function (blockInfo, canvases, info, an
|
||||
////// 显示/隐藏某个块时的动画效果 //////
|
||||
maps.prototype.animateBlock = function (loc, type, time, callback) {
|
||||
if (core.status.replay.speed == 24) time = 1;
|
||||
var isHide = type == 'hide';
|
||||
if (typeof loc[0] == 'number' && typeof loc[1] == 'number')
|
||||
loc = [loc];
|
||||
// --- 检测所有是0的点
|
||||
var list = this._animateBlock_getList(loc);
|
||||
var list = this._animateBlock_getList(loc, type);
|
||||
if (list.length == 0) {
|
||||
if (callback) callback();
|
||||
return;
|
||||
}
|
||||
this._animateBlock_drawList(list, isHide ? 1 : 0);
|
||||
this._animateBlock_drawList(list, type != 'show' ? 1 : 0);
|
||||
time /= Math.max(core.status.replay.speed, 1)
|
||||
this._animateBlock_doAnimate(loc, list, isHide, 10 / time, callback);
|
||||
this._animateBlock_doAnimate(loc, list, type, 10 / time, callback);
|
||||
}
|
||||
|
||||
maps.prototype._animateBlock_doAnimate = function (loc, list, isHide, delta, callback) {
|
||||
var opacity = isHide ? 1 : 0;
|
||||
maps.prototype._animateBlock_doAnimate = function (loc, list, type, delta, callback) {
|
||||
var opacity = type != 'show' ? 1 : 0;
|
||||
var animate = setInterval(function () {
|
||||
opacity += isHide ? -delta : delta;
|
||||
opacity += type != 'show' ? -delta : delta;
|
||||
core.maps._animateBlock_drawList(list, opacity);
|
||||
if (opacity >= 1 || opacity <= 0) {
|
||||
delete core.animateFrame.asyncId[animate];
|
||||
@ -1969,8 +1984,9 @@ maps.prototype._animateBlock_doAnimate = function (loc, list, isHide, delta, cal
|
||||
core.maps._deleteDetachedBlock(t.canvases);
|
||||
});
|
||||
loc.forEach(function (t) {
|
||||
if (isHide) core.removeBlock(t[0], t[1]);
|
||||
else core.showBlock(t[0], t[1]);
|
||||
if (type == 'show') core.showBlock(t[0], t[1]);
|
||||
else if (type == 'hide') core.hideBlock(t[0], t[1]);
|
||||
else if (type == 'remove') core.removeBlock(t[0], t[1]);
|
||||
});
|
||||
if (callback) callback();
|
||||
}
|
||||
@ -1979,7 +1995,7 @@ maps.prototype._animateBlock_doAnimate = function (loc, list, isHide, delta, cal
|
||||
core.animateFrame.asyncId[animate] = true;
|
||||
}
|
||||
|
||||
maps.prototype._animateBlock_getList = function (loc) {
|
||||
maps.prototype._animateBlock_getList = function (loc, type) {
|
||||
var list = [];
|
||||
loc.forEach(function (t) {
|
||||
var block = core.getBlock(t[0], t[1], null, true);
|
||||
@ -1991,6 +2007,16 @@ maps.prototype._animateBlock_getList = function (loc) {
|
||||
list.push({ 'x': t[0], 'y': t[1] });
|
||||
return;
|
||||
}
|
||||
// 该点是否已经被启用/删除
|
||||
if ((type == 'show' && !block.disable) || ((type == 'hide' || type == 'remove') && block.disable)) {
|
||||
list.push({ 'x': t[0], 'y': t[1] });
|
||||
return;
|
||||
}
|
||||
|
||||
if (type == 'hide' || type == 'remove') {
|
||||
core.hideBlock(t[0], t[1]); // 暂时先隐藏
|
||||
}
|
||||
|
||||
var canvases = core.maps._initDetachedBlock(blockInfo, t[0], t[1], block.event.displayDamage !== false);
|
||||
|
||||
list.push({
|
||||
|
||||
40
libs/ui.js
@ -1875,8 +1875,8 @@ ui.prototype.drawBookDetail = function (index) {
|
||||
|
||||
var left = 10, width = this.PIXEL - 2 * left, right = left + width;
|
||||
var content_left = left + 25, validWidth = right - content_left - 13;
|
||||
var contents = core.splitLines("data", content, validWidth, this._buildFont(16, false));
|
||||
var height = Math.max(24 * contents.length + 55, 80), top = (this.PIXEL - height) / 2, bottom = top + height;
|
||||
var height = Math.max(this.getTextContentHeight(content, {fontSize: 16, lineHeight: 24, maxWidth: validWidth}) + 58, 80),
|
||||
top = (this.PIXEL - height) / 2, bottom = top + height;
|
||||
|
||||
core.setAlpha('data', 0.9);
|
||||
core.fillRect('data', left, top, width, height, '#000000');
|
||||
@ -1884,7 +1884,7 @@ ui.prototype.drawBookDetail = function (index) {
|
||||
core.strokeRect('data', left - 1, top - 1, width + 1, height + 1,
|
||||
core.status.globalAttribute.borderColor, 2);
|
||||
|
||||
this._drawBookDetail_drawContent(enemy, contents, {top: top, content_left: content_left, bottom: bottom});
|
||||
this._drawBookDetail_drawContent(enemy, content, {top: top, content_left: content_left, bottom: bottom, validWidth: validWidth});
|
||||
}
|
||||
|
||||
ui.prototype._drawBookDetail_getInfo = function (index) {
|
||||
@ -1917,7 +1917,7 @@ ui.prototype._drawBookDetail_mofang = function (enemy, texts) {
|
||||
var hp = enemy.hp;
|
||||
var delta = core.status.hero.atk - core.status.hero.def;
|
||||
if (delta<hp && hp<=10000 && hp>0) {
|
||||
texts.push("模仿临界计算器:(当前攻防差"+core.formatBigNumber(delta)+")");
|
||||
texts.push("\r[#FF6A6A]\\d模仿临界计算器:\\d\r[](当前攻防差"+core.formatBigNumber(delta)+")");
|
||||
var u = [];
|
||||
this._drawBookDetail_mofang_getArray(hp).forEach(function (t) {
|
||||
if (u.length < 20) u.push(t);
|
||||
@ -1968,7 +1968,7 @@ ui.prototype._drawBookDetail_vampire = function (enemy, texts) {
|
||||
}
|
||||
core.status.hero.hp = start;
|
||||
if (core.canBattle(enemy.id)) {
|
||||
texts.push("打死该怪物最低需要生命值:"+core.formatBigNumber(start));
|
||||
texts.push("\r[#FF6A6A]\\d打死该怪物最低需要生命值:\\d\r[]"+core.formatBigNumber(start));
|
||||
}
|
||||
core.status.hero.hp = nowHp;
|
||||
}
|
||||
@ -1977,19 +1977,19 @@ ui.prototype._drawBookDetail_vampire = function (enemy, texts) {
|
||||
|
||||
ui.prototype._drawBookDetail_hatred = function (enemy, texts) {
|
||||
if (core.enemys.hasSpecial(enemy.special, 17)) {
|
||||
texts.push("当前仇恨伤害值:"+core.getFlag('hatred', 0));
|
||||
texts.push("\r[#FF6A6A]\\d当前仇恨伤害值:\\d\r[]"+core.getFlag('hatred', 0));
|
||||
}
|
||||
}
|
||||
|
||||
ui.prototype._drawBookDetail_turnAndCriticals = function (enemy, floorId, texts) {
|
||||
var damageInfo = core.getDamageInfo(enemy, null, null, null, floorId);
|
||||
texts.push("战斗回合数:"+((damageInfo||{}).turn||0));
|
||||
texts.push("\r[#FF6A6A]\\d战斗回合数:\\d\r[]"+((damageInfo||{}).turn||0));
|
||||
// 临界表
|
||||
var criticals = core.enemys.nextCriticals(enemy, 8, null, null, floorId).map(function (v) {
|
||||
return core.formatBigNumber(v[0])+":"+core.formatBigNumber(v[1]);
|
||||
});
|
||||
while (criticals[0]=='0:0') criticals.shift();
|
||||
texts.push("临界表:"+JSON.stringify(criticals));
|
||||
texts.push("\r[#FF6A6A]\\d临界表:\\d\r[]"+JSON.stringify(criticals));
|
||||
var prevInfo = core.getDamageInfo(enemy, {atk: core.status.hero.atk-1}, null, null, floorId);
|
||||
if (prevInfo != null && damageInfo != null) {
|
||||
if (damageInfo.damage != null) damageInfo = damageInfo.damage;
|
||||
@ -2000,26 +2000,14 @@ ui.prototype._drawBookDetail_turnAndCriticals = function (enemy, floorId, texts)
|
||||
}
|
||||
}
|
||||
|
||||
ui.prototype._drawBookDetail_drawContent = function (enemy, contents, pos) {
|
||||
ui.prototype._drawBookDetail_drawContent = function (enemy, content, pos) {
|
||||
// 名称
|
||||
core.setTextAlign('data', 'left');
|
||||
core.fillText('data', enemy.name, pos.content_left, pos.top + 30, '#FFD700', this._buildFont(22, true));
|
||||
var content_top = pos.top + 57;
|
||||
var content_top = pos.top + 44;
|
||||
|
||||
for (var i=0;i<contents.length;i++) {
|
||||
var text=contents[i];
|
||||
var index=text.indexOf(":");
|
||||
if (index>=0) {
|
||||
var x1 = text.substring(0, index+1);
|
||||
core.fillText('data', x1, pos.content_left, content_top, '#FF6A6A', this._buildFont(16, true));
|
||||
var len=core.calWidth('data', x1);
|
||||
core.fillText('data', text.substring(index+1), pos.content_left+len, content_top, '#FFFFFF', this._buildFont(16, false));
|
||||
}
|
||||
else {
|
||||
core.fillText('data', contents[i], pos.content_left, content_top, '#FFFFFF', this._buildFont(16, false));
|
||||
}
|
||||
content_top+=24;
|
||||
}
|
||||
this.drawTextContent('data', content, {left: pos.content_left, top: content_top, maxWidth: pos.validWidth,
|
||||
fontSize: 16, lineHeight: 24});
|
||||
}
|
||||
|
||||
////// 绘制楼层传送器 //////
|
||||
@ -2069,7 +2057,7 @@ ui.prototype.drawCenterFly = function () {
|
||||
var fillstyle = 'rgba(255,0,0,0.5)';
|
||||
if (core.canUseItem('centerFly')) fillstyle = 'rgba(0,255,0,0.5)';
|
||||
var toX = core.bigmap.width - 1 - core.getHeroLoc('x'), toY = core.bigmap.height - 1 - core.getHeroLoc('y');
|
||||
core.drawThumbnail(null, null, {heroLoc: core.status.hero.loc, heroIcon: core.getFlag('heroIcon', "hero.png")},
|
||||
core.drawThumbnail(null, null, {heroLoc: core.status.hero.loc, heroIcon: core.status.hero.image},
|
||||
{ctx: 'ui', centerX: toX, centerY: toY});
|
||||
var offsetX = core.clamp(toX - core.__HALF_SIZE__, 0, core.bigmap.width - core.__SIZE__),
|
||||
offsetY = core.clamp(toY - core.__HALF_SIZE__, 0, core.bigmap.height - core.__SIZE__);
|
||||
@ -2554,7 +2542,7 @@ ui.prototype._drawSLPanel_drawRecord = function(title, data, x, y, size, cho, hi
|
||||
core.strokeRect('ui', x-size/2, y+15, size, size, cho?strokeColor:'#FFFFFF', cho?6:2);
|
||||
if (data && data.floorId) {
|
||||
core.drawThumbnail(data.floorId, core.maps.loadMap(data.maps, data.floorId).blocks, {
|
||||
heroLoc: data.hero.loc, heroIcon: data.hero.flags.heroIcon, flags: data.hero.flags
|
||||
heroLoc: data.hero.loc, heroIcon: data.hero.image, flags: data.hero.flags
|
||||
}, {
|
||||
ctx: 'ui', x: x-size/2, y: y+15, size: size, centerX: data.hero.loc.x, centerY: data.hero.loc.y
|
||||
});
|
||||
|
||||
@ -691,9 +691,19 @@ utils.prototype.strlen = function (str) {
|
||||
return count;
|
||||
};
|
||||
|
||||
utils.prototype.reverseDirection = function (direction) {
|
||||
utils.prototype.turnDirection = function (turn, direction) {
|
||||
direction = direction || core.getHeroLoc('direction');
|
||||
return {"left":"right","right":"left","down":"up","up":"down"}[direction] || direction;
|
||||
var directionList = ["left", "up", "right", "down"];
|
||||
if (directionList.indexOf(turn) >= 0) return turn;
|
||||
switch (turn) {
|
||||
case ':left': turn = 3; break; // turn left
|
||||
case ':right': turn = 1; break; // turn right
|
||||
case ':back': turn = 2; break; // turn back
|
||||
default: turn = 0; break;
|
||||
}
|
||||
var index = directionList.indexOf(direction);
|
||||
if (index < 0) return direction;
|
||||
return directionList[(index + (turn || 0)) % 4];
|
||||
}
|
||||
|
||||
utils.prototype.matchWildcard = function (pattern, string) {
|
||||
|
||||
2
main.js
@ -85,7 +85,7 @@ function main() {
|
||||
'data', 'enemys', 'icons', 'maps', 'items', 'functions', 'events', 'plugins'
|
||||
];
|
||||
this.materials = [
|
||||
'animates', 'enemys', 'hero', 'items', 'npcs', 'terrains', 'enemy48', 'npc48'
|
||||
'animates', 'enemys', 'items', 'npcs', 'terrains', 'enemy48', 'npc48'
|
||||
];
|
||||
|
||||
this.statusBar = {
|
||||
|
||||
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.7 KiB |
|
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
@ -10,7 +10,8 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
],
|
||||
"images": [
|
||||
"bg.jpg",
|
||||
"winskin.png"
|
||||
"winskin.png",
|
||||
"hero.png"
|
||||
],
|
||||
"tilesets": [
|
||||
"magictower.png"
|
||||
@ -65,8 +66,8 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
],
|
||||
"startBgm": null,
|
||||
"statusLeftBackground": null,
|
||||
"statusTopBackground": "url(project/images/ground.png) repeat",
|
||||
"toolsBackground": "url(project/images/ground.png) repeat",
|
||||
"statusTopBackground": "url(project/materials/ground.png) repeat",
|
||||
"toolsBackground": "url(project/materials/ground.png) repeat",
|
||||
"borderColor": "#CCCCCC",
|
||||
"statusBarColor": "white",
|
||||
"hardLabelColor": "red",
|
||||
@ -81,6 +82,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
"version": "Ver 2.6.6",
|
||||
"floorId": "sample0",
|
||||
"hero": {
|
||||
"image": "hero.png",
|
||||
"name": "阳光",
|
||||
"lv": 1,
|
||||
"hpmax": 9999,
|
||||
@ -473,7 +475,8 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
"counterAttack": 0.1,
|
||||
"purify": 3,
|
||||
"hatred": 2,
|
||||
"animateSpeed": 400
|
||||
"animateSpeed": 400,
|
||||
"statusCanvasRowsOnMobile": 3
|
||||
},
|
||||
"flags": {
|
||||
"statusBarItems": [
|
||||
@ -497,7 +500,6 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
"startUsingCanvas": false,
|
||||
"startDirectly": false,
|
||||
"statusCanvas": false,
|
||||
"statusCanvasRowsOnMobile": 3,
|
||||
"displayEnemyDamage": true,
|
||||
"displayCritical": true,
|
||||
"displayExtraDamage": true,
|
||||
|
||||
@ -36,7 +36,7 @@ var enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80 =
|
||||
"poisonSkeleton": {"name":"紫骷髅","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"poisonBat": {"name":"紫蝙蝠","hp":100,"atk":120,"def":0,"money":14,"exp":0,"point":0,"special":[13]},
|
||||
"steelRock": {"name":"铁面人","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"skeletonPriest": {"name":"骷髅法师","hp":100,"atk":100,"def":0,"money":0,"exp":0,"point":0,"special":[18],"value":20},
|
||||
"skeletonPriest": {"name":"骷髅法师","hp":100,"atk":100,"def":0,"money":0,"exp":0,"point":0,"special":[18,23],"value":20},
|
||||
"skeletonKing": {"name":"骷髅王","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"skeletonWizard": {"name":"骷髅巫师","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
"redSkeletonCaption": {"name":"骷髅武士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
|
||||
|
||||
@ -156,91 +156,6 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 =
|
||||
]
|
||||
}
|
||||
],
|
||||
"滑冰事件": [
|
||||
{
|
||||
"type": "comment",
|
||||
"text": "公共事件:滑冰事件"
|
||||
},
|
||||
{
|
||||
"type": "if",
|
||||
"condition": "core.onSki()",
|
||||
"true": [
|
||||
{
|
||||
"type": "if",
|
||||
"condition": "core.canMoveHero()",
|
||||
"true": [
|
||||
{
|
||||
"type": "comment",
|
||||
"text": "检测下一个点是否可通行"
|
||||
},
|
||||
{
|
||||
"type": "setValue",
|
||||
"name": "flag:nx",
|
||||
"value": "core.nextX()"
|
||||
},
|
||||
{
|
||||
"type": "setValue",
|
||||
"name": "flag:ny",
|
||||
"value": "core.nextY()"
|
||||
},
|
||||
{
|
||||
"type": "if",
|
||||
"condition": "core.noPass(flag:nx, flag:ny)",
|
||||
"true": [
|
||||
{
|
||||
"type": "comment",
|
||||
"text": "不可通行,触发下一个点的事件"
|
||||
},
|
||||
{
|
||||
"type": "trigger",
|
||||
"loc": [
|
||||
"flag:nx",
|
||||
"flag:ny"
|
||||
]
|
||||
}
|
||||
],
|
||||
"false": [
|
||||
{
|
||||
"type": "comment",
|
||||
"text": "可通行,先移动到下个点,然后检查阻激夹域,并尝试触发该点事件"
|
||||
},
|
||||
{
|
||||
"type": "moveHero",
|
||||
"time": 80,
|
||||
"steps": [
|
||||
"forward"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"function": "function(){\ncore.checkBlock();\n}"
|
||||
},
|
||||
{
|
||||
"type": "comment",
|
||||
"text": "【触发事件】如果该点存在事件则会立刻结束当前事件"
|
||||
},
|
||||
{
|
||||
"type": "trigger",
|
||||
"loc": [
|
||||
"flag:nx",
|
||||
"flag:ny"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "comment",
|
||||
"text": "如果该点不存在事件,则继续检测该点是否是滑冰点"
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"function": "function(){\ncore.insertAction(\"滑冰事件\",null,null,null,true)\n}"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"回收钥匙商店": [
|
||||
{
|
||||
"type": "comment",
|
||||
|
||||
@ -16,7 +16,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
// 初始化人物,图标,统计信息
|
||||
core.status.hero = core.clone(hero);
|
||||
window.flags = core.status.hero.flags;
|
||||
core.events.setHeroIcon(core.getFlag('heroIcon', 'hero.png'), true);
|
||||
core.events.setHeroIcon(core.status.hero.image, true);
|
||||
core.control._initStatistics(core.animateFrame.totalTime);
|
||||
core.status.hero.statistics.totalTime = core.animateFrame.totalTime =
|
||||
Math.max(core.status.hero.statistics.totalTime, core.animateFrame.totalTime);
|
||||
@ -111,6 +111,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
// 重置画布尺寸
|
||||
core.maps.resizeMap(floorId);
|
||||
// 设置勇士的位置
|
||||
heroLoc.direction = core.turnDirection(heroLoc.direction);
|
||||
core.status.hero.loc = heroLoc;
|
||||
// 检查重生怪并重置
|
||||
if (!fromLoad) {
|
||||
@ -233,7 +234,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
|
||||
return true;
|
||||
},
|
||||
"afterBattle": function (enemyId, x, y, callback) {
|
||||
"afterBattle": function (enemyId, x, y) {
|
||||
// 战斗结束后触发的事件
|
||||
|
||||
var enemy = core.material.enemys[enemyId];
|
||||
@ -272,7 +273,12 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
// 删除该块
|
||||
var guards = []; // 支援
|
||||
if (x != null && y != null) {
|
||||
// 检查是否是重生怪物;如果是则仅隐藏不删除
|
||||
if (core.hasSpecial(enemy.special, 23)) {
|
||||
core.hideBlock(x, y);
|
||||
} else {
|
||||
core.removeBlock(x, y);
|
||||
}
|
||||
guards = core.getFlag("__guards__" + x + "_" + y, []);
|
||||
core.removeFlag("__guards__" + x + "_" + y);
|
||||
}
|
||||
@ -373,10 +379,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
else
|
||||
core.clearContinueAutomaticRoute();
|
||||
|
||||
if (callback) callback();
|
||||
|
||||
},
|
||||
"afterOpenDoor": function (doorId, x, y, callback) {
|
||||
"afterOpenDoor": function (doorId, x, y) {
|
||||
// 开一个门后触发的事件
|
||||
|
||||
var todo = [];
|
||||
@ -390,10 +394,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
core.continueAutomaticRoute();
|
||||
else
|
||||
core.clearContinueAutomaticRoute();
|
||||
|
||||
if (callback) callback();
|
||||
},
|
||||
"afterGetItem": function (itemId, x, y, isGentleClick, callback) {
|
||||
"afterGetItem": function (itemId, x, y, isGentleClick) {
|
||||
// 获得一个道具后触发的事件
|
||||
// itemId:获得的道具ID;x和y是该道具所在的坐标
|
||||
// isGentleClick:是否是轻按触发的
|
||||
@ -407,8 +409,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
}
|
||||
|
||||
if (todo.length > 0) core.insertAction(todo, x, y);
|
||||
|
||||
if (callback) callback();
|
||||
},
|
||||
"afterPushBox": function () {
|
||||
// 推箱子后的事件
|
||||
@ -939,7 +939,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
// 重置音量
|
||||
core.events.setVolume(core.getFlag("__volume__", 1), 0);
|
||||
// 加载勇士图标
|
||||
var icon = core.getFlag("heroIcon", "hero.png");
|
||||
var icon = core.status.hero.image;
|
||||
icon = core.getMappedName(icon);
|
||||
if (core.material.images.images[icon]) {
|
||||
core.material.images.hero = core.material.images.images[icon];
|
||||
@ -1107,7 +1107,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
type[currloc] = type[currloc] || {};
|
||||
type[currloc]["阻击伤害"] = true;
|
||||
|
||||
var rdir = core.reverseDirection(dir);
|
||||
var rdir = core.turnDirection(":back", dir);
|
||||
// 检查下一个点是否存在事件(从而判定是否移动)
|
||||
var rnx = x + core.utils.scan[rdir].x,
|
||||
rny = y + core.utils.scan[rdir].y;
|
||||
@ -1212,17 +1212,15 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
cache: {} // clear cache
|
||||
};
|
||||
},
|
||||
"moveOneStep": function (x, y) {
|
||||
// 勇士每走一步后执行的操作,x,y为要移动到的坐标。
|
||||
"moveOneStep": function (callback) {
|
||||
// 勇士每走一步后执行的操作。callback为行走完毕后的回调
|
||||
// 这个函数执行在“刚走完”的时候,即还没有检查该点的事件和领域伤害等。
|
||||
// 请注意:瞬间移动不会执行该函数。如果要控制能否瞬间移动有三种方法:
|
||||
// 1. 将全塔属性中的cannotMoveDirectly这个开关勾上,即可在全塔中全程禁止使用瞬移。
|
||||
// 2, 将楼层属性中的cannotMoveDirectly这个开关勾上,即禁止在该层楼使用瞬移。
|
||||
// 3. 将flag:cannotMoveDirectly置为true,即可使用flag控制在某段剧情范围内禁止瞬移。
|
||||
|
||||
// 设置当前坐标,增加步数
|
||||
core.setHeroLoc('x', x, true);
|
||||
core.setHeroLoc('y', y, true);
|
||||
// 增加步数
|
||||
core.status.hero.steps++;
|
||||
// 更新跟随者状态,并绘制
|
||||
core.updateFollowers();
|
||||
@ -1235,6 +1233,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
core.status.hero.hp = 0;
|
||||
core.updateStatusBar();
|
||||
core.events.lose();
|
||||
return;
|
||||
} else {
|
||||
core.updateStatusBar();
|
||||
}
|
||||
@ -1247,6 +1246,31 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
// 检查自动事件
|
||||
core.checkAutoEvents();
|
||||
|
||||
// ------ 检查目标点事件 ------ //
|
||||
// 无事件的道具(如血瓶)需要优先于阻激夹域判定
|
||||
var nowx = core.getHeroLoc('x'), nowy = core.getHeroLoc('y');
|
||||
var block = core.getBlock(nowx, nowy);
|
||||
var hasTrigger = false;
|
||||
if (block!=null && block.block.event.trigger=='getItem' &&
|
||||
!core.floors[core.status.floorId].afterGetItem[nowx+","+nowy]) {
|
||||
hasTrigger = true;
|
||||
core.trigger(nowx, nowy, callback);
|
||||
}
|
||||
// 执行目标点的阻激夹域事件
|
||||
core.checkBlock();
|
||||
|
||||
// 执行目标点的script和事件
|
||||
if (!hasTrigger)
|
||||
core.trigger(nowx, nowy, callback);
|
||||
|
||||
// 检查该点是否是滑冰
|
||||
if (core.onSki()) {
|
||||
// 延迟到事件最后执行,因为这之前可能有阻激夹域动画
|
||||
core.insertAction({"type": "moveAction"}, null, null, null, true);
|
||||
}
|
||||
|
||||
// ------ 检查目标点事件 END ------ //
|
||||
|
||||
// 如需强行终止行走可以在这里条件判定:
|
||||
// core.stopAutomaticRoute();
|
||||
},
|
||||
|
||||
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 9.6 KiB |
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 600 B After Width: | Height: | Size: 600 B |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 298 KiB After Width: | Height: | Size: 298 KiB |
@ -198,7 +198,7 @@
|
||||
box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
background: url(project/images/ground.png) repeat;
|
||||
background: url(project/materials/ground.png) repeat;
|
||||
z-index: 185;
|
||||
display: none;
|
||||
top: 0;
|
||||
@ -232,7 +232,7 @@
|
||||
}
|
||||
#toolBar {
|
||||
position: absolute;
|
||||
background: url(project/images/ground.png) repeat;
|
||||
background: url(project/materials/ground.png) repeat;
|
||||
z-index: 210;
|
||||
box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
10. 建议给“转变图块”事件增加一个淡入时间参数,用于原本是空地或空气墙的情况,目前这种效果必须借助存在安全隐患的红点
|
||||
(已完成!) 11. 建议修复勇士后退时跟随者的鬼畜行为,并推出一套能够对跟随者位置和朝向进行读写的API甚至事件,且允许这些信息被计入存档,以实现一些演出效果甚至游戏要素,如新新2用公主占位防冰块
|
||||
(已完成!) 12. “设置怪物属性”事件的下拉框目前只支持一部分,另一部分只能通过手敲json再解析来得到,希望提供完整支持
|
||||
13. 建议给core.moveAction(callback)提供对应的事件,用于在事件中让勇士像事件外一样移动,从而正常触发跑毒和阻激夹域捕等
|
||||
(已完成!) 13. 建议给core.moveAction(callback)提供对应的事件,用于在事件中让勇士像事件外一样移动,从而正常触发跑毒和阻激夹域捕等
|
||||
(已完成!) 14. core.openShop()和对应的事件,建议在用于公共事件时简单地退化为“插入公共事件”而不要打断当前事件,把决定权交给作者
|
||||
(已完成!) 15. “等待用户操作”虽然提供了场合块但还不支持将多个按键的场合合并(比如空格、回车和C键一般会被作者予以合并,执行内容如果只是大致相同也值得合并,在块内由作者根据flag再行分歧),建议支持一下
|
||||
(已完成!) 16. “绘制描边文本”事件建议加一个“描边颜色”参数,目前只能描黑边
|
||||
@ -31,10 +31,11 @@
|
||||
初始化&读档优化:不一次读取全部楼层并创建
|
||||
(已完成!) 绿钥匙进状态栏
|
||||
(已完成!) 图块ID不可全数字
|
||||
怪物详细信息富文本化
|
||||
(已完成!) 怪物详细信息富文本化
|
||||
(已完成!) for和forEach事件
|
||||
转向:顺时针/逆时针/反向
|
||||
事件转向
|
||||
(已完成!) 转向:顺时针/逆时针/反向
|
||||
(已完成!) 事件转向
|
||||
(已完成!) 修复core.removeBlock隐藏和删除问题
|
||||
(已完成!) 合并数值操作事件
|
||||
(已完成!) fromLoad,聚集问题
|
||||
(已完成!) 注释优化
|
||||
@ -45,7 +46,9 @@
|
||||
圆角边框
|
||||
像素高分辨率问题
|
||||
(已完成!) 道具效果优化,删除部分道具相关的开关
|
||||
素材列表选择
|
||||
(已完成!) 素材列表选择
|
||||
(已完成!) 油漆桶,动态更改地图大小
|
||||
地图拉框选择复制剪切删除
|
||||
|
||||
-------------
|
||||
|
||||
@ -74,7 +77,7 @@
|
||||
(已完成!) 22. betweenAttackMax在被四个怪同时夹击时(比如上下楼后或通过事件使勇士和其中一只怪重合了)目前是以上下方向的怪为准,建议在表格注释中予以强调,更合理的做法是在两种怪的战损中取max或min
|
||||
(不处理) 23. displayIdInBook属性不能用于夹击QAQ,同时建议给core.getBlockId()追加一个“如果是怪物,是否按displayIdInBook进行映射”的参数。此外此属性会导致core.hasEnemyLeft()在指定id时失真(不一定是坏事)
|
||||
(已完成!) 24. core.hasEnemyLeft()不应该调用core.getCurrentEnemys(),因为后者是用于手册的,它为了按伤害升序排列而调用了core.getDamageInfo(),而core.getDamageInfo()又会调用core.getEnemyInfo(),但作者完全可能在core.getDamageInfo()或core.getEnemyInfo()中使用core.hasEnemyLeft()判断特定id的怪物是否存在从而实现一些类似光环的效果(如协同),这样就会造成死递归
|
||||
25. 建议新增一个类似“勇士转向”的事件指令————“图块转向”,用于NPC甚至怪物(比如基于索引/数字对4取余),毕竟用转变图块的话不够通用
|
||||
(已完成!) 25. 建议新增一个类似“勇士转向”的事件指令————“图块转向”,用于NPC甚至怪物(比如基于索引/数字对4取余),毕竟用转变图块的话不够通用
|
||||
(已完成!) 26. “勇士转向”会导致跟随者聚集,这不利于演出,建议改成像core.turnHero()一样不聚集跟随者
|
||||
(已完成!) 27. 勇士后退时跟随者很鬼畜,建议优化(每步聚集算是一种简陋的办法)
|
||||
(不处理) 28. 勇士的移动帧只有2,建议改为允许作者指定
|
||||
@ -114,7 +117,7 @@
|
||||
(已完成!) 60. “设置怪物属性”事件的下拉框目前只支持一部分,另一部分只能通过手敲json再解析来得到,希望提供完整支持
|
||||
(已完成!) 61. 在事件编辑器中进行地图选点时,有些事件指令虽然只能用于同楼层,但实际生效时勇士可能已经不在当前正在编辑的楼层(比如在一个楼层切换事件指令后)了,所以希望地图选点始终提供楼层下拉表
|
||||
(文档相关给秋橙) 62. 希望在线文档介绍一下楼层和startText的独立开关的flag表示
|
||||
63. 希望给core.moveAction(callback)函数提供一个对应的事件指令,用于在事件流处理中让勇士进行一些有游戏性意义(即非纯演出)的移动。如果做不到的话希望参照本文的46号issue作为原生脚本勾选async的例子讲解如何使用
|
||||
(已完成!) 63. 希望给core.moveAction(callback)函数提供一个对应的事件指令,用于在事件流处理中让勇士进行一些有游戏性意义(即非纯演出)的移动。如果做不到的话希望参照本文的46号issue作为原生脚本勾选async的例子讲解如何使用
|
||||
(已完成!) 64. “打开全局商店”事件指令建议在用于公共事件版商店时简单地退化为“插入公共事件”而不要打断当前事件流,由作者在这个公共事件结尾去决定“立刻结束当前事件”还是不结束
|
||||
(已修复!) 65. “显隐贴图”的参数应为像素坐标而不是网格坐标,请修正在线文档的描述。同时建议加个淡入淡出时间参数,还建议贴图能像图片一样有透明度和被移动
|
||||
(不处理) 66. 读档建议换个和floor.mp3不一样的音效
|
||||
|
||||