This commit is contained in:
ckcz123 2017-12-31 22:31:50 +08:00
parent bfda12df04
commit 3195e1d505
2 changed files with 13 additions and 19 deletions

View File

@ -1059,9 +1059,8 @@ events.prototype.setInitData = function (hard) {
当获胜`{"type": "win"}`事件发生时,将调用`events.js`中的win事件。其显示一段恭喜文字并重新开始游戏。
``` js
////// 游戏结束事件 //////
////// 游戏获胜事件 //////
events.prototype.win = function(reason) {
// 获胜
core.waitHeroToStop(function() {
core.removeGlobalAnimate(0,0,true);
core.clearMap('all'); // 清空全地图
@ -1079,8 +1078,8 @@ events.prototype.win = function(reason) {
当失败(`{"type": "lose"}`,或者被怪强制战斗打死、被领域怪扣血死、中毒导致扣血死,路障导致扣血死等等)事件发生时,将调用`events.js`中的`lose`事件。其直接显示一段文字,并重新开始游戏。
``` js
////// 游戏失败事件 //////
events.prototype.lose = function(reason) {
// 失败
core.waitHeroToStop(function() {
core.drawText([
"\t[结局1]你死了。\n如题。"

View File

@ -3072,7 +3072,7 @@ core.prototype.drawTip = function (text, itemIcon) {
return;
}
else {
if (!core.timeout.getItemTipTimeout) {
if (!core.isset(core.timeout.getItemTipTimeout)) {
core.timeout.getItemTipTimeout = window.setTimeout(function () {
hide = true;
core.timeout.getItemTipTimeout = null;
@ -3432,30 +3432,29 @@ core.prototype.syncSave = function(type) {
// send
var xhr = new XMLHttpRequest();
xhr.open("POST", "../sync.php");
xhr.timeout = 1000;
xhr.open("POST", "/games/sync.php");
xhr.onload = function(e) {
if (xhr.status==200) {
// console.log("同步成功。");
var response = JSON.parse(xhr.response);
if (response.code<0) {
core.drawText("出错啦!\n无法同步存档到服务器。");
core.drawText("出错啦!\n无法同步存档到服务器。\n错误原因"+response.msg);
}
else {
core.drawText("同步成功!\n\n您的存档编号 "+response.code+"\n您的存档密码 "+response.msg+"\n\n请牢记以上两个信息如截图等在从服务器\n同步存档时使用。")
}
}
else {
core.drawText("出错啦!\n无法同步存档到服务器。");
core.drawText("出错啦!\n无法同步存档到服务器。\n错误原因HTTP "+xhr.status);
}
};
xhr.ontimeout = function(e) {
console.log(e);
core.drawText("出错啦!\n无法同步存档到服务器。");
core.drawText("出错啦!\n无法同步存档到服务器。\n错误原因"+e);
}
xhr.onerror = function(e) {
console.log(e);
core.drawText("出错啦!\n无法同步存档到服务器。");
core.drawText("出错啦!\n无法同步存档到服务器。\n错误原因"+e);
}
xhr.send(formData);
}, function() {
@ -3484,8 +3483,7 @@ core.prototype.syncSave = function(type) {
// send
var xhr = new XMLHttpRequest();
xhr.open("POST", "../sync.php");
xhr.timeout = 1000;
xhr.open("POST", "/games/sync.php");
xhr.onload = function(e) {
if (xhr.status==200) {
// console.log("同步成功。");
@ -3512,22 +3510,19 @@ core.prototype.syncSave = function(type) {
core.drawText("出错啦!\n存档密码错误");
break;
default:
core.drawText("出错啦!\n无法从服务器同步存档。");
core.drawText("出错啦!\n无法从服务器同步存档。\n错误原因"+response.msg);
break;
}
}
else {
core.drawText("出错啦!\n无法从服务器同步存档。");
core.drawText("出错啦!\n无法从服务器同步存档。\n错误原因HTTP "+xhr.status);
}
};
xhr.ontimeout = function(e) {
console.log(e);
core.drawText("出错啦!\n无法从服务器同步存档。");
core.drawText("出错啦!\n无法从服务器同步存档。\n错误原因"+e);
}
xhr.onerror = function(e) {
console.log(e);
core.drawText("出错啦!\n无法从服务器同步存档。");
core.drawText("出错啦!\n无法从服务器同步存档。\n错误原因"+e);
}
xhr.send(formData);
}, function() {