Beispiel #1
0
        private void InitializeComponents()
        {
            //
            // ButtonStart
            //
            ButtonResume                 = new UI.Components.Button("ButtonResume");
            ButtonResume.Content         = "Resume Game";
            ButtonResume.Size            = new Vector2f(100, 50);
            ButtonResume.Location        = new Vector2f(Application.Game.Window.Size.X / 2 - ButtonResume.Size.X / 2, 50);
            ButtonResume.OnClicked      += ButtonResume_Clicked;
            ButtonResume.ForegroundColor = Color.White;
            ButtonResume.BackgroundImage = new Image(@"assets/images/block_icon.png");
            ButtonResume.SetLayer(9999);

            //
            // ButtonQuit
            //
            ButtonQuit                 = new UI.Components.Button("ButtonQuitToMainMenu");
            ButtonQuit.Content         = "Quit To Main Menu";
            ButtonQuit.Size            = new Vector2f(100, 50);
            ButtonQuit.Location        = new Vector2f(Application.Game.Window.Size.X / 2 - ButtonQuit.Size.X / 2, 105);
            ButtonQuit.OnClicked      += (ButtonQuit_Clicked);
            ButtonQuit.ForegroundColor = Color.White;
            ButtonQuit.BackgroundImage = new Image(@"assets/images/block_icon.png");
            ButtonQuit.SetLayer(9999);

            //
            // ImageBlur
            //
            Image img = new Image(Application.Game.Window.Size.X, Application.Game.Window.Size.Y, new Color(54, 50, 41));

            ImageBackgroundBlur              = new UI.Components.Image("ImageBlur", img);
            ImageBackgroundBlur.Size         = new Vector2f(Application.Game.Window.Size.X, Application.Game.Window.Size.Y);
            ImageBackgroundBlur.Transparency = 150;
            ImageBackgroundBlur.SetLayer(9998);


            //
            // Add Components
            //
            m_Interface.AddChild(new UIElement[]
            {
                ButtonResume,
                ButtonQuit,
                ImageBackgroundBlur,
            });
        }
Beispiel #2
0
        public GameMenu(string name, Window w, PlayerController playerController, Arena arena) : base(name)
        {
            labelScore     = new Label("LabelScore");
            labelTime      = new Label("LabelTime");
            labelLevel     = new Label("LabelLevel");
            labelLines     = new Label("LabelLines");
            labelHighScore = new Label("LabelHighscore");
            imageNextBlock = new UI.Components.Image("ImageNextBlock", string.Empty);

            m_Interface = new UserInterface("GameMenu", w);

            // Objects from scene
            m_PlayerController = playerController;
            m_Arena            = arena;

            InitializeComponents();
        }
        private void InitializeComponents()
        {
            //
            // ButtonStart
            //
            ButtonRestart                 = new UI.Components.Button("ButtonRestart");
            ButtonRestart.Content         = "Restart";
            ButtonRestart.FontSize        = 12;
            ButtonRestart.ForegroundColor = Color.White;
            ButtonRestart.Size            = new Vector2f(150, 75);
            ButtonRestart.Location        = new Vector2f(Application.Game.Window.Size.X * 0.10f, 250);
            ButtonRestart.BackgroundImage = new Image(@"assets/images/block_icon.png");
            ButtonRestart.OnClicked      += ButtonRestart_Clicked;
            ButtonRestart.OnMouseEntered += ButtonRestart_MouseEntered;
            ButtonRestart.OnMouseLeft    += ButtonRestart_MouseLeft;
            ButtonRestart.SetLayer(1);

            //
            // ButtonQuit
            //
            ButtonQuit                 = new UI.Components.Button("ButtonQuitToMainMenu");
            ButtonQuit.Content         = "Quit To Main Menu";
            ButtonQuit.FontSize        = 12;
            ButtonQuit.ForegroundColor = Color.White;
            ButtonQuit.Size            = new Vector2f(150, 75);
            ButtonQuit.Location        = new Vector2f(Application.Game.Window.Size.X - Application.Game.Window.Size.X * 0.10f - ButtonQuit.Size.X, 250);
            ButtonQuit.BackgroundImage = new Image(@"assets/images/block_icon.png");
            ButtonQuit.OnClicked      += (ButtonQuit_Clicked);
            ButtonQuit.OnMouseEntered += ButtonQuit_MouseEntered;
            ButtonQuit.OnMouseLeft    += ButtonQuit_MouseLeft;
            ButtonQuit.SetLayer(1);

            //
            // LabelGameOver
            //
            LabelGameOver                 = new UI.Components.Label("LabelGameOver");
            LabelGameOver.Content         = $"Game Over";
            LabelGameOver.Size            = new Vector2f(100, 50);
            LabelGameOver.Location        = new Vector2f(Application.Game.Window.Size.X / 2 - LabelGameOver.Size.X * 1.5f, 100);
            LabelGameOver.ForegroundColor = Color.Red;
            LabelGameOver.BackgroundColor = Color.Transparent;
            LabelGameOver.FontSize        = 50;
            LabelGameOver.SetLayer(1);

            //
            // ImageBlur
            //
            Image img = new Image(Application.Game.Window.Size.X, Application.Game.Window.Size.Y, new Color(54, 50, 41));

            ImageBlur              = new UI.Components.Image("ImageBlur", img);
            ImageBlur.Size         = new Vector2f(Application.Game.Window.Size.X, Application.Game.Window.Size.Y);
            ImageBlur.Transparency = 150;
            ImageBlur.SetLayer(0);

            //
            // Add Components
            //
            m_Interface.AddChild(new UIElement[]
            {
                ButtonRestart,
                ButtonQuit,
                LabelGameOver,
                ImageBlur,
            });
        }