Esempio n. 1
0
        public override void TabPageDrag()
        {
            Kyub.Performance.SustainedPerformanceManager.Refresh(this);
            if (m_CanScrollBetweenTabs)
            {
                if (TweenManager.TweenIsActive(m_PagesContainerTweener))
                {
                    TweenManager.EndTween(m_PagesContainerTweener);

                    m_CurrentPage = NearestPage();

                    OnPagesTweenEnd();

                    TweenIndicator(m_CurrentPage);
                }

                TweenManager.EndTween(m_IndicatorTweener);

                if (m_Indicator != null)
                {
                    float normalizedPagesContainerPosition = -m_PagesContainer.anchoredPosition.x / (m_PageSize.x * m_Pages.Count);
                    if (m_ForceSameTabSize)
                    {
                        m_Indicator.anchoredPosition = new Vector2((m_TabWidth * m_Tabs.Length) * normalizedPagesContainerPosition, 0);
                    }
                    else
                    {
                        m_Indicator.anchoredPosition = new Vector2(rectTransform.GetProperSize().x *normalizedPagesContainerPosition, 0);
                    }
                }
            }
        }
Esempio n. 2
0
        void Update()
        {
            if (TweenManager.TweenIsActive(m_HandleAnchorMinTweener))
            {
                m_FillTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, 0, fillAreaTransform.rect.width * handleGraphicTransform.anchorMin.x);
            }

            if (m_InputField != null)
            {
                if (slider.wholeNumbers)
                {
                    m_InputField.inputField.contentType = InputField.ContentType.IntegerNumber;
                }
                else
                {
                    m_InputField.inputField.contentType = InputField.ContentType.DecimalNumber;
                }
            }

            if (m_IsSelected)
            {
                if (slider.wholeNumbers && m_HasDots)
                {
                    if (m_NumberOfDots != SliderValueRange())
                    {
                        RebuildDots();
                    }
                    for (int i = 0; i < m_DotGraphics.Length; i++)
                    {
                        if (slider.value > i)
                        {
                            m_DotGraphics[i].color = m_EnabledColor;
                        }
                        else
                        {
                            m_DotGraphics[i].color = m_BackgroundColor;
                        }
                    }
                }
                else
                {
                    DestroyDots();
                }

                if (m_HandleGraphic)
                {
                    m_HandleGraphic.color = m_Interactable ? m_EnabledColor : m_DisabledColor;
                }
            }

#if UNITY_EDITOR
            if (slider.value != m_LastSliderValue)
            {
                OnSliderValueChanged(m_LastSliderValue);
                m_LastSliderValue = slider.value;
            }
#endif
        }
Esempio n. 3
0
        public void SetLayoutVertical()
        {
            inputTextTransform.offsetMax = new Vector2(inputTextTransform.offsetMax.x, -m_TopSectionHeight);

            if (!TweenManager.TweenIsActive(m_HintTextFloatingValueTweener))
            {
                hintTextFloatingValue = (inputField.isFocused || inputField.text.Length > 0) ? 1 : 0;
                SetHintLayoutToFloatingValue();
            }

            if (m_LeftContentTransform)
            {
                ILayoutController[] controllers = m_LeftContentTransform.GetComponentsInChildren <ILayoutController>();
                for (int i = 0; i < controllers.Length; i++)
                {
                    controllers[i].SetLayoutVertical();
                }

                m_LeftContentTransform.anchoredPosition = new Vector2(m_LeftContentOffset.x, (inputTextTransform.offsetMax.y - (m_InputText.fontSize / 2) - 2) + m_LeftContentOffset.y);
            }

            if (m_RightContentTransform)
            {
                ILayoutController[] controllers = m_RightContentTransform.GetComponentsInChildren <ILayoutController>();
                for (int i = 0; i < controllers.Length; i++)
                {
                    controllers[i].SetLayoutVertical();
                }

                m_RightContentTransform.anchoredPosition = new Vector2(m_RightContentOffset.x, (inputTextTransform.offsetMax.y - (m_InputText.fontSize / 2) - 2) + m_RightContentOffset.y);
            }

            if (m_LineTransform != null)
            {
                m_LineTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Bottom, m_BottomSectionHeight, 1);
            }

            if (caretTransform != null)
            {
                caretTransform.offsetMin = new Vector2(caretTransform.offsetMin.x, inputTextTransform.offsetMin.y);
                caretTransform.offsetMax = new Vector2(caretTransform.offsetMax.x, inputTextTransform.offsetMax.y);
            }
        }
Esempio n. 4
0
        public void TabPageDrag()
        {
            if (m_CanScrollBetweenTabs)
            {
                if (TweenManager.TweenIsActive(m_PagesContainerTweener))
                {
                    TweenManager.EndTween(m_PagesContainerTweener);

                    m_CurrentPage = NearestPage();

                    OnPagesTweenEnd();

                    TweenIndicator(m_CurrentPage);
                }

                TweenManager.EndTween(m_IndicatorTweener);

                float normalizedPagesContainerPosition = -m_PagesContainer.anchoredPosition.x / (m_PageSize.x * m_Pages.Length);

                m_Indicator.anchoredPosition = new Vector2((m_TabWidth * m_Tabs.Length) * normalizedPagesContainerPosition, 0);
            }
        }
Esempio n. 5
0
        public void SetLayoutHorizontal()
        {
            if (!TweenManager.TweenIsActive(m_HintTextFloatingValueTweener))
            {
                hintTextFloatingValue = (inputField.isFocused || inputField.text.Length > 0) ? 1 : 0;
                SetHintLayoutToFloatingValue();
            }

            inputTextTransform.offsetMin = new Vector2(m_LeftSectionWidth, inputTextTransform.offsetMin.y);
            inputTextTransform.offsetMax = new Vector2(-m_RightSectionWidth, inputTextTransform.offsetMax.y);

            if (m_LineTransform != null)
            {
                m_LineTransform.offsetMin = new Vector2(m_LeftSectionWidth, m_LineTransform.offsetMin.y);
                m_LineTransform.offsetMax = new Vector2(-m_RightSectionWidth, m_LineTransform.offsetMax.y);
            }

            if (m_ValidationTextTransform != null)
            {
                m_ValidationTextTransform.offsetMin = new Vector2(m_LeftSectionWidth,
                                                                  m_ValidationTextTransform.offsetMin.y);
                m_ValidationTextTransform.offsetMax = new Vector2(-m_RightSectionWidth,
                                                                  m_ValidationTextTransform.offsetMax.y);
            }

            if (m_CounterTextTransform != null)
            {
                m_CounterTextTransform.offsetMin = new Vector2(m_LeftSectionWidth, m_CounterTextTransform.offsetMin.y);
                m_CounterTextTransform.offsetMax = new Vector2(-m_RightSectionWidth, m_CounterTextTransform.offsetMax.y);
            }

            if (caretTransform != null)
            {
                caretTransform.offsetMin = new Vector2(inputTextTransform.offsetMin.x, caretTransform.offsetMin.y);
                caretTransform.offsetMax = new Vector2(inputTextTransform.offsetMax.x, caretTransform.offsetMax.y);
            }
        }