Пример #1
0
        private void UpdateSelectionState()
        {
            if (m_Interactable)
            {
                m_CurrentSelectionState = inputField.isFocused ? ColorSelectionState.EnabledSelected : ColorSelectionState.EnabledDeselected;

                if (lineImage != null)
                {
                    lineImage.sprite = null;
                }
            }
            else
            {
                m_CurrentSelectionState = inputField.isFocused ? ColorSelectionState.DisabledSelected : ColorSelectionState.DisabledDeselected;

                if (lineImage != null)
                {
                    lineImage.sprite = lineDisabledSprite;
                    lineImage.type   = Image.Type.Tiled;
                }
            }

            if (m_CurrentSelectionState != m_LastSelectionState)
            {
                m_LastSelectionState = m_CurrentSelectionState;

                TweenManager.EndTween(m_LeftContentTweener);

                if (Application.isPlaying)
                {
                    if (m_LeftContentGraphic)
                    {
                        m_LeftContentTweener = TweenManager.TweenColor(color => m_LeftContentGraphic.color = color,
                                                                       m_LeftContentGraphic.color,
                                                                       IsSelected() ? m_LeftContentActiveColor : m_LeftContentInactiveColor, m_AnimationDuration);
                    }
                }
                else
                {
                    if (m_LeftContentGraphic)
                    {
                        m_LeftContentGraphic.color = IsSelected()
                            ? m_LeftContentActiveColor
                            : m_LeftContentInactiveColor;
                    }
                }

                TweenManager.EndTween(m_RightContentTweener);

                if (Application.isPlaying)
                {
                    if (m_RightContentGraphic)
                    {
                        m_RightContentTweener = TweenManager.TweenColor(color => m_RightContentGraphic.color = color,
                                                                        m_RightContentGraphic.color,
                                                                        IsSelected() ? m_RightContentActiveColor : m_RightContentInactiveColor, m_AnimationDuration);
                    }
                }
                else
                {
                    if (m_RightContentGraphic)
                    {
                        m_RightContentGraphic.color = IsSelected()
                            ? m_RightContentActiveColor
                            : m_RightContentInactiveColor;
                    }
                }

                TweenManager.EndTween(m_HintTextTweener);

                if (Application.isPlaying)
                {
                    m_HintTextTweener = TweenManager.TweenColor(color => m_HintTextObject.color = color,
                                                                m_HintTextObject.color, IsSelected() ? m_HintTextActiveColor : m_HintTextInactiveColor,
                                                                m_AnimationDuration);
                }
                else
                {
                    m_HintTextObject.color = IsSelected() ? m_HintTextActiveColor : m_HintTextInactiveColor;
                }

                TweenManager.EndTween(m_CounterTweener);

                if (Application.isPlaying)
                {
                    m_CounterTweener = TweenManager.TweenColor(color => m_CounterText.color = color,
                                                               m_CounterText.color, IsSelected() ? m_CounterActiveColor : m_CounterInactiveColor,
                                                               m_AnimationDuration);
                }
                else
                {
                    try
                    {
                        m_CounterText.color = IsSelected() ? m_CounterActiveColor : m_CounterInactiveColor;
                    }
                    catch
                    {
                        Debug.LogWarning("MaterialInputField:1127");
                    }
                }

                TweenManager.EndTween(m_ValidationColorTweener);

                if (Application.isPlaying)
                {
                    m_ValidationColorTweener = TweenManager.TweenColor(color => m_ValidationText.color = color,
                                                                       m_ValidationText.color, IsSelected() ? m_ValidationActiveColor : m_ValidationInactiveColor,
                                                                       m_AnimationDuration);
                }
                else
                {
                    m_ValidationText.color = IsSelected() ? m_ValidationActiveColor : m_ValidationInactiveColor;
                }

                m_LineTransform.GetComponent <Graphic>().color       = m_LineInactiveColor;
                m_ActiveLineTransform.GetComponent <Graphic>().color = m_LineActiveColor;

                canvasGroup.alpha          = m_Interactable ? 1 : 0.5f;
                canvasGroup.interactable   = m_Interactable;
                canvasGroup.blocksRaycasts = m_Interactable;
            }
        }
