mirror of
https://github.com/motajs/template.git
synced 2026-10-09 14:00:18 +08:00
fix(08-05): expose MapTileBase.restoreDefaultEvents and use it in toStatic
- MapTileBase.restoreDefaultEvents: protected -> public; declare on ITileBase with jsDoc
- MapLayer.toStatic(keepEvent=false): reset reused static tile via restoreDefaultEvents() instead of loadState({})
This commit is contained in:
parent
0d41abdaf6
commit
58def1809d
@ -383,7 +383,7 @@ export class MapLayer
|
||||
staticTile.syncTileEvent(tile);
|
||||
} else {
|
||||
// 不保留事件时,将复用的静态图块重置为默认事件
|
||||
staticTile.loadState({});
|
||||
staticTile.restoreDefaultEvents();
|
||||
}
|
||||
this.removeDynamic(tile, tile.x, tile.y);
|
||||
this.forEachHook(hook => hook.onDeleteDynamic?.(tile));
|
||||
|
||||
@ -43,7 +43,7 @@ export abstract class MapTileBase<TSave extends IMapBlockSaveBase>
|
||||
/**
|
||||
* 根据当前图块原始数据恢复默认事件并建立干净基准
|
||||
*/
|
||||
protected restoreDefaultEvents(): void {
|
||||
restoreDefaultEvents(): void {
|
||||
const eventView = this.tileEvent();
|
||||
eventView.clear();
|
||||
const data = this.raw();
|
||||
|
||||
@ -139,6 +139,11 @@ export interface ITileBase extends IReadonlyTileBase {
|
||||
* @param origin 要从哪个图块复制
|
||||
*/
|
||||
syncTileEvent(origin: IReadonlyTileBase): void;
|
||||
|
||||
/**
|
||||
* 根据当前图块原始数据恢复默认事件并建立干净基准
|
||||
*/
|
||||
restoreDefaultEvents(): void;
|
||||
}
|
||||
|
||||
export interface IStaticTile
|
||||
|
||||
Loading…
Reference in New Issue
Block a user