Example #1
0
        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);
        }
Example #2
0
        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_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.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;
        }