mirror of
https://github.com/motajs/template.git
synced 2026-11-30 18:54:30 +08:00
refactor: 重写缩略图组件
This commit is contained in:
1 parent
282875c956
commit
d29d0f7dbe
11 files changed
+570
-156
No files matched your search
@@ -15,6 +15,14 @@ import {
|
||||
import { createCoreStateConfig } from '../data/entry';
|
||||
import { MainClientPlugin } from './initialize';
|
||||
import { clientPlugins } from './plugin';
|
||||
import {
|
||||
CELL_HEIGHT,
|
||||
CELL_WIDTH,
|
||||
MAP_BLOCK_HEIGHT,
|
||||
MAP_BLOCK_WIDTH,
|
||||
MAP_HEIGHT,
|
||||
MAP_WIDTH
|
||||
} from './uiConstant';
|
||||
|
||||
/**
|
||||
* 创建渲染端配置对象
|
||||
@@ -30,6 +38,12 @@ export function createClientCoreConfig(
|
||||
rendererCanvas: RENDER_CANVAS,
|
||||
renderWidth: RENDER_WIDTH,
|
||||
renderHeight: RENDER_HEIGHT,
|
||||
mapCellWidth: CELL_WIDTH,
|
||||
mapCellHeight: CELL_HEIGHT,
|
||||
mapBlockWidth: MAP_BLOCK_WIDTH,
|
||||
mapBlockHeight: MAP_BLOCK_HEIGHT,
|
||||
expandMapRendererWidth: MAP_WIDTH,
|
||||
expandMapRendererHeight: MAP_HEIGHT,
|
||||
clientPlugins: [new MainClientPlugin(), ...clientPlugins],
|
||||
|
||||
...createCoreStateConfig(starter)
|
||||
|
||||
@@ -8,9 +8,9 @@ import { ElementLocator, Font } from '@motajs/render';
|
||||
export const CELL_WIDTH = 32;
|
||||
/** 每个格子的高度 */
|
||||
export const CELL_HEIGHT = 32;
|
||||
/** 地图格子宽度,此处仅影响画面,不影响游戏内逻辑,游戏内逻辑地图大小请在 core.js 中修改 */
|
||||
/** 地图画面的格子宽度,即在正常情况下,游戏画面横向会显示多少格子,同时作为分块宽度使用 */
|
||||
export const MAP_BLOCK_WIDTH = 13;
|
||||
/** 地图格子高度,此处仅影响画面,不影响游戏内逻辑,游戏内逻辑地图大小请在 core.js 中修改 */
|
||||
/** 地图画面的格子高度,即在正常情况下,游戏画面纵向会显示多少格子,同时作为分块宽度使用 */
|
||||
export const MAP_BLOCK_HEIGHT = 13;
|
||||
/** 地图像素宽度 */
|
||||
export const MAP_WIDTH = CELL_WIDTH * MAP_BLOCK_WIDTH;
|
||||
@@ -20,18 +20,6 @@ export const MAP_HEIGHT = CELL_HEIGHT * MAP_BLOCK_HEIGHT;
|
||||
export const HALF_MAP_WIDTH = MAP_WIDTH / 2;
|
||||
/** 地图高度的一半 */
|
||||
export const HALF_MAP_HEIGHT = MAP_HEIGHT / 2;
|
||||
/**
|
||||
* 动态内容预留,不明白含义的话不要动。地图上所有正在移动的图块称为动态内容,这些内容的数量无法预测,因此需要预留数组大小,
|
||||
* 如果不够再临时扩充。如果你的塔中有大量的移动操作,可以适当提高此值,避免频繁的内存扩充行为,可以一定程度上提高性能表现。
|
||||
*/
|
||||
export const DYNAMIC_RESERVE = 16;
|
||||
/**
|
||||
* 移动图块容忍度,不明白含义的话不要动。如果移动图块的数量长期小于当前预留数量,那么将会降低预留数量,提升性能表现。
|
||||
* 调整此值可以调整频率,值越大,越不容易因为数量小于预留数量而减小预留。
|
||||
*/
|
||||
export const MOVING_TOLERANCE = 60;
|
||||
/** 开关门动画的动画时长 */
|
||||
export const DOOR_ANIMATE_INTERVAL = 50;
|
||||
|
||||
//#endregion
|
||||
|
||||
@@ -65,14 +53,7 @@ export const HALF_HEIGHT = MAIN_HEIGHT / 2;
|
||||
/** 全屏显示的 loc */
|
||||
export const FULL_LOC: ElementLocator = [0, 0, MAIN_WIDTH, MAIN_HEIGHT];
|
||||
/** 居中显示的 loc */
|
||||
export const CENTER_LOC: ElementLocator = [
|
||||
HALF_WIDTH,
|
||||
HALF_HEIGHT,
|
||||
void 0,
|
||||
void 0,
|
||||
0.5,
|
||||
0.5
|
||||
];
|
||||
export const CENTER_LOC: ElementLocator = [HALF_WIDTH, HALF_HEIGHT];
|
||||
|
||||
//#endregion
|
||||
|
||||
|
||||
Reference in new issue
Block a user