Exemple #1
0
        public static string CurrrentLocationInfo(Character player)
        {
            ListOfLocations stuff          = new ListOfLocations();
            string          messageBoxText = "";

            foreach (GameLocation item in stuff.IntitializeGameLocationList())
            {
                if (player.LocationValue == item.Location)
                {
                    messageBoxText = item.Description;
                }
            }

            return(messageBoxText);
        }
Exemple #2
0
        public List <Tutor> GetTutorByLocation(ListOfLocations location)
        {
            var tList = new List <Tutor>();

            using (var ctx = new ApplicationDbContext())
            {
                var entity =
                    ctx
                    .Tutors
                    .Where(e => e.Location == location);

                foreach (Tutor tutor in entity)
                {
                    tList.Add(tutor);
                }
                return(tList);
            }
        }
Exemple #3
0
        public DetailTutor GetTutorById(int id)
        {
            string          FirstName = "";
            string          LastName  = "";
            ListOfLocations location  = new ListOfLocations();
            List <int>      stListint = new List <int>();
            List <int>      cListint  = new List <int>();
            List <String>   stList    = new List <String>();
            List <String>   cList     = new List <string>();
            List <string>   dList     = new List <string>();

            using (var ctxSch = new ApplicationDbContext())
            {
                var entitySch =
                    ctxSch
                    .Schedules
                    .Where(e => e.TutorId == id);
                if (entitySch != null)
                {
                    foreach (var schedule in entitySch)
                    {
                        stListint.Add(schedule.StudentId);
                        cListint.Add(schedule.CourseId);
                        dList.Add(schedule.Id + "-" + schedule.Time.ToString("D", CultureInfo.CreateSpecificCulture("en-US")) + "   ");
                    }
                }
            }
            foreach (var number in stListint)
            {
                using (var ctxst = new ApplicationDbContext())
                {
                    var entitySt =
                        ctxst
                        .Students
                        .Single(g => g.Id == number);
                    stList.Add(entitySt.Id + "-" + entitySt.LastName + ", " + entitySt.FirstName + "    ");
                }
            }
            foreach (var number in cListint)
            {
                using (var ctxC = new ApplicationDbContext())
                {
                    var entityC =
                        ctxC
                        .Courses
                        .Single(h => h.Id == number);
                    cList.Add(entityC.Id + "-" + entityC.Name + "    ");
                }
            }
            using (var ctx = new ApplicationDbContext())
            {
                var entity =
                    ctx
                    .Tutors
                    .Single(f => f.Id == id);
                FirstName = entity.FirstName;
                LastName  = entity.LastName;
                location  = entity.Location;
            }
            return
                (new DetailTutor
            {
                TutorId = id,
                TutorFirstName = FirstName,
                TutorLastName = LastName,
                Location = location,
                TutorCourseList = cList,
                TutorStudentList = stList,
                TutorScheduleList = dList
            });
        }
