mirror of
https://github.com/Gongxh0901/kunpolibrary
synced 2025-04-20 18:38:40 +00:00
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
|
/**
|
||
|
* @Author: Gongxh
|
||
|
* @Date: 2025-02-14
|
||
|
* @Description: 条件显示模块
|
||
|
*/
|
||
|
import { _decorator } from "cc";
|
||
|
import { InnerTimer } from "../global/InnerTimer";
|
||
|
import { ModuleBase } from "../module/ModuleBase";
|
||
|
import { info } from "../tool/log";
|
||
|
import { ConditionManager } from "./ConditionManager";
|
||
|
|
||
|
const { ccclass, menu, property } = _decorator;
|
||
|
|
||
|
@ccclass("ConditionModule")
|
||
|
@menu("kunpo/condition/ConditionModule")
|
||
|
export class ConditionModule extends ModuleBase {
|
||
|
@property({
|
||
|
displayName: "更新间隔(秒)",
|
||
|
min: 0.1,
|
||
|
step: 0.1,
|
||
|
})
|
||
|
updateDeltaTime: number = 0.3;
|
||
|
|
||
|
/** 模块名称 */
|
||
|
public moduleName: string = "条件显示模块";
|
||
|
|
||
|
private _timer: number = 0;
|
||
|
public init(): void {
|
||
|
this.onInit();
|
||
|
|
||
|
this._timer = InnerTimer.startTimer(() => {
|
||
|
ConditionManager._update();
|
||
|
}, this.updateDeltaTime, -1);
|
||
|
}
|
||
|
|
||
|
/** 模块初始化完成后调用的函数 */
|
||
|
protected onInit(): void {
|
||
|
info("ConditionModule init complete");
|
||
|
}
|
||
|
|
||
|
public onDestroy(): void {
|
||
|
InnerTimer.stopTimer(this._timer);
|
||
|
}
|
||
|
}
|