Пример #2
0
        private void UpdateSelectionState()
        {
            if (m_Interactable)
            {
                m_CurrentSelectionState = inputField.isFocused ? ColorSelectionState.EnabledSelected : ColorSelectionState.EnabledDeselected;

                if (lineImage != null)
                {
                    lineImage.sprite = null;
                }
            }
            else
            {
                m_CurrentSelectionState = inputField.isFocused ? ColorSelectionState.DisabledSelected : ColorSelectionState.DisabledDeselected;

                if (lineImage != null)
                {
                    lineImage.sprite = lineDisabledSprite;
                    lineImage.type = Image.Type.Tiled;
                }
            }

            if (m_CurrentSelectionState != m_LastSelectionState)
            {
                m_LastSelectionState = m_CurrentSelectionState;

                TweenManager.EndTween(m_LeftContentTweener);

                if (Application.isPlaying)
                {
                    if (m_LeftContentGraphic)
                    {
                        m_LeftContentTweener = TweenManager.TweenColor(color => m_LeftContentGraphic.color = color,
                            m_LeftContentGraphic.color,
                            IsSelected() ? m_LeftContentActiveColor : m_LeftContentInactiveColor, m_AnimationDuration);
                    }
                }
                else
                {
                    if (m_LeftContentGraphic)
                    {
                        m_LeftContentGraphic.color = IsSelected()
                            ? m_LeftContentActiveColor
                            : m_LeftContentInactiveColor;
                    }
                }

                TweenManager.EndTween(m_RightContentTweener);

                if (Application.isPlaying)
                {
                    if (m_RightContentGraphic)
                    {
                        m_RightContentTweener = TweenManager.TweenColor(color => m_RightContentGraphic.color = color,
                            m_RightContentGraphic.color,
                            IsSelected() ? m_RightContentActiveColor : m_RightContentInactiveColor, m_AnimationDuration);
                    }
                }
                else
                {
                    if (m_RightContentGraphic)
                    {
                        m_RightContentGraphic.color = IsSelected()
                            ? m_RightContentActiveColor
                            : m_RightContentInactiveColor;
                    }
                }

                TweenManager.EndTween(m_HintTextTweener);

                if (Application.isPlaying)
                {
                    m_HintTextTweener = TweenManager.TweenColor(color => m_HintTextObject.color = color,
                        m_HintTextObject.color, IsSelected() ? m_HintTextActiveColor : m_HintTextInactiveColor,
                        m_AnimationDuration);
                }
                else
                {
                    m_HintTextObject.color = IsSelected() ? m_HintTextActiveColor : m_HintTextInactiveColor;
                }

                TweenManager.EndTween(m_CounterTweener);

                if (Application.isPlaying)
                {
                    m_CounterTweener = TweenManager.TweenColor(color => m_CounterText.color = color,
                        m_CounterText.color, IsSelected() ? m_CounterActiveColor : m_CounterInactiveColor,
                        m_AnimationDuration);
                }
                else
                {
                    m_CounterText.color = IsSelected() ? m_CounterActiveColor : m_CounterInactiveColor;
                }

                TweenManager.EndTween(m_ValidationColorTweener);

                if (Application.isPlaying)
                {

                    m_ValidationColorTweener = TweenManager.TweenColor(color => m_ValidationText.color = color,
                        m_ValidationText.color, IsSelected() ? m_ValidationActiveColor : m_ValidationInactiveColor,
                        m_AnimationDuration);
                }
                else
                {
                    m_ValidationText.color = IsSelected() ? m_ValidationActiveColor : m_ValidationInactiveColor;
                }

                m_LineTransform.GetComponent<Graphic>().color = m_LineInactiveColor;
                m_ActiveLineTransform.GetComponent<Graphic>().color = m_LineActiveColor;

                canvasGroup.alpha = m_Interactable ? 1 : 0.5f;
                canvasGroup.interactable = m_Interactable;
                canvasGroup.blocksRaycasts = m_Interactable;
            }
        }