예제 #1
0
        protected void SetInitialState(UIState state)
        {
            foreach (ColorState colorState in state.ColorStates)
            {
                colorState.Component.color = UIColors.WithAlpha(
                    (Color)colorState.Color,
                    (float)colorState.Alpha);
            }

            _currentState = state;
        }
예제 #2
0
        protected override void Start()
        {
            base.Start();
            ColorSprite.color  = UIColors.WithAlpha(_baseColor, _colorAlpha);
            BorderSprite.color = UIColors.WithAlpha(_accentColor, _borderAlpha);

            _defaultState = new List <ColorState> {
                new ColorState(ColorSprite, _baseColor, _colorAlpha),
                new ColorState(BorderSprite, _accentColor, _borderAlpha)
            };
            _hoverState = new List <ColorState> {
                new ColorState(ColorSprite, _baseColor, _colorAlphaHover),
                new ColorState(BorderSprite, _accentColor, _borderAlphaHover)
            };
        }