/// <summary> /// method to manage the application setup and game loop /// </summary> private void ManageGameLoop() { PlayerAction playerActionChoice = PlayerAction.None; // // display splash screen // _playingGame = _gameConsoleView.DisplaySpashScreen(); // // player chooses to quit // if (!_playingGame) { Environment.Exit(1); } // // display introductory message // _gameConsoleView.DisplayGamePlayScreen("Mission Intro", Text.MissionIntro(), ActionMenu.MissionIntro, ""); _gameConsoleView.GetContinueKey(); // // initialize the mission player // InitializeMission(); // // prepare game play screen // _currentLocation = _gameUniverse.GetSpaceTimeLocationById(_gamePlayer.SpaceTimeLocationID); _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrrentLocationInfo(), ActionMenu.MainMenu, ""); // // game loop // while (_playingGame) { // // process all flags, events, and stats // UpdateGameStatus(); // // get next game action from player // playerActionChoice = GetNextPlayerAction(); // // choose an action based on the user's menu choice // switch (playerActionChoice) { case PlayerAction.None: break; case PlayerAction.PlayerInfo: _gameConsoleView.DisplayPlayerInfo(); break; case PlayerAction.ListLocations: _gameConsoleView.DisplayListOfLocations(); break; case PlayerAction.LookAround: _gameConsoleView.DisplayLookAround(); break; case PlayerAction.LookAt: LookAtAction(); break; case PlayerAction.Travel: // // get new location choice and update the current location property // _gamePlayer.SpaceTimeLocationID = _gameConsoleView.DisplayGetNextLocation(); _currentLocation = _gameUniverse.GetSpaceTimeLocationById(_gamePlayer.SpaceTimeLocationID); // // display the new space-time location info // _gameConsoleView.DisplayCurrentLocationInfo(); break; case PlayerAction.PickUp: PickUpAction(); break; case PlayerAction.Inventory: _gameConsoleView.DisplayInventory(); break; case PlayerAction.LocationsVisited: _gameConsoleView.DisplayLocationsVisited(); break; case PlayerAction.ListGameObjects: _gameConsoleView.DisplayListOfAllGameObjects(); break; case PlayerAction.PutDown: PutDownAction(); 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, ""); break; case PlayerAction.ListNonplayerCharacters: _gameConsoleView.DisplayListOfAllNpcObjects(); break; case PlayerAction.PlayerMenu: ActionMenu.currentMenu = ActionMenu.CurrentMenu.PlayerMenu; _gameConsoleView.DisplayGamePlayScreen("Traveler 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.NonplayerCharacterMenu: ActionMenu.currentMenu = ActionMenu.CurrentMenu.NpcMenu; _gameConsoleView.DisplayGamePlayScreen("NPC Menu", "Select an operation from the menu.", ActionMenu.NpcMenu, ""); break; case PlayerAction.TalkTo: TalkToAction(); break; case PlayerAction.Exit: _playingGame = false; break; default: break; } } // // close the application // Environment.Exit(1); }
/// <summary> /// show the current location info /// </summary> public void DisplayCurrentLocationInfo() { SpaceTimeLocation currentSpaceTimeLocation = _gameUniverse.GetSpaceTimeLocationById(_gamePlayer.SpaceTimeLocationID); DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(currentSpaceTimeLocation), ActionMenu.MainMenu, ""); }