예제 #1
0
        public MainMenu()
        {
            menuPanel = new Panel(new Vector2(250, 400), PanelSkin.Default, Anchor.Center);
            UserInterface.Active.AddEntity(menuPanel);

            menuPanel.AddChild(new Header("Sokoban"));
            menuPanel.AddChild(new HorizontalLine());


            var startButton = new Button("Start")
            {
                OnClick = (Entity btn) =>
                {
                    menuPanel.Visible = false;
                    StartButtonPressed?.Invoke();
                }
            };

            menuPanel.AddChild(startButton);
            var settingsButton = new Button("Settings")
            {
                OnClick = (Entity btn) =>
                {
                    menuPanel.Visible = false;
                }
            };

            menuPanel.AddChild(settingsButton);

            var exitButton = new Button("Exit")
            {
                OnClick = (Entity btn) =>
                {
                    ExitButtonPressed?.Invoke();
                }
            };

            menuPanel.AddChild(exitButton);
        }
예제 #2
0
 public virtual void PressStartButton()
 {
     StartButtonPressed?.Invoke(this, new EventArgs());
 }