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, 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); } } } }
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.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.gameObject.SetActive(false); return; } this.m_encounterTypeLabel.text = record2.Name; }