Exemple #1
0
 public MenuButton(SelectorMenu SelectorMenu, GraphicsComponent image, Action<MenuButton> action, Action<int> DefaultFunction, int Index, int layer)
     : base(layer)
 {
     this.SelectorMenu = SelectorMenu;
     this.image = image;
     this.Index = Index;
     image.CenterOrigin();
     Add(image);
     this.action = action;
     this.DefaultFunction = DefaultFunction;
 }
Exemple #2
0
 public static Tween Alpha(GraphicsComponent image, float targetAlpha, int duration, Ease.Easer easer, TweenMode tweenMode = TweenMode.Oneshot)
 {
     Entity entity = image.Entity;
     float startAlpha = image.Color.A / 255;
     Tween tween = new Tween(tweenMode, easer, duration, true);
     tween.OnUpdate = (t) => { image.Color.A = (byte)Math.Round(MathHelper.Lerp(startAlpha, targetAlpha, t.Eased) * 255.0f); };
     entity.Add(tween);
     return tween;
 }
Exemple #3
0
 internal void addChild(GraphicsComponent Child)
 {
     Children.Add(Child);
     Child.X = X;
     Child.Y = Y;
 }
Exemple #4
0
 public static Tween Scale(GraphicsComponent image, Vector2 targetScale, int duration, Ease.Easer easer, TweenMode tweenMode = TweenMode.Oneshot)
 {
     Vector2 startScale = image.Scale;
     Tween tween = new Tween(tweenMode, easer, duration, true);
     tween.OnUpdate = (t) => { image.Scale = Vector2.Lerp(startScale, targetScale, t.Eased); };
     image.Entity.Add(tween);
     return tween;
 }
Exemple #5
0
 public void deselectFunction(GraphicsComponent image)
 {
     outFunction(image, this);
 }
Exemple #6
0
 public void selectFunction( GraphicsComponent image )
 {
     inFunction(image, this);
 }
 private static void ScaleUpYoYo(GraphicsComponent image, Effect effect)
 {
     Tween.Scale( image, new Vector2( effect.max ), effect.duration, Ease.BackInOut, Tween.TweenMode.YoyoOneshot );
 }
 private static void FadeOut(GraphicsComponent image, Effect effect)
 {
     Tween.Alpha(image, effect.min, effect.duration, Ease.CubeOut, Tween.TweenMode.Oneshot);
 }
 internal static void OutlineOut(GraphicsComponent image, Effect effect)
 {
     image.outlined = false;
 }
 internal static void OutlineIn(GraphicsComponent image, Effect effect)
 {
     image.outlined = true;
     image.outlineColor = effect.outline;
 }
 internal static void ColorOut(GraphicsComponent image, Effect effect)
 {
     image.outlined = false;
     image.Color = effect.deselectedColor;
 }