12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- var t = require;
- var e = module;
- var i = exports;
- Object.defineProperty(i, "__esModule", {value: !0});
- const o = t("App"),
- s = t("BaseModel"),
- a = t("ShopConst"),
- n = t("ShopItemConfig");
- i.default = class extends s.default {
- constructor(t) {
- super(t),
- (this.savaData = null),
- (this._saveKey = "Shop"),
- (this.mothCardDays = 31),
- o.default.SaveManage.add(this, this._saveKey, !0, !0),
- o.default.SaveManage.load(this._saveKey);
- }
- init() {
- this.initConfig();
- }
- initConfig() {
- (this.shopItemDatas = {}), (this.shopGiftDatas = {});
- let e = o.default.ConfigManager.getConfig("ShopItemConfig");
- for (var i in e) {
- var s = e[i];
- this.shopItemDatas[s.shopType] || (this.shopItemDatas[s.shopType] = []);
- let t = n.getShopItemData(s);
- i = this.savaData.record[t.id];
- if (
- (i ? ((t.buyCnt = i.cnt), (t.time = i.time)) : t.buyCnt,
- this.shopItemDatas[s.shopType].push(t),
- t.shopType == a.ShopType.GIFT)
- ) {
- const e = t.cfg.shopGift.type;
- this.shopGiftDatas[e] || (this.shopGiftDatas[e] = []), this.shopGiftDatas[e].push(t);
- }
- }
- }
- updateMonthCardTime(t = 0) {}
- addGiftBuyCnt(t) {}
- updateGiftBuyCnt() {}
- getGiftBuyCnt(t) {
- return 0;
- }
- updateCnt(t) {
- const e = this.savaData.record;
- e[t.id] || (e[t.id] = {cnt: 0}),
- e[t.id].cnt++,
- (t.buyCnt = e[t.id].cnt),
- (t.time = e[t.id].time = o.default.DateUtils.secondNow()),
- t.shopType == a.ShopType.GIFT &&
- t.cfg.shopGift.type == a.ShopGiftType.FIRST_GIFT &&
- 1 === e[t.id].cnt &&
- (t.time = e[t.id].time = 0);
- }
- isFirstShowFirstGift() {
- const t = this.shopGiftDatas[a.ShopGiftType.FIRST_GIFT][0],
- e = this.savaData.record;
- return !e[t.id] && ((e[t.id] = {cnt: 0}), !0);
- }
- createMemento() {
- return this.savaData;
- }
- setMemento(t) {
- this.savaData = t || {record: {}, bankDiamond: 0};
- }
- };
|