示例#1
0
        public static UIState Diff(UIState fromState, UIState toState)
        {
            List <ColorState> colors = new List <ColorState>();

            foreach (ColorState fromColor in fromState.ColorStates)
            {
                foreach (ColorState toColor in toState.ColorStates)
                {
                    if (fromColor.Component == toColor.Component &&
                        fromColor.Color != toColor.Color)
                    {
                        colors.Add(toColor);
                    }
                }
            }

            return(new UIState(colors));
        }
示例#2
0
        protected void TransitionToState(UIState state)
        {
            _currentState = state;

            _colorTransitions.Clear();
            _lerp = 0f;

            foreach (ColorState colorState in state.ColorStates)
            {
                _colorTransitions.Add(new ColorTransition(
                                          colorState.Component,
                                          colorState.Component.color,
                                          colorState.Color,
                                          colorState.Alpha));
            }

            if (!_isAnimating)
            {
                _isAnimating = true;
            }
        }
示例#3
0
 public void OnPointerExit(PointerEventData eventData)
 {
     TransitionToState(UIState.Merge(_defaultState));
 }
示例#4
0
 public void OnPointerEnter(PointerEventData eventData)
 {
     TransitionToState(UIState.Merge(_hoverState));
 }