Fix 282 bugs & equip autoevent

This commit is contained in:
ckcz123 2021-09-25 20:29:43 +08:00
parent cd746fd6d9
commit 90a197fe88
5 changed files with 77 additions and 12 deletions

View File

@ -1537,6 +1537,10 @@ actions.prototype._clickToolbox = function (x, y) {
if (x >= this.LAST - 2 && y == this.LAST) { if (x >= this.LAST - 2 && y == this.LAST) {
core.playSound('取消'); core.playSound('取消');
core.ui.closePanel(); core.ui.closePanel();
var last = core.status.route[core.status.route.length - 1];
if (last.startsWith('equip:') || last.startsWith('unEquip:')) {
core.status.route.push('no');
}
core.checkAutoEvents(); core.checkAutoEvents();
return; return;
} }
@ -1713,6 +1717,10 @@ actions.prototype._keyUpToolbox = function (keycode) {
if (keycode == 84 || keycode == 27 || keycode == 88) { if (keycode == 84 || keycode == 27 || keycode == 88) {
core.playSound('取消'); core.playSound('取消');
core.ui.closePanel(); core.ui.closePanel();
var last = core.status.route[core.status.route.length - 1];
if (last.startsWith('equip:') || last.startsWith('unEquip:')) {
core.status.route.push('no');
}
core.checkAutoEvents(); core.checkAutoEvents();
return; return;
} }
@ -1740,6 +1748,10 @@ actions.prototype._clickEquipbox = function (x, y) {
if (x >= this.LAST - 2 && y == this.LAST) { if (x >= this.LAST - 2 && y == this.LAST) {
core.playSound('取消'); core.playSound('取消');
core.ui.closePanel(); core.ui.closePanel();
var last = core.status.route[core.status.route.length - 1];
if (last.startsWith('equip:') || last.startsWith('unEquip:')) {
core.status.route.push('no');
}
core.checkAutoEvents(); core.checkAutoEvents();
return; return;
} }
@ -1898,6 +1910,10 @@ actions.prototype._keyUpEquipbox = function (keycode, altKey) {
if (keycode == 81 || keycode == 27 || keycode == 88) { if (keycode == 81 || keycode == 27 || keycode == 88) {
core.playSound('取消'); core.playSound('取消');
core.ui.closePanel(); core.ui.closePanel();
var last = core.status.route[core.status.route.length - 1];
if (last.startsWith('equip:') || last.startsWith('unEquip:')) {
core.status.route.push('no');
}
core.checkAutoEvents(); core.checkAutoEvents();
return; return;
} }

View File

@ -48,6 +48,7 @@ control.prototype._init = function () {
this.registerReplayAction("key", this._replayAction_key); this.registerReplayAction("key", this._replayAction_key);
this.registerReplayAction("click", this._replayAction_click); this.registerReplayAction("click", this._replayAction_click);
this.registerReplayAction("ignoreInput", this._replayAction_ignoreInput); this.registerReplayAction("ignoreInput", this._replayAction_ignoreInput);
this.registerReplayAction("no", this._replayAction_no);
// --- 注册系统的resize // --- 注册系统的resize
this.registerResize("gameGroup", this._resize_gameGroup); this.registerResize("gameGroup", this._resize_gameGroup);
this.registerResize("canvas", this._resize_canvas); this.registerResize("canvas", this._resize_canvas);
@ -1751,10 +1752,24 @@ control.prototype._replayAction_equip = function (action) {
var equipId = action.substring(6); var equipId = action.substring(6);
var ownEquipment = core.getToolboxItems('equips'); var ownEquipment = core.getToolboxItems('equips');
var index = ownEquipment.indexOf(equipId), per = core.__SIZE__-1; var index = ownEquipment.indexOf(equipId), per = core.__SIZE__-1;
if (index<0) return false; if (index<0) {
core.removeFlag('__doNotCheckAutoEvents__');
return false;
}
var cb = function () {
var next = core.status.replay.toReplay[0]||"";
if (!next.startsWith('equip:') && !next.startsWith('unEquip:')) {
core.removeFlag('__doNotCheckAutoEvents__');
core.checkAutoEvents();
}
core.replay();
}
core.setFlag('__doNotCheckAutoEvents__', true);
core.status.route.push(action); core.status.route.push(action);
if (core.material.items[equipId].hideInReplay || core.status.replay.speed == 24) { if (core.material.items[equipId].hideInReplay || core.status.replay.speed == 24) {
core.loadEquip(equipId, core.replay); core.loadEquip(equipId, cb);
return true; return true;
} }
core.status.event.data = {"page":Math.floor(index/per)+1, "selectId":null}; core.status.event.data = {"page":Math.floor(index/per)+1, "selectId":null};
@ -1762,7 +1777,7 @@ control.prototype._replayAction_equip = function (action) {
core.ui._drawEquipbox(index); core.ui._drawEquipbox(index);
setTimeout(function () { setTimeout(function () {
core.ui.closePanel(); core.ui.closePanel();
core.loadEquip(equipId, core.replay); core.loadEquip(equipId, cb);
}, core.control.__replay_getTimeout()); }, core.control.__replay_getTimeout());
return true; return true;
} }
@ -1770,16 +1785,30 @@ control.prototype._replayAction_equip = function (action) {
control.prototype._replayAction_unEquip = function (action) { control.prototype._replayAction_unEquip = function (action) {
if (action.indexOf("unEquip:")!=0) return false; if (action.indexOf("unEquip:")!=0) return false;
var equipType = parseInt(action.substring(8)); var equipType = parseInt(action.substring(8));
if (!core.isset(equipType)) return false; if (!core.isset(equipType)) {
core.removeFlag('__doNotCheckAutoEvents__');
return false;
}
var cb = function () {
var next = core.status.replay.toReplay[0]||"";
if (!next.startsWith('equip:') && !next.startsWith('unEquip:')) {
core.removeFlag('__doNotCheckAutoEvents__');
core.checkAutoEvents();
}
core.replay();
}
core.setFlag('__doNotCheckAutoEvents__', true);
core.ui._drawEquipbox(equipType); core.ui._drawEquipbox(equipType);
core.status.route.push(action); core.status.route.push(action);
if (core.status.replay.speed == 24) { if (core.status.replay.speed == 24) {
core.unloadEquip(equipType, core.replay); core.unloadEquip(equipType, cb);
return true; return true;
} }
setTimeout(function () { setTimeout(function () {
core.ui.closePanel(); core.ui.closePanel();
core.unloadEquip(equipType, core.replay); core.unloadEquip(equipType, cb);
}, core.control.__replay_getTimeout()); }, core.control.__replay_getTimeout());
return true; return true;
} }
@ -1901,6 +1930,13 @@ control.prototype._replayAction_ignoreInput = function (action) {
return false; return false;
} }
control.prototype._replayAction_no = function (action) {
if (action != 'no') return false;
core.status.route.push(action);
core.replay();
return true;
}
// ------ 存读档相关 ------ // // ------ 存读档相关 ------ //
////// 自动存档 ////// ////// 自动存档 //////

View File

@ -160,7 +160,10 @@ events.prototype._gameOver_confirmUpload = function (ending, norank) {
core.events._gameOver_doUpload("", ending, norank); core.events._gameOver_doUpload("", ending, norank);
} }
else { else {
core.myprompt("请输入你的ID", core.getCookie('id') || "", function (username) { var id = core.getCookie('id') || "";
var hint = "请输入你的ID\n登录状态下输入数字用户编号可成为蓝名成绩并计入用户通关数";
if (id) hint = "请输入你的ID\n输入数字用户编号"+id+ "可成为蓝名成绩并计入用户通关数)";
core.myprompt(hint, id, function (username) {
core.events._gameOver_doUpload(username, ending, norank); core.events._gameOver_doUpload(username, ending, norank);
}); });
} }
@ -255,13 +258,13 @@ events.prototype._gameOver_askRate = function (ending) {
return; return;
} }
core.ui.drawConfirmBox("恭喜通关!你想进行评分吗?", function () { core.ui.drawConfirmBox("恭喜通关!你想查看榜单、评论,以及评分和标色投票吗?", function () {
if (core.platform.isPC) { if (core.platform.isPC) {
window.open("/score.php?name=" + core.firstData.name, "_blank"); window.open("/tower/?name=" + core.firstData.name, "_blank");
core.restart(); core.restart();
} }
else { else {
window.location.href = "/score.php?name=" + core.firstData.name; window.location.href = "/tower/?name=" + core.firstData.name;
} }
}, function () { }, function () {
core.restart(); core.restart();
@ -1133,6 +1136,7 @@ events.prototype.recoverEvents = function (data) {
events.prototype.checkAutoEvents = function () { events.prototype.checkAutoEvents = function () {
// 只有在无操作或事件流中才能执行自动事件! // 只有在无操作或事件流中才能执行自动事件!
if (!core.isPlaying() || (core.status.lockControl && core.status.event.id != 'action')) return; if (!core.isPlaying() || (core.status.lockControl && core.status.event.id != 'action')) return;
if (core.hasFlag('__doNotCheckAutoEvents__')) return;
var todo = [], delay = []; var todo = [], delay = [];
core.status.autoEvents.forEach(function (autoEvent) { core.status.autoEvents.forEach(function (autoEvent) {
var symbol = autoEvent.symbol, x = autoEvent.x, y = autoEvent.y, floorId = autoEvent.floorId; var symbol = autoEvent.symbol, x = autoEvent.x, y = autoEvent.y, floorId = autoEvent.floorId;

View File

@ -2592,6 +2592,8 @@ maps.prototype.moveBlock = function (x, y, steps, time, keep, callback) {
maps.prototype._moveBlock_doMove = function (blockInfo, canvases, moveInfo, callback) { maps.prototype._moveBlock_doMove = function (blockInfo, canvases, moveInfo, callback) {
var animateTotal = blockInfo.animate, animateTime = 0; var animateTotal = blockInfo.animate, animateTime = 0;
// 强制npc48行走时使用四帧动画
if (!blockInfo.doorInfo && !blockInfo.bigImage && blockInfo.cls == 'npc48') animateTotal = 4;
var _run = function () { var _run = function () {
var cb = function () { var cb = function () {
core.maps._deleteDetachedBlock(canvases); core.maps._deleteDetachedBlock(canvases);

View File

@ -67,7 +67,12 @@ def all_floors():
if len(ids) == 0: if len(ids) == 0:
abort(404) abort(404)
return None return None
return Response('\n'.join([get_file('project/floors/%s.js' % id) for id in ids]), mimetype = 'text/javascript') content = []
for id in ids:
v = get_file('project/floors/%s.js' % id)
if isPy3: v = str(v, encoding = 'utf-8')
content.append(v)
return Response('\n'.join(content), mimetype = 'text/javascript')
@app.route('/__all_animates__', methods=['GET']) @app.route('/__all_animates__', methods=['GET'])
def all_animates(): def all_animates():
@ -79,7 +84,9 @@ def all_animates():
for id in ids: for id in ids:
animate = 'project/animates/%s.animate' % id animate = 'project/animates/%s.animate' % id
if os.path.exists(animate): if os.path.exists(animate):
content.append(get_file(animate)) v = get_file(animate)
if isPy3: v = str(v, encoding = 'utf-8')
content.append(v)
else: content.append('') else: content.append('')
return '@@@~~~###~~~@@@'.join(content) return '@@@~~~###~~~@@@'.join(content)