示例#1
0
        /// <summary>
        ///
        /// </summary>
        public ChallengePauseDialog(IScreen screen, DisplayLayer drawOrder)
            : base(screen, drawOrder, "Pause")
        {
            // Der Titel-Text ist mittig ausgerichtet
            AlignX = HorizontalAlignment.Center;

            Bounds.Size = new ScreenPoint (screen, 0.3f, 0.31f);
            // Erstelle das Pause-Menü
            pauseMenu = new Menu (Screen, Index + DisplayLayer.Menu);
            pauseMenu.Bounds = ContentBounds;

            pauseMenu.ItemAlignX = HorizontalAlignment.Left;
            pauseMenu.ItemAlignY = VerticalAlignment.Center;

            MenuEntry settingsButton = new MenuEntry (
                screen: Screen,
                drawOrder: Index + DisplayLayer.MenuItem,
                name: "Settings",
            onClick: (time) => {
                Close (time);
                Screen.NextScreen = new GeneralSettingsScreen (Screen.Game);
            }
            );
            MenuEntry backButton = new MenuEntry (
                screen: Screen,
                drawOrder: Index + DisplayLayer.MenuItem,
                name: "Back to Game",
            onClick: (time) => {
                Close (time);
            }
            );

            backButton.AddKey (Keys.Escape);
            MenuEntry discardExitButton = new MenuEntry (
                screen: Screen,
                drawOrder: Index + DisplayLayer.MenuItem,
                name: "Abort Challenge",
            onClick: (time) => {
                Close (time);
                Screen.NextScreen = new StartScreen (Screen.Game);
            }
            );
            backButton.AddKey (Keys.Escape);

            pauseMenu.Add (settingsButton);
            pauseMenu.Add (backButton);
            pauseMenu.Add (discardExitButton);
        }
示例#2
0
        /// <summary>
        /// Erstelle einen neuen TextInputDialog.
        /// </summary>
        public TextInputDialog(IScreen screen, DisplayLayer drawOrder, string title, string text, string inputText)
            : base(screen, drawOrder, title)
        {
            textItem = new TextItem (screen, drawOrder, String.Empty);

            Cancel = (time) => {
                Close (time);
            };
            Submit = (time) => {
                Close (time);
            };

            Bounds.Size = new ScreenPoint (screen, 0.5f, 0.3f);
            // Der Titel-Text ist mittig ausgerichtet
            AlignX = HorizontalAlignment.Center;
            menu = new Menu (Screen, Index + DisplayLayer.Menu);
            menu.Bounds = ContentBounds;
            menu.Bounds.Padding = new ScreenPoint (screen, 0.010f, 0.019f);
            menu.ItemAlignX = HorizontalAlignment.Left;
            menu.ItemAlignY = VerticalAlignment.Center;

            //die Texteingabe
            textInput = new InputItem (Screen, Index + DisplayLayer.MenuItem, text, inputText);
            menu.Add (textInput);
            menu.Add (textItem);
            textInput.IsEnabled = true;
            textInput.IsInputEnabled = true;
            textInput.NameWidth = 0.35f;
            textInput.ValueWidth = 0.65f;

            ValidKeys.AddRange (new Keys[] { Keys.Enter, Keys.Escape });
        }
