12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- 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("RedPointMgr"),
- { ccclass: a, property: n, menu: r, executeInEditMode: l } = cc._decorator;
- t = class extends cc.Component {
- constructor() {
- super(...arguments),
- (this._isMulti = !1),
- (this.types = []),
- (this._type = 0),
- (this.numLab = null),
- (this.redNode = null);
- }
- set isMulti(t) {
- (this._isMulti = t) || (this.types.length = 1);
- }
- get isMulti() {
- return this._isMulti;
- }
- set type(t) {
- this.isMulti ? (this._type = t) : (this.types[0] = Object.keys(o.RedPointMgr.types)[t]);
- }
- get type() {
- return this.isMulti ? this._type : Object.keys(o.RedPointMgr.types).indexOf(this.types[0]);
- }
- addType() {
- var t;
- !this.isMulti ||
- ((t = Object.keys(o.RedPointMgr.types)[this._type]) && -1 === this.types.indexOf(t) && this.types.push(t));
- }
- deleteType() {
- var t;
- !this.isMulti || ((t = Object.keys(o.RedPointMgr.types)[this._type]) && this.types.remove(t));
- }
- onLoad() {}
- onEnable() {
- this.types.length &&
- this.redNode &&
- (1 === this.types.length ?
- s.default.RedPointMgr.subscribe(this.types[0], this.onUpdateRed, this) :
- s.default.RedPointMgr.subscribeGroup(this.types, this.onUpdateRed, this));
- }
- onDisable() {
- this.types.length &&
- this.redNode &&
- (1 === this.types.length ?
- s.default.RedPointMgr.unsubscribe(this.types[0], this.onUpdateRed, this) :
- s.default.RedPointMgr.unsubscribeGroup(this));
- }
- onUpdateRed(t) {
- "number" == typeof t
- ?
- (this.numLab && ((this.numLab.string = t + ""), (this.numLab.node.active = !0)),
- (this.redNode.active = !!t)) :
- (this.numLab && (this.numLab.node.active = !1), (this.redNode.active = t));
- }
- };
- e([n({ editorOnly: !0 })], t.prototype, "_isMulti", void 0),
- e([n({})], t.prototype, "isMulti", null),
- e(
- [
- n({
- type: cc.String,
- readonly: !0,
- visible: function() {
- return this.isMulti;
- }
- })
- ],
- t.prototype,
- "types",
- void 0
- ),
- e([n({ editorOnly: !0 })], t.prototype, "_type", void 0),
- e([n({ type: cc.Enum({}) })], t.prototype, "type", null),
- e([n(cc.Label)], t.prototype, "numLab", void 0),
- e([n(cc.Node)], t.prototype, "redNode", void 0),
- (t = e([a, l], t)),
- (i.default = t);
|