protected override bool HandleInput(MenuItem menuItem) { var closeView = false; switch (menuItem.Type) { case MenuItemType.PurposeHelp: PurposeHelp(); ViewHelpers.Continue(); break; case MenuItemType.MapHelp: MapHelp(); ViewHelpers.Continue(); break; // case "R": // ResourceHelp(); // break; // case "C": // CombatHelp(); // break; } return(closeView); }
private void LoadGame() { // list available save files var existingFiles = ShipwreckController.GetExistingSaveFileNames(); if (existingFiles.Count == 0) { Log.Warning("There are no saved games"); ViewHelpers.Continue(); return; } existingFiles.Add("Exit"); var fileToLoad = Prompt.Select("Which game would you like to load?", existingFiles); if (fileToLoad == "Exit") { return; } fileToLoad = FileHelper.AddExtension(fileToLoad, ".json"); // try load file if (ShipwreckController.TryLoadGame(fileToLoad, out var game)) { ShipwreckController.StartGame(game); } else { Log.Error($"Unable to load {fileToLoad}"); } }
protected override bool HandleInput(MenuItem menuItem) { const bool closeView = false; switch (menuItem.Type) { case MenuItemType.ViewCharacter: ShowPlayerStats(); ViewHelpers.Continue(); break; case MenuItemType.ViewInventory: new InventoryMenuView().Display(); break; case MenuItemType.ViewMap: ShowMap(); ViewHelpers.Continue(); break; case MenuItemType.Move: ShowMap(); Console.WriteLine(); Move(); ViewHelpers.Continue(); break; case MenuItemType.Explore: ExploreArea(); if (Shipwreck.CurrentGame.Status == GameStatus.Over) { return(true); } ShowMap(); ViewHelpers.Continue(); break; case MenuItemType.Wait: Wait(); ViewHelpers.Continue(); break; // case 'F': // new FireMenuView().Display(); // break; case MenuItemType.SaveGame: SaveGame(); ViewHelpers.Continue(); break; case MenuItemType.HelpMenu: var helpMenu = new HelpMenuView { InGameView = InGameView }; helpMenu.Display(); break; } return(closeView); }
private void ShowStatus() { var fire = Shipwreck.CurrentGame.Fire; var fireStatus = fire.Status.ToString(); var wood = fire.Inventory.Items.Find(x => x.InventoryItem.Name == "Branch"); var woodQuantity = wood?.Quantity ?? 0; Console.WriteLine("\n-------------------------\n Fire Status:\n-------------------------"); Console.WriteLine($" {fireStatus}"); Console.WriteLine($" Remaining Wood: {woodQuantity}"); Console.WriteLine("-------------------------"); ViewHelpers.Continue(); }
private void StartFire() { try { FireController.StartFire(); Console.WriteLine("The Fire was started"); ViewHelpers.Continue(); } catch (Exception e) { // TODO was a custom exception. Will need to be cleaned up Console.WriteLine("You can't start the fire without a match!"); ViewHelpers.Continue(); } }
protected override bool HandleInput(MenuItem menuItem) { const bool done = false; switch (menuItem.Type) { // case "A": // ShowAllItems(); // ViewHelpers.Continue(); // break; // case "G": // ViewGear(); // ViewHelpers.Continue(); // break; case MenuItemType.ViewFood: ViewFood(); ViewHelpers.Continue(); break; // case "R": // ViewResources(); // ViewHelpers.Continue(); // break; case MenuItemType.EatFood: ViewFood(); Console.WriteLine(); EatFood(); ViewHelpers.Continue(); break; // case "Q": // EquipGear(); // ViewHelpers.Continue(); // break; case MenuItemType.DropItem: DropItem(); ViewHelpers.Continue(); break; case MenuItemType.ViewCharacter: GameMenuView.ShowPlayerStats(); ViewHelpers.Continue(); break; } return(done); }
private void AddWood() { var woodRecord = Shipwreck.CurrentGame?.Player.Inventory.Items.Find(x => x.InventoryItem.Name == "Branch"); var inventoryQuantity = woodRecord?.Quantity ?? 0; Console.WriteLine($"You have {inventoryQuantity} Wood. How much would you like to put on the fire?"); var sQuantity = Console.ReadLine(); try { int.TryParse(sQuantity, out var quantityToAdd); var numRemoved = FireController.AddWood(quantityToAdd); Console.WriteLine($"Successfully added {numRemoved} wood to the fire"); ViewHelpers.Continue(); } catch (Exception e) { // TODO was a custom exception. Will need to be cleaned up Console.WriteLine(e.Message); ViewHelpers.Continue(); } }
private void ExtinguishFire() { Shipwreck.CurrentGame?.Fire.ExtinguishFire(); Console.WriteLine("The Fire was extinguished"); ViewHelpers.Continue(); }