1ef94d41-f65f-413b-8903-62b4a56215aa.js 1.38 KB
"use strict";
cc._RF.push(module, '1ef941B9l9BO4kDYrSlYhWq', 'ScheduleUtils');
// script/common/utils/ScheduleUtils.ts

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ScheduleUtils = void 0;
var ScheduleUtils;
(function (ScheduleUtils) {
    let scheduleWrapper;
    let scheduleWrapperId = 0;
    function getSchedulerWrapper(func) {
        if (func._wrapper)
            return func._wrapper;
        if (!scheduleWrapper) {
            scheduleWrapper = cc.Class({
                name: "cc.schedulerWrapper",
                ctor: function (func) {
                    this.func = func;
                },
                update: function (dt) {
                    this.func(dt);
                }
            });
        }
        let wrapper = func._wrapper = new scheduleWrapper(func);
        wrapper._id = "avg_schedule_wrapper_" + (scheduleWrapperId++);
        return wrapper;
    }
    function scheduleUpdate(target) {
        cc.director.getScheduler().scheduleUpdate(getSchedulerWrapper(target), 0, false);
    }
    ScheduleUtils.scheduleUpdate = scheduleUpdate;
    function unscheduleUpdate(target) {
        if (target._wrapper)
            cc.director.getScheduler().unscheduleUpdate(target._wrapper);
    }
    ScheduleUtils.unscheduleUpdate = unscheduleUpdate;
})(ScheduleUtils = exports.ScheduleUtils || (exports.ScheduleUtils = {}));

cc._RF.pop();