diff --git a/libs/actions.js b/libs/actions.js index 323aab20..0cfa4d37 100644 --- a/libs/actions.js +++ b/libs/actions.js @@ -286,6 +286,7 @@ actions.prototype._sys_keyDown_lockControl = function (keyCode) { case 'load': case 'replayLoad': case 'replayRemain': + case 'replaySince': this._keyDownSL(keyCode); break; case 'selectShop': @@ -388,6 +389,7 @@ actions.prototype._sys_keyUp_lockControl = function (keyCode, altKey) { case 'load': case 'replayLoad': case 'replayRemain': + case 'replaySince': this._keyUpSL(keyCode); break; case 'keyBoard': @@ -674,6 +676,7 @@ actions.prototype._sys_onclick_lockControl = function (x, y, px, py) { case 'load': case 'replayLoad': case 'replayRemain': + case 'replaySince': this._clickSL(x, y, px, py); break; case 'confirmBox': @@ -839,7 +842,7 @@ actions.prototype._sys_longClick_lockControl = function (x, y, px, py) { } } // 长按SL上下页快速翻页 - if (["save","load","replayLoad","replayRemain"].indexOf(core.status.event.id) >= 0) { + if (["save","load","replayLoad","replayRemain","replaySince"].indexOf(core.status.event.id) >= 0) { if ([this.HSIZE-2, this.HSIZE-3, this.HSIZE+2, this.HSIZE+3].indexOf(x) >= 0 && y == this.LAST) { this._clickSL(x, y); return true; @@ -2875,9 +2878,10 @@ actions.prototype._clickReplay = function (x, y) { case 0: core.playSound('确定'); return this._clickReplay_fromBeginning(); case 1: core.playSound('确定'); return this._clickReplay_fromLoad(); case 2: core.playSound('确定'); return this._clickReplay_replayRemain(); - case 3: core.playSound('确定'); return core.chooseReplayFile(); - case 4: core.playSound('确定'); return this._clickReplay_download(); - case 5: core.playSound('取消'); return core.ui.closePanel(); + case 3: core.playSound('确定'); return this._clickReplay_replaySince(); + case 4: core.playSound('确定'); return core.chooseReplayFile(); + case 5: core.playSound('确定'); return this._clickReplay_download(); + case 6: core.playSound('取消'); return core.ui.closePanel(); } } } @@ -2912,6 +2916,23 @@ actions.prototype._clickReplay_replayRemain = function () { }); } +actions.prototype._clickReplay_replaySince = function () { + core.closePanel(); + core.drawText([ + "\t[播放存档剩余录像]该功能为【接续播放录像】的简化版本,允许你播放\r[yellow]一个存档中剩余的录像\r,常常用于\r[yellow]录像局部优化\r。\n" + + "在录像正常播放中,你随时可以暂停并按S键进行存档;此时\r[yellow]剩余录像\r也会被记在存档中(在读档界面用\r[yellow][R]\r标识。)\n" + + "之后,你可以选择在路线优化后直接播放该存档的\r[yellow]剩余录像\r,而无需再像接续播放一样选择录像起点和终点。\n\n" + + "详细使用方法参见露珠录制的视频教程:\n\r[yellow]https://bilibili.com/video/BV1az4y1C78x", + "请选择一个存档。\n\n\r[yellow]该存档需为录像播放中存的,且坐标必须和当前勇士坐标完全相同。\r\n将尝试播放此存档的剩余录像。", + ], function () { + core.status.event.id = 'replaySince'; + core.lockControl(); + var saveIndex = core.saves.saveIndex; + var page = parseInt((saveIndex - 1) / 5), offset = saveIndex - 5 * page; + core.ui._drawSLPanel(10 * page + offset); + }); +} + actions.prototype._clickReplay_download = function () { // if (core.hasFlag('debug')) return core.drawText("\t[系统提示]调试模式下无法下载录像"); core.download(core.firstData.name + "_" + core.formatDate2() + ".h5route", diff --git a/libs/control.js b/libs/control.js index 43212ef9..c8d4c901 100644 --- a/libs/control.js +++ b/libs/control.js @@ -1968,6 +1968,7 @@ control.prototype.doSL = function (id, type) { case 'reload': this._doSL_reload(id, this._doSL_load_afterGet); break; case 'replayLoad': this._doSL_load(id, this._doSL_replayLoad_afterGet); break; case 'replayRemain': this._doSL_load(id, this._doSL_replayRemain_afterGet); break; + case 'replaySince': this._doSL_load(id, this._doSL_replaySince_afterGet); break; } } @@ -1979,7 +1980,11 @@ control.prototype._doSL_save = function (id) { // 在事件中的存档 if (core.status.event.interval != null) core.setFlag("__events__", core.status.event.interval); - core.setLocalForage("save"+id, core.saveData(), function() { + var data = core.saveData(); + if (core.isReplaying() && core.status.replay.toReplay.length > 0) { + data.__toReplay__ = core.encodeRoute(core.status.replay.toReplay); + } + core.setLocalForage("save"+id, data, function() { core.saves.saveIndex = id; core.setLocalStorage('saveIndex', core.saves.saveIndex); // 恢复事件 @@ -2088,7 +2093,6 @@ control.prototype._doSL_replayLoad_afterGet = function (id, data) { core.startReplay(route); core.drawTip("回退到存档节点"); }); - } control.prototype._doSL_replayRemain_afterGet = function (id, data) { @@ -2121,6 +2125,16 @@ control.prototype._doSL_replayRemain_afterGet = function (id, data) { }); } +control.prototype._doSL_replaySince_afterGet = function (id, data) { + if (data.floorId != core.status.floorId || data.hero.loc.x != core.getHeroLoc('x') || data.hero.loc.y != core.getHeroLoc('y')) + return alert("楼层或坐标不一致!"); + if (!data.__toReplay__) return alert('该存档没有剩余录像!'); + core.ui.closePanel(); + core.startReplay(core.decodeRoute(data.__toReplay__)); + core.drawTip("播放存档剩余录像"); + return; +} + ////// 同步存档到服务器 ////// control.prototype.syncSave = function (type) { core.ui.drawWaiting("正在同步,请稍候..."); diff --git a/libs/ui.js b/libs/ui.js index 403fbc14..d2f968db 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -3019,6 +3019,7 @@ ui.prototype._drawSLPanel_drawRecord = function(title, data, x, y, size, cho, hi var strokeColor = globalAttribute.selectColor; if (core.status.event.selection) strokeColor = '#FF6A6A'; if (!data || !data.floorId) highLight = false; + if (data && data.__toReplay__) title = '[R]' + title; core.fillText('ui', title, x, y, highLight?globalAttribute.selectColor:'#FFFFFF', this._buildFont(17, true)); core.strokeRect('ui', x-size/2, y+15, size, size, cho?strokeColor:'#FFFFFF', cho?6:2);