Exemple #4
0
        /// <summary>
        /// method to manage the application setup and game loop
        /// </summary>
        private void ManageGameLoop()
        {
            PlayerAction travelerActionChoice = PlayerAction.None;

            //
            // display splash screen
            //
            _playingGame = _gameConsoleView.DisplaySplashScreen();

            //
            // player chooses to quit
            //
            if (!_playingGame)
            {
                Environment.Exit(1);
            }

            //
            // display introductory message
            //

            _gameConsoleView.DisplayGamePlayScreen("Game Introduction", Text.CharacterCreation(), ActionMenu.MissionIntro, "");
            _gameConsoleView.GetContinueKey();
            _playerCharacter.LocationValue  = TheZlandProject.Models.Area.Sanctuary;
            _playerCharacter.HealthValue    = 10;
            _playerCharacter.MaxHealthValue = 10;
            _playerCharacter.AttackValue    = 2;

            //
            // initialize the mission traveler
            //
            InitializeMission();
            List <GameLocation> _listOfLocation = new List <GameLocation>();
            ListOfLocations     Instantiate     = new ListOfLocations();
            List <Character>    ListOfNPC       = ListOfAllNPC.InstantiateNPCLIst();

            _listOfLocation = Instantiate.IntitializeGameLocationList();
            List <TheZlandProject.GameObject> listOfAllGameObjects = new List <TheZlandProject.GameObject>();

            listOfAllGameObjects       = ListOfGameObjects.IntitializeGameObjectList();
            _playerCharacter.Inventory = listOfAllGameObjects;
            List <Area> ListOfPlacesVisited = new List <Area>();

            //
            // prepare game play screen
            //
            _gameConsoleView.DisplayGamePlayScreen("Current Location: " + _playerCharacter.LocationValue, Text.CurrrentLocationInfo(_playerCharacter), ActionMenu.MainMenu, "");

            //
            // game loop
            //

            travelerActionChoice = _gameConsoleView.GetActionMenuChoice(ActionMenu.MainMenu);

            Random playerRandomEncounter = new Random();

            while (_playingGame)
            {
                //
                // get next game action from player
                int randomBattle = 0;
                randomBattle = playerRandomEncounter.Next(1, 101);
                int probOfEncounter = 90;
                //
                // choose an action based on the player's menu choice
                //
                switch (travelerActionChoice)
                {
                case PlayerAction.None:
                    travelerActionChoice = _gameConsoleView.GetActionMenuChoice(ActionMenu.MainMenu);
                    break;

                case PlayerAction.Heal:
                    _gameConsoleView.Heal(_playerCharacter);
                    travelerActionChoice = PlayerAction.Return;
                    break;

                case PlayerAction.Act:
                    _gameConsoleView.DisplayGamePlayScreen("Current Location: " + _playerCharacter.LocationValue, Text.CurrrentLocationInfo(_playerCharacter), ActionMenu.Act, "");
                    travelerActionChoice = _gameConsoleView.GetActionMenuChoice(ActionMenu.Act);
                    break;

                case PlayerAction.Options:
                    _gameConsoleView.DisplayGamePlayScreen("Current Location: " + _playerCharacter.LocationValue, Text.CurrrentLocationInfo(_playerCharacter), ActionMenu.OptionMenu, "");
                    travelerActionChoice = _gameConsoleView.GetActionMenuChoice(ActionMenu.OptionMenu);
                    break;

                case PlayerAction.Travel:
                    if (randomBattle >= probOfEncounter)
                    {
                        _gameConsoleView.Battle(_playerCharacter);
                        travelerActionChoice = PlayerAction.Return;
                    }
                    else
                    {
                        _playerCharacter     = _gameConsoleView.DisplayTravelMenu(_playerCharacter, _listOfLocation, ListOfPlacesVisited, listOfAllGameObjects);
                        travelerActionChoice = PlayerAction.Return;
                    }
                    break;

                case PlayerAction.TalkTo:
                    _gameConsoleView.DisplayTalkTo(_playerCharacter, ListOfNPC);
                    travelerActionChoice = PlayerAction.Return;
                    break;

                case PlayerAction.PlayerInfo:
                    _gameConsoleView.DisplayPlayerInformation();
                    travelerActionChoice = _gameConsoleView.GetActionMenuChoice(ActionMenu.PlayerInformation);
                    break;

                case PlayerAction.EditPlayer:
                    _playerCharacter     = _gameConsoleView.DisplayEditPlayer(_playerCharacter);
                    travelerActionChoice = _gameConsoleView.GetActionMenuChoice(ActionMenu.MainMenu);
                    break;

                case PlayerAction.LookAround:
                    _playerCharacter     = _gameConsoleView.LookAround(_playerCharacter, listOfAllGameObjects);
                    travelerActionChoice = _gameConsoleView.GetActionMenuChoice(ActionMenu.LookAround);
                    break;

                case PlayerAction.LookAt:
                    _gameConsoleView.LookAt(_playerCharacter, listOfAllGameObjects);
                    travelerActionChoice = _gameConsoleView.GetActionMenuChoice(ActionMenu.ReturnOnly);
                    break;

                case PlayerAction.PickUpItem:
                    _playerCharacter     = _gameConsoleView.PickUpItem(_playerCharacter, listOfAllGameObjects);
                    travelerActionChoice = PlayerAction.Return;
                    break;

                case PlayerAction.PutDownItem:
                    _playerCharacter     = _gameConsoleView.PutDownItem(_playerCharacter, listOfAllGameObjects);
                    travelerActionChoice = PlayerAction.Return;
                    break;

                case PlayerAction.AdminMenu:
                    _gameConsoleView.DisplayAdminMenu();
                    travelerActionChoice = _gameConsoleView.GetActionMenuChoice(ActionMenu.AdminMenu);
                    break;

                case PlayerAction.DisplayAllObjects:
                    _gameConsoleView.DisplayAllGameObjects(listOfAllGameObjects);
                    travelerActionChoice = _gameConsoleView.GetActionMenuChoice(ActionMenu.ReturnOnly);
                    break;

                case PlayerAction.DisplayAllNPC:
                    _gameConsoleView.DisplayAllNPC(ListOfNPC);
                    travelerActionChoice = _gameConsoleView.GetActionMenuChoice(ActionMenu.ReturnOnly);
                    break;

                case PlayerAction.DisplayPlayerInventory:
                    _gameConsoleView.DisplayPlayerInventory(_playerCharacter);
                    travelerActionChoice = _gameConsoleView.GetActionMenuChoice(ActionMenu.ReturnOnly);
                    break;

                case PlayerAction.DisplayLocationsVisited:
                    _gameConsoleView.DisplayAllPlacesVisited(ListOfPlacesVisited);
                    travelerActionChoice = _gameConsoleView.GetActionMenuChoice(ActionMenu.ReturnOnly);
                    break;

                case PlayerAction.DisplayAllLocations:
                    _gameConsoleView.DisplayAllLocations(_listOfLocation);
                    travelerActionChoice = _gameConsoleView.GetActionMenuChoice(ActionMenu.ReturnOnly);
                    break;

                case PlayerAction.Return:
                    _gameConsoleView.DisplayCurrentLocation(_playerCharacter);
                    travelerActionChoice = _gameConsoleView.GetActionMenuChoice(ActionMenu.MainMenu);
                    break;

                case PlayerAction.Exit:
                    _playingGame = false;
                    break;

                default:
                    break;
                }
            }

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