From 2b04b6906295291207f2869afb682fc24f0140d5 Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Sat, 29 Dec 2018 13:55:32 +0800 Subject: [PATCH] core.isReplaying() --- docs/api.md | 5 +++++ docs/event.md | 4 ++-- libs/actions.js | 52 +++++++++++++++++++++++++------------------- libs/control.js | 44 ++++++++++++++++++++----------------- libs/core.js | 5 +++++ libs/events.js | 40 +++++++++++++++++----------------- libs/maps.js | 2 +- libs/ui.js | 2 +- libs/utils.js | 2 +- main.js | 18 +++++++-------- project/functions.js | 4 ++-- 11 files changed, 100 insertions(+), 78 deletions(-) diff --git a/docs/api.md b/docs/api.md index ed2c4914..29382194 100644 --- a/docs/api.md +++ b/docs/api.md @@ -188,6 +188,10 @@ core.trigger(x, y) [异步] 触发某个地点的事件。 +core.isReplaying() +当前是否正在录像播放中 + + core.drawBlock(block) 重绘某个图块。block应为core.status.thisMap.blocks中的一项。 @@ -346,6 +350,7 @@ core.control.gatherFollowers() core.control.replay() 回放下一个操作 + ========== core.enemys.XXX 和怪物相关的函数 ========== enemys.js主要用来进行怪物相关的内容,比如怪物的特殊属性,伤害和临界计算等。 diff --git a/docs/event.md b/docs/event.md index 047f5937..25c6e73b 100644 --- a/docs/event.md +++ b/docs/event.md @@ -2253,7 +2253,7 @@ if (core.getFlag("door",0)==2) { ////// 游戏获胜事件 ////// "win": function(reason, norank) { core.ui.closePanel(); - var replaying = core.status.replay.replaying; + var replaying = core.isReplaying(); core.stopReplay(); core.waitHeroToStop(function() { core.clearMap('all'); // 清空全地图 @@ -2277,7 +2277,7 @@ if (core.getFlag("door",0)==2) { ////// 游戏失败事件 ////// "lose": function(reason) { core.ui.closePanel(); - var replaying = core.status.replay.replaying; + var replaying = core.isReplaying(); core.stopReplay(); core.waitHeroToStop(function() { core.drawText([ diff --git a/libs/actions.js b/libs/actions.js index d7438936..4d9731ae 100644 --- a/libs/actions.js +++ b/libs/actions.js @@ -13,10 +13,16 @@ actions.prototype.init = function () { this.actionsdata = functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a.actions; } +actions.prototype.checkReplaying = function () { + if (core.isReplaying()&&core.status.event.id!='save' + &&(core.status.event.id||"").indexOf('book')!=0&&core.status.event.id!='viewMaps') + return true; + return false; +} + ////// 按下某个键时 ////// actions.prototype.onkeyDown = function (e) { - if (core.isset(core.status.replay)&&core.status.replay.replaying - &&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0&&core.status.event.id!='viewMaps') return; + if (this.checkReplaying()) return; if (!core.isset(core.status.holdingKeys))core.status.holdingKeys=[]; var isArrow={37:true,38:true,39:true,40:true}[e.keyCode] if(isArrow && !core.status.lockControl){ @@ -35,8 +41,7 @@ actions.prototype.onkeyDown = function (e) { ////// 放开某个键时 ////// actions.prototype.onkeyUp = function(e) { - if (core.isset(core.status.replay)&&core.status.replay.replaying - &&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0&&core.status.event.id!='viewMaps') { + if (this.checkReplaying()) { if (e.keyCode==27) // ESCAPE core.stopReplay(); else if (e.keyCode==90) // Z @@ -82,7 +87,7 @@ actions.prototype.onkeyUp = function(e) { ////// 按住某个键时 ////// actions.prototype.pressKey = function (keyCode) { - if (core.isset(core.status.replay)&&core.status.replay.replaying&&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0) return; + if (this.checkReplaying()) return; if (keyCode === core.status.holdingKeys.slice(-1)[0]) { this.keyDown(keyCode); window.setTimeout(function(){core.pressKey(keyCode);},30); @@ -91,8 +96,7 @@ actions.prototype.pressKey = function (keyCode) { ////// 根据按下键的code来执行一系列操作 ////// actions.prototype.keyDown = function(keyCode) { - if (core.isset(core.status.replay)&&core.status.replay.replaying - &&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0&&core.status.event.id!='viewMaps') return; + if (this.checkReplaying()) return; if (core.status.lockControl) { // Ctrl跳过对话 if (keyCode==17) { @@ -193,8 +197,7 @@ actions.prototype.keyDown = function(keyCode) { ////// 根据放开键的code来执行一系列操作 ////// actions.prototype.keyUp = function(keyCode, altKey, fromReplay) { - if (!fromReplay && core.isset(core.status.replay)&&core.status.replay.replaying - &&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0&&core.status.event.id!='viewMaps') return; + if (!fromReplay && this.checkReplaying()) return; var ok = function (keycode) { return keycode==27 || keycode==88 || keycode==13 || keycode==32 || keycode==67; @@ -324,8 +327,7 @@ actions.prototype.keyUp = function(keyCode, altKey, fromReplay) { ////// 点击(触摸)事件按下时 ////// actions.prototype.ondown = function (loc) { - if (core.isset(core.status.replay)&&core.status.replay.replaying - &&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0&&core.status.event.id!='viewMaps') return; + if (this.checkReplaying()) return; // 画板 if (core.status.played && (core.status.event||{}).id=='paint') { @@ -362,8 +364,7 @@ actions.prototype.ondown = function (loc) { ////// 当在触摸屏上滑动时 ////// actions.prototype.onmove = function (loc) { - if (core.isset(core.status.replay)&&core.status.replay.replaying - &&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0&&core.status.event.id!='viewMaps') return; + if (this.checkReplaying()) return; // 画板 if (core.status.played && (core.status.event||{}).id=='paint') { @@ -394,8 +395,7 @@ actions.prototype.onmove = function (loc) { ////// 当点击(触摸)事件放开时 ////// actions.prototype.onup = function () { - if (core.isset(core.status.replay)&&core.status.replay.replaying - &&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0&&core.status.event.id!='viewMaps') return; + if (this.checkReplaying()) return; // 画板 if (core.status.played && (core.status.event||{}).id=='paint') { @@ -460,8 +460,7 @@ actions.prototype.getClickLoc = function (x, y) { ////// 具体点击屏幕上(x,y)点时,执行的操作 ////// actions.prototype.onclick = function (x, y, stepPostfix) { - if (core.isset(core.status.replay)&&core.status.replay.replaying - &&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0&&core.status.event.id!='viewMaps') return; + if (this.checkReplaying()) return; // console.log("Click: (" + x + "," + y + ")"); stepPostfix=stepPostfix||[]; @@ -620,8 +619,7 @@ actions.prototype.onclick = function (x, y, stepPostfix) { actions.prototype.onmousewheel = function (direct) { // 向下滚动是 -1 ,向上是 1 - if (core.isset(core.status.replay)&&core.status.replay.replaying - &&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0&&core.status.event.id!='viewMaps') { + if (this.checkReplaying()) { // 滚轮控制速度 if (direct==1) core.speedUpReplay(); if (direct==-1) core.speedDownReplay(); @@ -678,6 +676,16 @@ actions.prototype.longClick = function (x, y, fromEvent) { return true; } } + // 长按可以跳过等待事件 + if (core.status.event.id=='action' && core.status.event.data.type=='sleep' + && !core.status.event.data.current.noSkip) { + if (core.isset(core.timeout.sleepTimeout) && Object.keys(core.animateFrame.asyncId).length==0) { + clearTimeout(core.timeout.sleepTimeout); + core.timeout.sleepTimeout = null; + core.events.doAction(); + return true; + } + } } else if (!fromEvent) { core.waitHeroToStop(function () { @@ -1051,7 +1059,7 @@ actions.prototype.keyUpViewMaps = function (keycode) { return; } - if (keycode==27 || keycode==13 || keycode==32 || (!core.status.replay.replaying && keycode==67)) { + if (keycode==27 || keycode==13 || keycode==32 || (!core.isReplaying() && keycode==67)) { core.clearMap('data'); core.ui.closePanel(); return; @@ -1071,8 +1079,8 @@ actions.prototype.keyUpViewMaps = function (keycode) { core.ui.drawMaps(core.status.event.data); return; } - if (keycode==88 || (core.status.replay.replaying && keycode==67)) { - if (core.isset(core.status.replay)&&core.status.replay.replaying) { + if (keycode==88 || (core.isReplaying() && keycode==67)) { + if (core.isReplaying()) { core.bookReplay(); } else { core.openBook(false); diff --git a/libs/control.js b/libs/control.js index 9afa5a06..64d5a6cb 100644 --- a/libs/control.js +++ b/libs/control.js @@ -1565,7 +1565,7 @@ control.prototype.triggerReplay = function () { control.prototype.pauseReplay = function () { if (!core.isPlaying()) return; if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0 || core.status.event.id=='viewMaps') return; - if (!core.status.replay.replaying) return; + if (!core.isReplaying()) return; core.status.replay.pausing = true; core.updateStatusBar(); core.drawTip("暂停播放"); @@ -1575,7 +1575,7 @@ control.prototype.pauseReplay = function () { control.prototype.resumeReplay = function () { if (!core.isPlaying()) return; if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0 || core.status.event.id=='viewMaps') return; - if (!core.status.replay.replaying) return; + if (!core.isReplaying()) return; core.status.replay.pausing = false; core.updateStatusBar(); core.drawTip("恢复播放"); @@ -1586,7 +1586,7 @@ control.prototype.resumeReplay = function () { control.prototype.speedUpReplay = function () { if (!core.isPlaying()) return; if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0 || core.status.event.id=='viewMaps') return; - if (!core.status.replay.replaying) return; + if (!core.isReplaying()) return; if (core.status.replay.speed==12) core.status.replay.speed=24.0; else if (core.status.replay.speed==6) core.status.replay.speed=12.0; else if (core.status.replay.speed==3) core.status.replay.speed=6.0; @@ -1601,7 +1601,7 @@ control.prototype.speedUpReplay = function () { control.prototype.speedDownReplay = function () { if (!core.isPlaying()) return; if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0 || core.status.event.id=='viewMaps') return; - if (!core.status.replay.replaying) return; + if (!core.isReplaying()) return; if (core.status.replay.speed==24) core.status.replay.speed=12.0; else if (core.status.replay.speed==12) core.status.replay.speed=6.0; else if (core.status.replay.speed==6) core.status.replay.speed=3.0; @@ -1617,7 +1617,7 @@ control.prototype.speedDownReplay = function () { control.prototype.setReplaySpeed = function (speed) { if (!core.isPlaying()) return; if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0 || core.status.event.id=='viewMaps') return; - if (!core.status.replay.replaying) return; + if (!core.isReplaying()) return; core.status.replay.speed = speed; core.drawTip("x"+core.status.replay.speed+"倍"); } @@ -1626,7 +1626,7 @@ control.prototype.setReplaySpeed = function (speed) { control.prototype.stopReplay = function () { if (!core.isPlaying()) return; if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0 || core.status.event.id=='viewMaps') return; - if (!core.status.replay.replaying) return; + if (!core.isReplaying()) return; core.status.replay.toReplay = []; core.status.replay.totalList = []; core.status.replay.replaying=false; @@ -1642,7 +1642,7 @@ control.prototype.stopReplay = function () { control.prototype.rewindReplay = function () { if (!core.isPlaying()) return; if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0 || core.status.event.id=='viewMaps') return; - if (!core.status.replay.replaying) return; + if (!core.isReplaying()) return; if (!core.status.replay.pausing) { core.drawTip("请先暂停录像"); return; @@ -1678,7 +1678,7 @@ control.prototype.rewindReplay = function () { control.prototype.saveReplay = function () { if (!core.isPlaying()) return; if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0 || core.status.event.id=='viewMaps') return; - if (!core.status.replay.replaying) return; + if (!core.isReplaying()) return; if (!core.status.replay.pausing) { core.drawTip("请先暂停录像"); return; @@ -1700,7 +1700,7 @@ control.prototype.saveReplay = function () { control.prototype.bookReplay = function () { if (!core.isPlaying()) return; if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0) return; - if (!core.status.replay.replaying) return; + if (!core.isReplaying()) return; if (!core.status.replay.pausing) { core.drawTip("请先暂停录像"); return; @@ -1727,7 +1727,7 @@ control.prototype.viewMapReplay = function () { if (!core.isPlaying()) return; if (core.status.event.id=='save' || (core.status.event.id||"").indexOf('book')==0 || core.status.event.id=='viewMaps') return; - if (!core.status.replay.replaying) return; + if (!core.isReplaying()) return; if (!core.status.replay.pausing) { core.drawTip("请先暂停录像"); return; @@ -1746,7 +1746,7 @@ control.prototype.viewMapReplay = function () { control.prototype.replay = function () { if (!core.isPlaying()) return; - if (!core.status.replay.replaying) return; // 没有回放 + if (!core.isReplaying()) return; // 没有回放 if (core.status.replay.pausing) return; // 暂停状态 if (core.status.replay.animate) return; // 正在某段动画中 @@ -1939,6 +1939,10 @@ control.prototype.replay = function () { } +control.prototype.isReplaying = function () { + return (core.status.replay||{}).replaying; +} + ////// 判断当前能否进入某个事件 ////// control.prototype.checkStatus = function (name, need, item) { if (need && core.status.event.id == name) { @@ -1963,7 +1967,7 @@ control.prototype.checkStatus = function (name, need, item) { ////// 点击怪物手册时的打开操作 ////// control.prototype.openBook = function (need) { - if (core.isset(core.status.replay)&&core.status.replay.replaying) return; + if (core.isReplaying()) return; // 当前是book,且从“浏览地图”打开 if (core.status.event.id == 'book' && core.isset(core.status.event.selection)) { @@ -1985,7 +1989,7 @@ control.prototype.openBook = function (need) { ////// 点击楼层传送器时的打开操作 ////// control.prototype.useFly = function (need) { - if (core.isset(core.status.replay)&&core.status.replay.replaying) return; + if (core.isReplaying()) return; if (!core.checkStatus('fly', need, true)) return; if (core.flags.flyNearStair && !core.nearStair()) { @@ -2012,7 +2016,7 @@ control.prototype.flyTo = function (toId, callback) { ////// 点击装备栏时的打开操作 ////// control.prototype.openEquipbox = function (need) { - if (core.isset(core.status.replay)&&core.status.replay.replaying) return; + if (core.isReplaying()) return; if (!core.checkStatus('equipbox', need)) return; core.ui.drawEquipbox(); @@ -2020,7 +2024,7 @@ control.prototype.openEquipbox = function (need) { ////// 点击工具栏时的打开操作 ////// control.prototype.openToolbox = function (need) { - if (core.isset(core.status.replay)&&core.status.replay.replaying) return; + if (core.isReplaying()) return; if (!core.checkStatus('toolbox', need)) return; core.ui.drawToolbox(); @@ -2028,7 +2032,7 @@ control.prototype.openToolbox = function (need) { ////// 点击快捷商店按钮时的打开操作 ////// control.prototype.openQuickShop = function (need) { - if (core.isset(core.status.replay)&&core.status.replay.replaying) return; + if (core.isReplaying()) return; if (!core.checkStatus('selectShop', need)) return; core.ui.drawQuickShop(); @@ -2036,7 +2040,7 @@ control.prototype.openQuickShop = function (need) { ////// 点击保存按钮时的打开操作 ////// control.prototype.save = function(need) { - if (core.isset(core.status.replay)&&core.status.replay.replaying) return; + if (core.isReplaying()) return; if (!core.checkStatus('save', need)) return; @@ -2048,7 +2052,7 @@ control.prototype.save = function(need) { ////// 点击读取按钮时的打开操作 ////// control.prototype.load = function (need) { - if (core.isset(core.status.replay)&&core.status.replay.replaying) return; + if (core.isReplaying()) return; var saveIndex = core.getLocalStorage('saveIndex', 1); var page=parseInt((saveIndex-1)/5), offset=saveIndex-5*page; @@ -2072,7 +2076,7 @@ control.prototype.load = function (need) { ////// 点击设置按钮时的操作 ////// control.prototype.openSettings = function (need) { - if (core.isset(core.status.replay)&&core.status.replay.replaying) return; + if (core.isReplaying()) return; if (!core.checkStatus('settings', need)) return; core.ui.drawSettings(); @@ -2598,7 +2602,7 @@ control.prototype.updateStatusBar = function () { this.controldata.updateStatusBar(); // 回放 - if (core.status.replay.replaying) { + if (core.isReplaying()) { core.statusBar.image.book.src = core.status.replay.pausing ? core.statusBar.icons.play.src : core.statusBar.icons.pause.src; core.statusBar.image.book.style.opacity = 1; diff --git a/libs/core.js b/libs/core.js index d5d6c9df..d2d62bfc 100644 --- a/libs/core.js +++ b/libs/core.js @@ -1236,6 +1236,11 @@ core.prototype.replay = function () { core.control.replay(); } +////// 是否正在回放录像 ////// +core.prototype.isReplaying = function () { + return core.control.isReplaying(); +} + ////// 判断当前能否进入某个事件 ////// core.prototype.checkStatus = function (name, need, item) { return core.control.checkStatus(name, need, item); diff --git a/libs/events.js b/libs/events.js index 5a0b2af7..747422c4 100644 --- a/libs/events.js +++ b/libs/events.js @@ -149,7 +149,7 @@ events.prototype.startGame = function (hard, seed, route, callback) { var real_start = function () { core.insertAction(core.clone(core.firstData.startText), null, null, function() { - if (!core.flags.startUsingCanvas && !core.status.replay.replaying && core.flags.showBattleAnimateConfirm) { // 是否提供“开启战斗动画”的选择项 + if (!core.flags.startUsingCanvas && !core.isReplaying() && core.flags.showBattleAnimateConfirm) { // 是否提供“开启战斗动画”的选择项 core.status.event.selection = core.flags.battleAnimate ? 0 : 1; core.ui.drawConfirmBox("你想开启战斗动画吗?\n之后可以在菜单栏中开启或关闭。\n(强烈建议新手开启此项)", function () { core.flags.battleAnimate = true; @@ -406,7 +406,7 @@ events.prototype.doAction = function() { if (typeof data == "string") { core.status.event.data.type='text'; // 如果是正在回放中,不显示 - if (core.status.replay.replaying) + if (core.isReplaying()) core.events.doAction(); else core.ui.drawTextBox(data); @@ -415,13 +415,13 @@ events.prototype.doAction = function() { core.status.event.data.type=data.type; switch (data.type) { case "text": // 文字/对话 - if (core.status.replay.replaying) + if (core.isReplaying()) core.events.doAction(); else core.ui.drawTextBox(data.text, data.showAll); break; case "autoText": - if (core.status.replay.replaying) + if (core.isReplaying()) core.events.doAction(); else { core.ui.drawTextBox(data.text); @@ -431,7 +431,7 @@ events.prototype.doAction = function() { } break; case "scrollText": // 滚动剧情文本 - if (core.status.replay.replaying) + if (core.isReplaying()) core.events.doAction(); else { var content = core.replaceText(data.text); @@ -729,7 +729,7 @@ events.prototype.doAction = function() { break; case "showImage": // 显示图片 if (!core.isset(data.loc)) data.loc=[0, 0]; - if (core.status.replay.replaying) { + if (core.isReplaying()) { data.time = 0; } var image = core.material.images.images[data.image]; @@ -749,7 +749,7 @@ events.prototype.doAction = function() { break; case "showTextImage": // 显示图片化文本 if (!core.isset(data.loc)) data.loc=[0, 0]; - if (core.status.replay.replaying) { + if (core.isReplaying()) { data.time = 0; } var content = core.replaceText(data.text); @@ -765,7 +765,7 @@ events.prototype.doAction = function() { } break; case "hideImage": // 隐藏图片 - if (core.status.replay.replaying) { + if (core.isReplaying()) { data.time = 0; } if (data.async || data.time == 0) { @@ -795,7 +795,7 @@ events.prototype.doAction = function() { this.doAction(); break; case "moveImage": // 图片移动 - if (core.status.replay.replaying) { // 正在播放录像 + if (core.isReplaying()) { // 正在播放录像 this.doAction(); } else { @@ -860,7 +860,7 @@ events.prototype.doAction = function() { break; } case "openShop": // 打开一个全局商店 - if (core.status.replay.replaying) { // 正在播放录像,简单将visited置为true + if (core.isReplaying()) { // 正在播放录像,简单将visited置为true core.status.shops[data.id].visited=true; core.status.event.data.list = []; this.doAction(); @@ -905,7 +905,7 @@ events.prototype.doAction = function() { break; } case "playSound": - if (!core.status.replay.replaying) + if (!core.isReplaying()) core.playSound(data.name); this.doAction(); break; @@ -1016,7 +1016,7 @@ events.prototype.doAction = function() { case "input": { var value; - if (core.status.replay.replaying) { + if (core.isReplaying()) { var action = core.status.replay.toReplay.shift(); if (action.indexOf("input:")==0 ) { value=parseInt(action.substring(6)); @@ -1040,7 +1040,7 @@ events.prototype.doAction = function() { case "input2": { var value; - if (core.status.replay.replaying) { + if (core.isReplaying()) { var action = core.status.replay.toReplay.shift(); try { if (action.indexOf("input2:")!=0) throw new Error("Input2 Error. Current action: "+action); @@ -1081,7 +1081,7 @@ events.prototype.doAction = function() { this.doAction(); break; case "choices": // 提供选项 - if (core.status.replay.replaying) { + if (core.isReplaying()) { if (core.status.replay.toReplay.length==0) { // 回放完毕 core.status.replay.replaying=false; core.drawTip("录像回放完毕"); @@ -1182,10 +1182,10 @@ events.prototype.doAction = function() { core.timeout.sleepTimeout = setTimeout(function() { core.timeout.sleepTimeout = null; core.events.doAction(); - }, core.status.replay.replaying?20:data.time); + }, core.isReplaying()?20:data.time); break; case "wait": - if (core.status.replay.replaying) { + if (core.isReplaying()) { var code = core.status.replay.toReplay.shift(); if (code.indexOf("input:")==0) { var value = parseInt(code.substring(6)); @@ -1369,7 +1369,7 @@ events.prototype.battle = function (id, x, y, force, callback) { if (!core.isset(core.status.event.id)) // 自动存档 core.autosave(true); - if (core.flags.battleAnimate&&!core.status.replay.replaying) { + if (core.flags.battleAnimate&&!core.isReplaying()) { core.waitHeroToStop(function() { core.ui.drawBattleAnimate(id, function() { core.events.afterBattle(id, x, y, callback); @@ -1403,7 +1403,7 @@ events.prototype.trigger = function (x, y) { if (core.isset(mapBlocks[b].event.data) && core.isset(mapBlocks[b].event.data.portalWithoutTrigger)) canCross=mapBlocks[b].event.data.portalWithoutTrigger; if (canCross) { - if (core.status.replay.replaying) { + if (core.isReplaying()) { if (core.status.replay.toReplay[0]=='no') { core.status.replay.toReplay.shift(); core.status.route.push("no"); @@ -1472,7 +1472,7 @@ events.prototype.changeFloor = function (floorId, stair, heroLoc, time, callback if (!core.isset(time)) time = core.values.floorChangeTime; if (!core.isset(time)) time = 800; - var displayAnimate = time>=100 && !core.status.replay.replaying; + var displayAnimate = time>=100 && !core.isReplaying(); time /= 20; core.lockControl(); @@ -1730,7 +1730,7 @@ events.prototype.setVolume = function (value, time, callback) { ////// 画面震动 ////// events.prototype.vibrate = function(time, callback) { - if (core.isset(core.status.replay)&&core.status.replay.replaying) { + if (core.isReplaying()) { if (core.isset(callback)) callback(); return; } diff --git a/libs/maps.js b/libs/maps.js index 154a75d8..ed4eb1aa 100644 --- a/libs/maps.js +++ b/libs/maps.js @@ -1357,7 +1357,7 @@ maps.prototype.drawAnimateFrame = function (animate, centerX, centerY, index) { maps.prototype.drawAnimate = function (name, x, y, callback) { // 正在播放录像:不显示动画 - if (core.isset(core.status.replay) && core.status.replay.replaying) { + if (core.isReplaying()) { if (core.isset(callback)) callback(); return -1; } diff --git a/libs/ui.js b/libs/ui.js index fde72b85..97c20069 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -299,7 +299,7 @@ ui.prototype.drawText = function (contents, callback) { if (core.isset(contents)) { // 合并 - if ((core.isset(core.status.event)&&core.status.event.id=='action') || (core.isset(core.status.replay)&&core.status.replay.replaying)) { + if ((core.isset(core.status.event)&&core.status.event.id=='action') || core.isReplaying()) { core.insertAction(contents,null,null,callback); return; } diff --git a/libs/utils.js b/libs/utils.js index b30fd953..c0521ef2 100644 --- a/libs/utils.js +++ b/libs/utils.js @@ -558,7 +558,7 @@ utils.prototype.rand2 = function (num) { num = num||2147483648; var value; - if (core.status.replay.replaying) { + if (core.isReplaying()) { var action = core.status.replay.toReplay.shift(); if (action.indexOf("random:")==0 ) { value=parseInt(action.substring(7)); diff --git a/main.js b/main.js index 0454b03a..740a0c49 100644 --- a/main.js +++ b/main.js @@ -407,7 +407,7 @@ main.dom.data.ontouchend = function (e) { main.statusBar.image.book.onclick = function (e) { e.stopPropagation(); - if (core.isset(core.status.replay) && core.status.replay.replaying) { + if (core.isReplaying()) { core.triggerReplay(); return; } @@ -426,7 +426,7 @@ main.statusBar.image.fly.onclick = function (e) { e.stopPropagation(); // 播放录像时 - if (core.isset(core.status.replay) && core.status.replay.replaying) { + if (core.isReplaying()) { core.stopReplay(); return; } @@ -451,7 +451,7 @@ main.statusBar.image.fly.onclick = function (e) { main.statusBar.image.toolbox.onclick = function (e) { e.stopPropagation(); - if (core.isset(core.status.replay) && core.status.replay.replaying) { + if (core.isReplaying()) { core.rewindReplay(); return; } @@ -470,7 +470,7 @@ main.statusBar.image.toolbox.onclick = function (e) { main.statusBar.image.toolbox.ondblclick = function (e) { e.stopPropagation(); - if (core.isset(core.status.replay) && core.status.replay.replaying) { + if (core.isReplaying()) { core.rewindReplay(); return; } @@ -484,7 +484,7 @@ main.statusBar.image.toolbox.ondblclick = function (e) { main.statusBar.image.shop.onclick = function (e) { e.stopPropagation(); - if (core.isset(core.status.replay) && core.status.replay.replaying) { + if (core.isReplaying()) { core.bookReplay(); return; } @@ -497,7 +497,7 @@ main.statusBar.image.shop.onclick = function (e) { main.statusBar.image.save.onclick = function (e) { e.stopPropagation(); - if (core.isset(core.status.replay) && core.status.replay.replaying) { + if (core.isReplaying()) { core.speedDownReplay(); return; } @@ -515,7 +515,7 @@ main.statusBar.image.save.onclick = function (e) { main.statusBar.image.load.onclick = function (e) { e.stopPropagation(); - if (core.isset(core.status.replay) && core.status.replay.replaying) { + if (core.isReplaying()) { core.speedUpReplay(); return; } @@ -533,7 +533,7 @@ main.statusBar.image.load.onclick = function (e) { main.statusBar.image.settings.onclick = function (e) { e.stopPropagation(); - if (core.isset(core.status.replay) && core.status.replay.replaying) { + if (core.isReplaying()) { core.saveReplay(); return; } @@ -549,7 +549,7 @@ main.statusBar.image.settings.onclick = function (e) { ////// 点击工具栏时 ////// main.dom.toolBar.onclick = function () { - if (core.isset(core.status.replay) && core.status.replay.replaying) + if (core.isReplaying()) return; main.core.control.setToolbarButton(!core.domStyle.toolbarBtn); } diff --git a/project/functions.js b/project/functions.js index e1deee8f..3fb07776 100644 --- a/project/functions.js +++ b/project/functions.js @@ -55,7 +55,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = "win": function(reason, norank) { // 游戏获胜事件 core.ui.closePanel(); - var replaying = core.status.replay.replaying; + var replaying = core.isReplaying(); core.stopReplay(); core.waitHeroToStop(function() { core.clearMap('all'); // 清空全地图 @@ -75,7 +75,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = "lose": function(reason) { // 游戏失败事件 core.ui.closePanel(); - var replaying = core.status.replay.replaying; + var replaying = core.isReplaying(); core.stopReplay(); core.waitHeroToStop(function() { core.drawText([