/// <summary> /// method to manage the application setup and game loop /// </summary> private void ManageGameLoop() { PlayerAction travelerActionChoice = PlayerAction.None; // // display splash screen // _playingGame = _gameConsoleView.DisplaySpashScreen(); // // player chooses to quit // if (!_playingGame) { Environment.Exit(1); } // // display introductory message // _gameConsoleView.DisplayGamePlayScreen("Quest Intro", Text.QuestIntro(), ActionMenu.MissionIntro, ""); _gameConsoleView.GetContinueKey(); // // initialize the mission traveler // InitializeMission(); // // prepare game play screen // _currentLocation = _gameUniverse.GetIslandLocationById(_gamePirate.IslandLocationId); _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, ""); _gameConsoleView.DisplayColoredText("", PlayerAction.ReturnToMainMenu, _currentLocation); // // game loop // while (_playingGame) { Console.CursorVisible = false; // // update all game stats/info // UpdateGameStatus(); // // get game action from player // if (ActionMenu.currentMenu == ActionMenu.CurrentMenu.MainMenu) { travelerActionChoice = _gameConsoleView.GetActionMenuChoice(ActionMenu.MainMenu); } else if (ActionMenu.currentMenu == ActionMenu.CurrentMenu.AdminMenu) { travelerActionChoice = _gameConsoleView.GetActionMenuChoice(ActionMenu.AdminMenu); } // // choose an action based on the user's menu choice // switch (travelerActionChoice) { case PlayerAction.None: break; case PlayerAction.EditPlayerInfo: _gameConsoleView.DisplayEditPirateInformation(); // // display game play screen with current location info and coordiantes // _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, ""); _gameConsoleView.DisplayColoredText("", PlayerAction.LookAround, _currentLocation); break; case PlayerAction.PlayerInfo: _gameConsoleView.DisplayPirateInfo(); _gameConsoleView.DisplayColoredText("", travelerActionChoice, _currentLocation); break; case PlayerAction.ListDestinations: _gameConsoleView.DisplayListOfIslandLocations(); _gameConsoleView.DisplayColoredText("", travelerActionChoice, _currentLocation); break; case PlayerAction.ListGameObjects: _gameConsoleView.DisplayListOfAllGameObjects(); _gameConsoleView.DisplayColoredText("", travelerActionChoice, _currentLocation); break; case PlayerAction.LookAround: _gameConsoleView.DisplayLookAround(); _gameConsoleView.DisplayColoredText("", travelerActionChoice, _currentLocation); break; case PlayerAction.LookAt: LookAtAction(); break; case PlayerAction.Travel: // // determine if the player has a ship in order to travel // if (_gamePirate.Ship == Ship.ShipType.None) { _gamePirate.ShipOwner = false; _gameConsoleView.DisplayInputErrorMessage("You currently do not own a ship needed to travel. Obtain a ship, and try again."); break; } else { _gamePirate.ShipOwner = true; } // // get new location choice and update current location // _gamePirate.IslandLocationId = _gameConsoleView.DisplayGetNextIslandLocation(); _currentLocation = _gameUniverse.GetIslandLocationById(_gamePirate.IslandLocationId); // // display game play screen with current location info and coordiantes // _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, ""); _gameConsoleView.DisplayColoredText("", PlayerAction.ReturnToMainMenu, _currentLocation); break; case PlayerAction.PirateLocationsVisited: _gameConsoleView.DisplayLocationsVisited(); _gameConsoleView.DisplayColoredText("", travelerActionChoice, _currentLocation); break; case PlayerAction.AdminMenu: ActionMenu.currentMenu = ActionMenu.CurrentMenu.AdminMenu; _gameConsoleView.DisplayGamePlayScreen("Admin Menu", "Select an operation from the menu.", ActionMenu.AdminMenu, "");; break; case PlayerAction.ReturnToMainMenu: ActionMenu.currentMenu = ActionMenu.CurrentMenu.MainMenu; _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, ""); _gameConsoleView.DisplayColoredText("", travelerActionChoice, _currentLocation); break; case PlayerAction.Inventory: _gameConsoleView.DisplayInventory(); break; case PlayerAction.TreasureInventory: _gameConsoleView.DisplayTreasureInventory(); break; case PlayerAction.PickUp: PickUpAction(); break; case PlayerAction.PutDown: PutDownAction(); break; case PlayerAction.Exit: _gameConsoleView.DisplayClosingScreen(); _playingGame = false; break; default: break; } } // // close the application // Environment.Exit(1); }
/// <summary> /// method to manage the application setup and game loop /// </summary> private void ManageGameLoop() { PlayerAction travelerActionChoice = PlayerAction.None; // // display splash screen // _playingGame = _gameConsoleView.DisplaySpashScreen(); // // player chooses to quit // if (!_playingGame) { Environment.Exit(1); } // // display introductory message // _gameConsoleView.DisplayGamePlayScreen("Quest Intro", Text.QuestIntro(), ActionMenu.MissionIntro, ""); _gameConsoleView.GetContinueKey(); // // initialize the mission traveler // InitializeMission(); // // prepare game play screen // _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrrentLocationInfo(), ActionMenu.MainMenu, ""); // // game loop // while (_playingGame) { travelerActionChoice = _gameConsoleView.GetActionMenuChoice(ActionMenu.MainMenu); // // choose an action based on the user's menu choice // switch (travelerActionChoice) { case PlayerAction.None: break; case PlayerAction.EditPlayerInfo: _gameConsoleView.DisplayEditPirateInfo(); _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrrentLocationInfo(), ActionMenu.MainMenu, ""); break; case PlayerAction.PlayerInfo: _gameConsoleView.DisplayPirateInfo(); break; case PlayerAction.Return: _gameConsoleView.ReturnPlayerToMainScreen(); break; case PlayerAction.Exit: _gameConsoleView.DisplayClosingScreen(); _playingGame = false; break; default: break; } } // // close the application // Environment.Exit(1); }
/// <summary> /// method to manage the application setup and game loop /// </summary> private void ManageGameLoop() { PlayerAction travelerActionChoice = PlayerAction.None; // // display splash screen // _playingGame = _gameConsoleView.DisplaySpashScreen(); // // player chooses to quit // if (!_playingGame) { Environment.Exit(1); } // // display introductory message // _gameConsoleView.DisplayGamePlayScreen("Quest Intro", Text.QuestIntro(), ActionMenu.MissionIntro, ""); _gameConsoleView.GetContinueKey(); // // initialize the mission traveler // InitializeMission(); // // prepare game play screen // _currentLocation = _gameUniverse.GetIslandLocationById(_gamePirate.IslandLocationId); _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, ""); _gameConsoleView.DisplayColoredText("", PlayerAction.ReturnToMainMenu, _currentLocation); // // game loop // while (_playingGame) { Console.CursorVisible = false; // // update all game stats/info // UpdateGameStatus(); // // get game action from player // travelerActionChoice = GetNextPlayerAction(); // // choose an action based on the user's menu choice // switch (travelerActionChoice) { case PlayerAction.None: break; case PlayerAction.PlayerMenu: ActionMenu.currentMenu = ActionMenu.CurrentMenu.PlayerMenu; _gameConsoleView.DisplayGamePlayScreen("Player Menu", "Select an operation from the menu.", ActionMenu.PlayerMenu, ""); break; case PlayerAction.ObjectMenu: ActionMenu.currentMenu = ActionMenu.CurrentMenu.ObjectMenu; _gameConsoleView.DisplayGamePlayScreen("Object Menu", "Select an operation from the menu.", ActionMenu.ObjectMenu, ""); break; case PlayerAction.NpcMenu: ActionMenu.currentMenu = ActionMenu.CurrentMenu.NpcMenu; _gameConsoleView.DisplayGamePlayScreen("NPC Menu", "Select an operation from the menu.", ActionMenu.NpcMenu, ""); break; case PlayerAction.EditPlayerInfo: _gameConsoleView.DisplayEditPirateInformation(); // // display game play screen with current location info and coordiantes // _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, ""); _gameConsoleView.DisplayColoredText("", PlayerAction.ReturnToMainMenu, _currentLocation); break; case PlayerAction.PlayerInfo: _gameConsoleView.DisplayPirateInfo(); _gameConsoleView.DisplayColoredText("", travelerActionChoice, _currentLocation); break; case PlayerAction.ListDestinations: _gameConsoleView.DisplayListOfIslandLocations(); _gameConsoleView.DisplayColoredText("", travelerActionChoice, _currentLocation); break; case PlayerAction.ListGameObjects: _gameConsoleView.DisplayListOfAllGameObjects(); _gameConsoleView.DisplayColoredObjects(travelerActionChoice, 0); break; case PlayerAction.ListNpcs: _gameConsoleView.DisplayListOfAllNpcs(); _gameConsoleView.DisplayColoredNpcs(travelerActionChoice); break; case PlayerAction.LookAround: _gameConsoleView.DisplayLookAround(); _gameConsoleView.DisplayColoredText("", travelerActionChoice, _currentLocation); _gameConsoleView.DisplayColoredObjects(travelerActionChoice, 0); _gameConsoleView.DisplayColoredNpcs(travelerActionChoice); break; case PlayerAction.LookAt: LookAtAction(); _gameConsoleView.DisplayColoredObjects(travelerActionChoice, _gamePirate.IndividualGameObject); break; case PlayerAction.Travel: // // get new location choice and update current location // _gamePirate.IslandLocationId = _gameConsoleView.DisplayGetNextIslandLocation(); _currentLocation = _gameUniverse.GetIslandLocationById(_gamePirate.IslandLocationId); // // display game play screen with current location info and coordiantes // _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, ""); _gameConsoleView.DisplayColoredText("", PlayerAction.ReturnToMainMenu, _currentLocation); break; case PlayerAction.PirateLocationsVisited: _gameConsoleView.DisplayLocationsVisited(); _gameConsoleView.DisplayColoredText("", travelerActionChoice, _currentLocation); break; case PlayerAction.AdminMenu: ActionMenu.currentMenu = ActionMenu.CurrentMenu.AdminMenu; _gameConsoleView.DisplayGamePlayScreen("Admin Menu", "Select an operation from the menu.", ActionMenu.AdminMenu, "");; break; case PlayerAction.ReturnToMainMenu: ActionMenu.currentMenu = ActionMenu.CurrentMenu.MainMenu; _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, ""); _gameConsoleView.DisplayColoredText("", travelerActionChoice, _currentLocation); break; case PlayerAction.Inventory: _gameConsoleView.DisplayInventory(); break; case PlayerAction.TreasureInventory: _gameConsoleView.DisplayTreasureInventory(); _gameConsoleView.DisplayColoredObjects(travelerActionChoice, 0); break; case PlayerAction.PickUp: PickUpAction(); break; case PlayerAction.PutDown: PutDownAction(); break; case PlayerAction.TalkTo: TalkToAction(); break; case PlayerAction.TradeWith: TradeWithAction(); break; case PlayerAction.Exit: _gameConsoleView.DisplayClosingScreen(); _playingGame = false; break; default: break; } } // // close the application // Environment.Exit(1); }