Remove openDoor Animate

This commit is contained in:
ckcz123 2018-12-19 18:30:14 +08:00
parent 7c24a1cbad
commit fe17819443
3 changed files with 10 additions and 12 deletions

View File

@ -740,7 +740,6 @@ control.prototype.setHeroMoveInterval = function (direction, x, y, callback) {
////// 实际每一步的行走过程 ////// ////// 实际每一步的行走过程 //////
control.prototype.moveAction = function (callback) { control.prototype.moveAction = function (callback) {
if (core.interval.openDoorAnimate!=null) return; // 开门判断
if (core.status.heroMoving>0) return; if (core.status.heroMoving>0) return;
var direction = core.getHeroLoc('direction'); var direction = core.getHeroLoc('direction');
var x = core.getHeroLoc('x'); var x = core.getHeroLoc('x');

View File

@ -24,7 +24,6 @@ function core() {
this.interval = { this.interval = {
'heroMoveInterval': null, 'heroMoveInterval': null,
"tipAnimate": null, "tipAnimate": null,
'openDoorAnimate': null,
'onDownInterval': null, 'onDownInterval': null,
} }
this.animateFrame = { this.animateFrame = {
@ -357,7 +356,6 @@ core.prototype.init = function (coreData, callback) {
core.initStatus.maps = core.maps.initMaps(core.floorIds); core.initStatus.maps = core.maps.initMaps(core.floorIds);
core.setRequestAnimationFrame(); core.setRequestAnimationFrame();
core.showStartAnimate();
if (main.mode=='play') if (main.mode=='play')
core.events.initGame(); core.events.initGame();
@ -365,6 +363,8 @@ core.prototype.init = function (coreData, callback) {
if (core.isset(functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a.plugins)) if (core.isset(functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a.plugins))
core.plugin = new functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a.plugins.plugin(); core.plugin = new functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a.plugins.plugin();
core.showStartAnimate();
if (core.isset(callback)) callback(); if (core.isset(callback)) callback();
}); });

View File

@ -838,6 +838,7 @@ events.prototype.doAction = function() {
var floorId=data.floorId || core.status.floorId; var floorId=data.floorId || core.status.floorId;
if (floorId==core.status.floorId) if (floorId==core.status.floorId)
core.openDoor(null, x, y, false, function() { core.openDoor(null, x, y, false, function() {
core.lockControl();
core.events.doAction(); core.events.doAction();
}) })
else { else {
@ -845,8 +846,6 @@ events.prototype.doAction = function() {
this.doAction(); this.doAction();
} }
break; break;
this.doAction();
break;
} }
case "openShop": // 打开一个全局商店 case "openShop": // 打开一个全局商店
if (core.status.replay.replaying) { // 正在播放录像简单将visited置为true if (core.status.replay.replaying) { // 正在播放录像简单将visited置为true
@ -1268,9 +1267,6 @@ events.prototype.getItem = function (itemId, itemNum, itemX, itemY, callback) {
////// 开门 ////// ////// 开门 //////
events.prototype.openDoor = function (id, x, y, needKey, callback) { events.prototype.openDoor = function (id, x, y, needKey, callback) {
if (core.interval.openDoorAnimate!=null) return;
if (!core.isset(id)) id = core.getBlockId(x, y); if (!core.isset(id)) id = core.getBlockId(x, y);
// 是否存在门 // 是否存在门
@ -1284,7 +1280,6 @@ events.prototype.openDoor = function (id, x, y, needKey, callback) {
if (core.status.automaticRoute.moveStepBeforeStop.length>=1)core.status.automaticRoute.moveStepBeforeStop[0].step-=core.status.automaticRoute.movedStep; if (core.status.automaticRoute.moveStepBeforeStop.length>=1)core.status.automaticRoute.moveStepBeforeStop[0].step-=core.status.automaticRoute.movedStep;
} }
core.stopAutomaticRoute();
var speed = id.endsWith("Wall")?70:30; var speed = id.endsWith("Wall")?70:30;
if (needKey && id.endsWith("Door")) { if (needKey && id.endsWith("Door")) {
@ -1304,14 +1299,18 @@ events.prototype.openDoor = function (id, x, y, needKey, callback) {
core.playSound("door.mp3"); core.playSound("door.mp3");
var state = 0; var state = 0;
var door = core.material.icons.animates[id]; var door = core.material.icons.animates[id];
core.lockControl();
core.stopHero();
core.stopAutomaticRoute();
core.status.replay.animate=true; core.status.replay.animate=true;
core.removeGlobalAnimate(x,y); core.removeGlobalAnimate(x,y);
core.interval.openDoorAnimate = window.setInterval(function () { var animate = window.setInterval(function () {
state++; state++;
if (state == 4) { if (state == 4) {
clearInterval(core.interval.openDoorAnimate); clearInterval(animate);
core.interval.openDoorAnimate=null;
core.removeBlock(x, y); core.removeBlock(x, y);
core.unLockControl();
core.status.replay.animate=false; core.status.replay.animate=false;
core.events.afterOpenDoor(id,x,y,callback); core.events.afterOpenDoor(id,x,y,callback);
return; return;