示例#3
0
        /// <summary>
        ///
        /// </summary>
        public HighscoreDialog(IScreen screen, DisplayLayer drawOrder, Challenge challenge)
            : base(screen, drawOrder, "Highscores")
        {
            // Der Titel-Text ist mittig ausgerichtet
            AlignX = HorizontalAlignment.Center;
            Bounds.Size = new ScreenPoint (screen, 0.60f, 0.5f);

            // Erstelle das Highscore-Menü
            highscoreList = new Menu (Screen, Index + DisplayLayer.Menu);
            highscoreList.Bounds = ContentBounds;
            highscoreList.ItemAlignX = HorizontalAlignment.Left;
            highscoreList.ItemAlignY = VerticalAlignment.Center;

            if (challenge.Highscore != null) {
                //sotiert die Highscoreliste wird nach der Zeit sotiert
                int highscoreCounter = 0;
                foreach (KeyValuePair<string, int> entry in challenge.Highscore.OrderBy (key => key.Value)) {
                    TimeSpan playTime = TimeSpan.FromSeconds (entry.Value);
                    string formattedPlayTime = (playTime.Hours * 60 + playTime.Minutes).ToString ("D2") + "m " + playTime.Seconds.ToString ("D2") + "s";

                    TextItem firstScore = new TextItem (screen, drawOrder, formattedPlayTime + "    " + entry.Key);
                    highscoreList.Add (firstScore);
                    highscoreCounter++;
                    if (highscoreCounter > 8) {
                        break;
                    }
                }
            }

            buttons = new Container (screen, Index + DisplayLayer.Menu);
            buttons.ItemBackgroundColor =(s) => Design.DialogBackground;
            buttons.ItemAlignX = HorizontalAlignment.Center;

            // Button zum Neustarten der Challenge
            Action<GameTime> restartAction = (time) => {
                Close (time);
                Screen.NextScreen = new ChallengeModeScreen (Screen.Game, challenge);
            };
            MenuEntry restartButton = new MenuEntry (
                screen: Screen,
                drawOrder: Index + DisplayLayer.MenuItem,
                name: "Restart challenge",
                onClick: restartAction
            );
            restartButton.Bounds.Size = new ScreenPoint (screen, ContentBounds.Size.Relative.X / 2, 0.05f);
            restartButton.Bounds.Position = ContentBounds.Position + ContentBounds.Size.OnlyY
                                            - restartButton.Bounds.Size.OnlyY;
            buttons.Add (restartButton);

            // Button für die Rückkehr zum StartScreen
            Action<GameTime> returnAction = (time) => {
                Close (time);
                Screen.NextScreen = new StartScreen (Screen.Game);
            };
            MenuEntry returnButton = new MenuEntry (
                screen: Screen,
                drawOrder: Index + DisplayLayer.MenuItem,
                name: "Return to menu",
                onClick: returnAction
            );
            returnButton.Bounds.Size = new ScreenPoint (screen, ContentBounds.Size.Relative.X / 2, 0.05f);
            returnButton.Bounds.Position = ContentBounds.Position + ContentBounds.Size.OnlyY
                                           - returnButton.Bounds.Size.OnlyY + ContentBounds.Size.OnlyX / 2;
            buttons.Add (returnButton);
        }
示例#4
0
        public SettingsScreen(GameCore game)
            : base(game)
        {
            MenuName = "Settings";

            spriteBatch = new SpriteBatch (GraphicsDevice);

            navigationMenu = new Menu (this, DisplayLayer.ScreenUI + DisplayLayer.Menu);
            navigationMenu.Bounds.Position = ScreenContentBounds.Position;
            navigationMenu.Bounds.Size = new ScreenPoint (this, 0.200f, ScreenContentBounds.Size.Relative.Y);
            navigationMenu.Bounds.Padding = new ScreenPoint (this, 0.010f, 0.010f);
            navigationMenu.ItemAlignX = HorizontalAlignment.Left;
            navigationMenu.ItemAlignY = VerticalAlignment.Center;

            MenuEntry profileButton = new MenuEntry (
                screen: this,
                drawOrder: DisplayLayer.ScreenUI + DisplayLayer.MenuItem,
                name: "General",
            onClick: (time) => {
                game.SkipNextScreenEffect =true;
                NextScreen = new GeneralSettingsScreen (Game);
            }
            );
            MenuEntry graphicsButton = new MenuEntry (
                screen: this,
                drawOrder: DisplayLayer.ScreenUI + DisplayLayer.MenuItem,
                name: "Graphics",
            onClick: (time) =>  {
                game.SkipNextScreenEffect =true;
                NextScreen = new GraphicsSettingsScreen (Game);
            }
            );
            MenuEntry audioButton = new MenuEntry (
                screen: this,
                drawOrder: DisplayLayer.ScreenUI + DisplayLayer.MenuItem,
                name: "Audio",
            onClick: (time) =>  {
                game.SkipNextScreenEffect =true;
                NextScreen = new AudioSettingsScreen (Game);
            }
            );
            MenuEntry controlsButton = new MenuEntry (
                screen: this,
                drawOrder: DisplayLayer.ScreenUI + DisplayLayer.MenuItem,
                name: "Controls",
            onClick: (time) =>  {
                game.SkipNextScreenEffect =true;
                NextScreen = new ControlSettingsScreen (Game);
            }
            );

            navigationMenu.Add (profileButton);
            navigationMenu.Add (graphicsButton);
            navigationMenu.Add (audioButton);
            navigationMenu.Add (controlsButton);

            initalizeDebugButton ();

            lines.AddPoints (0.000f, 0.050f,
                             0.030f, 0.970f,
                             0.760f, 0.895f,
                             0.880f, 0.970f,
                             0.970f, 0.050f,
                             1.000f
                            );

            backButton = new MenuEntry (
                screen: this,
                drawOrder: DisplayLayer.ScreenUI + DisplayLayer.MenuItem,
                name: "Back",
                onClick: (time) => NextScreen = Game.Screens.Where ((s) => !(s is SettingsScreen)).ElementAt (0)
            );
            backButton.AddKey (Keys.Escape);
            backButton.SetCoordinates (left: 0.770f, top: 0.910f, right: 0.870f, bottom: 0.960f);
            backButton.AlignX = HorizontalAlignment.Center;

            // this menu contains the actual settings and is filled in the subclasses
            settingsMenu = new Menu (this, DisplayLayer.ScreenUI + DisplayLayer.Menu);
            settingsMenu.Bounds.Position = ScreenContentBounds.Position + navigationMenu.Bounds.Size.OnlyX;
            settingsMenu.Bounds.Size = ScreenContentBounds.Size - navigationMenu.Bounds.Size.OnlyX;;
            settingsMenu.Bounds.Padding = new ScreenPoint (this, 0.010f, 0.010f);
            settingsMenu.ItemAlignX = HorizontalAlignment.Left;
            settingsMenu.ItemAlignY = VerticalAlignment.Center;
            settingsMenu.RelativeItemHeight = Design.DataItemHeight;
        }
