Esempio n. 1
0
        public Damage(int value, Vector2D position, AutoDisposer autoDisposer)
        {
            this.SetupUpdateAndAutoDispose(autoDisposer);
            this.position = position;

            {
                var font = new Font(
                    Config.MainConfig.MainFontPath,
                    35,
                    new Color(1, 1, 1, 1),
                    new Font.FontFrame[] {
                    new Font.FontFrame(5, new Color(1, 1, 1, 1)),
                    //new Font.FontFrame(2, new Color(1, 0.5, 0.5, 0.5)),
                    new Font.FontFrame(5, new Color(1, 0, 0, 0))
                },
                    0);
                var x  = position.X;
                var y  = position.Y;
                var ts = new TextSprite(value.ToString(), font, new Vector2D(x, y));
                layer.Add(ts, 20);

                ts.Rect.Position.X -= ts.GetRect().Size.X / 2;

                textSprite = ts;
            }
        }
Esempio n. 2
0
        public Button(string text, Font font, Vector2D position, Action click)
        {
            this.click = click;

            {
                var ts = new TextSprite(text, font, new Vector2D(0, 0), TextSprite.Type.Separation, null);
                layer.Add(ts, 20);

                var size = ts.GetRect().Size;
                ts.Rect.Position = new Vector2D((1600 - size.X) / 2, position.Y);

                textSpriteNewGame = ts;
            }
            {
                var font2 = new Font(
                    font.fontPath,
                    font.fontSize,
                    new Color(1, 1, 1, 1),
                    new Font.FontFrame[] {
                    new Font.FontFrame(4, new Color(1.0, 1.0, 1.0, 1.0)),
                    new Font.FontFrame(1, new Color(0.5, 1.0, 1.0, 1.0))
                },
                    font.lineTextMargin);
                var x  = position.X;
                var y  = position.Y;
                var ts = new TextSprite(text, font2, new Vector2D(0, 0), TextSprite.Type.Separation, null);
                layer.Add(ts, 30);

                var size = ts.GetRect().Size;
                ts.Rect.Position = new Vector2D((1600 - size.X) / 2, position.Y);

                textSpriteNewGameEffect        = ts;
                textSpriteNewGameEffect.IsDraw = false;
            }
        }
Esempio n. 3
0
        public override void Update()
        {
            var position = textSpriteNewGame.Rect.Position;
            var size     = textSpriteNewGame.GetRect().Size;
            var mouse    = Emugen.Input.InputCore.Instance.mousePosition;

            if (((position.X <= mouse.X) && (mouse.X < (position.X + size.X))) &&
                ((position.Y <= mouse.Y) && (mouse.Y < (position.Y + size.Y))))
            {
                var input = Emugen.Input.InputCore.Instance;
                if (input.GetKeyEventType(Emugen.Input.InputCore.KeyEventCode.MouseLeftButton) == Emugen.Input.InputCore.KeyEventType.Up)
                {
                    if (click != null)
                    {
                        click();
                    }
                }
                textSpriteNewGameEffect.IsDraw = true;

                {
                    textSpriteNewGameEffectTimer += 0.10;

                    var tmp = ((Math.Sin(textSpriteNewGameEffectTimer) + 1.0) / 2.0) * 0.5 + 0.2;
                    if (textSpriteNewGameEffectTimer >= (Math.PI * 2))
                    {
                        textSpriteNewGameEffectTimer = 0;
                    }
                    textSpriteNewGameEffect.Color.A = tmp;
                }
            }
            else
            {
                textSpriteNewGameEffect.IsDraw = false;
                textSpriteNewGameEffectTimer   = 0;
            }
        }