win noexit
This commit is contained in:
parent
e8ad81da8d
commit
b3e11e1938
@ -1724,15 +1724,16 @@ return code;
|
||||
*/;
|
||||
|
||||
win_s
|
||||
: '游戏胜利,结局' ':' EvalString? '不计入榜单' Bool Newline
|
||||
: '游戏胜利,结局' ':' EvalString? '不计入榜单' Bool '不结束游戏' Bool Newline
|
||||
|
||||
|
||||
/* win_s
|
||||
tooltip : win: 获得胜利, 该事件会显示获胜页面, 并重新游戏
|
||||
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=win%EF%BC%9A%E8%8E%B7%E5%BE%97%E8%83%9C%E5%88%A9
|
||||
default : ["",false]
|
||||
default : ["",false, false]
|
||||
Bool_0 = Bool_0?', "norank": 1':'';
|
||||
var code = '{"type": "win", "reason": "'+EvalString_0+'"'+Bool_0+'},\n';
|
||||
Bool_1 = Bool_1?', "noexit": 1':'';
|
||||
var code = '{"type": "win", "reason": "'+EvalString_0+'"'+Bool_0+Bool_1+'},\n';
|
||||
return code;
|
||||
*/;
|
||||
|
||||
@ -3397,7 +3398,7 @@ ActionParser.prototype.parseAction = function() {
|
||||
break;
|
||||
case "win":
|
||||
this.next = MotaActionBlocks['win_s'].xmlText([
|
||||
data.reason,data.norank?true:false,this.next]);
|
||||
data.reason,data.norank?true:false,data.noexit?true:false,this.next]);
|
||||
break;
|
||||
case "lose":
|
||||
this.next = MotaActionBlocks['lose_s'].xmlText([
|
||||
|
||||
@ -108,9 +108,9 @@ events.prototype.setInitData = function () {
|
||||
}
|
||||
|
||||
////// 游戏获胜事件 //////
|
||||
events.prototype.win = function (reason, norank) {
|
||||
core.status.gameOver = true;
|
||||
return this.eventdata.win(reason, norank);
|
||||
events.prototype.win = function (reason, norank, noexit) {
|
||||
if (!noexit) core.status.gameOver = true;
|
||||
return this.eventdata.win(reason, norank, noexit);
|
||||
}
|
||||
|
||||
////// 游戏失败事件 //////
|
||||
@ -121,10 +121,12 @@ events.prototype.lose = function (reason) {
|
||||
|
||||
////// 游戏结束 //////
|
||||
events.prototype.gameOver = function (ending, fromReplay, norank) {
|
||||
core.clearMap('all');
|
||||
core.deleteAllCanvas();
|
||||
core.dom.gif2.innerHTML = "";
|
||||
core.setWeather();
|
||||
if (!core.status.extraEvent) {
|
||||
core.clearMap('all');
|
||||
core.deleteAllCanvas();
|
||||
core.dom.gif2.innerHTML = "";
|
||||
core.setWeather();
|
||||
}
|
||||
core.ui.closePanel();
|
||||
|
||||
if (main.isCompetition && ending != null) {
|
||||
@ -220,12 +222,22 @@ events.prototype._gameOver_confirmDownload = function (ending) {
|
||||
}
|
||||
|
||||
events.prototype._gameOver_askRate = function (ending) {
|
||||
core.ui.closePanel();
|
||||
|
||||
// 继续接下来的事件
|
||||
if (core.status.extraEvent) {
|
||||
core.status.event = core.status.extraEvent;
|
||||
delete core.status.extraEvent;
|
||||
core.lockControl();
|
||||
core.doAction();
|
||||
return;
|
||||
}
|
||||
|
||||
if (ending == null) {
|
||||
core.restart();
|
||||
return;
|
||||
}
|
||||
|
||||
core.ui.closePanel();
|
||||
core.ui.drawConfirmBox("恭喜通关本塔,你想进行评分吗?", function () {
|
||||
if (core.platform.isPC) {
|
||||
window.open("/score.php?name=" + core.firstData.name + "&num=10", "_blank");
|
||||
@ -1624,7 +1636,7 @@ events.prototype._action_continue = function (data, x, y, prefix) {
|
||||
}
|
||||
|
||||
events.prototype._action_win = function (data, x, y, prefix) {
|
||||
this.win(data.reason, data.norank);
|
||||
this.win(data.reason, data.norank, data.noexit);
|
||||
}
|
||||
|
||||
events.prototype._action_lose = function (data, x, y, prefix) {
|
||||
|
||||
@ -648,6 +648,7 @@ utils.prototype.setStatusBarInnerHTML = function (name, value, css) {
|
||||
// 判定是否斜体
|
||||
var italic = /^[-a-zA-Z0-9`~!@#$%^&*()_=+\[{\]}\\|;:'",<.>\/?]*$/.test(value);
|
||||
var style = 'font-style: ' + (italic ? 'italic' : 'normal') + '; ';
|
||||
style += 'text-shadow: #000 1px 0 0, #000 0 1px 0, #000 -1px 0 0, #000 0 -1px 0; ';
|
||||
// 判定是否需要缩放
|
||||
var length = this.strlen(value) || 1;
|
||||
style += 'font-size: ' + Math.min(1, 7 / length) + 'em; ';
|
||||
|
||||
@ -74,23 +74,31 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
|
||||
core.updateEnemys();
|
||||
},
|
||||
"win": function(reason, norank) {
|
||||
"win": function (reason, norank, noexit) {
|
||||
// 游戏获胜事件
|
||||
// 请注意,成绩统计时是按照hp进行上传并排名
|
||||
// 可以先在这里对最终分数进行计算,比如将2倍攻击和5倍黄钥匙数量加到分数上
|
||||
// core.status.hero.hp += 2 * core.getRealStatus('atk') + 5 * core.itemCount('yellowKey');
|
||||
|
||||
// 如果不退出,则临时存储数据
|
||||
if (noexit) {
|
||||
core.status.extraEvent = core.clone(core.status.event);
|
||||
}
|
||||
|
||||
// 游戏获胜事件
|
||||
core.ui.closePanel();
|
||||
var replaying = core.isReplaying();
|
||||
if (replaying) core.stopReplay();
|
||||
core.waitHeroToStop(function() {
|
||||
core.clearMap('all'); // 清空全地图
|
||||
core.deleteAllCanvas(); // 删除所有创建的画布
|
||||
core.dom.gif2.innerHTML = "";
|
||||
// 请注意:
|
||||
// 成绩统计时是按照hp进行上传并排名,因此光在这里改${status:hp}是无效的
|
||||
// 如需按照其他的的分数统计方式,请先将hp设置为你的得分
|
||||
// core.setStatus('hp', ...);
|
||||
core.waitHeroToStop(function () {
|
||||
if (!noexit) {
|
||||
core.clearMap('all'); // 清空全地图
|
||||
core.deleteAllCanvas(); // 删除所有创建的画布
|
||||
core.dom.gif2.innerHTML = "";
|
||||
}
|
||||
core.drawText([
|
||||
"\t[" + (reason||"恭喜通关") + "]你的分数是${status:hp}。"
|
||||
"\t[" + (reason || "恭喜通关") + "]你的分数是${status:hp}。"
|
||||
], function () {
|
||||
core.events.gameOver(reason||'', replaying, norank);
|
||||
core.events.gameOver(reason || '', replaying, norank);
|
||||
})
|
||||
});
|
||||
},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user