Esempio n. 1
0
 private void Update()
 {
     if (this.IsResearching())
     {
         this.m_researchProgressBG.get_gameObject().SetActive(true);
         float num = 1f - ((!this.IsRespec()) ? ((float)this.GetRemainingResearchTime() / (float)this.m_garrTalentRec.ResearchDurationSecs) : ((float)this.GetRemainingRespecTime() / (float)this.m_garrTalentRec.RespecDurationSecs));
         this.m_researchProgressFill.set_fillAmount(num);
         this.SetVisualState(TalentVisualState.researching);
         if (!this.m_requestedUpdate && num >= 1f)
         {
             this.m_requestedUpdate = true;
             MobilePlayerGarrisonDataRequest mobilePlayerGarrisonDataRequest = new MobilePlayerGarrisonDataRequest();
             mobilePlayerGarrisonDataRequest.GarrTypeID = 3;
             Login.instance.SendToMobileServer(mobilePlayerGarrisonDataRequest);
             this.m_shouldShowCheckAnim = true;
             AutoCenterItem componentInParent = base.get_gameObject().GetComponentInParent <AutoCenterItem>();
             if (componentInParent && !componentInParent.IsCentered() && !this.m_playedTalentToast)
             {
                 Main.instance.m_UISound.Play_TalentReadyToast();
                 this.m_playedTalentToast = true;
             }
         }
     }
     if (this.m_shouldShowCheckAnim && !this.m_playedShowCheckAnim)
     {
         AutoCenterItem componentInParent2 = base.get_gameObject().GetComponentInParent <AutoCenterItem>();
         if (componentInParent2 && componentInParent2.IsCentered())
         {
             UiAnimMgr.instance.PlayAnim("TalentDoneAnim", base.get_transform(), Vector3.get_zero(), 1f, 0f);
             Main.instance.m_UISound.Play_TalentReadyCheck();
             this.m_shouldShowCheckAnim = false;
             this.m_playedShowCheckAnim = true;
         }
     }
 }
    public void CenterAndZoomOut()
    {
        AutoCenterItem componentInParent = base.get_gameObject().GetComponentInParent <AutoCenterItem>();

        if (componentInParent && componentInParent.IsCentered())
        {
            this.CenterAndZoom(Vector2.get_zero(), null, false);
        }
    }
    public void CenterOnItem(int itemIndex)
    {
        AutoCenterItem[] componentsInChildren = this.m_scrollRectContentsRT.GetComponentsInChildren <AutoCenterItem>(true);
        RectTransform    component            = componentsInChildren[itemIndex].GetComponent <RectTransform>();

        this.m_targetX = -component.anchoredPosition.x;
        if (componentsInChildren[itemIndex].IsCentered())
        {
            return;
        }
        AutoCenterItem[] autoCenterItemArray = componentsInChildren;
        for (int i = 0; i < (int)autoCenterItemArray.Length; i++)
        {
            autoCenterItemArray[i].SetCentered(false);
        }
        this.m_centeredItem = componentsInChildren[itemIndex];
        iTween.Stop(this.m_scrollRectContentsRT.gameObject);
        iTween.ValueTo(this.m_scrollRectContentsRT.gameObject, iTween.Hash(new object[] { "name", "autocenter", "from", this.m_scrollRectContentsRT.anchoredPosition.x, "to", this.m_targetX, "time", this.m_autoCenterDuration, "easetype", this.m_easeType, "onupdatetarget", base.gameObject, "onupdate", "OnAutoCenterUpdate", "oncompletetarget", base.gameObject, "oncomplete", "OnAutoCenterComplete" }));
    }
    public void OnTouchEnd(BaseEventData eventData, int itemIndex)
    {
        Vector2 vector2;
        bool    flag;

        if (eventData != null)
        {
            RectTransformUtility.ScreenPointToLocalPointInRectangle(this.m_scrollViewportRT, ((PointerEventData)eventData).position, Camera.main, out vector2);
            this.m_touchEndX = vector2.x;
        }
        bool mTouchEndX   = this.m_touchEndX - this.m_touchStartX >= this.m_minSwipeDistance;
        bool mTouchStartX = this.m_touchStartX - this.m_touchEndX >= this.m_minSwipeDistance;
        bool flag1        = false;

        if (!mTouchEndX || this.m_touchEndX - this.m_touchStartX <= this.m_maxSwipeDistance)
        {
            flag = (!mTouchStartX ? false : this.m_touchStartX - this.m_touchEndX > this.m_maxSwipeDistance);
        }
        else
        {
            flag = true;
        }
        bool flag2 = flag;

        AutoCenterItem[] componentsInChildren = this.m_scrollRectContentsRT.GetComponentsInChildren <AutoCenterItem>(true);
        int num = 0;

        if (itemIndex < 0)
        {
            float single = -1f;
            for (int i = 0; i < (int)componentsInChildren.Length; i++)
            {
                RectTransform component             = componentsInChildren[i].GetComponent <RectTransform>();
                float         mScrollRectContentsRT = -this.m_scrollRectContentsRT.anchoredPosition.x;
                Vector2       vector21 = component.anchoredPosition;
                float         single1  = Mathf.Abs(mScrollRectContentsRT - vector21.x);
                if (single < 0f || single1 < single)
                {
                    single = single1;
                    num    = i;
                }
            }
            if (num == 0 && this.m_scrollRectContentsRT.anchoredPosition.x > 0f)
            {
                flag1 = true;
            }
            if (num == (int)componentsInChildren.Length - 1)
            {
                RectTransform rectTransform = componentsInChildren[num].GetComponent <RectTransform>();
                if (-this.m_scrollRectContentsRT.anchoredPosition.x > rectTransform.anchoredPosition.x)
                {
                    flag1 = true;
                }
            }
        }
        else
        {
            num = itemIndex;
        }
        if (flag1)
        {
            return;
        }
        if (eventData != null && !flag2)
        {
            if (mTouchStartX && num < (int)componentsInChildren.Length - 1)
            {
                num++;
            }
            if (mTouchEndX && num > 0)
            {
                num--;
            }
        }
        Vector2 component1 = componentsInChildren[num].GetComponent <RectTransform>().anchoredPosition;

        this.m_targetX = -component1.x + (float)this.m_horizontalLayoutGroup.padding.left;
        AutoCenterItem[] autoCenterItemArray = componentsInChildren;
        for (int j = 0; j < (int)autoCenterItemArray.Length; j++)
        {
            autoCenterItemArray[j].SetCentered(false);
        }
        this.m_centeredItem = componentsInChildren[num];
        iTween.Stop(this.m_scrollRectContentsRT.gameObject);
        iTween.ValueTo(this.m_scrollRectContentsRT.gameObject, iTween.Hash(new object[] { "name", "autocenter", "from", this.m_scrollRectContentsRT.anchoredPosition.x, "to", this.m_targetX, "time", this.m_autoCenterDuration, "easetype", this.m_easeType, "onupdatetarget", base.gameObject, "onupdate", "OnAutoCenterUpdate", "oncompletetarget", base.gameObject, "oncomplete", "OnAutoCenterComplete" }));
    }