public void SetMechanicType(int missionMechanicTypeID, int mechanicAbilityID, bool hideBorder = false) { this.m_garrAbilityID = mechanicAbilityID; GarrMechanicTypeRec record = StaticDB.garrMechanicTypeDB.GetRecord(missionMechanicTypeID); if (record != null) { this.m_missionMechanicIcon.gameObject.SetActive(true); this.m_missionMechanicTypeID = record.ID; this.m_counterWithThisAbilityID = MissionMechanic.GetAbilityToCounterMechanicType(missionMechanicTypeID); if (this.m_counterWithThisAbilityID != 0) { GarrAbilityRec record2 = StaticDB.garrAbilityDB.GetRecord(this.m_counterWithThisAbilityID); if (record2 != null) { Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, record2.IconFileDataID); if (sprite != null) { this.m_missionMechanicIcon.sprite = sprite; if (this.m_grayscaleShader != null) { Material material = new Material(this.m_grayscaleShader); this.m_missionMechanicIcon.material = material; } } } } } else { this.m_missionMechanicIcon.gameObject.SetActive(false); } this.SetCountered(false, false, true); this.m_missionMechanicIconBorder.gameObject.SetActive(!hideBorder); }
public void UpdateUsefulAbilitiesDisplay(int currentGarrMissionID) { AbilityDisplay[] componentsInChildren = this.usefulAbilitiesGroup.GetComponentsInChildren <AbilityDisplay>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Object.DestroyImmediate(componentsInChildren[i].get_gameObject()); } List <int> list = new List <int>(); JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)PersistentMissionData.missionDictionary.get_Item(currentGarrMissionID); for (int j = 0; j < jamGarrisonMobileMission.Encounter.Length; j++) { int num = (jamGarrisonMobileMission.Encounter[j].MechanicID.Length <= 0) ? 0 : jamGarrisonMobileMission.Encounter[j].MechanicID[0]; GarrMechanicRec record = StaticDB.garrMechanicDB.GetRecord(num); if (record == null) { Debug.LogWarning(string.Concat(new object[] { "INVALID garrMechanic ID ", num, " in mission ", jamGarrisonMobileMission.MissionRecID })); } else { int abilityToCounterMechanicType = MissionMechanic.GetAbilityToCounterMechanicType((int)record.GarrMechanicTypeID); if (!list.Contains(abilityToCounterMechanicType)) { list.Add(abilityToCounterMechanicType); } } } List <int> usefulBuffAbilitiesForFollower = MissionMechanic.GetUsefulBuffAbilitiesForFollower(this.m_followerID); List <int> list2 = Enumerable.ToList <int>(Enumerable.Union <int>(list, usefulBuffAbilitiesForFollower)); JamGarrisonFollower jamGarrisonFollower = PersistentFollowerData.followerDictionary.get_Item(this.m_followerID); int[] abilityID = jamGarrisonFollower.AbilityID; for (int k = 0; k < abilityID.Length; k++) { int num2 = abilityID[k]; using (List <int> .Enumerator enumerator = list2.GetEnumerator()) { while (enumerator.MoveNext()) { int current = enumerator.get_Current(); if (num2 == current) { GameObject gameObject = Object.Instantiate <GameObject>(this.m_abilityDisplayPrefab); gameObject.get_transform().SetParent(this.usefulAbilitiesGroup.get_transform(), false); AbilityDisplay component = gameObject.GetComponent <AbilityDisplay>(); component.SetAbility(num2, true, false, null); component.m_abilityNameText.get_gameObject().SetActive(false); } } } } }
public void UpdateUsefulAbilitiesDisplay(int currentGarrMissionID) { if (!PersistentFollowerData.followerDictionary.ContainsKey(this.m_followerID)) { return; } AbilityDisplay[] componentsInChildren = this.usefulAbilitiesGroup.GetComponentsInChildren <AbilityDisplay>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Object.DestroyImmediate(componentsInChildren[i].gameObject); } List <int> list = new List <int>(); JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)PersistentMissionData.missionDictionary[currentGarrMissionID]; for (int j = 0; j < jamGarrisonMobileMission.Encounter.Length; j++) { int num = (jamGarrisonMobileMission.Encounter[j].MechanicID.Length <= 0) ? 0 : jamGarrisonMobileMission.Encounter[j].MechanicID[0]; GarrMechanicRec record = StaticDB.garrMechanicDB.GetRecord(num); if (record == null) { Debug.LogWarning(string.Concat(new object[] { "INVALID garrMechanic ID ", num, " in mission ", jamGarrisonMobileMission.MissionRecID })); } else { int abilityToCounterMechanicType = MissionMechanic.GetAbilityToCounterMechanicType((int)record.GarrMechanicTypeID); if (!list.Contains(abilityToCounterMechanicType)) { list.Add(abilityToCounterMechanicType); } } } List <int> usefulBuffAbilitiesForFollower = MissionMechanic.GetUsefulBuffAbilitiesForFollower(this.m_followerID); List <int> list2 = list.Union(usefulBuffAbilitiesForFollower).ToList <int>(); JamGarrisonFollower jamGarrisonFollower = PersistentFollowerData.followerDictionary[this.m_followerID]; foreach (int num2 in jamGarrisonFollower.AbilityID) { foreach (int num3 in list2) { 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); } } } }
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); } } }
public void SetEncounter(int garrEncounterID, int garrMechanicID) { this.m_missionEncounter.SetEncounter(garrEncounterID, garrMechanicID); GarrMechanicRec record = StaticDB.garrMechanicDB.GetRecord(garrMechanicID); if (record == null || record.GarrAbilityID == 0) { base.get_gameObject().SetActive(false); return; } this.m_mechanicEffect.SetAbility(record.GarrAbilityID); int abilityToCounterMechanicType = MissionMechanic.GetAbilityToCounterMechanicType((int)record.GarrMechanicTypeID); this.m_mechanicCounterAbility.SetAbility(abilityToCounterMechanicType); GarrMechanicTypeRec record2 = StaticDB.garrMechanicTypeDB.GetRecord((int)record.GarrMechanicTypeID); if (record2 == null) { base.get_gameObject().SetActive(false); return; } this.m_encounterTypeLabel.set_text(record2.Name); }