Fix openDoor replay Bug
This commit is contained in:
parent
49daef63fb
commit
8d88cc4d01
@ -176,6 +176,7 @@ core.openDoor(id, x, y, needKey, callback) [异步]
|
||||
尝试开门操作。id为目标点的ID,x和y为坐标,needKey表示是否需要使用钥匙,callback为开门完毕后的回调函数。
|
||||
id可为null代表使用地图上的值。
|
||||
例如:core.openDoor('yellowDoor', 10, 3, false, function() {console.log("1")})
|
||||
此函数返回true代表成功开门,并将执行callback回调;返回false代表无法开门,且不会执行回调函数。
|
||||
|
||||
|
||||
core.battle(id, x, y, force, callback) [异步]
|
||||
|
||||
@ -623,7 +623,7 @@ core.prototype.nearHero = function (x, y) {
|
||||
|
||||
////// 开门 //////
|
||||
core.prototype.openDoor = function (id, x, y, needKey, callback) {
|
||||
core.events.openDoor(id, x, y, needKey, callback);
|
||||
return core.events.openDoor(id, x, y, needKey, callback);
|
||||
}
|
||||
|
||||
////// 战斗 //////
|
||||
|
||||
@ -864,11 +864,15 @@ events.prototype.doAction = function() {
|
||||
y = core.calValue(data.loc[1], prefix);
|
||||
}
|
||||
var floorId=data.floorId || core.status.floorId;
|
||||
if (floorId==core.status.floorId)
|
||||
core.openDoor(null, x, y, data.needKey, function() {
|
||||
if (floorId==core.status.floorId) {
|
||||
var _callback = function () {
|
||||
core.lockControl();
|
||||
core.events.doAction();
|
||||
})
|
||||
}
|
||||
if (!core.openDoor(null, x, y, data.needKey, _callback)) {
|
||||
_callback();
|
||||
}
|
||||
}
|
||||
else {
|
||||
core.removeBlock(x, y, floorId);
|
||||
this.doAction();
|
||||
@ -1423,8 +1427,7 @@ events.prototype.openDoor = function (id, x, y, needKey, callback) {
|
||||
// 是否存在门
|
||||
if (!core.terrainExists(x, y, id) || !(id.endsWith("Door") || id.endsWith("Wall"))
|
||||
|| !core.isset(core.material.icons.animates[id])) {
|
||||
if (core.isset(callback)) callback();
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
if (core.status.automaticRoute.moveStepBeforeStop.length==0) {
|
||||
core.status.automaticRoute.moveStepBeforeStop=core.status.automaticRoute.autoStepRoutes.slice(core.status.automaticRoute.autoStep-1,core.status.automaticRoute.autoStepRoutes.length);
|
||||
@ -1440,8 +1443,7 @@ events.prototype.openDoor = function (id, x, y, needKey, callback) {
|
||||
core.drawTip("你没有" + ((core.material.items[key]||{}).name||"钥匙"));
|
||||
else core.drawTip("无法开启此门");
|
||||
core.clearContinueAutomaticRoute();
|
||||
if (core.isset(callback)) callback();
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
core.autosave(true);
|
||||
core.removeItem(key);
|
||||
@ -1469,7 +1471,9 @@ events.prototype.openDoor = function (id, x, y, needKey, callback) {
|
||||
}
|
||||
core.clearMap('event', 32 * x, 32 * y, 32, 32);
|
||||
core.drawImage('event', core.material.images.animates, 32 * state, 32 * door, 32, 32, 32 * x, 32 * y, 32, 32);
|
||||
}, speed / core.status.replay.speed)
|
||||
}, speed / core.status.replay.speed);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
////// 战斗 //////
|
||||
|
||||
Loading…
Reference in New Issue
Block a user