public void SetCombatAllyChampion(WrapperGarrisonFollower follower, int garrMissionID, int missionCost)
        {
            this.m_combatAllyMissionID = garrMissionID;
            this.m_combatAllyChampion  = new WrapperGarrisonFollower?(follower);
            this.m_combatAllyAbilityDisplay.SetSpell(this.m_combatAllyChampion.Value.ZoneSupportSpellID);
            this.m_combatAllySlot.SetFollower(follower.GarrFollowerID);
            GarrFollowerRec record      = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID);
            CreatureRec     creatureRec = StaticDB.creatureDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.ALLIANCE ? record.HordeCreatureID : record.AllianceCreatureID));

            if (follower.Quality == 6 && record.TitleName != null && record.TitleName.Length > 0)
            {
                this.m_combatAllyName.text = record.TitleName;
            }
            else if (record != null)
            {
                this.m_combatAllyName.text = creatureRec.Name;
            }
            Text mCombatAllyName          = this.m_combatAllyName;
            WrapperGarrisonFollower value = this.m_combatAllyChampion.Value;

            mCombatAllyName.color = GeneralHelpers.GetQualityColor(value.Quality);
            if (missionCost > GarrisonStatus.WarResources())
            {
                this.m_useItemButtonLabel.text    = StaticDB.GetString("CANT_AFFORD", "Can't Afford");
                this.m_useItemButtonLabel.color   = Color.red;
                this.m_useItemButton.interactable = false;
            }
            else
            {
                this.m_useItemButtonLabel.text = StaticDB.GetString("ASSIGN_CHAMPION", null);
            }
            int numActiveChampions = GeneralHelpers.GetNumActiveChampions();
            int maxActiveFollowers = GarrisonStatus.GetMaxActiveFollowers();

            this.m_isOverMaxChampionSoftCap = false;
            this.m_needMoreResources        = false;
            if (numActiveChampions > maxActiveFollowers)
            {
                this.m_isOverMaxChampionSoftCap = true;
            }
            if (GarrisonStatus.WarResources() < missionCost)
            {
                this.m_needMoreResources = true;
            }
            this.SetCombatAllyAvailabilityStatus();
        }
예제 #2
0
 private void UpdateChampionButtons(WrapperGarrisonFollower follower)
 {
     if (this.m_activateChampionButton == null || this.m_deactivateChampionButton == null)
     {
         return;
     }
     if ((follower.Flags & 8) == 0)
     {
         bool flags = (follower.Flags & 4) != 0;
         bool remainingFollowerActivations = GarrisonStatus.GetRemainingFollowerActivations() > 0;
         this.m_activateChampionButton.SetActive((!flags ? false : remainingFollowerActivations));
         int  numActiveChampions = GeneralHelpers.GetNumActiveChampions();
         int  maxActiveFollowers = GarrisonStatus.GetMaxActiveFollowers();
         bool currentMissionID   = follower.CurrentMissionID != 0;
         this.m_deactivateChampionButton.SetActive((flags || currentMissionID ? false : numActiveChampions > maxActiveFollowers));
     }
     else
     {
         this.m_activateChampionButton.SetActive(false);
         this.m_deactivateChampionButton.SetActive(false);
     }
 }
예제 #3
0
        private void UpdateChampionButtons(WrapperGarrisonFollower follower)
        {
            if (this.m_activateChampionButton == null || this.m_deactivateChampionButton == null)
            {
                return;
            }
            bool flag = (follower.Flags & 8) != 0;

            if (flag)
            {
                this.m_activateChampionButton.SetActive(false);
                this.m_deactivateChampionButton.SetActive(false);
            }
            else
            {
                bool flag2 = (follower.Flags & 4) != 0;
                bool flag3 = GarrisonStatus.GetRemainingFollowerActivations() > 0;
                this.m_activateChampionButton.SetActive(flag2 && flag3);
                int  numActiveChampions = GeneralHelpers.GetNumActiveChampions();
                int  maxActiveFollowers = GarrisonStatus.GetMaxActiveFollowers();
                bool flag4 = follower.CurrentMissionID != 0;
                this.m_deactivateChampionButton.SetActive(!flag2 && !flag4 && numActiveChampions > maxActiveFollowers);
            }
        }
