Exemple #1
0
        public void ShowGUI()
        {
            _guiHandler.Clear();

            _guiHandler.Add(_guiPanel);
        }
 public void ShowStartGUI()
 {
     _guiHandler.Clear();
     _guiHandler.Add(_startPanel1);
     _guiHandler.Add(_startPanel2);
 }
        internal void HighScoreGui()
        {
            var height = _rCanvas.Height;
            var width = _rCanvas.Width;
            _highscore = true;
            _guiHandler = _highScoreHandler;

            // Erst if-Abfrage, ob ich grad aus der Pause komme, weil ich dann nichts überschreiben will
            if (_gameHandler.GameState.LastState != GameState.State.HiddenPause &&
                _gameHandler.GameState.CurrentState == GameState.State.Highscore)
            {
                Console.WriteLine("HighScoreGui");
                _guiHandler.Clear(); // Alte Infos aus dem GameHandler entfernen (z.B. Stand der Tomaten)
                for (int i = 0; i < 10; i++) //Restliche Tomaten aus dem Spiel noch entfernen
                {
                    _highScoreHandler.Remove(_guiImageTomato[i]);
                }

                // Bilder&Texte&Buttons hinzufügen
                _highScoreHandler.Add(_guiImages[(int) _btnimages.Endbild]);
                _highScoreHandler.Add(_guiImages[(int) _btnimages.btniCreditsA]);
                _highScoreHandler.Add(_guiImages[(int) _btnimages.btniNochmal]);
                _highScoreHandler.Add(_guiImages[(int) _btnimages.btniHighscore]);
                _highScoreHandler.Add(_guiText5);
                _highScoreHandler.Add(_guiText6);
                _highScoreHandler.Add(nameInput);
                _highScoreHandler.Add(_name);
                _highScoreHandler.Add(_guiCredits);
                _highScoreHandler.Add(_guiDiffs[(int) _buttons.btnCredits]);
                _highScoreHandler.Add(_guiDiffs[(int) _buttons.btnNochmal]);
                _highScoreHandler.Add(_guiDiffs[(int) _buttons.btnHighscore]);
                _guiDiffs[(int)_buttons.btnNochmal].OnGUIButtonDown += OnbtnPlay;
                _guiDiffs[(int)_buttons.btnHighscore].OnGUIButtonDown += OnbtnHighscore;
                _guiDiffs[(int)_buttons.btnCredits].OnGUIButtonDown += Credits;

                // Punkte
                if (_highScoreHandler.Contains(_guiText4))
                {
                    _highScoreHandler.Remove(_guiText4);
                }
                float textwidth;
                textwidth = GUIText.GetTextWidth("You reached --- Points!", _guiFontWESTERN30);
                _guiText4 = new GUIText("You reached " + _points + " Points!", _guiFontWESTERN30, width / 2 - (int)(textwidth / 2), (height / 3), new float4(1, 0, 0, 1));
                _highScoreHandler.Add(_guiText4);
            }
        }