1ef94d41-f65f-413b-8903-62b4a56215aa.js
1.38 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"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();