Пример #1
0
        public void RunGameLoop(GameLoop game)
        {
            SetupMenus setup = new SetupMenus();
            //InGame inGame = new InGame();
            Map map = new Map();

            GameRunning = true;
            do
            {
                switch (GameState)
                {
                case GameState.MainMenu:
                    break;

                //case GameState.MapSetupMenu:
                //    setup.MapSetup(game, out game, out map);
                //    break;
                //case GameState.OptionsMenu:
                //    SettingsMenu();
                //    break;
                //case GameState.InGameField:
                //    //here: new class that handles the InGame loop.
                //    //inGame.InGameField(game, map);
                //    break;
                default:
                    break;
                }
                MainMenu();
            } while (GameRunning);
        }//AppRunLoop
Пример #2
0
        //PresentationHelpers helper = new PresentationHelpers();

        public void MapSetup(GameLoop game, out GameLoop setupOutGame, out Map setupOutMap)
        {
            Map      map           = new Map(0, 0, 0);
            TileType grassland     = new TileType("Grassland", "Gra", 1);
            TileType nothing       = new TileType("Nothing", "Non", 10);
            bool     setupComplete = false;

            do
            {
                Console.Clear();
                PresentationHelpers.TitleMessage("MAP SETUP");
                DisplayMapSettings(map);
                Console.WriteLine("Please Select an option:\n(C). Set Columns\t(R). Set Rows\t(U). Set Unit Limit\t(X). Done\t(P)Load Preset\t(D). Display Map");
                try
                {
                    PresentationHelpers.DisplayMap(map);
                }
                catch (Exception)
                {
                    //swallow the exceptions. They'd just be NullReference
                    //and IndexOutOfRange anyway.
                }
                var userInput = Console.ReadLine().ToUpper();
                switch (userInput)
                {
                case "C":
                    SetupMapX(map);
                    break;

                case "R":
                    SetupMapY(map);
                    break;

                case "U":
                    SetUpUnitLimit(map);
                    break;

                case "D":
                    map.GenerateMapArray(grassland);
                    //map.MapNodes[0, 0].TileType = nothing;
                    //PresentationHelpers.DisplayMap(map);
                    //Console.ReadLine();
                    break;

                case "P":
                    //I'm hardcoding it now, but we could easily create a method
                    //like SelectPreset() that offers a list of all the
                    //stuff in our MapPresets class.
                    map = MapPresets.DungeonPreset();
                    //PresentationHelpers.DisplayMap(map);
                    //Console.ReadLine();
                    break;

                case "X":
                    //game.GameState = GameState.InGameField;
                    setupComplete = true;
                    break;

                default:
                    PresentationHelpers.InvalidSelectionMessage();
                    break;
                }
            } while (!setupComplete);
            setupOutGame = game;
            setupOutMap  = map;
        }//end MapSetup