Ejemplo n.º 1
0
            void ExecuteButtonPressAction(string buttonName)
            {
                switch (buttonName)
                {
                case StartButtonName:
                    MenuUIManager.SwitchToPackagePickingScreen();
                    break;

                case LoadButtonName:
                    MenuUIManager.SwitchToLoadGame();
                    break;

                case OptionsButtonName:
                    MenuUIManager.SwitchToOptions();
                    break;

                case AboutButtonName:
                    MenuUIManager.SwitchToAboutScreen();
                    break;

                case ExitButtonName:
                    //DO NOT WAIT, THIS IS CORRECT
                    Game.Exit();
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(buttonName), "Unknown button on the MainMenu screen");
                }
            }
Ejemplo n.º 2
0
            async void SaveButton_Pressed(PressedEventArgs args)
            {
                if (LineEdit.Text == "")
                {
                    await MenuUIManager.ErrorPopUp.DisplayError("Invalid name", "Name of the saved game cannot be empty");

                    return;
                }

                string newAbsoluteFilePath = Path.Combine(Game.Files.SaveGameDirAbsolutePath, LineEdit.Text);

                if (Game.Files.FileExists(newAbsoluteFilePath))
                {
                    bool confirmed = await MenuUIManager.ConfirmationPopUp
                                     .RequestConfirmation("Overriding file",
                                                          $"Do you really want to override the file \"{MatchSelected}\"?",
                                                          null,
                                                          proxy);

                    if (!confirmed)
                    {
                        return;
                    }
                }

                try {
                    MenuUIManager.MenuController.SavePausedLevel(LineEdit.Text);
                    MenuUIManager.SwitchBack();
                }
                catch (Exception) {
                    await MenuUIManager.ErrorPopUp.DisplayError("Saving Error",
                                                                "There was an error while saving the level, see log for details.",
                                                                proxy);
                }
            }
Ejemplo n.º 3
0
 protected void Exit()
 {
     MenuUIManager.MenuController.EndPausedLevel();
     Proxy.PausedLevel = null;
     MenuUIManager.Clear();
     MenuUIManager.SwitchToMainMenu();
 }
Ejemplo n.º 4
0
            async void SaveAsButtonReleased(ReleasedEventArgs args)
            {
                if (Level.LevelRep.GamePack.TryGetLevel(name, out LevelRep oldLevel))
                {
                    bool confirm = await MenuUIManager.ConfirmationPopUp.RequestConfirmation("Override level",
                                                                                             "Do you want to override existing level with the same name?",
                                                                                             null,
                                                                                             proxy);

                    if (!confirm)
                    {
                        return;
                    }
                }

                LevelRep newLevelRep = null;

                try {
                    newLevelRep = Level.LevelRep.CreateClone(name, description, ThumbnailPath);
                    newLevelRep.SaveToGamePack(true);
                    MenuUIManager.SwitchBack();
                }
                catch (Exception) {
                    newLevelRep?.Dispose();
                    await MenuUIManager.ErrorPopUp.DisplayError("Package Error",
                                                                "There was an error while saving the level to package, see log for details.",
                                                                proxy);
                }
            }
Ejemplo n.º 5
0
                static UIElement InitTeamItem(int teamID, MHUrhoApp game, MenuUIManager menuUIManager)
                {
                    var newElement = game.UI.LoadLayout(game.PackageManager.GetXmlFile("UI/TeamListItemLayout.xml", true),
                                                        menuUIManager.MenuRoot.GetDefaultStyle());

                    Text textElement = (Text)newElement.GetChild("TeamIDText");

                    textElement.Value = teamID.ToString();

                    return(newElement);
                }
Ejemplo n.º 6
0
 void ExitConfirmation(bool confirmed)
 {
     if (confirmed)
     {
         if (changed)
         {
             Game.Config.Reload(Game.Files);
             SetValues(Game.Config);
         }
         changed = false;
         MenuUIManager.SwitchBack();
     }
 }
