123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- var t = require;
- var e = module;
- var i = exports;
- Object.defineProperty(i, "__esModule", {value: !0}),
- (i.getShopItemData = i.ShopGiftItemData = i.ShopBoxItemData = i.ShopItemData = void 0);
- const a = t("App"),
- s = t("GameText"),
- o = t("ConfigManager"),
- n = t("ControllerConst"),
- r = t("BagConst"),
- l = t("SystemOpenConst"),
- h = t("ShopConst");
- class c {
- constructor() {
- this.buyCnt = 0;
- }
- parse(t) {
- for (var e in t) this[e] = t[e];
- return (this.cfg = t), (this.shopType = t.shopType), this;
- }
- parseMutil(t) {
- let e = [];
- for (const s of t.split("|")) {
- const t = s.split(":");
- var i = {id: parseInt(t[0]), cnt: parseInt(t[1])};
- e.push(i);
- }
- return e;
- }
- parseMutil_1(t) {
- let e = [],
- i = t.split("|");
- for (var s of i) e.push(parseInt(s));
- return e;
- }
- getDiamondIconUrl() {
- return "Texture/itemIcon/diamond_" + this.cfg.icon;
- }
- getName() {
- return s.GameText.getTextByStr("shop_name_" + this.id);
- }
- }
- class d extends (i.ShopItemData = c) {}
- i.ShopBoxItemData = d;
- class u extends c {
- constructor() {
- super(...arguments),
- (this.items = null),
- (this.costumeItemIds = null),
- (this._costumes = null),
- (this.isSysOpen = !0);
- }
- get costumes() {
- var t = this.cfg.shopGift.costumes;
- return t && !this._costumes && this.parseCostume(t), this._costumes;
- }
- parse(t) {
- return (
- super.parse(t), (this.items = this.parseMutil(t.shopGift.items)), (this.giftType = t.shopGift.type), this
- );
- }
- parseCostume(t) {
- let e = [],
- i = [];
- const s = t.split("|");
- for (const o of s) {
- const t = parseInt(o);
- i.push(t);
- const s = a.default.ControllerManager.applyFunc(n.ControllerConst.Item, r.BagConst.GET_ITEM, t);
- e.push(s.getTempCostume());
- }
- e.length && ((this._costumes = e), (this.costumeItemIds = i));
- }
- isCanGetFirstGift() {
- return (
- this.buyCnt && this.buyCnt <= 3 && a.default.DateUtils.isLastDay(this.time, a.default.DateUtils.secondNow())
- );
- }
- isBuyGift() {
- return 0 < this.buyCnt;
- }
- isHideGift() {
- return this.shopType == h.ShopType.GIFT ? 3 < this.buyCnt : 0 < this.buyCnt;
- }
- isShowInShopView() {
- return (
- a.default.ControllerManager.applyFunc(
- n.ControllerConst.SystemOpen,
- l.OpenConst.CHCEK_OPEN,
- l.OpenTypeConst.FIRST_GIFT
- ) && !this.buyCnt
- );
- }
- }
- (i.ShopGiftItemData = u),
- (i.getShopItemData = function (t) {
- let e = null;
- switch (t.shopType) {
- case h.ShopType.REMOVE_AD_GIFT:
- case h.ShopType.GIFT:
- case h.ShopType.ONCE_GIFT:
- e = new u();
- break;
- case h.ShopType.BOX:
- e = new d();
- break;
- default:
- e = new c();
- }
- return e.parse(t);
- }),
- o.registerJSONConf("ShopItemConfig", "files/shopItem"),
- o.registerJSONConf("ProductConfig", "files/productConfig");
|