コード例 #1
0
        // The update function is the logical loop, here all logic goes.
        public override void Update()
        {
            // Loop through all of the buttons, and check what button is being pressed,
            // Act accordingly.
            for (int i = 0; i < uiElements.Length; i++)
            {
                if (uiElements[i].IsClicked())
                {
                    switch (uiElements[i].ID)
                    {
                    case 0:     // New Game
                        StageHandler.LoadStage(new MainGame("Game"));
                        break;

                    case 2:     // Coop
                        if (StageHandler.StageExists("Coop"))
                        {
                            StageHandler.SetCurrentStage("Coop");
                        }
                        else
                        {
                            StageHandler.LoadStage(new CoopMenu("Coop"));
                        }
                        break;

                    case 5:     // Exit
                        Raylib.CloseWindow();
                        Environment.Exit(1);
                        break;
                    }
                }
            }
        }
コード例 #2
0
        // The update function is the logical loop, here all logic goes.
        public override void Update()
        {
            // Loop through all of the uiElements, and check what button is being pressed,
            // Act accordingly.
            for (int i = 0; i < uiElements.Length; i++)
            {
                if (uiElements[i].IsClicked())
                {
                    switch (uiElements[i].ID)
                    {
                    case 0:     // Join
                        Client.Connect();
                        break;

                    case 1:     // Host
                        Host.InitHost();
                        break;

                    case 2:     // Back
                        StageHandler.SetCurrentStage("MainMenu");
                        break;

                    case 3:
                        Client.Broadcast();
                        break;
                    }
                }
            }
        }