Ejemplo n.º 1
0
        private void SpawnButtons()
        {
            TextButton btnStart = new TextButton(new Rectangle(), font, "Start", texPixel);
            btnStart.Click += () => {
                TheWitnessPuzzles.Puzzle currentPanel = FileStorageManager.LoadCurrentPanel();
                if (currentPanel == null)
                {
                    currentPanel = DI.Get<PanelGenerator>().GeneratePanel();
                    FileStorageManager.SaveCurrentPanel(currentPanel);
                }

                ScreenManager.Instance.AddScreen<PanelGameScreen>(false, true, currentPanel);
                SoundManager.PlayOnce(Sound.MenuEnter);
            };

            TextButton btnHistory = new TextButton(new Rectangle(), font, "Library", texPixel);
            btnHistory.Click += () => {
                ScreenManager.Instance.AddScreen<HistoryGameScreen>(false, true);
                SoundManager.PlayOnce(Sound.MenuEnter);
            };

            TextButton btnSettings = new TextButton(new Rectangle(), font, "Settings", texPixel);
            btnSettings.Click += () => {
                ScreenManager.Instance.AddScreen<SettingsGameScreen>(false, true);
                SoundManager.PlayOnce(Sound.MenuEnter);
            };

            TextButton btnAbout = new TextButton(new Rectangle(), font, "About", texPixel);
            btnAbout.Click += () => {
                ScreenManager.Instance.AddScreen<AboutGameScreen>(false, true);
                SoundManager.PlayOnce(Sound.MenuEnter);
            };

            buttons.Add(btnStart);
            buttons.Add(btnHistory);
            buttons.Add(btnSettings);
            buttons.Add(btnAbout);

            UpdateButtonsPosition();
        }
Ejemplo n.º 2
0
        private void SpawnButtons()
        {
            int btnSize = (int)(Math.Min(ScreenSize.X, ScreenSize.Y) * 0.2f);

            btnBack        = new TextButton(new Rectangle(btnSize / 2, ScreenSize.Y - btnSize, btnSize, btnSize / 2), font, "Back", texPixel);
            btnBack.Click += () =>
            {
                SoundManager.PlayOnce(Sound.MenuEscape);

                switch (state)
                {
                case EditorState.PanelDimensionsSelect:
                    ScreenManager.Instance.GoBack();
                    break;

                case EditorState.Main:
                    state = EditorState.PanelDimensionsSelect;
                    break;

                case EditorState.NodeEdit:
                    break;

                case EditorState.EdgeEdit:
                    break;

                case EditorState.BlockEdit:
                    break;

                case EditorState.TetrisSelect:
                    break;
                }
            };

            btnNext        = new TextButton(new Rectangle(ScreenSize.X - btnSize - btnSize / 2, ScreenSize.Y - btnSize, btnSize, btnSize / 2), font, "Next", texPixel);
            btnNext.Click += () =>
            {
                SoundManager.PlayOnce(Sound.MenuEnter);

                switch (state)
                {
                case EditorState.PanelDimensionsSelect:
                    state = EditorState.Main;
                    if (panel == null)
                    {
                        panel = new Puzzle(panelDimensions.X, panelDimensions.Y);
                    }
                    renderer.SetPanel(panel);
                    renderer.RenderPanelToTexture(panelTexture);
                    break;

                case EditorState.Main:
                    break;

                case EditorState.NodeEdit:
                    break;

                case EditorState.EdgeEdit:
                    break;

                case EditorState.BlockEdit:
                    break;

                case EditorState.TetrisSelect:
                    break;
                }
            };
        }