123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- 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 o = t("App"),
- s = t("ListView"),
- a = t("BaseView"),
- n = (t("ViewConst"), t("GameUtils")),
- r = t("CostumeConst"),
- l = t("CostumeController"),
- h = t("CostumeBagItem"),
- c = t("CostumeMergeItem"),
- {ccclass: d, property: u} = cc._decorator;
- t = class extends a.default {
- constructor() {
- super(...arguments),
- (this.mergeNode = null),
- (this.newItemSpecialSpr = null),
- (this.newItemNameLab = null),
- (this.newItemCurLab = null),
- (this.newItemUpgradeLab = null),
- (this.newItemSpecialRichText = null),
- (this.mergeBtn = null),
- (this.costLab = null),
- (this.mergeItemsNode = null),
- (this.selectNode = null),
- (this.itemList = null),
- (this.newItemDisplay = null),
- (this.targetDisplay = null),
- (this.costItemDisplay1 = null),
- (this.costItemDisplay2 = null),
- (this.items = null),
- (this.bgType = 1),
- (this.targetItem = null),
- (this._model = null);
- }
- initUI() {
- super.initUI(), this.itemList.node.on(s.ListViewEvent.ITEM_TAP, this.onSelectItem, this);
- }
- onItemMerge() {
- var t = this.itemList.selectedItems.slice(1),
- e = l.default.ins.mergeCostume(this.targetItem, t);
- e &&
- (o.default.ViewManager.open(47, t, this.targetItem, e.refundDiamond),
- (this.targetItem = null),
- l.default.ins.updateMergeInfo(),
- this.toNormalState(),
- this.updateList(),
- this.itemList.updateViewPort());
- }
- open() {
- super.open(),
- (this._model = l.default.ins.getModel()),
- l.default.ins.updateMergeInfo(),
- this.toNormalState(),
- this.updateList();
- }
- close() {
- super.close(), (this._model = null);
- }
- toNormalState() {
- (this.mergeNode.active = !1), (this.selectNode.active = !0);
- }
- toSelectState() {
- (this.mergeNode.active = !0), (this.selectNode.active = !1);
- }
- onRenderItem(t, e) {
- const i = t.getComponent(c.CostumeMergeItem),
- s = this.items[e];
- i.setData(s);
- }
- onSelectItem(t, e) {
- if (this.targetItem) {
- if (t.data === this.targetItem) this.setTarget(null), this.updateList();
- else {
- const t = this.itemList.selectedItems;
- t.length === this.itemList.maxMultipleSelectNum
- ? this.updateMergeBtnState(!0)
- : this.updateMergeBtnState(!1),
- 1 < t.length
- ? (this.costItemDisplay1.show(), this.costItemDisplay1.setData(t[1]))
- : this.costItemDisplay1.hide(),
- 2 < t.length
- ? (this.costItemDisplay2.show(), this.costItemDisplay2.setData(t[2]))
- : this.costItemDisplay2.hide();
- }
- } else this.setTarget(t.data), this.toSelectState();
- }
- setTarget(t) {
- if ((this.targetItem = t)) {
- this.newItemNameLab.string = t.getName();
- const i = t.getNextGradeItem();
- this.newItemDisplay.setData(i),
- (this.newItemCurLab.string = t.getBaseValueStr()),
- (this.newItemUpgradeLab.string = i.getBaseValueStr()),
- (this.newItemSpecialSpr.node.active = !0),
- i.data.grade === r.RarityType.rare
- ? ((this.newItemSpecialRichText.string = i.getSpecialAbilityStr1()),
- o.default.CommonUtils.setSpriteFrame(r.getGradeBgByGrade(i.data.grade), this.newItemSpecialSpr))
- : i.data.grade === r.RarityType.epic
- ? ((this.newItemSpecialRichText.string = i.getSpecialAbilityStr2()),
- o.default.CommonUtils.setSpriteFrame(r.getGradeBgByGrade(i.data.grade), this.newItemSpecialSpr))
- : i.data.grade === r.RarityType.legendary
- ? ((this.newItemSpecialRichText.string = i.getSpecialAbilityStr3()),
- o.default.CommonUtils.setSpriteFrame(r.getGradeBgByGrade(i.data.grade), this.newItemSpecialSpr))
- : i.data.grade === r.RarityType.mystic
- ? ((this.newItemSpecialRichText.string = i.getSpecialAbilityStr4()),
- o.default.CommonUtils.setSpriteFrame(r.getGradeBgByGrade(i.data.grade), this.newItemSpecialSpr))
- : ((this.newItemSpecialRichText.string = ""), (this.newItemSpecialSpr.node.active = !1)),
- this.targetDisplay.setData(t);
- var e = t.getMergeCfg();
- this.costItemDisplay1.hide(),
- 2 === e.costume_count
- ? (this.costItemDisplay2.hide(), (this.costItemDisplay2.node.active = !0))
- : (this.costItemDisplay2.node.active = !1),
- this.updateMergeBtnState(!1),
- (this.itemList.maxMultipleSelectNum = 1 + e.costume_count);
- const s = this._model.getMergeCostume(t);
- s.includes(t) || s.unshift(t),
- this.itemList.updateDataSource(s),
- this.itemList.select([t]),
- this.itemList.updateViewPort();
- } else this.toNormalState();
- }
- updateMergeBtnState(t) {
- (this.mergeBtn.interactable = t),
- this.mergeBtn.node
- .getComponentInChildren(cc.Label)
- .setMaterial(0, t ? this.mergeBtn.normalMaterial : this.mergeBtn.grayMaterial);
- }
- updateList() {
- const t = this._model,
- e = (this.items = t.items.filter(t => t.data.grade < r.RarityType.mystic));
- this.items.sort((t, e) => (t.canMerge === e.canMerge ? n.sortCostume(t, e) : e.canMerge ? 1 : -1)),
- this.itemList.updateDataSource(e);
- }
- onTouchTipBtn() {
- o.default.ViewManager.open(35);
- }
- };
- e([u({type: cc.Node})], t.prototype, "mergeNode", void 0),
- e([u({type: cc.Sprite})], t.prototype, "newItemSpecialSpr", void 0),
- e([u({type: cc.Label})], t.prototype, "newItemNameLab", void 0),
- e([u({type: cc.Label})], t.prototype, "newItemCurLab", void 0),
- e([u({type: cc.Label})], t.prototype, "newItemUpgradeLab", void 0),
- e([u({type: cc.RichText})], t.prototype, "newItemSpecialRichText", void 0),
- e([u({type: cc.Button})], t.prototype, "mergeBtn", void 0),
- e([u({type: cc.Label})], t.prototype, "costLab", void 0),
- e([u({type: cc.Node})], t.prototype, "mergeItemsNode", void 0),
- e([u({type: cc.Node})], t.prototype, "selectNode", void 0),
- e([u({type: s.ListView})], t.prototype, "itemList", void 0),
- e([u(h.CostumeBagItem)], t.prototype, "newItemDisplay", void 0),
- e([u(h.CostumeBagItem)], t.prototype, "targetDisplay", void 0),
- e([u(h.CostumeBagItem)], t.prototype, "costItemDisplay1", void 0),
- e([u(h.CostumeBagItem)], t.prototype, "costItemDisplay2", void 0),
- (t = e([d], t)),
- (i.default = t);
|