diff --git a/libs/actions.js b/libs/actions.js index 20419c23..772182a5 100644 --- a/libs/actions.js +++ b/libs/actions.js @@ -1026,11 +1026,14 @@ actions.prototype.clickViewMaps = function (x,y) { ////// 查看地图界面时,按下某个键的操作 ////// actions.prototype.keyDownViewMaps = function (keycode) { if (!core.isset(core.status.event.data)) return; + + var floorId = core.floorIds[core.status.event.data.index], mh = core.floors[floorId].height||13; + if (keycode==38||keycode==33) this.clickViewMaps(6, 3); if (keycode==40||keycode==34) this.clickViewMaps(6, 9); - if (keycode==87) this.clickViewMaps(6,0); + if (keycode==87 && mh>13) this.clickViewMaps(6,0); if (keycode==65) this.clickViewMaps(0,6); - if (keycode==83) this.clickViewMaps(6,12); + if (keycode==83 && mh>13) this.clickViewMaps(6,12); if (keycode==68) this.clickViewMaps(12,6); return; } @@ -1042,12 +1045,12 @@ actions.prototype.keyUpViewMaps = function (keycode) { return; } - if (keycode==27 || keycode==13 || keycode==32 || keycode==67) { + if (keycode==27 || keycode==13 || keycode==32 || (!core.status.replay.replaying && keycode==67)) { core.clearMap('data'); core.setOpacity('data', 1); core.ui.closePanel(); } - if (keycode==88) { + if (keycode==88 || (core.status.replay.replaying && keycode==67)) { if (core.isset(core.status.replay)&&core.status.replay.replaying) { core.bookReplay(); } else { diff --git a/libs/control.js b/libs/control.js index 109d5953..3a524ea6 100644 --- a/libs/control.js +++ b/libs/control.js @@ -251,7 +251,16 @@ control.prototype.resetStatus = function(hero, hard, floorId, route, maps, value totalTime=core.status.hero.statistics.totalTime; } - this.clearStatus(); + // 停止各个Timeout和Interval + for (var i in core.timeout) { + clearTimeout(core.timeout[i]); + core.timeout[i] = null; + } + for (var i in core.interval) { + clearInterval(core.interval[i]); + core.interval[i] = null; + } + core.clearStatusBar(); // 初始化status core.status = core.clone(core.initStatus); @@ -2019,8 +2028,11 @@ control.prototype.replay = function () { var pos=action.substring(5).split(":"); var x=parseInt(pos[0]), y=parseInt(pos[1]); + var nowx=core.getHeroLoc('x'), nowy=core.getHeroLoc('y'); if (core.control.moveDirectly(x,y)) { + core.ui.drawArrow('route', 32*nowx+16, 32*nowy+16, 32*x+16, 32*y+16, '#FF0000', 3); setTimeout(function () { + core.clearMap('route'); core.replay(); }, 750 / Math.max(1, core.status.replay.speed)); return; @@ -2724,6 +2736,7 @@ control.prototype.resize = function(clientWidth, clientHeight) { if (!core.flags.enableLevelUp) count--; if (!core.flags.enableDebuff) count--; if (core.isset(core.flags.enableKeys) && !core.flags.enableKeys) count--; + if (!core.flags.enablePZF) count--; var statusLineHeight = BASE_LINEHEIGHT * 9 / count; var statusLineFontSize = DEFAULT_FONT_SIZE; diff --git a/libs/ui.js b/libs/ui.js index 1d80b92c..7b2b8ce1 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -68,7 +68,27 @@ ui.prototype.drawLine = function (map, x1, y1, x2, y2, style, lineWidth) { core.canvas[map].beginPath(); core.canvas[map].moveTo(x1, y1); core.canvas[map].lineTo(x2, y2); - core.canvas[map].closePath(); + core.canvas[map].stroke(); +} + +////// 在某个canvas上绘制一个箭头 ////// +ui.prototype.drawArrow = function (map, x1, y1, x2, y2, style, lineWidth) { + if (x1==x2 && y1==y2) return; + if (core.isset(style)) { + core.setStrokeStyle(map, style); + } + if (core.isset(lineWidth)) { + core.setLineWidth(map, lineWidth); + } + var head = 10; + var dx = x2-x1, dy=y2-y1; + var angle = Math.atan2(dy,dx); + core.canvas[map].beginPath(); + core.canvas[map].moveTo(x1,y1); + core.canvas[map].lineTo(x2, y2); + core.canvas[map].lineTo(x2-head*Math.cos(angle-Math.PI/6),y2-head*Math.sin(angle-Math.PI/6)); + core.canvas[map].moveTo(x2, y2); + core.canvas[map].lineTo(x2-head*Math.cos(angle+Math.PI/6),y2-head*Math.sin(angle+Math.PI/6)); core.canvas[map].stroke(); }