public override void OnSuccess(WWWResult www) { if (Network.IsError) { switch (Network.ErrCode) { case Network.EErrCode.NoUnitParty: case Network.EErrCode.IllegalParty: this.OnFailed(); break; default: FlowNode_Network.Retry(); break; } } WebAPI.JSON_BodyResponse <Json_PlayerDataAll> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_PlayerDataAll> >(www.text); GameManager instance = MonoSingleton <GameManager> .Instance; try { if (jsonObject.body == null) { throw new InvalidJSONException(); } instance.Deserialize(jsonObject.body.player); instance.Deserialize(jsonObject.body.parties); } catch (Exception ex) { FlowNode_Network.Retry(); return; } Json_Party[] parties = jsonObject.body.parties; if (parties != null && parties.Length > 0) { Json_Party json = parties[0]; for (int index1 = 0; index1 < 11; ++index1) { int num = index1; if (index1 != 9) { PartyData party = new PartyData((PlayerPartyTypes)num); party.Deserialize(json); PartyWindow2.EditPartyTypes editPartyType = ((PlayerPartyTypes)num).ToEditPartyType(); List <PartyEditData> teams = new List <PartyEditData>(); int maxTeamCount = editPartyType.GetMaxTeamCount(); for (int index2 = 0; index2 < maxTeamCount; ++index2) { PartyEditData partyEditData = new PartyEditData(PartyUtility.CreateDefaultPartyNameFromIndex(index2), party); teams.Add(partyEditData); } PartyUtility.SaveTeamPresets(editPartyType, 0, teams, false); } } } Network.RemoveAPI(); ((Behaviour)this).set_enabled(false); this.ActivateOutputLinks(10); }
public void Deserialize(Json_Party json) { this.Reset(); if (json == null) { throw new InvalidCastException(); } this.mLeaderIndex = 0; for (int index = 0; index < json.units.Length; ++index) { this.mUniqueIDs[index] = json.units[index]; } this.Selected = json.flg_sel != 0; this.IsDefense = json.flg_seldef != 0; }