# Function: onActiveBuffInfoChange
▸ onActiveBuffInfoChange(handler
: ActiveBuffInfoChangeEventHandler): void
注册 增益项目状态信息改变 事件处理函数
example
import { buffSystem } from '@timi/mogs-sdk';
buffSystem.onActiveBuffInfoChange((event) => {
switch (event.type) {
case buffSystem.ActiveBuffInfoChangeEventType.Add:
console.log(
'新 Buff 生效:',
event.previousValue === null,
event.currentValue,
);
break;
case buffSystem.ActiveBuffInfoChangeEventType.Remove:
console.log(
'现有 Buff 失效:',
event.previousValue,
event.currentValue === null,
);
break;
case buffSystem.ActiveBuffInfoChangeEventType.Update:
console.log(
'现有 Buff 信息更新:',
event.previousValue,
event.currentValue,
);
break;
}
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# 参数:
属性 | 类型 |
---|---|
handler | ActiveBuffInfoChangeEventHandler |
# 返回值:
void