private FollowerListItem InsertFollowerIntoListView(WrapperGarrisonFollower follower)
        {
            GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID);

            if (record == null)
            {
                return(null);
            }
            if (record.GarrFollowerTypeID != (uint)GarrisonStatus.GarrisonFollowerType)
            {
                return(null);
            }
            if (this.m_isCombatAllyList)
            {
                bool           flags          = (follower.Flags & 8) != 0;
                FollowerStatus followerStatus = GeneralHelpers.GetFollowerStatus(follower);
                if (flags || follower.ZoneSupportSpellID <= 0 || followerStatus == FollowerStatus.inactive || followerStatus == FollowerStatus.fatigued || followerStatus == FollowerStatus.inBuilding)
                {
                    return(null);
                }
            }
            GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.m_followerListItemPrefab);

            gameObject.transform.SetParent(this.m_followerListViewContents.transform, false);
            FollowerListItem component = gameObject.GetComponent <FollowerListItem>();

            component.SetFollower(follower);
            return(component);
        }
        public void InitFollowerList()
        {
            FollowerListItem[] componentsInChildren  = this.m_followerListViewContents.GetComponentsInChildren <FollowerListItem>(true);
            FollowerListItem[] followerListItemArray = componentsInChildren;
            for (int i = 0; i < (int)followerListItemArray.Length; i++)
            {
                FollowerListItem followerListItem = followerListItemArray[i];
                if (PersistentFollowerData.followerDictionary.ContainsKey(followerListItem.m_followerID))
                {
                    WrapperGarrisonFollower item = PersistentFollowerData.followerDictionary[followerListItem.m_followerID];
                    if ((item.Flags & 8) == 0 || item.Durability > 0)
                    {
                        followerListItem.SetFollower(item);
                    }
                    else
                    {
                        followerListItem.gameObject.SetActive(false);
                        followerListItem.transform.SetParent(Main.instance.transform);
                    }
                }
                else
                {
                    followerListItem.gameObject.SetActive(false);
                    followerListItem.transform.SetParent(Main.instance.transform);
                }
            }
            Transform mFollowerListViewContents = this.m_followerListViewContents.transform;
            float     single  = this.m_followerListViewContents.transform.localPosition.x;
            Vector3   vector3 = this.m_followerListViewContents.transform.localPosition;

            mFollowerListViewContents.localPosition = new Vector3(single, 0f, vector3.z);
            this.SortFollowerListData();
            componentsInChildren = this.m_followerListViewContents.GetComponentsInChildren <FollowerListItem>(true);
            foreach (KeyValuePair <int, WrapperGarrisonFollower> mSortedFollowerList in this.m_sortedFollowerList)
            {
                bool flag = false;
                FollowerListItem[] followerListItemArray1 = componentsInChildren;
                int num = 0;
                while (num < (int)followerListItemArray1.Length)
                {
                    if (followerListItemArray1[num].m_followerID != mSortedFollowerList.Value.GarrFollowerID)
                    {
                        num++;
                    }
                    else
                    {
                        flag = true;
                        break;
                    }
                }
                if (!flag)
                {
                    if ((mSortedFollowerList.Value.Flags & 8) == 0 || mSortedFollowerList.Value.Durability > 0)
                    {
                        this.InsertFollowerIntoListView(mSortedFollowerList.Value);
                    }
                }
            }
        }
        private void InsertFollowerIntoListView(WrapperGarrisonFollower follower, FollowerCategory followerCategory)
        {
            GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID);

            if (record == null)
            {
                return;
            }
            if (record.GarrFollowerTypeID != (uint)GarrisonStatus.GarrisonFollowerType)
            {
                return;
            }
            bool           flags          = (follower.Flags & 8) != 0;
            bool           flag           = !flags;
            FollowerStatus followerStatus = GeneralHelpers.GetFollowerStatus(follower);

            switch (followerCategory)
            {
            case FollowerCategory.ActiveChampion:
            {
                if (!flag || followerStatus == FollowerStatus.inactive)
                {
                    return;
                }
                break;
            }

            case FollowerCategory.InactiveChampion:
            {
                if (!flag || followerStatus != FollowerStatus.inactive)
                {
                    return;
                }
                break;
            }

            case FollowerCategory.Troop:
            {
                if (!flags || follower.Durability <= 0)
                {
                    return;
                }
                break;
            }

            default:
            {
                return;
            }
            }
            FollowerListItem followerListItem = UnityEngine.Object.Instantiate <FollowerListItem>(this.m_followerDetailListItemPrefab);

            followerListItem.transform.SetParent(this.m_followerDetailListContent.transform, false);
            followerListItem.SetFollower(follower);
        }
 private void SyncVisibleListOrderToSortedFollowerList()
 {
     FollowerListItem[] componentsInChildren = this.m_followerListViewContents.GetComponentsInChildren <FollowerListItem>(true);
     for (int i = 0; i < this.m_sortedFollowerList.Count; i++)
     {
         FollowerListItem[] followerListItemArray = componentsInChildren;
         int num = 0;
         while (num < (int)followerListItemArray.Length)
         {
             FollowerListItem followerListItem = followerListItemArray[num];
             if (followerListItem.m_followerID != this.m_sortedFollowerList[i].Value.GarrFollowerID)
             {
                 num++;
             }
             else
             {
                 followerListItem.transform.SetSiblingIndex(i);
                 break;
             }
         }
     }
 }
        private void DetailFollowerListItem_ManageFollowerDetailViewSize(int garrFollowerID)
        {
            object mFollowerDetailViewExtraHeight;

            if ((garrFollowerID != this.m_followerID ? false : this.m_followerDetailViewLayoutElement.minHeight == 0f))
            {
                if (this.m_followerDetailView.GetCurrentFollower() != this.m_followerID)
                {
                    this.m_followerDetailView.SetFollower(this.m_followerID);
                }
                iTween.StopByName(base.gameObject, "FollowerDetailExpand");
                iTween.StopByName(base.gameObject, "FollowerDetailExpandArrow");
                iTween.StopByName(base.gameObject, "FollowerDetailContract");
                iTween.StopByName(base.gameObject, "FollowerDetailContractArrow");
                this.SelectMe();
                bool  flag = false;
                float mFollowerDetailViewLayoutElement  = 0f;
                FollowerListItem[] componentsInChildren = OrderHallFollowersPanel.instance.m_followerDetailListContent.GetComponentsInChildren <FollowerListItem>(true);
                int num = 0;
                while (num < (int)componentsInChildren.Length)
                {
                    FollowerListItem followerListItem = componentsInChildren[num];
                    if (followerListItem == this)
                    {
                        break;
                    }
                    else if (followerListItem.m_followerDetailViewLayoutElement.minHeight <= 0f)
                    {
                        num++;
                    }
                    else
                    {
                        mFollowerDetailViewLayoutElement = followerListItem.m_followerDetailViewLayoutElement.minHeight;
                        flag = true;
                        break;
                    }
                }
                RectTransform           component = this.m_followerDetailView.traitsAndAbilitiesRootObject.GetComponent <RectTransform>();
                OrderHallFollowersPanel orderHallFollowersPanel = OrderHallFollowersPanel.instance;
                Vector3 vector3 = base.transform.localPosition;
                orderHallFollowersPanel.ScrollListTo(-vector3.y - (!flag ? 0f : mFollowerDetailViewLayoutElement) - 56f);
                bool flag1 = true;
                WrapperGarrisonFollower item = PersistentFollowerData.followerDictionary[this.m_followerID];
                bool            flags        = (item.Flags & 8) != 0;
                GarrFollowerRec record       = StaticDB.garrFollowerDB.GetRecord(item.GarrFollowerID);
                if (flags || item.FollowerLevel < MissionDetailView.GarrisonFollower_GetMaxFollowerLevel((int)record.GarrFollowerTypeID))
                {
                    flag1 = false;
                }
                GameObject gameObject = base.gameObject;
                object[]   objArray   = new object[] { "name", "FollowerDetailExpand", "from", this.m_followerDetailViewLayoutElement.minHeight, "to", null, null, null, null, null, null, null, null, null };
                float      single     = component.rect.height;
                if (!flags)
                {
                    mFollowerDetailViewExtraHeight = this.m_followerDetailViewExtraHeight;
                }
                else
                {
                    mFollowerDetailViewExtraHeight = null;
                }
                objArray[5]  = single + (float)mFollowerDetailViewExtraHeight;
                objArray[6]  = "time";
                objArray[7]  = 0.25f;
                objArray[8]  = "easetype";
                objArray[9]  = iTween.EaseType.easeOutCubic;
                objArray[10] = "onupdate";
                objArray[11] = "SetDetailViewHeight";
                objArray[12] = "oncomplete";
                objArray[13] = "ExpandDetailViewComplete";
                iTween.ValueTo(gameObject, iTween.Hash(objArray));
                iTween.ValueTo(base.gameObject, iTween.Hash(new object[] { "name", "FollowerDetailExpandArrow", "from", 0, "to", -90f, "time", 0.25f, "easetype", iTween.EaseType.easeOutCubic, "onupdate", "SetExpandArrowRotation", "oncomplete", "ExpandArrowRotationComplete" }));
                this.m_followerDetailViewCanvasGroup.alpha = 1f;
            }
            else if (this.m_followerDetailViewLayoutElement.minHeight > 0f)
            {
                iTween.StopByName(base.gameObject, "FollowerDetailExpand");
                iTween.StopByName(base.gameObject, "FollowerDetailExpandArrow");
                iTween.StopByName(base.gameObject, "FollowerDetailContract");
                iTween.StopByName(base.gameObject, "FollowerDetailContractArrow");
                this.DeselectMe();
                iTween.ValueTo(base.gameObject, iTween.Hash(new object[] { "name", "FollowerDetailContract", "from", this.m_followerDetailViewLayoutElement.minHeight, "to", 0f, "time", 0.25f, "easetype", iTween.EaseType.easeOutCubic, "onupdate", "SetDetailViewHeight", "oncomplete", "ContractDetailViewComplete" }));
                GameObject gameObject1 = base.gameObject;
                object[]   objArray1   = new object[14];
                objArray1[0] = "name";
                objArray1[1] = "FollowerDetailContractArrow";
                objArray1[2] = "from";
                Vector3 mExpandArrow = this.m_expandArrow.transform.localEulerAngles;
                objArray1[3]  = mExpandArrow.z;
                objArray1[4]  = "to";
                objArray1[5]  = 360f;
                objArray1[6]  = "time";
                objArray1[7]  = 0.25f;
                objArray1[8]  = "easetype";
                objArray1[9]  = iTween.EaseType.easeOutCubic;
                objArray1[10] = "onupdate";
                objArray1[11] = "SetExpandArrowRotation";
                objArray1[12] = "oncomplete";
                objArray1[13] = "ContractArrowRotationComplete";
                iTween.ValueTo(gameObject1, iTween.Hash(objArray1));
            }
        }
 private void InitFollowerList()
 {
     FollowerListItem[] componentsInChildren  = this.m_followerDetailListContent.GetComponentsInChildren <FollowerListItem>(true);
     FollowerListItem[] followerListItemArray = componentsInChildren;
     for (int i = 0; i < (int)followerListItemArray.Length; i++)
     {
         FollowerListItem followerListItem = followerListItemArray[i];
         if (PersistentFollowerData.followerDictionary.ContainsKey(followerListItem.m_followerID))
         {
             WrapperGarrisonFollower item = PersistentFollowerData.followerDictionary[followerListItem.m_followerID];
             if ((item.Flags & 8) == 0 || item.Durability > 0)
             {
                 followerListItem.SetFollower(item);
             }
             else
             {
                 UnityEngine.Object.Destroy(followerListItem.gameObject);
                 followerListItem.transform.SetParent(null);
             }
         }
         else
         {
             UnityEngine.Object.Destroy(followerListItem.gameObject);
             followerListItem.transform.SetParent(null);
         }
     }
     this.SortFollowerListData();
     foreach (KeyValuePair <int, WrapperGarrisonFollower> mSortedFollowerList in this.m_sortedFollowerList)
     {
         bool flag = false;
         FollowerListItem[] followerListItemArray1 = componentsInChildren;
         int num = 0;
         while (num < (int)followerListItemArray1.Length)
         {
             if (followerListItemArray1[num].m_followerID != mSortedFollowerList.Value.GarrFollowerID)
             {
                 num++;
             }
             else
             {
                 flag = true;
                 break;
             }
         }
         if (!flag)
         {
             this.InsertFollowerIntoListView(mSortedFollowerList.Value, FollowerCategory.ActiveChampion);
         }
     }
     foreach (KeyValuePair <int, WrapperGarrisonFollower> keyValuePair in this.m_sortedFollowerList)
     {
         bool flag1 = false;
         FollowerListItem[] followerListItemArray2 = componentsInChildren;
         int num1 = 0;
         while (num1 < (int)followerListItemArray2.Length)
         {
             if (followerListItemArray2[num1].m_followerID != keyValuePair.Value.GarrFollowerID)
             {
                 num1++;
             }
             else
             {
                 flag1 = true;
                 break;
             }
         }
         if (!flag1)
         {
             this.InsertFollowerIntoListView(keyValuePair.Value, FollowerCategory.Troop);
         }
     }
     foreach (KeyValuePair <int, WrapperGarrisonFollower> mSortedFollowerList1 in this.m_sortedFollowerList)
     {
         bool flag2 = false;
         FollowerListItem[] followerListItemArray3 = componentsInChildren;
         int num2 = 0;
         while (num2 < (int)followerListItemArray3.Length)
         {
             if (followerListItemArray3[num2].m_followerID != mSortedFollowerList1.Value.GarrFollowerID)
             {
                 num2++;
             }
             else
             {
                 flag2 = true;
                 break;
             }
         }
         if (!flag2)
         {
             this.InsertFollowerIntoListView(mSortedFollowerList1.Value, FollowerCategory.InactiveChampion);
         }
     }
     this.SyncVisibleListOrderToSortedFollowerList();
 }