* feat: 添加 Tilemap 编辑器插件和组件生命周期支持 * feat(editor-core): 添加声明式插件注册 API * feat(editor-core): 改进tiledmap结构合并tileset进tiledmapeditor * feat: 添加 editor-runtime SDK 和插件系统改进 * fix(ci): 修复SceneResourceManager里变量未使用问题
32 lines
920 B
TypeScript
32 lines
920 B
TypeScript
/**
|
|
* Tilemap Tool Interface
|
|
*/
|
|
|
|
import type { TilemapComponent } from '@esengine/tilemap';
|
|
import type { TileSelection } from '../stores/TilemapEditorStore';
|
|
|
|
export interface ToolContext {
|
|
tilemap: TilemapComponent;
|
|
selectedTiles: TileSelection | null;
|
|
currentLayer: number;
|
|
layerLocked: boolean;
|
|
brushSize: number;
|
|
editingCollision: boolean;
|
|
tileWidth: number;
|
|
tileHeight: number;
|
|
}
|
|
|
|
export interface ITilemapTool {
|
|
readonly id: string;
|
|
readonly name: string;
|
|
readonly icon: string;
|
|
readonly cursor: string;
|
|
|
|
onMouseDown(tileX: number, tileY: number, ctx: ToolContext): void;
|
|
onMouseMove(tileX: number, tileY: number, ctx: ToolContext): void;
|
|
onMouseUp(tileX: number, tileY: number, ctx: ToolContext): void;
|
|
|
|
// Preview tiles to highlight during drag
|
|
getPreviewTiles?(tileX: number, tileY: number, ctx: ToolContext): { x: number; y: number }[];
|
|
}
|