public override void Load(LogicJSONObject jsonObject) { LogicJSONBoolean initialSpawnDoneBoolean = jsonObject.GetJSONBoolean("initial_spawn_done"); if (initialSpawnDoneBoolean != null) { this.m_initialSpawnDone = initialSpawnDoneBoolean.IsTrue(); } if (this.m_timer != null) { this.m_timer.Destruct(); this.m_timer = null; } this.m_timer = LogicTimer.GetLogicTimer(jsonObject, this.m_parent.GetLevel().GetLogicTime(), "spawn_timer", this.m_intervalSeconds); LogicJSONNumber lifetimeSpawnsNumber = jsonObject.GetJSONNumber("lifetime_spawns"); if (lifetimeSpawnsNumber != null) { this.m_lifeTimeSpawns = lifetimeSpawnsNumber.GetIntValue(); } LogicJSONArray spawnedArray = jsonObject.GetJSONArray("spawned"); if (spawnedArray != null) { for (int i = 0; i < spawnedArray.Size(); i++) { this.m_spawned.Add(spawnedArray.GetJSONNumber(i).GetIntValue()); } } }
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()); } } } }