public override void Load(JObject jsonObject) { ID = jsonObject["rid"].ToObject <int>(); m_vMaxTroop = jsonObject["max_troops"].ToObject <int>(); m_vMaxSpell = jsonObject["max_spells"].ToObject <int>(); m_vDonatedTroop = jsonObject["donated_troops"].ToObject <int>(); m_vDonatedSpell = jsonObject["donated_spell"].ToObject <int>(); JArray jsonDonaterID = (JArray)jsonObject["donater_list"]; foreach (JToken jToken in jsonDonaterID) { JObject data = (JObject)jToken; BookmarkSlot di = new BookmarkSlot(0); di.Load(data); m_vDonatorList.Add(di); } JArray jsonDonatedUnit = (JArray)jsonObject["donated_unit"]; foreach (JToken jToken in jsonDonatedUnit) { JObject data = (JObject)jToken; DonationSlot ds = new DonationSlot(0, 0, 0, 0); ds.Load(data); m_vUnitDonation.Add(ds); } m_vMessage = jsonObject["message"].ToObject <string>(); }
public override void Load(JObject jsonObject) { base.Load(jsonObject); ID = jsonObject["rid"].ToObject <int>(); m_vMaxTroop = jsonObject["max_troops"].ToObject <int>(); m_vMaxSpell = jsonObject["max_spells"].ToObject <int>(); m_vDonatedTroop = jsonObject["donated_troops"].ToObject <int>(); m_vDonatedSpell = jsonObject["donated_spell"].ToObject <int>(); using (IEnumerator <JToken> enumerator = ((JArray)jsonObject["donater_list"]).GetEnumerator()) { while (((IEnumerator)enumerator).MoveNext()) { JObject current = (JObject)enumerator.Current; BookmarkSlot bookmarkSlot = new BookmarkSlot(0L); bookmarkSlot.Load(current); this.m_vDonatorList.Add(bookmarkSlot); } } using (IEnumerator <JToken> enumerator = ((JArray)jsonObject["donated_unit"]).GetEnumerator()) { while (((IEnumerator)enumerator).MoveNext()) { JObject current = (JObject)enumerator.Current; DonationSlot donationSlot = new DonationSlot(0L, 0, 0, 0); donationSlot.Load(current); this.m_vUnitDonation.Add(donationSlot); } } m_vMessage = jsonObject["message"].ToObject <string>(); }