mirror of
https://github.com/motajs/template.git
synced 2026-10-19 21:30:30 +08:00
fix(07-05): #06-09-3 restore the dynamic tile num on load
- loadState 先 this.set(save.num),再恢复存档事件 - 取消 saveLoad.test.ts 的 num 恢复用例 skip
This commit is contained in:
parent
b1c20ea07d
commit
3b1b9f1d5c
@ -115,8 +115,12 @@ export class DynamicTile
|
||||
return save;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从存档恢复动态图块:先经 `set` 还原图块数字(同时重取原始图块并重建默认事件),
|
||||
* 再按存档逐条覆盖事件;`num` 与 `events` 即 `IDynamicBlockSave` 的全部字段。
|
||||
*/
|
||||
loadState(save: Readonly<IDynamicBlockSave>): void {
|
||||
this.restoreDefaultEvents();
|
||||
this.set(save.num);
|
||||
if (save.events) {
|
||||
const eventView = this.tileEvent();
|
||||
eventView.clear();
|
||||
|
||||
@ -160,8 +160,8 @@ describe('DynamicTile save and load round trips', () => {
|
||||
}
|
||||
});
|
||||
|
||||
// 疑似 bug:loadState 不恢复存档中的图块数字,详见 06-TEST-FINDINGS.md #06-09-3
|
||||
it.skip('restores the tile num on the same instance', () => {
|
||||
// 验证 loadState 恢复存档中的图块数字(#06-09-3 已修复)
|
||||
it('restores the tile num on the same instance', () => {
|
||||
const { layer } = createMapFixture();
|
||||
const tile = layer.createDynamic(1, 1, 0);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user