123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- 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 });
- const { ccclass: o, property: a, menu: n, executeInEditMode: r, playOnFocus: l } = cc._decorator;
- e = class extends cc.Component {
- constructor() {
- super(...arguments),
- (this._isShow = !0),
- (this._btns = []),
- (this._bgMinHeight = 100),
- (this._bgHeight = 0),
- (this.contractionBtn = null),
- (this.bgNode = null);
- }
- set isShow(t) {
- this.buttonChange();
- }
- get isShow() {
- return this._isShow;
- }
- set btns(t) {
- (this._btns = t), this.onChildChange();
- }
- get btns() {
- return this._btns;
- }
- onLoad() {}
- onChildChange() {
- var e = this._btns.length;
- this._bgHeight = this._bgMinHeight;
- let i = -64;
- for (let t = 0; t < e && this._btns[t]; t++)
- (this._bgHeight += 10 + this._btns[t].height),
- (this._btns[t].y = i),
- (this._btns[t].active = !0),
- (i -= 10 + this._btns[t].height);
- (this._isShow = !0), (this.contractionBtn.node.y = 40 - this._bgHeight), (this.bgNode.height = this._bgHeight);
- }
- buttonChange() {
- if (((this.contractionBtn.interactable = !1), (this._isShow = !this._isShow), this._isShow)) {
- cc.tween(this.bgNode).to(0.2, { height: this._bgHeight }).start(),
- cc
- .tween(this.contractionBtn.node)
- .to(0.2, { angle: 180, y: 40 - this._bgHeight })
- .start();
- let i = e => {
- if (e > this.btns.length - 1) this.contractionBtn.interactable = !0;
- else {
- let t = this.btns[e];
- (t.active = !0),
- cc
- .tween(t)
- .to(0.1, { y: t.y - t.height, opacity: 255 }, { easing: cc.easing.sineOut })
- .call(() => {
- i(++e);
- })
- .start();
- }
- };
- i(0);
- } else {
- cc
- .tween(this.contractionBtn.node)
- .to(0.2, { angle: 0, y: 40 - this._bgMinHeight })
- .start(),
- cc.tween(this.bgNode).to(0.2, { height: this._bgMinHeight }).start();
- let i = e => {
- if (e < 0) this.contractionBtn.interactable = !0;
- else {
- let t = this.btns[e];
- cc.tween(t)
- .to(0.1, { y: t.y + t.height, opacity: 0 }, { easing: cc.easing.sineOut })
- .call(() => {
- i(--e), (t.active = !1);
- })
- .start();
- }
- };
- i(this.btns.length - 1);
- }
- }
- };
- s([a], e.prototype, "_isShow", void 0),
- s([a({})], e.prototype, "isShow", null),
- s([a()], e.prototype, "_btns", void 0),
- s([a({ type: cc.Node })], e.prototype, "btns", null),
- s([a], e.prototype, "_bgMinHeight", void 0),
- s([a], e.prototype, "_bgHeight", void 0),
- s([a({ type: cc.Button })], e.prototype, "contractionBtn", void 0),
- s([a({ type: cc.Node })], e.prototype, "bgNode", void 0),
- (e = s([o, r, l], e)),
- (i.default = e);
|