Exemplo n.º 1
0
        private void initializeOptions(OptionsComponent optionComponent)
        {
            optionVectors.Clear();

            distances.Clear();

            for (int i = 0; i < optionComponent.options.Count; i++)
            {
                if (transition.State == TransitionState.intro)
                {
                    optionVectors.Add(optionComponent.options[i].TextVector);

                    Vector2 temp = optionComponent.options[i].TextVector + startVector;

                    Vector2 distance = optionComponent.options[i].TextVector - temp;

                    optionComponent.options[i].TextVector = temp;

                    distances.Add(distance);
                }
                else if (transition.State == TransitionState.exit || transition.State == TransitionState.selected)
                {
                    Vector2 temp = optionComponent.options[i].TextVector + startVector;

                    Vector2 distance = temp - optionComponent.options[i].TextVector;

                    optionVectors.Add(optionComponent.options[i].TextVector);

                    distances.Add(distance);
                }
            }
        }
Exemplo n.º 2
0
        public override void setTransition(IComponent component)
        {
            OptionsComponent options = component as OptionsComponent;

            initializeOptions(options);
            initialized = true;

            transition.setTransition(component);
        }
Exemplo n.º 3
0
        private void resetOptions(OptionsComponent optionComponent)
        {
            if (defaultAlpha > 0)
            {
                alpha = defaultAlpha;

                setAlpha(optionComponent);
            }
        }
Exemplo n.º 4
0
        private void setAlpha(OptionsComponent optionComponent)
        {
            foreach (OptionType option in optionComponent.options)
            {
                Color temp = option.TextColor;

                temp.A = (byte)alpha;

                option.TextColor = temp;
            }
        }
Exemplo n.º 5
0
 private void resetOptions(OptionsComponent optionComponent)
 {
     for (int i = 0; i < optionComponent.options.Count; i++)
     {
         try
         {
             optionComponent.options[i].TextVector = optionVectors[i];
         }
         catch
         {
         }
     }
 }
Exemplo n.º 6
0
        public override void update(IComponent component)
        {
            OptionsComponent options = component as OptionsComponent;

            if (!initialized)
            {
                resetOptions(options);
                initializeOptions(options);
                initialized = true;
            }

            setOptions(options);

            transition.update(component);
        }
Exemplo n.º 7
0
        private void initializeOptions(OptionsComponent optionComponent)
        {
            defaultAlpha = optionComponent.options[0].TextColor.A;

            //Set the fade to fade in
            if (transition.State == TransitionState.intro)
            {
                direction = 255;
                alpha     = 0;

                setAlpha(optionComponent);
            }
            //Else set the fade to fade out;
            else if (transition.State == TransitionState.exit || transition.State == TransitionState.selected)
            {
                direction = -255;
                alpha     = 255;

                setAlpha(optionComponent);
            }
        }
Exemplo n.º 8
0
        private void setOptions(OptionsComponent optionComponent)
        {
            Vector2 temp = new Vector2();

            for (int i = 0; i < optionComponent.options.Count; i++)
            {
                temp.X = (distances[i].X / transition.Interval);
                temp.Y = (distances[i].Y / transition.Interval);

                int x = (int)(optionVectors[i].X - optionComponent.options[i].TextVector.X);
                int y = (int)(optionVectors[i].Y - optionComponent.options[i].TextVector.Y);

                if (((Math.Abs(x) < Math.Abs(temp.X)) || (Math.Abs(y) < Math.Abs(temp.Y))) && transition.State == TransitionState.intro)
                {
                    optionComponent.options[i].TextVector = optionVectors[i];
                }
                else
                {
                    optionComponent.options[i].TextVector += temp;
                }
            }
        }
Exemplo n.º 9
0
        public override void update(IComponent component)
        {
            OptionsComponent options = component as OptionsComponent;

            if (!initialized)
            {
                resetOptions(options);
                initializeOptions(options);
                initialized = true;
            }

            int x = 255 - alpha;
            int y = direction / transition.Interval;

            if (x >= y)
            {
                alpha += direction / transition.Interval;
            }

            setAlpha(options);

            transition.update(component);
        }