Ejemplo n.º 7
0
                static UIElement InitTypeItem(PlayerType player, MHUrhoApp game, MenuUIManager menuUIManager)
                {
                    var newElement = game.UI.LoadLayout(game.PackageManager.GetXmlFile("UI/PlayerTypeItemLayout.xml", true),
                                                        menuUIManager.MenuRoot.GetDefaultStyle());

                    BorderImage playerIcon        = (BorderImage)newElement.GetChild("PlayerIcon");
                    Text        playerName        = (Text)newElement.GetChild("PlayerName");
                    Text        playerDescription = (Text)newElement.GetChild("PlayerDescription", true);

                    playerIcon.Texture   = player.Package.PlayerIconTexture;
                    playerIcon.ImageRect = player.IconRectangle;

                    playerName.Value = player.Name;
                    //FUTURE: Description
                    playerDescription.Value = "Nothing for now";

                    return(newElement);
                }
Ejemplo n.º 8
0
 void SaveConfirmation(bool confirmed)
 {
     if (confirmed)
     {
         if (changed)
         {
             Game.Config.Save(Game.Files);
             changed = false;
         }
         MenuUIManager.SwitchBack();
     }
     else
     {
         if (changed)
         {
             Game.Config.Reload(Game.Files);
             SetValues(Game.Config);
             Game.Config.SetGraphicsMode(Game.Graphics);
             changed = false;
         }
     }
 }
Ejemplo n.º 9
0
 void SaveGame()
 {
     MenuUIManager.SwitchToSaveGame();
 }
Ejemplo n.º 10
0
 protected void Resume()
 {
     Proxy.PausedLevel = null;
     MenuUIManager.Clear();
     MenuUIManager.MenuController.ResumePausedLevel();
 }
Ejemplo n.º 11
0
 void SaveLevelPrototypeAs()
 {
     MenuUIManager.SwitchToSaveAsScreen(Level);
 }
Ejemplo n.º 12
0
 void BackButton_Pressed(PressedEventArgs args)
 {
     MenuUIManager.SwitchBack();
 }
Ejemplo n.º 13
0
 void SwitchToEditingNewLevel()
 {
     MenuUIManager.SwitchToLevelCreationScreen(null);
 }
Ejemplo n.º 14
0
 void SwitchToEditingExistingLevel(LevelRep level)
 {
     MenuUIManager.SwitchToLevelCreationScreen(level);
 }
Ejemplo n.º 15
0
 protected FilePickScreen(MenuUIManager menuUIManager)
     : base(menuUIManager)
 {
 }
Ejemplo n.º 16
0
 public FileSystemBrowsingPopUp(MenuUIManager uiManager)
 {
     menuUIManager = uiManager;
 }
Ejemplo n.º 17
0
 public ErrorPopUp(MenuUIManager menuUIManager)
 {
     this.menuUIManager = menuUIManager;
 }
Ejemplo n.º 18
0
 void MainMenuButtonPressed(PressedEventArgs obj)
 {
     MenuUIManager.Clear();
     MenuUIManager.SwitchToMainMenu();
 }
Ejemplo n.º 19
0
 void LoadGame()
 {
     MenuUIManager.SwitchToLoadGame();
 }
Ejemplo n.º 20
0
 public void SimulateBackButton()
 {
     MenuUIManager.SwitchBack();
 }
Ejemplo n.º 21
0
 protected void GoToOptions()
 {
     MenuUIManager.SwitchToOptions();
 }
Ejemplo n.º 22
0
 void SwitchToPlayingLevel(LevelRep level)
 {
     MenuUIManager.SwitchToLevelSettingsScreen(level);
 }
Ejemplo n.º 23
0
 public ConfirmationPopUp(MenuUIManager menuUIManager)
 {
     this.menuUIManager = menuUIManager;
 }
Ejemplo n.º 24
0
 void BackButtonReleased(ReleasedEventArgs args)
 {
     MenuUIManager.SwitchBack();
 }