Fix Snipe Bug

This commit is contained in:
oc 2018-01-17 09:39:38 +08:00
parent c3da5c5e1c
commit d172cbcd86
3 changed files with 107 additions and 91 deletions

View File

@ -2773,8 +2773,6 @@ core.prototype.checkBlock = function () {
////// 阻击事件(动画效果) ////// ////// 阻击事件(动画效果) //////
core.prototype.snipe = function (snipes) { core.prototype.snipe = function (snipes) {
core.waitHeroToStop(function() {
core.lockControl();
var scan = { var scan = {
'up': {'x': 0, 'y': -1}, 'up': {'x': 0, 'y': -1},
@ -2811,6 +2809,28 @@ core.prototype.snipe = function (snipes) {
snipe.block = core.clone(block); snipe.block = core.clone(block);
}) })
var finishSnipe = function () {
snipes.forEach(function (t) {
core.removeBlock(t.x, t.y);
var nBlock = core.clone(t.block);
nBlock.x = t.nx; nBlock.y = t.ny;
core.status.thisMap.blocks.push(nBlock);
core.addGlobalAnimate(2, 32*t.nx, 32*t.ny, t.blockIcon, t.blockImage);
core.canvas.event.drawImage(t.blockImage, 0, t.blockIcon*32, 32, 32, 32*t.nx, 32*t.ny, 32, 32);
});
core.syncGlobalAnimate();
core.updateStatusBar();
return;
}
if (core.status.replay.replaying) {
finishSnipe();
}
else {
core.waitHeroToStop(function() {
core.lockControl();
var time = 500, step = 0; var time = 500, step = 0;
var animateValue = 2; var animateValue = 2;
@ -2856,22 +2876,16 @@ core.prototype.snipe = function (snipes) {
if (step==16) { // 移动完毕 if (step==16) { // 移动完毕
clearInterval(animate); clearInterval(animate);
snipes.forEach(function (t) { finishSnipe();
core.removeBlock(t.x, t.y);
var nBlock = core.clone(t.block);
nBlock.x = t.nx; nBlock.y = t.ny;
core.status.thisMap.blocks.push(nBlock);
core.addGlobalAnimate(animateValue, 32*t.nx, 32*t.ny, t.blockIcon, t.blockImage);
});
core.syncGlobalAnimate();
core.updateStatusBar();
// 不存在自定义事件 // 不存在自定义事件
if (core.status.event.id==null) if (core.status.event.id==null)
core.unLockControl(); core.unLockControl();
core.replay();
} }
}, time/16); }, time/16);
}); });
}
} }
////// 更改画面色调 ////// ////// 更改画面色调 //////
@ -3665,13 +3679,11 @@ core.prototype.syncSave = function(type) {
core.drawText("出错啦!\n无法同步存档到服务器。\n错误原因HTTP "+xhr.status); core.drawText("出错啦!\n无法同步存档到服务器。\n错误原因HTTP "+xhr.status);
} }
}; };
xhr.ontimeout = function(e) { xhr.ontimeout = function() {
console.log(e); core.drawText("出错啦!\n无法同步存档到服务器。\n错误原因Timeout");
core.drawText("出错啦!\n无法同步存档到服务器。\n错误原因"+e);
} }
xhr.onerror = function(e) { xhr.onerror = function() {
console.log(e); core.drawText("出错啦!\n无法同步存档到服务器。\n错误原因XHR Error");
core.drawText("出错啦!\n无法同步存档到服务器。\n错误原因"+e);
} }
xhr.send(formData); xhr.send(formData);
}, function() { }, function() {
@ -3735,11 +3747,11 @@ core.prototype.syncSave = function(type) {
core.drawText("出错啦!\n无法从服务器同步存档。\n错误原因HTTP "+xhr.status); core.drawText("出错啦!\n无法从服务器同步存档。\n错误原因HTTP "+xhr.status);
} }
}; };
xhr.ontimeout = function(e) { xhr.ontimeout = function() {
core.drawText("出错啦!\n无法从服务器同步存档。\n错误原因"+e); core.drawText("出错啦!\n无法同步存档到服务器。\n错误原因Timeout");
} }
xhr.onerror = function(e) { xhr.onerror = function() {
core.drawText("出错啦!\n无法从服务器同步存档。\n错误原因"+e); core.drawText("出错啦!\n无法同步存档到服务器。\n错误原因XHR Error");
} }
xhr.send(formData); xhr.send(formData);
}, function() { }, function() {

View File

@ -150,7 +150,7 @@ events.prototype.gameOver = function () {
core.drawConfirmBox("你想下载录像吗?", function () { core.drawConfirmBox("你想下载录像吗?", function () {
// 检测是否微信浏览器 // 检测是否微信浏览器
if () // if ()
}, function () { }, function () {

View File

@ -34,6 +34,10 @@ main.floors.sample0 = {
], ],
"events": { // 该楼的所有可能事件列表 "events": { // 该楼的所有可能事件列表
"3,9": [
"test"
],
"10,9": [ // 守着道具的老人 "10,9": [ // 守着道具的老人
"\t[老人,man]这些是本样板支持的所有的道具。\n\n道具分为三类items, constants, tools。\nitems 为即捡即用类道具,例如宝石、血瓶、剑盾等。\nconstants 为永久道具,例如怪物手册、楼层传送器、幸运金币等。\ntools 为消耗类道具,例如破墙镐、炸弹、中心对称飞行器等。\n\n后两类道具在工具栏中可以看到并使用。", "\t[老人,man]这些是本样板支持的所有的道具。\n\n道具分为三类items, constants, tools。\nitems 为即捡即用类道具,例如宝石、血瓶、剑盾等。\nconstants 为永久道具,例如怪物手册、楼层传送器、幸运金币等。\ntools 为消耗类道具,例如破墙镐、炸弹、中心对称飞行器等。\n\n后两类道具在工具栏中可以看到并使用。",
"\t[老人,man]有关道具效果定义在items.js中。\n目前大多数道具已有默认行为如有自定义的需求则需在items.js中修改代码。", "\t[老人,man]有关道具效果定义在items.js中。\n目前大多数道具已有默认行为如有自定义的需求则需在items.js中修改代码。",