mirror of
https://github.com/unanmed/HumanBreak.git
synced 2026-11-03 01:54:58 +08:00
feat: 伤害渲染 & EventEmitter自动补全
This commit is contained in:
1 parent
fe57adf6af
commit
c916b957c2
29 files changed
+1180
-497
No files matched your search
@@ -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
@@ -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';
|
||||
|
||||
Reference in new issue
Block a user