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 static PlayerPartyTypes ToPlayerPartyType(this PartyWindow2.EditPartyTypes type) { switch (type) { case PartyWindow2.EditPartyTypes.Normal: return(PlayerPartyTypes.Normal); case PartyWindow2.EditPartyTypes.Event: return(PlayerPartyTypes.Event); case PartyWindow2.EditPartyTypes.MP: return(PlayerPartyTypes.Multiplay); case PartyWindow2.EditPartyTypes.Arena: return(PlayerPartyTypes.Arena); case PartyWindow2.EditPartyTypes.ArenaDef: return(PlayerPartyTypes.ArenaDef); case PartyWindow2.EditPartyTypes.Character: return(PlayerPartyTypes.Character); case PartyWindow2.EditPartyTypes.Tower: return(PlayerPartyTypes.Tower); case PartyWindow2.EditPartyTypes.Versus: return(PlayerPartyTypes.Versus); default: throw new InvalidPartyTypeException(); } }
public static int GetMaxTeamCount(this PartyWindow2.EditPartyTypes type) { GameManager instanceDirect = MonoSingleton <GameManager> .GetInstanceDirect(); if (Object.op_Equality((Object)instanceDirect, (Object)null)) { switch (type) { case PartyWindow2.EditPartyTypes.Normal: case PartyWindow2.EditPartyTypes.Event: return(5); case PartyWindow2.EditPartyTypes.Tower: return(6); default: return(1); } } else { FixParam fixParam = instanceDirect.MasterParam.FixParam; switch (type) { case PartyWindow2.EditPartyTypes.Normal: return(fixParam.PartyNumNormal); case PartyWindow2.EditPartyTypes.Event: return(fixParam.PartyNumEvent); case PartyWindow2.EditPartyTypes.MP: return(fixParam.PartyNumMulti); case PartyWindow2.EditPartyTypes.Arena: return(fixParam.PartyNumArenaAttack); case PartyWindow2.EditPartyTypes.ArenaDef: return(fixParam.PartyNumArenaDefense); case PartyWindow2.EditPartyTypes.Character: return(fixParam.PartyNumChQuest); case PartyWindow2.EditPartyTypes.Tower: return(fixParam.PartyNumTower); default: return(1); } } }
private void LoadParty() { this.mCurrentQuest = MonoSingleton <GameManager> .Instance.FindQuest(GlobalVars.SelectedQuestID); this.mIsHeloOnly = PartyUtility.IsSoloStoryParty(this.mCurrentQuest); PlayerData player = MonoSingleton <GameManager> .Instance.Player; PartyWindow2.EditPartyTypes type = PartyUtility.GetEditPartyTypes(this.mCurrentQuest); if (type == PartyWindow2.EditPartyTypes.Auto) { type = PartyWindow2.EditPartyTypes.Normal; } PartyData partyOfType = MonoSingleton <GameManager> .Instance.Player.FindPartyOfType(type.ToPlayerPartyType()); this.mCurrentParty = new UnitData[partyOfType.MAX_UNIT]; string str = this.mCurrentQuest.units.Get(0); if (this.mIsUserOwnUnits) { for (int index = 0; index < partyOfType.MAX_UNIT; ++index) { long unitUniqueId = partyOfType.GetUnitUniqueID(index); if (unitUniqueId > 0L) { this.mCurrentParty[index] = player.FindUnitDataByUniqueID(unitUniqueId); } } } else { for (int index = 0; index < partyOfType.MAX_UNIT && index < this.mUserSelectionParty.Length; ++index) { if (this.mUserSelectionParty[index] == null) { this.mCurrentParty[index] = (UnitData)null; } if (this.mUserSelectionParty[index] == null || !(this.mUserSelectionParty[index].UnitParam.iname == str)) { this.mCurrentParty[index] = this.mUserSelectionParty[index]; } } } }
private void LoadParty() { this.mCurrentQuest = MonoSingleton <GameManager> .Instance.FindQuest(GlobalVars.SelectedQuestID); this.mIsHeloOnly = PartyUtility.IsSoloStoryParty(this.mCurrentQuest); if (this.StoryNormalObjects != null) { for (int index = 0; index < this.StoryNormalObjects.Length; ++index) { if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.StoryNormalObjects[index], (UnityEngine.Object)null)) { this.StoryNormalObjects[index].SetActive(!this.mIsHeloOnly); } } } if (this.HeloOnlyObjects != null) { for (int index = 0; index < this.HeloOnlyObjects.Length; ++index) { if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.HeloOnlyObjects[index], (UnityEngine.Object)null)) { this.HeloOnlyObjects[index].SetActive(this.mIsHeloOnly); } } } if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.GuestUnitSlot, (UnityEngine.Object)null)) { if (this.mIsHeloOnly) { ((Component)this.GuestUnitSlot).get_transform().SetSiblingIndex(0); } else { ((Component)this.GuestUnitSlot).get_transform().SetSiblingIndex(4); } } PlayerData player = MonoSingleton <GameManager> .Instance.Player; PartyWindow2.EditPartyTypes type = PartyUtility.GetEditPartyTypes(this.mCurrentQuest); if (type == PartyWindow2.EditPartyTypes.Auto) { type = PartyWindow2.EditPartyTypes.Normal; } PartyData partyOfType = MonoSingleton <GameManager> .Instance.Player.FindPartyOfType(type.ToPlayerPartyType()); this.mCurrentParty = new UnitData[partyOfType.MAX_UNIT]; UnitData data = (UnitData)null; string iname = this.mCurrentQuest.units.Get(0); if (this.mIsUserOwnUnits) { data = MonoSingleton <GameManager> .Instance.Player.FindUnitDataByUnitID(iname); for (int index = 0; index < partyOfType.MAX_UNIT; ++index) { long unitUniqueId = partyOfType.GetUnitUniqueID(index); if (unitUniqueId > 0L) { this.mCurrentParty[index] = player.FindUnitDataByUniqueID(unitUniqueId); } } } else { for (int index = 0; index < partyOfType.MAX_UNIT && index < this.mUserSelectionParty.Length; ++index) { if (this.mUserSelectionParty[index] == null) { this.mCurrentParty[index] = (UnitData)null; } if (this.mUserSelectionParty[index] != null && this.mUserSelectionParty[index].UnitParam.iname == iname) { data = this.mUserSelectionParty[index]; } else { this.mCurrentParty[index] = this.mUserSelectionParty[index]; } } } int count = this.mCurrentParty.Length - 2; UnitData[] array1 = ((IEnumerable <UnitData>) this.mCurrentParty).Skip <UnitData>(count).Take <UnitData>(2).ToArray <UnitData>(); UnitData[] array2 = ((IEnumerable <UnitData>) this.mCurrentParty).Take <UnitData>(count).ToArray <UnitData>(); for (int index = 0; index < this.SubUnitSlots.Length && index < array1.Length; ++index) { this.SubUnitSlots[index].SetSlotData <QuestParam>(this.mCurrentQuest); this.SubUnitSlots[index].SetSlotData <UnitData>(array1[index]); } for (int index = 0; index < this.UnitSlots.Length && index < array2.Length; ++index) { this.UnitSlots[index].SetSlotData <QuestParam>(this.mCurrentQuest); this.UnitSlots[index].SetSlotData <UnitData>(array2[index]); } if (data != null) { this.mGuestUnit = data; this.GuestUnitSlot.SetSlotData <QuestParam>(this.mCurrentQuest); this.GuestUnitSlot.SetSlotData <UnitData>(data); ((Component)this.GuestUnitSlot).get_gameObject().SetActive(true); } else { ((Component)this.GuestUnitSlot).get_gameObject().SetActive(false); } if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.FriendSlot, (UnityEngine.Object)null)) { if (this.mCurrentQuest.type == QuestTypes.Tower) { ((Component)this.FriendSlot).get_gameObject().SetActive(false); } else { ((Component)this.FriendSlot).get_gameObject().SetActive(true); if (this.mIsUserOwnUnits) { this.mCurrentSupport = (SupportData)GlobalVars.SelectedSupport; this.FriendSlot.SetSlotData <UnitData>(this.mCurrentSupport != null ? this.mCurrentSupport.Unit : (UnitData)null); } else if (this.mSupportData != null) { this.FriendSlot.SetSlotData <UnitData>(this.mSupportData.Unit); } } } int num; switch (type) { case PartyWindow2.EditPartyTypes.Normal: case PartyWindow2.EditPartyTypes.Arena: case PartyWindow2.EditPartyTypes.ArenaDef: case PartyWindow2.EditPartyTypes.Character: num = 3; break; case PartyWindow2.EditPartyTypes.Tower: num = 5; break; default: if ((this.mCurrentQuest == null ? 0 : (this.mCurrentQuest.UseFixEditor ? 1 : 0)) == 0) { num = 4; break; } goto case PartyWindow2.EditPartyTypes.Normal; } for (int index = 0; index < this.UnitSlots.Length; ++index) { if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.UnitSlots[index], (UnityEngine.Object)null)) { ((Component)this.UnitSlots[index]).get_gameObject().SetActive(index < num); } } }