public override void Load(LogicJSONObject jsonObject) { LogicJSONObject baseObject = jsonObject.GetJSONObject("base"); if (baseObject == null) { Debugger.Error("ChatStreamEntry::load base is NULL"); } base.Load(baseObject); this.m_castleLevel = LogicJSONHelper.GetInt(jsonObject, "castle_level"); this.m_castleUsedCapacity = LogicJSONHelper.GetInt(jsonObject, "castle_used"); this.m_castleUsedSpellCapacity = LogicJSONHelper.GetInt(jsonObject, "castle_sp_used"); this.m_castleTotalCapacity = LogicJSONHelper.GetInt(jsonObject, "castle_total"); this.m_castleTotalSpellCapacity = LogicJSONHelper.GetInt(jsonObject, "castle_sp_total"); LogicJSONString messageObject = jsonObject.GetJSONString("message"); if (messageObject != null) { this.m_message = messageObject.GetStringValue(); } LogicJSONArray donationArray = jsonObject.GetJSONArray("donators"); if (donationArray != null) { for (int i = 0; i < donationArray.Size(); i++) { DonationContainer donationContainer = new DonationContainer(); donationContainer.Load(donationArray.GetJSONObject(i)); this.m_donationContainerList.Add(donationContainer); } } LogicJSONArray unitArray = jsonObject.GetJSONArray("units"); if (unitArray != null) { this.m_unitCount = new LogicArrayList <LogicUnitSlot>(); for (int i = 0; i < unitArray.Size(); i++) { LogicUnitSlot unitSlot = new LogicUnitSlot(null, -1, 0); unitSlot.ReadFromJSON(unitArray.GetJSONObject(i)); this.m_unitCount.Add(unitSlot); } } }
public override void Decode(ByteStream stream) { base.Decode(stream); this.m_castleLevel = stream.ReadInt(); this.m_castleTotalCapacity = stream.ReadInt(); this.m_castleTotalSpellCapacity = stream.ReadInt(); this.m_castleUsedCapacity = stream.ReadInt(); this.m_castleUsedSpellCapacity = stream.ReadInt(); for (int i = 0, size = stream.ReadInt(); i < size; i++) { DonationContainer donationContainer = new DonationContainer(); donationContainer.Decode(stream); this.m_donationContainerList.Add(donationContainer); } if (stream.ReadBoolean()) { this.m_message = stream.ReadString(900000); } int count = stream.ReadInt(); if (count > -1) { this.m_unitCount = new LogicArrayList <LogicUnitSlot>(count); for (int i = 0; i < count; i++) { LogicUnitSlot unitSlot = new LogicUnitSlot(null, -1, 0); unitSlot.Decode(stream); this.m_unitCount.Add(unitSlot); } } }