123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- 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("PanelAni"),
- a = t("NotificationConst"),
- n = t("MachineService"),
- r = t("MapService"),
- {ccclass: l, property: h} = cc._decorator;
- t = class extends cc.Component {
- constructor() {
- super(...arguments),
- (this.btnLab = null),
- (this.btn = null),
- (this.bgNode = null),
- (this.panelAni = null),
- (this.machineData = null);
- }
- onLoad() {
- (this.node.zIndex = 10), this.node.removeFromParent(!1);
- }
- onTouchBtn() {
- s.default.SoundManager.playEffect("clickBtn"),
- n.default.ins.unlockMachine(this.machineData.cfg.machine_num - 1),
- this.node.removeFromParent(!1),
- (this.machineData = null);
- }
- onUpdateMoney() {
- this.btn.interactable = this.machineData.canUnlock();
- }
- onDisable() {
- s.default.NotificationCenter.removeListener(a.NotificationConst.UPDATE_MONEY, this.onUpdateMoney, this);
- }
- showBox(t) {
- if (t != this.machineData) {
- s.default.NotificationCenter.addListener(a.NotificationConst.UPDATE_MONEY, this.onUpdateMoney, this),
- (this.btn.interactable = t.canUnlock()),
- (this.machineData = t),
- (this.btnLab.string = t.cfg.install_cost),
- (this.node.scale = 0);
- const i = t.getPos();
- i.y += 0;
- var e = 100 + this.node.width / 2,
- t = cc.view.getVisibleSize().width - this.node.width / 2 - 50;
- i.x < e ? (this.bgNode.x = 60) : i.x > t ? (this.bgNode.x = -60) : (this.bgNode.x = 0),
- (this.node.position = i),
- this.node.parent || r.default.ins.mapNode.addChild(this.node),
- this.playShowAni();
- } else this.playHideAni();
- }
- playShowAni() {
- this.panelAni.showPanel();
- }
- playHideAni() {
- this.panelAni.hidePanel(() => {
- this.node.removeFromParent(!1), (this.machineData = null);
- });
- }
- };
- e([h(cc.Label)], t.prototype, "btnLab", void 0),
- e([h(cc.Button)], t.prototype, "btn", void 0),
- e([h(cc.Node)], t.prototype, "bgNode", void 0),
- e([h(o.PanelAni)], t.prototype, "panelAni", void 0),
- (t = e([l], t)),
- (i.default = t);
|