draw arrow
This commit is contained in:
parent
386beccaa3
commit
9d3377e5df
@ -1026,11 +1026,14 @@ actions.prototype.clickViewMaps = function (x,y) {
|
|||||||
////// 查看地图界面时,按下某个键的操作 //////
|
////// 查看地图界面时,按下某个键的操作 //////
|
||||||
actions.prototype.keyDownViewMaps = function (keycode) {
|
actions.prototype.keyDownViewMaps = function (keycode) {
|
||||||
if (!core.isset(core.status.event.data)) return;
|
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==38||keycode==33) this.clickViewMaps(6, 3);
|
||||||
if (keycode==40||keycode==34) this.clickViewMaps(6, 9);
|
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==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);
|
if (keycode==68) this.clickViewMaps(12,6);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1042,12 +1045,12 @@ actions.prototype.keyUpViewMaps = function (keycode) {
|
|||||||
return;
|
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.clearMap('data');
|
||||||
core.setOpacity('data', 1);
|
core.setOpacity('data', 1);
|
||||||
core.ui.closePanel();
|
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) {
|
if (core.isset(core.status.replay)&&core.status.replay.replaying) {
|
||||||
core.bookReplay();
|
core.bookReplay();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -251,7 +251,16 @@ control.prototype.resetStatus = function(hero, hard, floorId, route, maps, value
|
|||||||
totalTime=core.status.hero.statistics.totalTime;
|
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
|
// 初始化status
|
||||||
core.status = core.clone(core.initStatus);
|
core.status = core.clone(core.initStatus);
|
||||||
@ -2019,8 +2028,11 @@ control.prototype.replay = function () {
|
|||||||
|
|
||||||
var pos=action.substring(5).split(":");
|
var pos=action.substring(5).split(":");
|
||||||
var x=parseInt(pos[0]), y=parseInt(pos[1]);
|
var x=parseInt(pos[0]), y=parseInt(pos[1]);
|
||||||
|
var nowx=core.getHeroLoc('x'), nowy=core.getHeroLoc('y');
|
||||||
if (core.control.moveDirectly(x,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 () {
|
setTimeout(function () {
|
||||||
|
core.clearMap('route');
|
||||||
core.replay();
|
core.replay();
|
||||||
}, 750 / Math.max(1, core.status.replay.speed));
|
}, 750 / Math.max(1, core.status.replay.speed));
|
||||||
return;
|
return;
|
||||||
@ -2724,6 +2736,7 @@ control.prototype.resize = function(clientWidth, clientHeight) {
|
|||||||
if (!core.flags.enableLevelUp) count--;
|
if (!core.flags.enableLevelUp) count--;
|
||||||
if (!core.flags.enableDebuff) count--;
|
if (!core.flags.enableDebuff) count--;
|
||||||
if (core.isset(core.flags.enableKeys) && !core.flags.enableKeys) count--;
|
if (core.isset(core.flags.enableKeys) && !core.flags.enableKeys) count--;
|
||||||
|
if (!core.flags.enablePZF) count--;
|
||||||
|
|
||||||
var statusLineHeight = BASE_LINEHEIGHT * 9 / count;
|
var statusLineHeight = BASE_LINEHEIGHT * 9 / count;
|
||||||
var statusLineFontSize = DEFAULT_FONT_SIZE;
|
var statusLineFontSize = DEFAULT_FONT_SIZE;
|
||||||
|
|||||||
22
libs/ui.js
22
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].beginPath();
|
||||||
core.canvas[map].moveTo(x1, y1);
|
core.canvas[map].moveTo(x1, y1);
|
||||||
core.canvas[map].lineTo(x2, y2);
|
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();
|
core.canvas[map].stroke();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user