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); } }
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); } }
void ExitConfirmation(bool confirmed) { if (confirmed) { if (changed) { Game.Config.Reload(Game.Files); SetValues(Game.Config); } changed = false; MenuUIManager.SwitchBack(); } }
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; } } }
public void SimulateBackButton() { MenuUIManager.SwitchBack(); }
void BackButtonReleased(ReleasedEventArgs args) { MenuUIManager.SwitchBack(); }
void BackButton_Pressed(PressedEventArgs args) { MenuUIManager.SwitchBack(); }