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); } } }