mirror of
https://github.com/Gongxh0901/kunpolibrary
synced 2025-12-05 20:29:10 +00:00
仓库中添加内置的demo
This commit is contained in:
23
demo/assets/script/condition/Condition1.ts
Normal file
23
demo/assets/script/condition/Condition1.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* @Author: Gongxh
|
||||
* @Date: 2025-02-17
|
||||
* @Description: 条件1 关联数据conditon1
|
||||
*/
|
||||
import { GlobalEvent } from 'kunpocc-event';
|
||||
import { DataHelper } from '../Data/DataHelper';
|
||||
import { kunpo } from '../header';
|
||||
import { ConditionType } from './ConditionType';
|
||||
const { conditionClass } = kunpo._conditionDecorator;
|
||||
|
||||
@conditionClass(ConditionType.Condition1)
|
||||
export class Condition1 extends kunpo.ConditionBase {
|
||||
protected onInit(): void {
|
||||
GlobalEvent.add("condition1", () => {
|
||||
this.tryUpdate();
|
||||
}, this);
|
||||
}
|
||||
|
||||
protected evaluate(): boolean {
|
||||
return DataHelper.getValue("condition1", true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user