Beispiel #1
0
        private void OnEnable()
        {
            if (Main.instance == null)
            {
                return;
            }
            if (this.m_followerID > 0)
            {
                if (!PersistentFollowerData.followerDictionary.ContainsKey(this.m_followerID))
                {
                    base.transform.SetParent(Main.instance.transform);
                    base.gameObject.SetActive(false);
                    return;
                }
                this.SetAvailabilityStatus(PersistentFollowerData.followerDictionary[this.m_followerID]);
            }
            Main instance = Main.instance;

            instance.FollowerDataChangedAction = (Action)Delegate.Combine(instance.FollowerDataChangedAction, new Action(this.FollowerDataChanged));
            Main instance2 = Main.instance;

            instance2.UseArmamentResultAction = (Action <int, WrapperGarrisonFollower, WrapperGarrisonFollower>)Delegate.Combine(instance2.UseArmamentResultAction, new Action <int, WrapperGarrisonFollower, WrapperGarrisonFollower>(this.HandleUseArmamentResult));
            if (AdventureMapPanel.instance != null)
            {
                AdventureMapPanel instance3 = AdventureMapPanel.instance;
                instance3.OnMissionFollowerSlotChanged = (Action <int, bool>)Delegate.Combine(instance3.OnMissionFollowerSlotChanged, new Action <int, bool>(this.OnMissionFollowerSlotChanged));
                AdventureMapPanel instance4 = AdventureMapPanel.instance;
                instance4.DeselectAllFollowerListItemsAction = (Action)Delegate.Combine(instance4.DeselectAllFollowerListItemsAction, new Action(this.DeselectMe));
            }
            if (this.m_followerDetailView != null && OrderHallFollowersPanel.instance != null)
            {
                OrderHallFollowersPanel instance5 = OrderHallFollowersPanel.instance;
                instance5.FollowerDetailListItemSelectedAction = (Action <int>)Delegate.Combine(instance5.FollowerDetailListItemSelectedAction, new Action <int>(this.DetailFollowerListItem_ManageFollowerDetailViewSize));
            }
        }
Beispiel #2
0
 private void OnDisable()
 {
     Singleton <GarrisonWrapper> .Instance.FollowerDataChangedAction -= this.FollowerDataChanged;
     Singleton <GarrisonWrapper> .Instance.UseArmamentResultAction   -= this.HandleUseArmamentResult;
     if (AdventureMapPanel.instance != null)
     {
         AdventureMapPanel instance = AdventureMapPanel.instance;
         instance.OnMissionFollowerSlotChanged = (Action <int, bool>)Delegate.Remove(instance.OnMissionFollowerSlotChanged, new Action <int, bool>(this.OnMissionFollowerSlotChanged));
         AdventureMapPanel instance2 = AdventureMapPanel.instance;
         instance2.DeselectAllFollowerListItemsAction = (Action)Delegate.Remove(instance2.DeselectAllFollowerListItemsAction, new Action(this.DeselectMe));
     }
     if (this.m_followerDetailView != null && OrderHallFollowersPanel.instance != null)
     {
         OrderHallFollowersPanel instance3 = OrderHallFollowersPanel.instance;
         instance3.FollowerDetailListItemSelectedAction = (Action <int>)Delegate.Remove(instance3.FollowerDetailListItemSelectedAction, new Action <int>(this.DetailFollowerListItem_ManageFollowerDetailViewSize));
     }
 }
        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 Awake()
 {
     OrderHallFollowersPanel.instance = this;
 }