private void InitEquipmentSlots(WrapperGarrisonFollower follower) { AbilityDisplay[] componentsInChildren = this.m_equipmentSlotsRootObject.GetComponentsInChildren <AbilityDisplay>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Object.Destroy(componentsInChildren[i].gameObject); } bool flag = false; bool flag2 = true; for (int j = 0; j < follower.AbilityIDs.Count; j++) { GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(follower.AbilityIDs[j]); if ((record.Flags & 1u) != 0u) { flag = true; GameObject gameObject = Object.Instantiate <GameObject>(this.m_equipmentSlotPrefab); gameObject.transform.SetParent(this.m_equipmentSlotsRootObject.transform, false); AbilityDisplay component = gameObject.GetComponent <AbilityDisplay>(); component.SetAbility(follower.AbilityIDs[j], true, true, this); } } bool flag3 = (follower.Flags & 8) != 0; GarrFollowerRec record2 = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID); if (flag3 || follower.FollowerLevel < MissionDetailView.GarrisonFollower_GetMaxFollowerLevel((int)record2.GarrFollowerTypeID)) { flag2 = false; } this.m_equipmentSlotsText.gameObject.SetActive(flag || flag2); }
private void SetCharShipmentTroop(WrapperShipmentType shipmentType, CharShipmentRec charShipmentRec) { this.m_rightStackLayoutElement.minHeight = 170f; this.m_isTroop = true; this.m_charShipmentRec = charShipmentRec; this.m_troopSpecificArea.SetActive(true); this.m_itemSpecificArea.SetActive(false); this.m_troopName.gameObject.SetActive(true); this.m_itemName.gameObject.SetActive(false); GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord((int)charShipmentRec.GarrFollowerID); if (record == null) { this.m_troopName.text = "Invalid Follower ID: " + charShipmentRec.GarrFollowerID; return; } this.m_followerRec = record; int num = (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceCreatureID : record.HordeCreatureID; CreatureRec record2 = StaticDB.creatureDB.GetRecord(num); if (record2 == null) { this.m_troopName.text = "Invalid Creature ID: " + num; return; } string text = "Assets/BundleAssets/PortraitIcons/cid_" + record2.ID.ToString("D8") + ".png"; Sprite sprite = AssetBundleManager.PortraitIcons.LoadAsset <Sprite>(text); if (sprite != null) { this.m_troopSnapshotImage.sprite = sprite; } for (int i = 0; i < record.Vitality; i++) { GameObject gameObject = Object.Instantiate <GameObject>(this.m_troopHeartPrefab); gameObject.transform.SetParent(this.m_troopHeartContainer.transform, false); } this.m_troopName.text = record2.Name; foreach (GarrFollowerXAbilityRec garrFollowerXAbilityRec in from rec in StaticDB.garrFollowerXAbilityDB.GetRecordsByParentID((int)charShipmentRec.GarrFollowerID) where rec.FactionIndex == (int)GarrisonStatus.Faction() select rec) { GameObject gameObject2 = Object.Instantiate <GameObject>(this.m_abilityDisplayPrefab); gameObject2.transform.SetParent(this.m_traitsAndAbilitiesRootObject.transform, false); AbilityDisplay component = gameObject2.GetComponent <AbilityDisplay>(); component.SetAbility(garrFollowerXAbilityRec.GarrAbilityID, true, true, null); } this.UpdateTroopSlots(); this.m_troopResourceCostText.text = string.Empty + shipmentType.CurrencyCost; Sprite sprite2 = GeneralHelpers.LoadCurrencyIcon(shipmentType.CurrencyTypeID); if (sprite2 != null) { this.m_troopResourceIcon.sprite = sprite2; } this.UpdateRecruitButtonState(); }
private void SetCharShipmentTroop(WrapperShipmentType shipmentType, CharShipmentRec charShipmentRec) { this.m_isTroop = true; this.m_charShipmentRec = charShipmentRec; this.m_troopSpecificArea.SetActive(true); this.m_itemSpecificArea.SetActive(false); this.m_troopName.gameObject.SetActive(true); this.m_itemName.gameObject.SetActive(false); GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord((int)charShipmentRec.GarrFollowerID); if (record == null) { Debug.LogError(string.Concat("Invalid Follower ID: ", charShipmentRec.GarrFollowerID)); this.m_troopName.text = string.Concat("Invalid Follower ID: ", charShipmentRec.GarrFollowerID); return; } this.m_followerRec = record; int num = (GarrisonStatus.Faction() != PVP_FACTION.HORDE ? record.AllianceCreatureID : record.HordeCreatureID); CreatureRec creatureRec = StaticDB.creatureDB.GetRecord(num); if (creatureRec == null) { Debug.LogError(string.Concat("Invalid Creature ID: ", num)); this.m_troopName.text = string.Concat("Invalid Creature ID: ", num); return; } int d = creatureRec.ID; string str = string.Concat("Assets/BundleAssets/PortraitIcons/cid_", d.ToString("D8"), ".png"); AssetBundleManager.PortraitIcons.LoadAsset <Sprite>(str); for (int i = 0; i < record.Vitality; i++) { GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.m_troopHeartPrefab); gameObject.transform.SetParent(this.m_troopHeartContainer.transform, false); } this.m_troopName.text = creatureRec.Name; foreach (GarrFollowerXAbilityRec garrFollowerXAbilityRec in from rec in StaticDB.garrFollowerXAbilityDB.GetRecordsByParentID((int)charShipmentRec.GarrFollowerID) where rec.FactionIndex == (int)GarrisonStatus.Faction() select rec) { GameObject gameObject1 = UnityEngine.Object.Instantiate <GameObject>(this.m_abilityDisplayPrefab); gameObject1.transform.SetParent(this.m_traitsAndAbilitiesRootObject.transform, false); AbilityDisplay component = gameObject1.GetComponent <AbilityDisplay>(); component.SetAbility(garrFollowerXAbilityRec.GarrAbilityID, true, true, null); } this.UpdateTroopSlots(); this.m_troopResourceCostText.text = string.Concat(string.Empty, shipmentType.CurrencyCost); Sprite sprite = GeneralHelpers.LoadCurrencyIcon(shipmentType.CurrencyTypeID); if (sprite != null) { this.m_troopResourceIcon.sprite = sprite; } this.UpdateRecruitButtonState(); }
public void UpdateUsefulAbilitiesDisplay(int currentGarrMissionID, IDictionary <uint, int> usefulCounterAbilityIDs) { if (!PersistentFollowerData.followerDictionary.ContainsKey(this.m_followerID)) { return; } AbilityDisplay[] componentsInChildren = this.usefulAbilitiesGroup.GetComponentsInChildren <AbilityDisplay>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Object.Destroy(componentsInChildren[i].gameObject); } WrapperGarrisonMission wrapperGarrisonMission = PersistentMissionData.missionDictionary[currentGarrMissionID]; for (int j = 0; j < wrapperGarrisonMission.Encounters.Count; j++) { int num = (wrapperGarrisonMission.Encounters[j].MechanicIDs.Count <= 0) ? 0 : wrapperGarrisonMission.Encounters[j].MechanicIDs[0]; GarrMechanicRec record = StaticDB.garrMechanicDB.GetRecord(num); if (record == null) { Debug.LogWarning(string.Concat(new object[] { "INVALID garrMechanic ID ", num, " in mission ", wrapperGarrisonMission.MissionRecID })); } else if (!usefulCounterAbilityIDs.ContainsKey(record.GarrMechanicTypeID)) { int abilityToCounterMechanicType = MissionMechanic.GetAbilityToCounterMechanicType((int)record.GarrMechanicTypeID); usefulCounterAbilityIDs.Add(record.GarrMechanicTypeID, abilityToCounterMechanicType); } } List <int> usefulBuffAbilitiesForFollower = MissionMechanic.GetUsefulBuffAbilitiesForFollower(this.m_followerID); List <int> list = usefulCounterAbilityIDs.Values.Union(usefulBuffAbilitiesForFollower).ToList <int>(); foreach (int num2 in PersistentFollowerData.followerDictionary[this.m_followerID].AbilityIDs) { foreach (int num3 in list) { if (num2 == num3) { GameObject gameObject = Object.Instantiate <GameObject>(this.m_abilityDisplayPrefab); gameObject.transform.SetParent(this.usefulAbilitiesGroup.transform, false); AbilityDisplay component = gameObject.GetComponent <AbilityDisplay>(); component.SetAbility(num2, true, false, null); component.m_abilityNameText.gameObject.SetActive(false); } } } }
private void HandleUseEquipmentResult(WrapperGarrisonFollower oldFollower, WrapperGarrisonFollower newFollower) { if (this.m_garrFollowerID != newFollower.GarrFollowerID) { return; } foreach (int abilityID in newFollower.AbilityIDs) { if ((StaticDB.garrAbilityDB.GetRecord(abilityID).Flags & 1) != 0) { bool flag = true; foreach (int num in oldFollower.AbilityIDs) { if (num != abilityID) { continue; } flag = false; break; } if (!flag) { continue; } AbilityDisplay[] componentsInChildren = this.m_equipmentSlotsRootObject.GetComponentsInChildren <AbilityDisplay>(true); for (int i = 0; i < (int)componentsInChildren.Length; i++) { AbilityDisplay abilityDisplay = componentsInChildren[i]; bool flag1 = true; foreach (int abilityID1 in newFollower.AbilityIDs) { if (abilityDisplay.GetAbilityID() != abilityID1) { continue; } flag1 = false; break; } if (flag1) { Debug.Log(string.Concat(new object[] { "New ability is ", abilityID, " replacing ability ID ", abilityDisplay.GetAbilityID() })); abilityDisplay.SetAbility(abilityID, true, true, this); Main.instance.m_UISound.Play_UpgradeEquipment(); UiAnimMgr.instance.PlayAnim("FlameGlowPulse", abilityDisplay.transform, Vector3.zero, 1f, 0f); } } } } }
public void SetEncounter(int garrEncounterID, int garrMechanicID) { this.m_garrEncounterID = garrEncounterID; this.m_garrMechanicID = garrMechanicID; GarrEncounterRec record = StaticDB.garrEncounterDB.GetRecord(garrEncounterID); if (record == null) { this.nameText.text = string.Empty + garrEncounterID; return; } this.nameText.text = record.Name; Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.PortraitIcons, record.PortraitFileDataID); if (sprite != null) { this.portraitImage.sprite = sprite; } else { this.missingIconText.gameObject.SetActive(true); this.missingIconText.text = string.Empty + record.PortraitFileDataID; } if (this.m_missionMechanicPrefab != null) { GameObject gameObject = Object.Instantiate <GameObject>(this.m_missionMechanicPrefab); gameObject.transform.SetParent(this.m_mechanicRoot.transform, false); MissionMechanic component = gameObject.GetComponent <MissionMechanic>(); component.SetMechanicTypeWithMechanicID(garrMechanicID, false); } if (this.m_mechanicEffectDisplayPrefab != null) { GarrMechanicRec record2 = StaticDB.garrMechanicDB.GetRecord(garrMechanicID); if (record2 == null) { this.m_mechanicRoot.SetActive(false); } if (record2 != null && record2.GarrAbilityID != 0) { GameObject gameObject2 = Object.Instantiate <GameObject>(this.m_mechanicEffectDisplayPrefab); gameObject2.transform.SetParent(this.m_mechanicEffectRoot.transform, false); AbilityDisplay component2 = gameObject2.GetComponent <AbilityDisplay>(); component2.SetAbility(record2.GarrAbilityID, false, false, null); } } }
private void InitEquipmentSlots(WrapperGarrisonFollower follower) { AbilityDisplay[] componentsInChildren = this.m_equipmentSlotsRootObject.GetComponentsInChildren <AbilityDisplay>(true); for (int i = 0; i < (int)componentsInChildren.Length; i++) { UnityEngine.Object.Destroy(componentsInChildren[i].gameObject); } bool flag = false; for (int j = 0; j < follower.AbilityIDs.Count; j++) { if ((StaticDB.garrAbilityDB.GetRecord(follower.AbilityIDs[j]).Flags & 1) != 0) { flag = true; GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.m_equipmentSlotPrefab); gameObject.transform.SetParent(this.m_equipmentSlotsRootObject.transform, false); AbilityDisplay component = gameObject.GetComponent <AbilityDisplay>(); component.SetAbility(follower.AbilityIDs[j], true, true, this); } } this.m_equipmentSlotsText.gameObject.SetActive(flag); }
public void UpdateMechanicPreview(bool missionInProgress, WrapperGarrisonMission mission) { int num = 0; if (!missionInProgress) { for (int i = 0; i < mission.Encounters.Count; i++) { int id = (mission.Encounters[i].MechanicIDs.Count <= 0) ? 0 : mission.Encounters[i].MechanicIDs[0]; GarrMechanicRec record = StaticDB.garrMechanicDB.GetRecord(id); if (record != null && record.GarrAbilityID != 0) { this.m_previewAbilityID[num] = record.GarrAbilityID; this.m_previewCanCounterStatus[num] = GeneralHelpers.HasFollowerWhoCanCounter((int)record.GarrMechanicTypeID); num++; } } bool flag = true; AbilityDisplay[] componentsInChildren = this.m_previewMechanicsGroup.GetComponentsInChildren <AbilityDisplay>(true); if (num != componentsInChildren.Length) { flag = false; } if (flag) { for (int j = 0; j < componentsInChildren.Length; j++) { if (componentsInChildren[j] == null) { flag = false; break; } if (componentsInChildren[j].GetAbilityID() != this.m_previewAbilityID[j]) { flag = false; break; } if (componentsInChildren[j].GetCanCounterStatus() != this.m_previewCanCounterStatus[j]) { flag = false; break; } } } if (!flag) { for (int k = 0; k < componentsInChildren.Length; k++) { if (componentsInChildren[k] != null) { componentsInChildren[k].gameObject.transform.SetParent(null); Object.Destroy(componentsInChildren[k].gameObject); } } for (int l = 0; l < num; l++) { GameObject gameObject = Object.Instantiate <GameObject>(this.m_previewMechanicEffectPrefab); gameObject.transform.SetParent(this.m_previewMechanicsGroup.transform, false); AbilityDisplay component = gameObject.GetComponent <AbilityDisplay>(); component.SetAbility(this.m_previewAbilityID[l], false, false, null); component.SetCanCounterStatus(this.m_previewCanCounterStatus[l]); } } } }
public void SetFollower(int followerID) { this.m_garrFollowerID = followerID; if (followerID == 0) { RectTransform[] componentsInChildren = this.traitsAndAbilitiesRootObject.GetComponentsInChildren <RectTransform>(true); for (int i = 0; i < componentsInChildren.Length; i++) { if (componentsInChildren[i] != null && componentsInChildren[i] != this.traitsAndAbilitiesRootObject.transform) { Object.Destroy(componentsInChildren[i].gameObject); } } AbilityDisplay[] componentsInChildren2 = this.m_equipmentSlotsRootObject.GetComponentsInChildren <AbilityDisplay>(true); for (int j = 0; j < componentsInChildren2.Length; j++) { Object.Destroy(componentsInChildren2[j].gameObject); } } if (!PersistentFollowerData.followerDictionary.ContainsKey(followerID)) { return; } GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(followerID); if (record == null) { return; } CreatureRec record2 = StaticDB.creatureDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceCreatureID : record.HordeCreatureID); if (record2 == null) { return; } WrapperGarrisonFollower follower = PersistentFollowerData.followerDictionary[followerID]; string text = "Assets/BundleAssets/PortraitIcons/cid_" + record2.ID.ToString("D8") + ".png"; Sprite sprite = AssetBundleManager.PortraitIcons.LoadAsset <Sprite>(text); if (sprite != null) { this.followerSnapshot.sprite = sprite; } RectTransform[] componentsInChildren3 = this.traitsAndAbilitiesRootObject.GetComponentsInChildren <RectTransform>(true); for (int k = 0; k < componentsInChildren3.Length; k++) { if (componentsInChildren3[k] != null && componentsInChildren3[k] != this.traitsAndAbilitiesRootObject.transform) { Object.Destroy(componentsInChildren3[k].gameObject); } } bool flag = false; for (int l = 0; l < follower.AbilityIDs.Count; l++) { GarrAbilityRec record3 = StaticDB.garrAbilityDB.GetRecord(follower.AbilityIDs[l]); if ((record3.Flags & 512u) != 0u) { if (!flag) { GameObject gameObject = Object.Instantiate <GameObject>(this.specializationHeaderPrefab); gameObject.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false); flag = true; Text component = gameObject.GetComponent <Text>(); if (component != null) { component.text = StaticDB.GetString("SPECIALIZATION", null); } } GameObject gameObject2 = Object.Instantiate <GameObject>(this.abilityDisplayPrefab); gameObject2.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false); AbilityDisplay component2 = gameObject2.GetComponent <AbilityDisplay>(); component2.SetAbility(record3.ID, false, false, null); } } bool flag2 = false; for (int m = 0; m < follower.AbilityIDs.Count; m++) { GarrAbilityRec record4 = StaticDB.garrAbilityDB.GetRecord(follower.AbilityIDs[m]); if ((record4.Flags & 1u) == 0u) { if ((record4.Flags & 512u) == 0u) { if (!flag2) { GameObject gameObject3 = Object.Instantiate <GameObject>(this.abilitiesHeaderPrefab); gameObject3.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false); flag2 = true; Text component3 = gameObject3.GetComponent <Text>(); if (component3 != null) { component3.text = StaticDB.GetString("ABILITIES", null); } } GameObject gameObject4 = Object.Instantiate <GameObject>(this.abilityDisplayPrefab); gameObject4.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false); AbilityDisplay component4 = gameObject4.GetComponent <AbilityDisplay>(); component4.SetAbility(follower.AbilityIDs[m], false, false, null); } } } if (follower.ZoneSupportSpellID > 0) { GameObject gameObject5 = Object.Instantiate <GameObject>(this.zoneSupportAbilityHeaderPrefab); gameObject5.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false); GameObject gameObject6 = Object.Instantiate <GameObject>(this.m_spellDisplayPrefab); gameObject6.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false); SpellDisplay component5 = gameObject6.GetComponent <SpellDisplay>(); component5.SetSpell(follower.ZoneSupportSpellID); Text componentInChildren = gameObject5.GetComponentInChildren <Text>(); if (componentInChildren != null) { componentInChildren.text = StaticDB.GetString("COMBAT_ALLY", null); } } bool flag3 = (follower.Flags & 8) != 0; if (flag3) { GarrStringRec record5 = StaticDB.garrStringDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.ALLIANCE) ? record.HordeFlavorGarrStringID : record.AllianceFlavorGarrStringID); if (record5 != null) { Text text2 = Object.Instantiate <Text>(this.m_troopDescriptionPrefab); text2.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false); text2.text = record5.Text; text2.font = FontLoader.LoadStandardFont(); } } this.InitEquipmentSlots(follower); this.UpdateChampionButtons(follower); }
public void ShowMissionResults(int garrMissionID, int missionResultType, bool awardOvermax) { GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(garrMissionID); if (record == null) { return; } this.m_missionResultsDisplayCanvasGroupAutoFadeOut.Reset(); this.m_currentResultType = (MissionResultType)missionResultType; this.m_followerExperienceDisplayArea.SetActive(false); this.m_attemptedAutoComplete = false; this.m_garrMissionID = garrMissionID; this.m_darknessBG.SetActive(true); this.m_popupView.SetActive(true); this.m_bonusLootDisplay.SetActive(false); if (this.missionFollowerSlotGroup != null) { MissionFollowerSlot[] componentsInChildren = this.missionFollowerSlotGroup.GetComponentsInChildren <MissionFollowerSlot>(true); for (int i = 0; i < componentsInChildren.Length; i++) { if (componentsInChildren[i] != null && componentsInChildren[i] != this.missionFollowerSlotGroup.transform) { componentsInChildren[i].gameObject.transform.SetParent(null); Object.Destroy(componentsInChildren[i].gameObject); } } } MissionEncounter[] componentsInChildren2 = this.enemyPortraitsGroup.GetComponentsInChildren <MissionEncounter>(true); for (int j = 0; j < componentsInChildren2.Length; j++) { if (componentsInChildren2[j] != null && componentsInChildren2[j] != this.enemyPortraitsGroup.transform) { componentsInChildren2[j].gameObject.transform.SetParent(null); Object.Destroy(componentsInChildren2[j].gameObject); } } if (this.treasureChestHorde != null && this.treasureChestAlliance != null) { if (GarrisonStatus.Faction() == PVP_FACTION.HORDE) { this.treasureChestHorde.SetActive(true); this.treasureChestAlliance.SetActive(false); } else { this.treasureChestHorde.SetActive(false); this.treasureChestAlliance.SetActive(true); } } WrapperGarrisonMission wrapperGarrisonMission = PersistentMissionData.missionDictionary[garrMissionID]; this.m_missionStartedTime = wrapperGarrisonMission.StartTime; this.m_missionDurationInSeconds = wrapperGarrisonMission.MissionDuration; for (int k = 0; k < wrapperGarrisonMission.Encounters.Count; k++) { GameObject gameObject = Object.Instantiate <GameObject>(this.missionEncounterPrefab); gameObject.transform.SetParent(this.enemyPortraitsGroup.transform, false); MissionEncounter component = gameObject.GetComponent <MissionEncounter>(); int garrMechanicID = (wrapperGarrisonMission.Encounters[k].MechanicIDs.Count <= 0) ? 0 : wrapperGarrisonMission.Encounters[k].MechanicIDs[0]; component.SetEncounter(wrapperGarrisonMission.Encounters[k].EncounterID, garrMechanicID); } this.missionNameText.text = record.Name; this.missionLocationText.text = record.Location; GarrMissionTypeRec record2 = StaticDB.garrMissionTypeDB.GetRecord((int)record.GarrMissionTypeID); this.missionTypeImage.overrideSprite = TextureAtlas.instance.GetAtlasSprite((int)record2.UiTextureAtlasMemberID); if (this.missionFollowerSlotGroup != null) { for (int l = 0; l < (int)record.MaxFollowers; l++) { GameObject gameObject2 = Object.Instantiate <GameObject>(this.missionFollowerSlotPrefab); gameObject2.transform.SetParent(this.missionFollowerSlotGroup.transform, false); MissionFollowerSlot component2 = gameObject2.GetComponent <MissionFollowerSlot>(); component2.m_enemyPortraitsGroup = this.enemyPortraitsGroup; } } if (record.UiTextureKitID > 0) { UiTextureKitRec record3 = StaticDB.uiTextureKitDB.GetRecord((int)record.UiTextureKitID); this.m_scrollingEnvironment_Back.enabled = false; this.m_scrollingEnvironment_Mid.enabled = false; this.m_scrollingEnvironment_Fore.enabled = false; int uitextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("_" + record3.KitPrefix + "-Back"); if (uitextureAtlasMemberID > 0) { Sprite atlasSprite = TextureAtlas.instance.GetAtlasSprite(uitextureAtlasMemberID); if (atlasSprite != null) { this.m_scrollingEnvironment_Back.enabled = true; this.m_scrollingEnvironment_Back.sprite = atlasSprite; } else { Debug.Log("Missing expected Back sprite from UiTextureKitID: [" + record.UiTextureKitID.ToString() + "]"); } } int uitextureAtlasMemberID2 = TextureAtlas.GetUITextureAtlasMemberID("_" + record3.KitPrefix + "-Mid"); if (uitextureAtlasMemberID2 > 0) { Sprite atlasSprite2 = TextureAtlas.instance.GetAtlasSprite(uitextureAtlasMemberID2); if (atlasSprite2 != null) { this.m_scrollingEnvironment_Mid.enabled = true; this.m_scrollingEnvironment_Mid.sprite = atlasSprite2; } else { Debug.Log("Missing expected Mid sprite from UiTextureKitID: [" + record.UiTextureKitID.ToString() + "]"); } } int uitextureAtlasMemberID3 = TextureAtlas.GetUITextureAtlasMemberID("_" + record3.KitPrefix + "-Fore"); if (uitextureAtlasMemberID3 > 0) { Sprite atlasSprite3 = TextureAtlas.instance.GetAtlasSprite(uitextureAtlasMemberID3); if (atlasSprite3 != null) { this.m_scrollingEnvironment_Fore.enabled = true; this.m_scrollingEnvironment_Fore.sprite = atlasSprite3; } else { Debug.Log("Missing expected Fore sprite from UiTextureKitID: [" + record.UiTextureKitID.ToString() + "]"); } } } else { Debug.LogWarning(string.Concat(new object[] { "DATA ERROR: Mission UITextureKit Not Set for mission ID:", record.ID, " - ", record.Name })); Debug.LogWarning("This means the scrolling background images will show the wrong location"); } if (this.m_lootGroupObj == null || this.m_missionRewardDisplayPrefab == null) { return; } MissionRewardDisplay[] componentsInChildren3 = this.m_lootGroupObj.GetComponentsInChildren <MissionRewardDisplay>(true); for (int m = 0; m < componentsInChildren3.Length; m++) { if (componentsInChildren3[m] != null) { Object.Destroy(componentsInChildren3[m].gameObject); } } if (missionResultType == 1) { PersistentFollowerData.ClearPreMissionFollowerData(); } List <WrapperGarrisonFollower> list = new List <WrapperGarrisonFollower>(); MissionFollowerSlot[] componentsInChildren4 = this.missionFollowerSlotGroup.GetComponentsInChildren <MissionFollowerSlot>(true); int num = 0; foreach (WrapperGarrisonFollower wrapperGarrisonFollower in PersistentFollowerData.followerDictionary.Values) { if (wrapperGarrisonFollower.CurrentMissionID == garrMissionID) { componentsInChildren4[num++].SetFollower(wrapperGarrisonFollower.GarrFollowerID); if (missionResultType == 1) { PersistentFollowerData.CachePreMissionFollower(wrapperGarrisonFollower); } list.Add(wrapperGarrisonFollower); } } this.UpdateMissionStatus(garrMissionID); foreach (MissionFollowerSlot missionFollowerSlot in componentsInChildren4) { missionFollowerSlot.InitHeartPanel(); } MissionRewardDisplay.InitMissionRewards(this.m_missionRewardDisplayPrefab.gameObject, this.m_lootGroupObj.transform, wrapperGarrisonMission.Rewards); if (record.OvermaxRewardPackID > 0 && wrapperGarrisonMission.OvermaxRewards.Count > 0) { this.m_bonusLootDisplay.SetActive(true); WrapperGarrisonMissionReward wrapperGarrisonMissionReward = wrapperGarrisonMission.OvermaxRewards[0]; if (wrapperGarrisonMissionReward.ItemID > 0) { this.m_bonusMissionRewardDisplay.InitReward(MissionRewardDisplay.RewardType.item, wrapperGarrisonMissionReward.ItemID, (int)wrapperGarrisonMissionReward.ItemQuantity, 0, wrapperGarrisonMissionReward.ItemFileDataID); } else if (wrapperGarrisonMissionReward.FollowerXP > 0u) { this.m_bonusMissionRewardDisplay.InitReward(MissionRewardDisplay.RewardType.followerXP, 0, (int)wrapperGarrisonMissionReward.FollowerXP, 0, 0); } else if (wrapperGarrisonMissionReward.CurrencyQuantity > 0u) { if (wrapperGarrisonMissionReward.CurrencyType == 0) { this.m_bonusMissionRewardDisplay.InitReward(MissionRewardDisplay.RewardType.gold, 0, (int)(wrapperGarrisonMissionReward.CurrencyQuantity / 10000u), 0, 0); } else { CurrencyTypesRec record4 = StaticDB.currencyTypesDB.GetRecord(wrapperGarrisonMissionReward.CurrencyType); int rewardQuantity = (int)((ulong)wrapperGarrisonMissionReward.CurrencyQuantity / (ulong)(((record4.Flags & 8u) == 0u) ? 1L : 100L)); this.m_bonusMissionRewardDisplay.InitReward(MissionRewardDisplay.RewardType.currency, wrapperGarrisonMissionReward.CurrencyType, rewardQuantity, 0, 0); } } } this.m_timeUntilFadeOutMissionDetailsDisplay = this.m_missionDetailsFadeOutDelay; this.m_timeUntilShowFollowerExperienceDisplays = this.m_experienceDisplayInitialEntranceDelay; if (missionResultType == 2) { this.InitFollowerExperienceDisplays(); this.m_missionInProgressMessage.SetActive(false); this.m_missionSuccessMessage.SetActive(true); this.m_missionFailMessage.SetActive(false); if (this.m_fancyEntrance != null) { Object.Destroy(this.m_fancyEntrance); iTween.Stop(this.m_missionSuccessMessage); this.m_missionSuccessMessage.transform.localScale = Vector3.one; iTween.Stop(this.m_missionFailMessage); this.m_missionFailMessage.transform.localScale = Vector3.one; } this.m_missionSuccessMessage.SetActive(false); this.m_fancyEntrance = this.m_missionSuccessMessage.AddComponent <FancyEntrance>(); this.m_fancyEntrance.m_fadeInCanvasGroup = this.m_missionSuccessMessage.GetComponent <CanvasGroup>(); this.m_fancyEntrance.m_fadeInTime = this.m_messageFadeInTime; this.m_fancyEntrance.m_punchScale = this.m_messagePunchScale; this.m_fancyEntrance.m_punchScaleAmount = this.m_messagePunchScaleAmount; this.m_fancyEntrance.m_punchScaleDuration = this.m_messagePunchScaleDuration; this.m_fancyEntrance.m_timeToDelayEntrance = this.m_messageTimeToDelayEntrance; this.m_fancyEntrance.m_activateOnEnable = true; this.m_fancyEntrance.m_objectToNotifyOnBegin = base.gameObject; this.m_fancyEntrance.m_notifyOnBeginCallbackName = "OnShowSuccessMessage"; this.m_missionSuccessMessage.SetActive(true); MissionRewardDisplay[] componentsInChildren5 = this.m_lootGroupObj.GetComponentsInChildren <MissionRewardDisplay>(true); for (int num2 = 0; num2 < componentsInChildren5.Length; num2++) { componentsInChildren5[num2].ShowResultSuccess(this.m_lootEffectInitialDelay + this.m_lootEffectDelay * (float)num2); } if (this.m_bonusLootChance > 0) { iTween.ValueTo(base.gameObject, iTween.Hash(new object[] { "name", "ShakeIt", "from", 0.3f, "to", 1f, "delay", this.m_bonusLootShakeInitialDelay, "time", this.m_bonusLootShakeDuration, "onupdate", "OnBonusLootShakeUpdate", "oncomplete", "OnBonusLootShakeComplete" })); } if (awardOvermax) { this.m_bonusMissionRewardDisplay.ShowResultSuccess(this.m_lootEffectInitialDelay + this.m_lootEffectDelay * (float)componentsInChildren5.Length); } else { this.m_bonusMissionRewardDisplay.ShowResultFail(this.m_lootEffectInitialDelay + this.m_lootEffectDelay * (float)componentsInChildren5.Length); } } if (missionResultType == 3) { this.InitFollowerExperienceDisplays(); this.m_missionInProgressMessage.SetActive(false); this.m_missionSuccessMessage.SetActive(false); this.m_missionFailMessage.SetActive(true); if (this.m_fancyEntrance != null) { Object.Destroy(this.m_fancyEntrance); iTween.Stop(this.m_missionSuccessMessage); this.m_missionSuccessMessage.transform.localScale = Vector3.one; iTween.Stop(this.m_missionFailMessage); this.m_missionFailMessage.transform.localScale = Vector3.one; } this.m_missionFailMessage.SetActive(false); this.m_fancyEntrance = this.m_missionFailMessage.AddComponent <FancyEntrance>(); this.m_fancyEntrance.m_fadeInCanvasGroup = this.m_missionFailMessage.GetComponent <CanvasGroup>(); this.m_fancyEntrance.m_fadeInTime = this.m_messageFadeInTime; this.m_fancyEntrance.m_punchScale = this.m_messagePunchScale; this.m_fancyEntrance.m_punchScaleAmount = this.m_messagePunchScaleAmount; this.m_fancyEntrance.m_punchScaleDuration = this.m_messagePunchScaleDuration; this.m_fancyEntrance.m_timeToDelayEntrance = this.m_messageTimeToDelayEntrance; this.m_fancyEntrance.m_activateOnEnable = true; this.m_fancyEntrance.m_objectToNotifyOnBegin = base.gameObject; this.m_fancyEntrance.m_notifyOnBeginCallbackName = "OnShowFailMessage"; this.m_missionFailMessage.SetActive(true); MissionRewardDisplay[] componentsInChildren6 = this.m_lootGroupObj.GetComponentsInChildren <MissionRewardDisplay>(true); for (int num3 = 0; num3 < componentsInChildren6.Length; num3++) { componentsInChildren6[num3].ShowResultFail(this.m_lootEffectInitialDelay); } this.m_bonusMissionRewardDisplay.ShowResultFail(this.m_lootEffectInitialDelay); } if (missionResultType == 0) { this.m_missionInProgressMessage.SetActive(true); this.m_missionSuccessMessage.SetActive(false); this.m_missionFailMessage.SetActive(false); this.m_bonusMissionRewardDisplay.ClearResults(); } if (missionResultType == 1) { this.m_missionInProgressMessage.SetActive(false); this.m_missionSuccessMessage.SetActive(false); this.m_missionFailMessage.SetActive(false); FollowerExperienceDisplay[] componentsInChildren7 = this.m_followerExperienceDisplayArea.GetComponentsInChildren <FollowerExperienceDisplay>(true); foreach (FollowerExperienceDisplay followerExperienceDisplay in componentsInChildren7) { Object.Destroy(followerExperienceDisplay.gameObject); } } if (this.m_partyBuffGroup == null) { return; } AbilityDisplay[] componentsInChildren8 = this.m_partyBuffGroup.GetComponentsInChildren <AbilityDisplay>(true); foreach (AbilityDisplay abilityDisplay in componentsInChildren8) { Object.Destroy(abilityDisplay.gameObject); } int adjustedMissionDuration = GeneralHelpers.GetAdjustedMissionDuration(record, list, this.enemyPortraitsGroup); int num6 = 0; foreach (WrapperGarrisonFollower wrapperGarrisonFollower2 in PersistentFollowerData.followerDictionary.Values) { if (wrapperGarrisonFollower2.CurrentMissionID == garrMissionID) { int[] buffsForCurrentMission = GeneralHelpers.GetBuffsForCurrentMission(wrapperGarrisonFollower2.GarrFollowerID, garrMissionID, this.missionFollowerSlotGroup, adjustedMissionDuration); num6 += buffsForCurrentMission.Length; foreach (int garrAbilityID in buffsForCurrentMission) { GameObject gameObject3 = Object.Instantiate <GameObject>(this.m_mechanicEffectDisplayPrefab); gameObject3.transform.SetParent(this.m_partyBuffGroup.transform, false); AbilityDisplay component3 = gameObject3.GetComponent <AbilityDisplay>(); component3.SetAbility(garrAbilityID, false, false, null); } } } if (num6 > 8) { this.m_partyBuffsText.text = string.Empty; } else { this.m_partyBuffsText.text = StaticDB.GetString("PARTY_BUFFS", null); } HorizontalLayoutGroup component4 = this.m_partyBuffGroup.GetComponent <HorizontalLayoutGroup>(); if (component4 != null) { if (num6 > 10 && Main.instance.IsNarrowScreen()) { component4.spacing = 3f; } else { component4.spacing = 6f; } } this.m_partyBuffGroup.SetActive(num6 > 0); }
public void SetFollower(int followerID) { this.m_garrFollowerID = followerID; if (followerID == 0) { RectTransform[] componentsInChildren = this.traitsAndAbilitiesRootObject.GetComponentsInChildren <RectTransform>(true); for (int i = 0; i < (int)componentsInChildren.Length; i++) { if (componentsInChildren[i] != null && componentsInChildren[i] != this.traitsAndAbilitiesRootObject.transform) { UnityEngine.Object.Destroy(componentsInChildren[i].gameObject); } } AbilityDisplay[] abilityDisplayArray = this.m_equipmentSlotsRootObject.GetComponentsInChildren <AbilityDisplay>(true); for (int j = 0; j < (int)abilityDisplayArray.Length; j++) { UnityEngine.Object.Destroy(abilityDisplayArray[j].gameObject); } } if (!PersistentFollowerData.followerDictionary.ContainsKey(followerID)) { return; } GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(followerID); if (record == null) { return; } CreatureRec creatureRec = StaticDB.creatureDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.HORDE ? record.AllianceCreatureID : record.HordeCreatureID)); if (creatureRec == null) { return; } WrapperGarrisonFollower item = PersistentFollowerData.followerDictionary[followerID]; int d = creatureRec.ID; string str = string.Concat("Assets/BundleAssets/PortraitIcons/cid_", d.ToString("D8"), ".png"); Sprite sprite = AssetBundleManager.PortraitIcons.LoadAsset <Sprite>(str); if (sprite != null) { this.followerSnapshot.sprite = sprite; } RectTransform[] rectTransformArray = this.traitsAndAbilitiesRootObject.GetComponentsInChildren <RectTransform>(true); for (int k = 0; k < (int)rectTransformArray.Length; k++) { if (rectTransformArray[k] != null && rectTransformArray[k] != this.traitsAndAbilitiesRootObject.transform) { UnityEngine.Object.Destroy(rectTransformArray[k].gameObject); } } bool flag = false; for (int l = 0; l < item.AbilityIDs.Count; l++) { GarrAbilityRec garrAbilityRec = StaticDB.garrAbilityDB.GetRecord(item.AbilityIDs[l]); if ((garrAbilityRec.Flags & 512) != 0) { if (!flag) { GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.specializationHeaderPrefab); gameObject.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false); flag = true; Text component = gameObject.GetComponent <Text>(); if (component != null) { component.text = StaticDB.GetString("SPECIALIZATION", null); } } GameObject gameObject1 = UnityEngine.Object.Instantiate <GameObject>(this.abilityDisplayPrefab); gameObject1.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false); AbilityDisplay abilityDisplay = gameObject1.GetComponent <AbilityDisplay>(); abilityDisplay.SetAbility(garrAbilityRec.ID, false, false, null); } } bool flag1 = false; for (int m = 0; m < item.AbilityIDs.Count; m++) { GarrAbilityRec record1 = StaticDB.garrAbilityDB.GetRecord(item.AbilityIDs[m]); if ((record1.Flags & 1) == 0) { if ((record1.Flags & 512) == 0) { if (!flag1) { GameObject gameObject2 = UnityEngine.Object.Instantiate <GameObject>(this.abilitiesHeaderPrefab); gameObject2.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false); flag1 = true; Text text = gameObject2.GetComponent <Text>(); if (text != null) { text.text = StaticDB.GetString("ABILITIES", null); } } GameObject gameObject3 = UnityEngine.Object.Instantiate <GameObject>(this.abilityDisplayPrefab); gameObject3.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false); AbilityDisplay component1 = gameObject3.GetComponent <AbilityDisplay>(); component1.SetAbility(item.AbilityIDs[m], false, false, null); } } } if (item.ZoneSupportSpellID > 0) { GameObject gameObject4 = UnityEngine.Object.Instantiate <GameObject>(this.zoneSupportAbilityHeaderPrefab); gameObject4.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false); GameObject gameObject5 = UnityEngine.Object.Instantiate <GameObject>(this.m_spellDisplayPrefab); gameObject5.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false); gameObject5.GetComponent <SpellDisplay>().SetSpell(item.ZoneSupportSpellID); Text componentInChildren = gameObject4.GetComponentInChildren <Text>(); if (componentInChildren != null) { componentInChildren.text = StaticDB.GetString("COMBAT_ALLY", null); } } if ((item.Flags & 8) != 0) { GarrStringRec garrStringRec = StaticDB.garrStringDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.ALLIANCE ? record.HordeFlavorGarrStringID : record.AllianceFlavorGarrStringID)); if (garrStringRec != null) { Text text1 = UnityEngine.Object.Instantiate <Text>(this.m_troopDescriptionPrefab); text1.transform.SetParent(this.traitsAndAbilitiesRootObject.transform, false); text1.text = garrStringRec.Text; text1.font = FontLoader.LoadStandardFont(); } } this.InitEquipmentSlots(item); this.UpdateChampionButtons(item); }