Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SoundScreen"/> class.
        /// </summary>
        /// <param name="graphicsManager">The graphics manager.</param>
        /// <param name="screenManager">The screen manager.</param>
        public SoundScreen(IBallerburgGraphicsManager graphicsManager, IScreenManager screenManager)
            : base(graphicsManager, screenManager, "Ballerburg3D")
        {
            // Zurück button
              zurueckMenuEntry = new MenuEntry(this, ResourceLoader.GetString("BackText"), 0) { Position = new Vector2(500, 450) };
              zurueckMenuEntry.Selected += ZurueckMenuEntrySelected;

              musicVolumeSlider = new HSlider(this, new Rectangle(250, 100, 300, 20), screenManager.ApplicationSettings.MusicVolume);
              musicVolumeSlider.ValueChanged += OnMusicVolumeChanged;
              soundFxVolumeSlider = new HSlider(this, new Rectangle(250, 200, 300, 20), screenManager.ApplicationSettings.FxVolume);
              menuEffectsVolumeSlider = new HSlider(this, new Rectangle(250, 300, 300, 20), screenManager.ApplicationSettings.MenuEffectsVolume);

              var musicList = new List<string> { "DarkStar", "High Tension", "Tentacle", "Death Row", "Boomerang", "Aus" };

              musicSelectButton = new ComboToggleButton(this, "Musik", new Collection<string>(musicList), 0, 0) { Position = new Vector2(20, 100) };
              musicSelectButton.Selected += OnMusicButtonSelected;

              toggleMenuEffectsActionButton = new OnOffToggleButton(this, "Menueeffekte", true, 0) { Position = new Vector2(20, 200) };

              toggleSoundEffectsActionButton = new OnOffToggleButton(this, "Soundeffekte", true, 0) { Position = new Vector2(20, 300) };

              ControlsContainer.Add(zurueckMenuEntry);
              ControlsContainer.Add(musicVolumeSlider);
              ControlsContainer.Add(soundFxVolumeSlider);
              ControlsContainer.Add(menuEffectsVolumeSlider);
              ControlsContainer.Add(musicSelectButton);
              ControlsContainer.Add(toggleMenuEffectsActionButton);
              ControlsContainer.Add(toggleSoundEffectsActionButton);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SpielerDialogScreen"/> class.
        /// </summary>
        /// <param name="graphicsManager">The GraphicsManager</param>
        /// <param name="screenManager">The screen manager.</param>
        /// <param name="spielerNr">The spieler nr.</param>
        /// <param name="playerSettings">The player settings.</param>
        public SpielerDialogScreen(IBallerburgGraphicsManager graphicsManager, IScreenManager screenManager, int spielerNr, PlayerSettings playerSettings)
            : base(graphicsManager, screenManager, "Spieler" + spielerNr.ToString() + " Dialog")
        {
            this.playerSettings = playerSettings;

              // Zurück button
              zurueckMenuEntry = new MenuEntry(this, ResourceLoader.GetString("BackText"), 0) { Position = new Vector2(500, 450) };
              zurueckMenuEntry.Selected += ZurueckMenuEntrySelected;

              castleType = screenManager.PlayerSettings[spielerNr - 1].Castle.CastleType;

              var selectedEntry = 0;

              if (screenManager.PlayerSettings[spielerNr - 1].PlayerType == PlayerType.Computer)
              {
            selectedEntry = 1;
              }

              var entries = new List<string> { "Aus", "An" };

              computerMenuEntry = new ComboToggleButton(this, "Computer", new Collection<string>(entries), selectedEntry, 0)
                              {
                                Position = new Vector2(10, 100)
                              };
              computerMenuEntry.Selected += ComputerMenuEntrySelected;

              txtCastleName = new TextBox(this, false) { Position = new Vector2(260, 270), ShowCursor = false };

              nameLabel = new MenuEntry(this, "Name", 0) { Position = new Vector2(10, 200) };
              nameLabel.Selected += NameMenuEntrySelected;

              ControlsContainer.Add(zurueckMenuEntry);
              ControlsContainer.Add(computerMenuEntry);
              ControlsContainer.Add(nameLabel);
              ControlsContainer.Add(txtCastleName);

              var pp = GraphicsManager.GraphicsDevice.PresentationParameters;
              renderTarget = new RenderTarget2D(GraphicsManager.GraphicsDevice, pp.BackBufferWidth, pp.BackBufferHeight, false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="MainMenuScreen"/> class.
        /// </summary>
        /// <param name="graphicsManager">The graphics manager.</param>
        /// <param name="screenManager">The screen manager.</param>
        public MainMenuScreen(IBallerburgGraphicsManager graphicsManager, IScreenManager screenManager)
            : base(graphicsManager, screenManager, "Ballerburg3D")
        {
            // Create the menu entries.
              // Starten Button
              spielStartenMenuEntry = new MenuEntry(this, "starten", 0) { Position = new Vector2(350, 450) };
              spielStartenMenuEntry.Selected += SpielStartenMenuEntrySelected;

              // Zurück button
              zurueckMenuEntry = new MenuEntry(this, ResourceLoader.GetString("BackText"), 0) { Position = new Vector2(500, 450) };
              zurueckMenuEntry.Selected += ZurueckMenuEntrySelected;

              // Anzahl Spieler Buttons
              var numPlayerList = new List<string> { "Anzahl: 2", "Anzahl: 3", "Anzahl: 4" };

              anzahlSpielerToggleButton = new ComboToggleButton(this, "Spieler", new Collection<string>(numPlayerList), 0, 0)
                                      {
                                        Position = new Vector2(10, 100)
                                      };
              anzahlSpielerToggleButton.Selected += ToggleNumPlayersMenuEntrySelected;

              spielOptionenMenuEntry = new MenuEntry(this, "Optionen", 0) { Position = new Vector2(10, 250) };
              spielOptionenMenuEntry.Selected += SpielOptionenMenuEntrySelected;

              soundMenuEntry = new MenuEntry(this, "Sound", 0) { Position = new Vector2(220, 250) };
              soundMenuEntry.Selected += SoundMenuEntrySelected;

              creditsMenuEntry = new MenuEntry(this, "Credits", 0) { Position = new Vector2(430, 250) };
              creditsMenuEntry.Selected += CreditsMenuEntrySelected;

              graphikMenuEntry = new MenuEntry(this, "Graphik", 0) { Position = new Vector2(220, 350) };
              graphikMenuEntry.Selected += GraphikMenuEntrySelected;

              spielerActionButtons = new ActionToggleButton[4];

              spielerActionButtons[0] = new ActionToggleButton(this, "Spieler 1", screenManager.PlayerSettings[0].PlayerName, 0)
                                    {
                                      Position = new Vector2(220, 100)
                                    };
              spielerActionButtons[0].Selected += Spieler1KonfigurierenMenuEntrySelected;
              screenManager.PlayerSettings[0].IsActive = true;

              spielerActionButtons[1] = new ActionToggleButton(this, "Spieler 2", screenManager.PlayerSettings[1].PlayerName, 0)
                                    {
                                      Position = new Vector2(430, 100)
                                    };
              spielerActionButtons[1].Selected += Spieler2KonfigurierenMenuEntrySelected;
              screenManager.PlayerSettings[1].IsActive = true;

              spielerActionButtons[2] = new ActionToggleButton(this, "Spieler 3", screenManager.PlayerSettings[2].PlayerName, 0)
                                    {
                                      Position = new Vector2(220, 150)
                                    };
              spielerActionButtons[2].Selected += Spieler3KonfigurierenMenuEntrySelected;
              spielerActionButtons[2].SetInactive();
              screenManager.PlayerSettings[2].IsActive = false;

              spielerActionButtons[3] = new ActionToggleButton(this, "Spieler 4", screenManager.PlayerSettings[3].PlayerName, 0)
                                    {
                                      Position = new Vector2(430, 150)
                                    };
              spielerActionButtons[3].Selected += Spieler4KonfigurierenMenuEntrySelected;
              spielerActionButtons[3].SetInactive();
              screenManager.PlayerSettings[3].IsActive = false;

              for (int i = 0; i < GameSettings.NumPlayers; i++)
              {
            spielerActionButtons[i].SetActive();
              }

              for (int i = GameSettings.NumPlayers; i < 4; i++)
              {
            spielerActionButtons[i].SetInactive();
              }

              ControlsContainer.Add(spielStartenMenuEntry);
              ControlsContainer.Add(zurueckMenuEntry);
              ControlsContainer.Add(anzahlSpielerToggleButton);
              ControlsContainer.Add(spielerActionButtons[0]);
              ControlsContainer.Add(spielerActionButtons[1]);
              ControlsContainer.Add(spielerActionButtons[2]);
              ControlsContainer.Add(spielerActionButtons[3]);
              ControlsContainer.Add(spielOptionenMenuEntry);
              ControlsContainer.Add(soundMenuEntry);
              ControlsContainer.Add(creditsMenuEntry);
              ControlsContainer.Add(graphikMenuEntry);

              ScreenActivated += OnScreenActivated;
        }