示例#5
0
        /// <summary>
        /// Erzeugt ein neues ConfirmDialog-Objekt und initialisiert dieses mit dem zugehörigen IGameScreen-Objekt.
        /// Zudem sind Angaben zur Zeichenreihenfolge, einer Zeichenkette für den Titel und für den eingeblendeten Text Pflicht.
        /// [base=screen, drawOrder, title, text]
        /// </summary>
        public ConfirmDialog(IScreen screen, DisplayLayer drawOrder, string title)
            : base(screen, drawOrder, title)
        {
            // Der Titel-Text ist mittig ausgerichtet
            AlignX = HorizontalAlignment.Center;

            Cancel = (time) => {
                Close (time);
            };
            Submit = (time) => {
                Close (time);
            };

            // Keys
            ValidKeys.AddRange (new Keys[] { Keys.Enter, Keys.Escape });

            // Menü, in dem die Textanzeige angezeigt wird
            menu = new Menu (Screen, Index + DisplayLayer.Menu);
            menu.Bounds = ContentBounds;
            menu.ItemForegroundColor = (s) => Color.White;
            menu.ItemBackgroundColor = (s) => Color.Transparent;
            menu.ItemAlignX = HorizontalAlignment.Left;
            menu.ItemAlignY = VerticalAlignment.Center;

            // Button-Container
            buttons = new Container (screen, Index + DisplayLayer.Menu);
            buttons.ItemAlignX = HorizontalAlignment.Center;
            buttons.ItemBackgroundColor = (s) => Design.DialogBackground;

            // Button zum Canceln
            Action<GameTime> cancelAction = (time) => {
                Cancel (time);
            };
            MenuEntry cancelButton = new MenuEntry (
                screen: Screen,
                drawOrder: Index + DisplayLayer.MenuItem,
                name: "Cancel",
                onClick: cancelAction
            );
            cancelButton.Bounds.Size = new ScreenPoint (screen, ()=>ContentBounds.Size.Relative.X / 2, ()=>0.05f);
            cancelButton.Bounds.Position = ContentBounds.Position + ContentBounds.Size.OnlyY
                                           - cancelButton.Bounds.Size.OnlyY;
            buttons.Add (cancelButton);

            // Button zum Submitten
            Action<GameTime> submitAction = (time) => {
                Submit (time);
            };
            MenuEntry submitButton = new MenuEntry (
                screen: Screen,
                drawOrder: Index + DisplayLayer.MenuItem,
                name: "Confirm",
                onClick: submitAction
            );
            submitButton.Bounds.Size = new ScreenPoint (screen, ()=>ContentBounds.Size.Relative.X / 2, ()=>0.05f);
            submitButton.Bounds.Position = ContentBounds.Position + ContentBounds.Size.OnlyY
                                           - submitButton.Bounds.Size.OnlyY + ContentBounds.Size.OnlyX / 2;
            buttons.Add (submitButton);

            // Buttons zum Menü hinzufügen
            menu.Add (buttons);
        }