feat: 伤害渲染 & EventEmitter自动补全

This commit is contained in:
AncTe committed 2024-05-23 23:55:08 +08:00
1 parent fe57adf6af
commit c916b957c2
29 files changed
+1180 -497

No files matched your search

+28
View File
@@ -96,3 +96,31 @@ Range.registerRangeType(
);
}
);
Range.registerRangeType(
'rect',
(col, { x, y, w, h }) => {
const list = col.collection.list;
const ex = x + w;
const ey = y + h;
return list.filter(v => {
return (
has(v.x) &&
has(v.y) &&
v.x >= x &&
v.y >= y &&
v.x < ex &&
v.y < ey
);
});
},
(col, { x, y, w, h }, item) => {
const ex = x + w;
const ey = y + h;
const v = item;
return (
has(v.x) && has(v.y) && v.x >= x && v.y >= y && v.x < ex && v.y < ey
);
}
);
+1 -1
View File
@@ -43,7 +43,7 @@ export function has<T>(value: T): value is NonNullable<T> {
* 根据伤害大小获取颜色
* @param damage 伤害大小
*/
export function getDamageColor(damage: number): Color {
export function getDamageColor(damage: number): string {
if (typeof damage !== 'number') return '#f00';
if (damage === 0) return '#2f2';
if (damage < 0) return '#7f7';