예제 #4
0
        private void InitFollowerList()
        {
            FollowerListItem[] componentsInChildren = this.m_followerDetailListContent.GetComponentsInChildren <FollowerListItem>(true);
            foreach (FollowerListItem followerListItem in componentsInChildren)
            {
                if (!PersistentFollowerData.followerDictionary.ContainsKey(followerListItem.m_followerID))
                {
                    Object.Destroy(followerListItem.gameObject);
                    followerListItem.transform.SetParent(null);
                }
                else
                {
                    WrapperGarrisonFollower follower = PersistentFollowerData.followerDictionary[followerListItem.m_followerID];
                    bool flag = (follower.Flags & 8) != 0;
                    if (flag && follower.Durability <= 0)
                    {
                        Object.Destroy(followerListItem.gameObject);
                        followerListItem.transform.SetParent(null);
                    }
                    else
                    {
                        followerListItem.SetFollower(follower);
                    }
                }
            }
            this.SortFollowerListData();
            if (this.m_championsHeader == null)
            {
                this.m_championsHeader = Object.Instantiate <FollowerListHeader>(this.m_followerListHeaderPrefab);
            }
            this.m_championsHeader.transform.SetParent(this.m_followerDetailListContent.transform, false);
            this.m_championsHeader.m_title.font = GeneralHelpers.LoadStandardFont();
            this.m_championsHeader.m_count.font = GeneralHelpers.LoadStandardFont();
            this.m_championsHeader.m_title.text = StaticDB.GetString("CHAMPIONS", null) + ": ";
            int numActiveChampions = GeneralHelpers.GetNumActiveChampions();
            int maxActiveFollowers = GarrisonStatus.GetMaxActiveFollowers();

            if (numActiveChampions <= maxActiveFollowers)
            {
                this.m_championsHeader.m_count.text = string.Concat(new object[]
                {
                    string.Empty,
                    numActiveChampions,
                    "/",
                    maxActiveFollowers
                });
            }
            else
            {
                this.m_championsHeader.m_count.text = string.Concat(new object[]
                {
                    "<color=#ff0000ff>",
                    numActiveChampions,
                    "/",
                    maxActiveFollowers,
                    "</color>"
                });
            }
            foreach (KeyValuePair <int, WrapperGarrisonFollower> keyValuePair in this.m_sortedFollowerList)
            {
                bool flag2 = false;
                foreach (FollowerListItem followerListItem2 in componentsInChildren)
                {
                    if (followerListItem2.m_followerID == keyValuePair.Value.GarrFollowerID)
                    {
                        flag2 = true;
                        break;
                    }
                }
                if (!flag2)
                {
                    this.InsertFollowerIntoListView(keyValuePair.Value, FollowerCategory.ActiveChampion);
                }
            }
            int numTroops = GeneralHelpers.GetNumTroops();

            if (this.m_troopsHeader == null)
            {
                this.m_troopsHeader = Object.Instantiate <FollowerListHeader>(this.m_followerListHeaderPrefab);
            }
            this.m_troopsHeader.transform.SetParent(this.m_followerDetailListContent.transform, false);
            this.m_troopsHeader.m_title.font = GeneralHelpers.LoadStandardFont();
            this.m_troopsHeader.m_title.text = StaticDB.GetString("TROOPS", null) + ": ";
            this.m_troopsHeader.m_count.font = GeneralHelpers.LoadStandardFont();
            this.m_troopsHeader.m_count.text = string.Empty + numTroops;
            foreach (KeyValuePair <int, WrapperGarrisonFollower> keyValuePair2 in this.m_sortedFollowerList)
            {
                bool flag3 = false;
                foreach (FollowerListItem followerListItem3 in componentsInChildren)
                {
                    if (followerListItem3.m_followerID == keyValuePair2.Value.GarrFollowerID)
                    {
                        flag3 = true;
                        break;
                    }
                }
                if (!flag3)
                {
                    this.InsertFollowerIntoListView(keyValuePair2.Value, FollowerCategory.Troop);
                }
            }
            int numInactiveChampions = GeneralHelpers.GetNumInactiveChampions();

            if (this.m_inactiveHeader == null)
            {
                this.m_inactiveHeader = Object.Instantiate <FollowerListHeader>(this.m_followerListHeaderPrefab);
            }
            this.m_inactiveHeader.transform.SetParent(this.m_followerDetailListContent.transform, false);
            this.m_inactiveHeader.m_title.font = GeneralHelpers.LoadStandardFont();
            this.m_inactiveHeader.m_title.text = StaticDB.GetString("INACTIVE", null) + ": ";
            this.m_inactiveHeader.m_count.font = GeneralHelpers.LoadStandardFont();
            this.m_inactiveHeader.m_count.text = string.Empty + numInactiveChampions;
            foreach (KeyValuePair <int, WrapperGarrisonFollower> keyValuePair3 in this.m_sortedFollowerList)
            {
                bool flag4 = false;
                foreach (FollowerListItem followerListItem4 in componentsInChildren)
                {
                    if (followerListItem4.m_followerID == keyValuePair3.Value.GarrFollowerID)
                    {
                        flag4 = true;
                        break;
                    }
                }
                if (!flag4)
                {
                    this.InsertFollowerIntoListView(keyValuePair3.Value, FollowerCategory.InactiveChampion);
                }
            }
            this.SyncVisibleListOrderToSortedFollowerList();
            this.m_championsHeader.gameObject.SetActive(numActiveChampions > 0);
            this.m_troopsHeader.gameObject.SetActive(numTroops > 0);
            this.m_inactiveHeader.gameObject.SetActive(numInactiveChampions > 0);
            this.m_championsHeader.transform.SetSiblingIndex(0);
            this.m_troopsHeader.transform.SetSiblingIndex(numActiveChampions + 1);
            this.m_inactiveHeader.transform.SetSiblingIndex(numActiveChampions + numTroops + 2);
        }