Compare commits

..

1 Commits

Author SHA1 Message Date
AncTe
67e021ecd2
Merge 206bed7dc0 into 820dc5bf4c 2025-09-28 08:31:28 +00:00
4 changed files with 14 additions and 22 deletions

View File

@ -19,7 +19,6 @@ import {
Layer,
calNeedRenderOf
} from './layer';
import { MAP_BLOCK_WIDTH, MAP_HEIGHT, MAP_WIDTH } from '../shared';
/**
*
@ -168,9 +167,9 @@ export class Damage extends RenderItem<EDamageEvent> {
constructor() {
super('absolute', false, true);
this.block = new BlockCacher(0, 0, MAP_BLOCK_WIDTH, 1);
this.block = new BlockCacher(0, 0, core._WIDTH_, 1);
this.type = 'absolute';
this.size(MAP_WIDTH, MAP_HEIGHT);
this.size(core._PX_, core._PY_);
this.setHD(true);
this.setAntiAliasing(true);
}

View File

@ -3,12 +3,6 @@ import { HeroRenderer } from './hero';
import { ILayerGroupRenderExtends, LayerGroup } from './layer';
import { LayerGroupFloorBinder } from './layer';
import { hyper, TimingFn } from 'mutate-animate';
import {
MAP_BLOCK_HEIGHT,
MAP_BLOCK_WIDTH,
MAP_HEIGHT,
MAP_WIDTH
} from '../shared';
export class FloorViewport implements ILayerGroupRenderExtends {
id: string = 'viewport';
@ -68,8 +62,8 @@ export class FloorViewport implements ILayerGroupRenderExtends {
this.enabled = true;
const { x, y } = core.status.hero.loc;
const { x: nx, y: ny } = this.group.camera;
const halfWidth = MAP_WIDTH / 2;
const halfHeight = MAP_HEIGHT / 2;
const halfWidth = core._PX_ / 2;
const halfHeight = core._PY_ / 2;
const cell = this.group.cellSize;
const half = cell / 2;
this.applyPosition(
@ -100,8 +94,8 @@ export class FloorViewport implements ILayerGroupRenderExtends {
getBoundedPosition(x: number, y: number) {
if (!this.checkDependency()) return { x, y };
if (!this.boundX && !this.boundY) return { x, y };
const width = MAP_BLOCK_WIDTH;
const height = MAP_BLOCK_HEIGHT;
const width = core._WIDTH_;
const height = core._HEIGHT_;
const minX = (width - 1) / 2;
const minY = (height - 1) / 2;
const floor = core.status.maps[this.binder!.getFloor()];
@ -207,7 +201,7 @@ export class FloorViewport implements ILayerGroupRenderExtends {
this.applyPosition(nx, ny);
if (ending) {
if (this.ox === xTarget && this.oy === yTarget) {
if (this.ox === xTarget && this.oy == yTarget) {
this.hero!.off('moveTick', this.movingFramer);
return;
}
@ -282,8 +276,8 @@ export class FloorViewport implements ILayerGroupRenderExtends {
private applyPosition(x: number, y: number) {
if (!this.enabled) return;
if (x === this.nx && y === this.ny) return;
const halfWidth = MAP_WIDTH / 2;
const halfHeight = MAP_HEIGHT / 2;
const halfWidth = core._PX_ / 2;
const halfHeight = core._PY_ / 2;
const cell = this.group.cellSize;
const half = cell / 2;
this.nx = x;

View File

@ -9,7 +9,6 @@ import {
LayerGroupFloorBinder,
FloorViewport
} from './elements';
import { MAP_WIDTH } from './shared';
const loopMaps = MiscData.loopMaps;
@ -72,13 +71,13 @@ function enableLoopMapElement(floorId: FloorIds) {
// 这个是计算循环地图应该显示在哪
const [, y2] = transform.transformed(x1 - testPos, 0);
camera.reset();
camera.translate(MAP_WIDTH - testPos, y2);
loopLayer.pos(transform.x - MAP_WIDTH, 0);
camera.translate(core._PX_ - testPos, y2);
loopLayer.pos(transform.x - core._PX_, 0);
loopLayer.show();
loopLayer.update(loopLayer);
} else {
const [x2, y2] = transform.transformed(testPos, 0);
if (x2 < MAP_WIDTH) {
if (x2 < core._PX_) {
// 这个不用做其他运算,可以直接显示
camera.reset();
camera.translate(0, y2);

View File

@ -7,9 +7,9 @@ import { Font } from '@motajs/render-style';
/** 每个格子的宽高 */
export const CELL_SIZE = 32;
/** 地图格子宽度,此处仅影响画面,可能不影响游戏内的部分逻辑,游戏内逻辑地图大小请在 core.js 中修改 */
/** 地图格子宽度,此处仅影响画面,不影响游戏内逻辑,游戏内逻辑地图大小请在 core.js 中修改 */
export const MAP_BLOCK_WIDTH = 15;
/** 地图格子高度,此处仅影响画面,可能不影响游戏内的部分逻辑,游戏内逻辑地图大小请在 core.js 中修改 */
/** 地图格子高度,此处仅影响画面,不影响游戏内逻辑,游戏内逻辑地图大小请在 core.js 中修改 */
export const MAP_BLOCK_HEIGHT = 15;
/** 地图像素宽度 */
export const MAP_WIDTH = CELL_SIZE * MAP_BLOCK_WIDTH;