123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- 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}), (i.ShopGiftItem = void 0);
- const a = t("App"),
- s = t("SwitchFrame"),
- n = t("ControllerConst"),
- r = (t("ViewConst"), t("BagConst")),
- o = t("CostumeBagItem"),
- l = t("ShopConst"),
- h = t("ShopItem"),
- c = t("ShopNormalItem"),
- {property: d, ccclass: u, menu: p} = cc._decorator;
- t = class extends h.ShopItem {
- constructor() {
- super(...arguments),
- (this.bigBg = null),
- (this.huawen = null),
- (this.smallBg = null),
- (this.switchFram = null),
- (this.nameLabelOutLine = null),
- (this.giftNameLab = null),
- (this.rateLab = null),
- (this.organiPriceLab = null),
- (this.diamondItem = null),
- (this.costumeBagItem = null),
- (this.shopNormalItem = null),
- (this.iconSwitchFrame = null),
- (this.data = null);
- }
- setData(t) {
- this.data = t;
- }
- isRemove() {
- return !this.data.isShowInShopView();
- }
- initItem() {
- (this.isShow = !0), (this.giftNameLab.string = this.data.getName());
- let e = a.default.Platform.getPriceNum(this.data.cfg.payId);
- (this.costLab.string = e + "元"),
- this.data.cfg.rate
- ? ((this.rateLab.string = 10 * this.data.cfg.rate + "折"),
- (this.organiPriceLab.string = Math.ceil(e / this.data.cfg.rate) + "元"))
- : ((this.rateLab.node.parent.active = !1),
- (this.organiPriceLab.node.active = !1),
- (this.costLab.node.y = 0));
- var i,
- s = this.data.items;
- this.diamondItem.setData(this.data.getDiamondIconUrl(), "" + this.data.cfg.diamond);
- for (let t = 0; t < s.length; t++) {
- 0 == t
- ? (i = this.shopNormalItem)
- : ((i = cc.instantiate(this.shopNormalItem)), this.shopNormalItem.parent.addChild(i));
- const e = i.getComponent(c.ShopNormalItem),
- o = a.default.ControllerManager.applyFunc(n.ControllerConst.Item, r.BagConst.GET_ITEM, s[t].id);
- o.data.itemType == r.ItemType.REMOVE_AD
- ? e.setData(o.getItemPic(), "NO ADS")
- : e.setData(o.getItemPic(), "" + s[t].cnt);
- }
- this.data.costumes
- ? (this.costumeBagItem.setData(this.data.costumes[0]), this.costumeBagItem.node.setSiblingIndex(9))
- : (this.costumeBagItem.node.active = !1);
- let o = this.data.cfg.shopGift.color;
- if (o) {
- const e = f[o];
- (this.bigBg.color = a.default.Color.getColorFromHex(e.bgColor)),
- (this.huawen.color = a.default.Color.getColorFromHex(e.iconColor)),
- (this.nameLabelOutLine.color = a.default.Color.getColorFromHex(e.nameOutLinColor)),
- (this.smallBg.color = a.default.Color.getColorFromHex(e.smallBgColor)),
- (this.switchFram.frameIndex = e.frameIndex);
- }
- this.iconSwitchFrame.frameIndex = this.data.giftType == l.ShopGiftType.REMOVE_AD_GIFT ? 1 : 0;
- }
- onTouchBuyBtn() {
- this.data.giftType == l.ShopGiftType.FIRST_GIFT
- ? a.default.ViewManager.open(40)
- : this.data.giftType == l.ShopGiftType.REMOVE_AD_GIFT
- ? a.default.ViewManager.open(53, this.data)
- : a.default.ControllerManager.applyFunc(n.ControllerConst.Shop, l.ShopConst.BUY, this.data);
- }
- };
- e([d(cc.Node)], t.prototype, "bigBg", void 0),
- e([d(cc.Node)], t.prototype, "huawen", void 0),
- e([d(cc.Node)], t.prototype, "smallBg", void 0),
- e([d(s.default)], t.prototype, "switchFram", void 0),
- e([d(cc.LabelOutline)], t.prototype, "nameLabelOutLine", void 0),
- e([d(cc.Label)], t.prototype, "giftNameLab", void 0),
- e([d(cc.Label)], t.prototype, "rateLab", void 0),
- e([d(cc.Label)], t.prototype, "organiPriceLab", void 0),
- e([d(c.ShopNormalItem)], t.prototype, "diamondItem", void 0),
- e([d(o.CostumeBagItem)], t.prototype, "costumeBagItem", void 0),
- e([d(cc.Node)], t.prototype, "shopNormalItem", void 0),
- e([d(s.default)], t.prototype, "iconSwitchFrame", void 0),
- (t = e([u, p("view/Shop/item/ShopGiftItem")], t)),
- (i.ShopGiftItem = t);
- const f = {
- yellow: {
- bgColor: "#fff1a5",
- nameOutLinColor: "#ecb154",
- iconColor: "#fde395",
- smallBgColor: "#fffad4",
- frameIndex: 0
- },
- red: {bgColor: "#ffd5d0", nameOutLinColor: "#e17d73", iconColor: "#ffc2bc", smallBgColor: "#ffeadf", frameIndex: 1},
- purple: {
- bgColor: "#daddff",
- nameOutLinColor: "#aa83c6",
- iconColor: "#ceceff",
- smallBgColor: "#daf2ff",
- frameIndex: 2
- }
- };
|