var t = require; var e = module; var i = exports; var 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; }, s = (this && this.__awaiter) || function (t, n, r, l) { return new (r = r || Promise)(function (i, e) { function s(t) { try { a(l.next(t)); } catch (t) { e(t); } } function o(t) { try { a(l.throw(t)); } catch (t) { e(t); } } function a(t) { var e; t.done ? i(t.value) : ((e = t.value) instanceof r ? e : new r(function (t) { t(e); }) ).then(s, o); } a((l = l.apply(t, n || [])).next()); }); }; Object.defineProperty(i, "__esModule", {value: !0}); const h = t("App"), {ccclass: o} = cc._decorator; e = e( [o], (e = class extends cc.Component { constructor() { super(...arguments), (this.btn = null), (this._init = !1); } initBtn(n = "", r = "", l = "") { return s(this, void 0, void 0, function* () { var t, e, i, s, o, a; cc.sys.platform !== cc.sys.WECHAT_GAME ? (this.node.active = !1) : this._init || ((this._init = !0), (yield h.default.Platform.isAuthorization()) ? (this.node.active = !1) : ((this.node.active = !0), (t = this.node.getBoundingBoxToWorld()), (a = wx.getSystemInfoSync()), (e = cc.winSize), (i = (t.xMin / e.width) * a.windowWidth), (s = ((e.height - t.yMax) / e.height) * a.windowHeight), (o = (t.width / e.width) * a.windowWidth), (a = (t.height / e.height) * a.windowHeight), (this.btn = wx.createUserInfoButton({ type: "text", text: l, style: { left: i, top: s, width: o, height: a, lineHeight: 40, backgroundColor: n, color: r, textAlign: "center", fontSize: 16, borderRadius: 4 }, withCredentials: !1 })), this.btn.onTap(t => { if (t) { const e = h.default.GameDataMsr.playerInfo; (e.nickName = t.userInfo.nickName), (e.head = t.userInfo.avatarUrl); } this.node.active = !1; }), this.btn.show())); }); } onEnable() { this.btn && this.btn.show(); } onDisable() { this.btn && this.btn.hide(); } onDestroy() { this.btn && (this.btn.destroy(), (this.btn = null)); } onLoad() {} hideBtn() { this.btn && this.btn.hide(); } }) ); i.default = e;