fix: 大地图自动寻路

This commit is contained in:
unanmed 2024-10-03 17:25:21 +08:00
parent f98362f748
commit c6b701c9ff
5 changed files with 5 additions and 86 deletions

View File

@ -660,24 +660,6 @@ actions.prototype._sys_ondown = function (x, y, px, py) {
clearTimeout(core.timeout.onDownTimeout);
core.timeout.onDownTimeout = null;
core.status.preview.prepareDragging = false;
if (
!core.hasFlag('__lockViewport__') &&
(core.status.thisMap.width > core._WIDTH_ ||
core.status.thisMap.height > core._HEIGHT_)
) {
core.status.preview.prepareDragging = true;
core.status.preview.px = px;
core.status.preview.py = py;
core.timeout.onDownTimeout = setTimeout(function () {
core.clearMap('ui');
core.status.preview.prepareDragging = false;
core.status.preview.enabled = true;
core.status.preview.dragging = true;
core.drawTip('已进入预览模式,可直接拖动大地图');
core.status.stepPostfix = [];
}, 500);
}
};
////// 当在触摸屏上滑动时 //////
@ -730,24 +712,6 @@ actions.prototype._sys_onmove_choices = function (x, y, px, py) {
actions.prototype._sys_onmove = function (x, y, px, py) {
if (core.status.lockControl) return false;
if (core.status.preview?.dragging) {
core.setViewport(
core.bigmap.offsetX - px + core.status.preview.px,
core.bigmap.offsetY - py + core.status.preview.py
);
core.status.preview.px = px;
core.status.preview.py = py;
return true;
}
if (core.status.preview?.prepareDragging) {
if (
Math.abs(px - core.status.preview.px) <= 20 &&
Math.abs(py - core.status.preview.py) <= 20
)
return true;
else core.status.preview.prepareDragging = false;
}
clearTimeout(core.timeout.onDownTimeout);
core.timeout.onDownTimeout = null;
@ -810,14 +774,6 @@ actions.prototype._sys_onup = function (x, y, px, py) {
clearInterval(core.interval.onDownInterval);
core.interval.onDownInterval = null;
if (core.isPlaying()) {
core.status.preview.prepareDragging = false;
if (core.status.preview.dragging) {
core.status.preview.dragging = false;
return true;
}
}
if ((core.status.stepPostfix || []).length == 0) return false;
var stepPostfix = [];

View File

@ -229,8 +229,7 @@ control.prototype._animationFrame_globalAnimate = function (timestamp) {
if (
(core.status.hero || {}).animate &&
core.status.heroMoving == 0 &&
main.mode == 'play' &&
!core.status.preview.enabled
main.mode == 'play'
) {
core.drawHero('stop', null, core.status.globalAnimateStatus);
}

View File

@ -191,13 +191,6 @@ function core() {
// 按下键的时间:为了判定双击
downTime: null,
ctrlDown: false,
preview: {
enabled: false,
prepareDragging: false,
dragging: false,
px: 0,
py: 0
},
// 路线&回放
route: [],

View File

@ -171,8 +171,12 @@ export function init() {
adapters['hero-adapter']?.sync('setAnimateDir', value);
setHeroDirection(value as Dir);
} else if (name === 'x') {
// 为了防止逆天样板出问题
core.bigmap.posX = value as number;
adapters['hero-adapter']?.sync('setHeroLoc', value);
} else {
// 为了防止逆天样板出问题
core.bigmap.posY = value as number;
adapters['hero-adapter']?.sync('setHeroLoc', void 0, value);
}
};

33
src/types/status.d.ts vendored
View File

@ -542,33 +542,6 @@ interface AnimateObj {
callback: () => void;
}
interface ActionsPreview {
/**
*
*/
dragging: boolean;
/**
*
*/
enabled: boolean;
/**
*
*/
prepareDragging: boolean;
/**
*
*/
px: number;
/**
*
*/
py: number;
}
interface RouteFolding {
/**
*
@ -762,12 +735,6 @@ interface InitGameStatus {
[P in keyof NumberToId]: Block<P>;
};
/**
* @deprecated
*
*/
preview: ActionsPreview;
/**
*
*/