mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-01-19 04:19:30 +08:00
fix: 显伤层报错
This commit is contained in:
parent
d535fe82c0
commit
dbae5a7c7d
@ -130,24 +130,20 @@ export class BlockCacher<
|
||||
if (deep & (1 << i)) {
|
||||
const nowIndex = index * this.cacheDepth + i;
|
||||
const item = this.cache.get(nowIndex);
|
||||
if (item) {
|
||||
item.destroy();
|
||||
item?.destroy();
|
||||
this.cache.delete(nowIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空指定索引的缓存,与 {@link clearCache} 不同的是,这里会直接清空对应索引的缓存,而不是指定分块的缓存(分块->void)
|
||||
*/
|
||||
clearCacheByIndex(index: number, func: (item: T) => void) {
|
||||
clearCacheByIndex(index: number) {
|
||||
const item = this.cache.get(index);
|
||||
if (item) {
|
||||
item.destroy();
|
||||
item?.destroy();
|
||||
this.cache.delete(index);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空所有缓存
|
||||
|
@ -503,7 +503,8 @@ export class Damage extends RenderItem<EDamageEvent> {
|
||||
this.emit('dirtyUpdate', v);
|
||||
|
||||
// 否则依次渲染并写入缓存
|
||||
const temp = cache?.canvas ?? new MotaOffscreenCanvas2D();
|
||||
const temp =
|
||||
block.cache.get(v)?.canvas ?? new MotaOffscreenCanvas2D();
|
||||
temp.clear();
|
||||
temp.setHD(true);
|
||||
temp.setAntiAliasing(true);
|
||||
|
Loading…
Reference in New Issue
Block a user