public void Init() { LogicDataTable table = LogicDataTables.GetTable(LogicDataType.GEM_BUNDLE); for (int i = 0; i < table.GetItemCount(); i++) { LogicGemBundleData data = (LogicGemBundleData)table.GetItemAt(i); LogicOffer offer = new LogicOffer(new LogicBundleOfferData(data), this.m_level); this.m_offers.Add(offer); } // TODO: Implement this. }
public void OfferBuyed(LogicOffer offer) { LogicOfferData data = offer.GetData(); if (data.GetLinkedPackageId() != 0) { this.m_terminate = true; } int shopFrontPageCooldownAfterPurchaseSeconds = data.GetShopFrontPageCooldownAfterPurchaseSeconds(); if (shopFrontPageCooldownAfterPurchaseSeconds > 0) { if (this.m_timer != null) { this.m_timer.Destruct(); this.m_timer = null; } this.m_timer = new LogicTimer(); this.m_timer.StartTimer(shopFrontPageCooldownAfterPurchaseSeconds, this.m_level.GetLogicTime(), false, -1); } }
public void Load(LogicJSONObject root) { LogicJSONObject jsonObject = root.GetJSONObject("offer"); if (jsonObject != null) { this.m_offerObject = jsonObject; if (this.m_timer != null) { this.m_timer.Destruct(); this.m_timer = null; } this.m_timer = LogicTimer.GetLogicTimer(jsonObject, this.m_level.GetLogicTime(), "pct", 604800); if (jsonObject.Get("t") != null) { this.m_terminate = true; } LogicJSONArray offerArray = jsonObject.GetJSONArray("offers"); if (offerArray != null) { for (int i = 0; i < offerArray.Size(); i++) { LogicJSONObject obj = (LogicJSONObject)offerArray.Get(i); if (obj != null) { int data = LogicJSONHelper.GetInt(obj, "data", -1); if (data != -1) { LogicOffer offer = this.GetOfferById(data); if (offer != null) { offer.Load(obj); } } } else { Debugger.Error("LogicOfferManager::load - Offer is NULL!"); } } } for (int i = 0; i < 2; i++) { LogicJSONNumber number = (LogicJSONNumber)jsonObject.Get(i == 1 ? "top2" : "top"); if (number != null) { this.m_topOffer[i] = this.GetOfferById(number.GetIntValue()); } } } }