Пример #1
0
        }//end Main Menu

        public void SettingsMenu()
        {
            //MenuItem item1 = new MenuItem("Stuff", "S");
            //MenuItem item2 = new MenuItem("Exit", "X");
            bool exit = false;

            List <MenuItem> items = new List <MenuItem>();

            //items.Add(item1);
            //items.Add(item2);
            PresentationHelpers.CenteredMenu(items, "Settings");

            do
            {
                string userInput = System.Console.ReadLine().ToUpper();
                switch (userInput)
                {
                case "S":
                    System.Console.WriteLine("Stuff happens");
                    break;

                case "X":
                    System.Console.WriteLine("Bye");
                    exit = true;
                    break;

                default:
                    PresentationHelpers.InvalidSelectionMessage();
                    break;
                }
            } while (!exit);
        }
Пример #2
0
        }//AppRunLoop

        //Moved MainMenu to its own method
        public void MainMenu()
        {
            //Creating some instances of the custom class MenuItem for presentation helper scaffolding
            //MenuItem itemOne = new MenuItem("Start a game", "P");
            //MenuItem itemTwo = new MenuItem("Settings", "S");
            //MenuItem itemThree = new MenuItem("Exit", "X");
            bool choiceMade = false;

            //Since the CenteredMenu method takes a List of MenuItems we add our chosen items to a list
            List <MenuItem> menuItems = new List <MenuItem>();

            //menuItems.Add(itemOne);
            //menuItems.Add(itemThree);
            //menuItems.Add(itemTwo);

            //Here we are calling the CenteredMenu() which takes as explained above
            //Takes a list of MenuItems and a string to use as the menu title
            PresentationHelpers.CenteredMenu(menuItems, "Main Menu");

            do
            {
                string userInput = System.Console.ReadLine().ToUpper();
                switch (userInput)
                {
                //case "P":
                //    GameState = GameState.MapSetupMenu;
                //    choiceMade = true;
                //    break;
                //case "S":
                //    GameState = GameState.OptionsMenu;
                //    choiceMade = true;
                //    break;
                case "X":
                    System.Console.WriteLine("Thanks for playing!");
                    GameRunning = false;
                    choiceMade  = true;
                    break;

                default:
                    PresentationHelpers.InvalidSelectionMessage();
                    break;
                }
            } while (!choiceMade);
        }//end Main Menu
Пример #3
0
        }//end MapSetup

        public void SetupMapX(Map map)
        {
            bool setupComplete = false;

            do
            {
                Console.WriteLine("Input the Map Size X");
                string userInput = Console.ReadLine();

                try
                {
                    map.MapX = int.Parse(userInput);
                    Console.WriteLine(map.MapX);
                    setupComplete = true;
                }
                catch (FormatException)
                {
                    PresentationHelpers.InvalidSelectionMessage();
                }
            } while (!setupComplete);
        }
Пример #4
0
        public void SetUpUnitLimit(Map map)
        {
            bool setupComplete = false;

            do
            {
                Console.WriteLine("Set Unit Limit\n(the limit on map must be less than half of the total number of spaces available)");
                string userInput = Console.ReadLine();

                try
                {
                    map.MapUnitLimit = int.Parse(userInput);
                    Console.WriteLine(map.MapUnitLimit);
                    setupComplete = true;
                }
                catch (FormatException)
                {
                    PresentationHelpers.InvalidSelectionMessage();
                }
            } while (!setupComplete);
        }
Пример #5
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
Пример #6
0
        static void Main(string[] args)
        {
            {
                #region MenusMockDatabase
                #region MainMenu
                MenuItem newGame     = new MenuItem("N", MenuItemActions.NewGame);
                MenuItem loadGame    = new MenuItem("L", MenuItemActions.LoadGame);
                MenuItem customGame  = new MenuItem("C", MenuItemActions.CustomGame);
                MenuItem exitGame    = new MenuItem("X", MenuItemActions.ExitGame);
                MenuItem optionsMenu = new MenuItem("O", MenuItemActions.GoToOptionsMenu);

                Menu mainMenu = new Menu("Main Menu");
                mainMenu.MenuItems.Add(newGame);
                mainMenu.MenuItems.Add(loadGame);
                mainMenu.MenuItems.Add(customGame);
                mainMenu.MenuItems.Add(exitGame);
                mainMenu.MenuItems.Add(optionsMenu);
                #endregion
                #endregion

                ApplicationController appController = new ApplicationController();
                Console.WriteLine(appController.GameState);
                do
                {
                    //title

                    PresentationHelpers.DisplayOptions(mainMenu);
                    Menu.CompareToUserInput(PresentationHelpers.AcceptPlayerInput(), mainMenu, appController);
                    Console.WriteLine("AfterMenu, {0}", appController.GameState.ToString());
                } while (appController.GameState == GameState.MainMenu);

                //GameManager gameManager = new GameManager();
                //gameManager.Test = 1;
                //PresentationHelpers.LoopRedirect(gameManager);

                //TODO: move this shit to its proper location sarazua
                //GameLoops game = new GameLoops();
                //game.RunGameLoop(game);
                //var folderPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\TacticsGameTestsss";

                //Humanoid testUnitOne = new Humanoid("BLAh", "SRZ", 40, 10, 40, 10, 10, 40, 40, true);
                //var unitToSave = XMLHelper.ActorParser(testUnitOne);

                //System.Xml.Serialization.XmlSerializer writer = new System.Xml.Serialization.XmlSerializer(typeof(UnitTestDTO));
                //System.IO.Directory.CreateDirectory(folderPath);
                //var filePath = folderPath + "//" + unitToSave.Name;
                //System.IO.FileStream file = System.IO.File.Create(filePath);


                //XMLHelper.SaveToFile<UnitTestDTO>(unitToSave, unitToSave.Name, FolderName.Units);
                //writer.Serialize(file, unitToSave);
                //file.Close();

                //XMLSaver.SaveToFile<UnitTestDTO>(unitToSave, unitToSave.Name, "Units");

                //var dto = XMLHelper.ReadFromFile<UnitTestDTO>("BLAh", FolderName.Units);
                //Console.WriteLine(dto.Name);
                //Console.WriteLine(dto.Dexterity);
                //Console.WriteLine(dto.LearnedAbilities);
            }
        }