123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- var t = require;
- var e = module;
- var i = exports;
- e =
- (this && this.__decorate) ||
- function (t, e, i, s) {
- var o,
- a = arguments.length,
- n = a < 3 ? e : null === s ? (s = Object.getOwnPropertyDescriptor(e, i)) : s;
- if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) n = Reflect.decorate(t, e, i, s);
- else
- for (var r = t.length - 1; 0 <= r; r--)
- (o = t[r]) && (n = (a < 3 ? o(n) : 3 < a ? o(e, i, n) : o(e, i)) || n);
- return 3 < a && n && Object.defineProperty(e, i, n), n;
- };
- Object.defineProperty(i, "__esModule", {value: !0});
- const s = t("App"),
- o = t("RoleService"),
- a = t("Chef"),
- n = t("ChefAI"),
- {ccclass: r} = cc._decorator;
- e = e(
- [r],
- (e = class extends cc.Component {
- constructor() {
- super(...arguments),
- (this.progress = null),
- (this.manAI = null),
- (this.leftTime = null),
- (this._hireEndTime = 0),
- (this._holdTime = 0),
- (this._callBack = null),
- (this._target = null);
- }
- onLoad() {
- this.manAI = this.getComponent(n.default);
- const t = s.default.NodePoolMsr.catLefttimeProgressPool.pop();
- (t.zIndex = -1), (this.progress = t.getComponent(cc.ProgressBar)), this.node.addChild(t);
- }
- update(t) {}
- onDestroy() {
- this.progress.isValid && this.progress.node.destroy();
- }
- setLeftTime(t, e) {
- (this._hireEndTime = t), (this._holdTime = e), (this.update = this.updateProgress);
- }
- setCallBack(t, e) {
- (this._callBack = t), (this._target = e);
- }
- removeImmediately() {
- this.update = this.checkCanDestory;
- }
- checkCanDestory() {
- (this.manAI.state !== n.AI_STATE.NONE &&
- this.manAI.state !== n.AI_STATE.REST &&
- this.manAI.state !== n.AI_STATE.MOVE_TO_REST &&
- this.manAI.state !== n.AI_STATE.DEEP_REST) ||
- (o.default.ins.removeEmployee(this.getComponent(a.default)),
- this._callBack && this._callBack.call(this._target));
- }
- updateProgress() {
- var t = (this._hireEndTime - s.default.DateUtils.Now()) / this._holdTime;
- 0 < t
- ? (this.progress.progress = t)
- : ((this.progress.progress = 1e-4), (this.update = this.checkCanDestory));
- }
- })
- );
- i.default = e;
|