1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- var t = require;
- var e = module;
- var i = exports;
- var s =
- (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});
- var {ccclass: e} = cc._decorator,
- e = s(
- [e],
- (e = class extends cc.Component {
- constructor() {
- super(...arguments), (this.btn = null), (this._init = !1);
- }
- initBtn() {
- var t, e, i, s, o, a;
- this._init ||
- cc.sys.platform !== cc.sys.WECHAT_GAME ||
- ((this._init = !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.createGameClubButton({
- type: "text",
- text: "",
- style: {
- left: i,
- top: s,
- width: o,
- height: a,
- lineHeight: 0,
- backgroundColor: "",
- color: "#3296fa",
- textAlign: "center",
- fontSize: 16,
- borderRadius: 4
- }
- })),
- this.btn.show());
- }
- onEnable() {
- this.btn && this.btn.show();
- }
- onDisable() {
- this.btn && this.btn.hide();
- }
- onDestroy() {
- this.btn && (this.btn.destroy(), (this.btn = null));
- }
- })
- );
- i.default = e;
|