Пример #1
0
        /// <summary>
        /// display info on current location
        /// </summary>
        public void DisplayLookAround()
        {
            //
            // get current map location
            //
            MapLocation currentMapLocation = _gameKingdom.GetMapLocationById(_gamePlayer.MapLocationID);

            //
            //get list of game objects in current map location
            //
            List <GameObject> gameObjectsInCurrentMapLocation = _gameKingdom.GetGameObjectsByMapLocationId(_gamePlayer.MapLocationID);

            string messageBoxText = Text.LookAround(currentMapLocation) + Environment.NewLine + Environment.NewLine;

            messageBoxText += Text.GameObjectsChooseList(gameObjectsInCurrentMapLocation);

            DisplayGamePlayScreen("Current Location", messageBoxText, ActionMenu.MainMenu, "");
        }
Пример #2
0
        /// <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("Mission Intro", Text.MissionIntro(), ActionMenu.MissionIntro, "");
            _gameConsoleView.GetContinueKey();

            //
            // initialize the mission traveler
            //
            InitializeMission();

            //
            // prepare game play screen
            //
            _currentLocation = _gameKingdom.GetMapLocationById(_gamePlayer.MapLocationID);
            _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, "");

            //
            // game loop
            //
            while (_playingGame)
            {
                //
                // process all flags, events, and stats
                //
                UpdateGameStatus();

                //
                // get next 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.PlayerInfo:
                    _gameConsoleView.DisplayTravelerInfo();
                    break;

                case PlayerAction.ListMapLocations:
                    _gameConsoleView.DisplayListOfMapLocations();
                    break;

                case PlayerAction.LookAround:
                    _gameConsoleView.DisplayLookAround();
                    break;

                case PlayerAction.Travel:
                    //
                    // get new location choice and update the current location property
                    //
                    _gamePlayer.MapLocationID = _gameConsoleView.DisplayGetNextMapLocation();
                    _currentLocation          = _gameKingdom.GetMapLocationById(_gamePlayer.MapLocationID);

                    //
                    //set the game play screen to the current location info format
                    //
                    _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo
                                                               (_currentLocation), ActionMenu.MainMenu, "");
                    break;

                case PlayerAction.PlayerLocationsVisited:
                    _gameConsoleView.DisplayLocationsVisited();
                    break;

                case PlayerAction.ListGameObjects:
                    _gameConsoleView.DisplayListOfAllGameObjects();
                    break;

                case PlayerAction.LookAt:
                    LookAtAction();
                    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.Inventory:
                    _gameConsoleView.DisplayInventory();
                    break;

                case PlayerAction.PickUp:
                    PickUpAction();
                    break;

                case PlayerAction.PutDown:
                    PutDownAction();
                    break;

                case PlayerAction.Exit:
                    _playingGame = false;
                    break;

                default:
                    break;
                }
            }

            //
            // close the application
            //
            Environment.Exit(1);
        }