changingFloor
This commit is contained in:
parent
6aeb32bd61
commit
77612f1018
@ -31,11 +31,17 @@ var functions_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
|
||||
"_lint": true,
|
||||
"_data": "游戏失败事件"
|
||||
},
|
||||
"changingFloor": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_lint": true,
|
||||
"_data": "正在切换楼层过程中的操作\n此函数的执行时间是在切换楼层过程中屏幕完全变黑的一刻"
|
||||
},
|
||||
"afterChangeFloor": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_lint": true,
|
||||
"_data": "转换楼层结束的事件"
|
||||
"_data": "转换楼层结束的事件\n此函数会在整个楼层切换完全结束后执行"
|
||||
},
|
||||
"addPoint": {
|
||||
"_leaf": true,
|
||||
|
||||
@ -1498,77 +1498,30 @@ events.prototype.changeFloor = function (floorId, stair, heroLoc, time, callback
|
||||
|
||||
var changing = function () {
|
||||
|
||||
core.events.setFloorName(floorId);
|
||||
core.events.eventdata.changingFloor(floorId, fromLoad);
|
||||
|
||||
// 重置画布尺寸
|
||||
core.maps.resizeMap(floorId);
|
||||
if (core.isset(heroLoc.direction))
|
||||
core.setHeroLoc('direction', heroLoc.direction);
|
||||
core.setHeroLoc('x', heroLoc.x);
|
||||
core.setHeroLoc('y', heroLoc.y);
|
||||
core.clearMap('hero');
|
||||
core.drawHero();
|
||||
|
||||
// 更改BGM
|
||||
if (core.isset(core.status.maps[floorId].bgm)) {
|
||||
var bgm = core.status.maps[floorId].bgm;
|
||||
if (bgm instanceof Array) bgm = bgm[0];
|
||||
core.playBgm(bgm);
|
||||
var changed = function () {
|
||||
core.unLockControl();
|
||||
core.status.replay.animate=false;
|
||||
core.events.afterChangeFloor(floorId, fromLoad);
|
||||
if (core.isset(callback)) callback();
|
||||
}
|
||||
|
||||
// 不存在事件时,更改画面色调
|
||||
var color = core.getFlag('__color__', null);
|
||||
if (!core.isset(color) && core.isset(core.status.maps[floorId].color)) {
|
||||
color = core.status.maps[floorId].color;
|
||||
}
|
||||
if (core.isset(color)) {
|
||||
// 直接变色
|
||||
core.clearMap('curtain');
|
||||
core.fillRect('curtain',0,0,416,416,core.arrayToRGBA(color));
|
||||
core.status.curtainColor = color;
|
||||
}
|
||||
else core.clearMap('curtain');
|
||||
|
||||
// 更改天气
|
||||
var weather = core.getFlag('__weather__', null);
|
||||
if (!core.isset(weather) && core.isset(core.status.maps[floorId].weather)) {
|
||||
weather = core.status.maps[floorId].weather;
|
||||
}
|
||||
if (core.isset(weather)) {
|
||||
core.setWeather(weather[0], weather[1])
|
||||
}
|
||||
else core.setWeather();
|
||||
|
||||
// 清除gif
|
||||
core.dom.gif.innerHTML = "";
|
||||
|
||||
// 检查重生
|
||||
if (!core.isset(fromLoad)) {
|
||||
core.status.maps[floorId].blocks.forEach(function(block) {
|
||||
if (block.disable && core.isset(block.event) && block.event.cls.indexOf('enemy')==0
|
||||
&& core.enemys.hasSpecial(core.material.enemys[block.event.id].special, 23)) {
|
||||
block.disable = false;
|
||||
}
|
||||
})
|
||||
}
|
||||
// 画地图
|
||||
core.drawMap(floorId, function () {
|
||||
if (core.isset(heroLoc.direction))
|
||||
core.setHeroLoc('direction', heroLoc.direction);
|
||||
core.setHeroLoc('x', heroLoc.x);
|
||||
core.setHeroLoc('y', heroLoc.y);
|
||||
core.clearMap('hero');
|
||||
core.drawHero();
|
||||
|
||||
var changed = function () {
|
||||
core.unLockControl();
|
||||
core.status.replay.animate=false;
|
||||
core.events.afterChangeFloor(floorId, fromLoad);
|
||||
if (core.isset(callback)) callback();
|
||||
}
|
||||
if (displayAnimate) {
|
||||
core.hide(core.dom.floorMsgGroup, time/4, function () {
|
||||
changed();
|
||||
});
|
||||
}
|
||||
else {
|
||||
if (displayAnimate) {
|
||||
core.hide(core.dom.floorMsgGroup, time/4, function () {
|
||||
changed();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
else {
|
||||
changed();
|
||||
}
|
||||
|
||||
}
|
||||
core.playSound('floor.mp3');
|
||||
if (displayAnimate) {
|
||||
|
||||
@ -84,9 +84,64 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
core.events.gameOver(null, replaying);
|
||||
});
|
||||
})
|
||||
},
|
||||
"changingFloor": function (floorId, fromLoad) {
|
||||
// 正在切换楼层过程中执行的操作;此函数的执行时间是“屏幕完全变黑“的那一刻
|
||||
// floorId为要切换到的楼层ID;fromLoad表示是否是从读档造成的切换
|
||||
|
||||
// ---------- 此时还没有进行切换,当前floorId还是原来的 ---------- //
|
||||
var currentId = core.status.floorId || null; // 获得当前的floorId,可能为null
|
||||
// 可以对currentId进行判定,比如删除某些自定义图层等
|
||||
// if (currentId == 'MT0') {
|
||||
// core.deleteAllCanvas();
|
||||
// }
|
||||
|
||||
// 设置新楼层名
|
||||
core.events.setFloorName(floorId);
|
||||
// 重置画布尺寸
|
||||
core.maps.resizeMap(floorId);
|
||||
// 切换楼层BGM
|
||||
if (core.isset(core.status.maps[floorId].bgm)) {
|
||||
var bgm = core.status.maps[floorId].bgm;
|
||||
if (bgm instanceof Array) bgm = bgm[0];
|
||||
core.playBgm(bgm);
|
||||
}
|
||||
// 更改画面色调
|
||||
var color = core.getFlag('__color__', null);
|
||||
if (!core.isset(color) && core.isset(core.status.maps[floorId].color))
|
||||
color = core.status.maps[floorId].color;
|
||||
if (core.isset(color)) {
|
||||
core.clearMap('curtain');
|
||||
core.fillRect('curtain',0,0,416,416,core.arrayToRGBA(color));
|
||||
core.status.curtainColor = color;
|
||||
}
|
||||
else core.clearMap('curtain');
|
||||
// 更改天气
|
||||
var weather = core.getFlag('__weather__', null);
|
||||
if (!core.isset(weather) && core.isset(core.status.maps[floorId].weather))
|
||||
weather = core.status.maps[floorId].weather;
|
||||
if (core.isset(weather))
|
||||
core.setWeather(weather[0], weather[1]);
|
||||
else core.setWeather();
|
||||
// 清除动图
|
||||
core.dom.gif.innerHTML = '';
|
||||
|
||||
// 检查重生怪并重置
|
||||
if (!fromLoad) {
|
||||
core.status.maps[floorId].blocks.forEach(function(block) {
|
||||
if (block.disable && core.isset(block.event) && block.event.cls.indexOf('enemy')==0 &&
|
||||
core.enemys.hasSpecial(core.material.enemys[block.event.id].special, 23)) {
|
||||
block.disable = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// ---------- 绘制地图;这一步将会设置core.status.floorId ---------- //
|
||||
core.drawMap(floorId);
|
||||
|
||||
},
|
||||
"afterChangeFloor": function (floorId, fromLoad) {
|
||||
// 转换楼层结束的事件
|
||||
// 转换楼层结束的事件;此函数会在整个楼层切换完全结束后再执行
|
||||
// floorId是切换到的楼层;fromLoad若为true则代表是从读档行为造成的楼层切换
|
||||
|
||||
// 每次抵达楼层时执行的事件
|
||||
|
||||
Loading…
Reference in New Issue
Block a user