示例#1
0
        private static void Main()
        {
            // Start console
            ConsoleManager.Start();
            ConsoleManager.Initialize();

            // Wait for console to get ready TODO: Actually check for when ConsoleManager is ready
            Thread.Sleep(1000);

            // Ask what game to start
            StartCommand command;

            while (true)
            {
                // Write available commands
                Console.WriteLine("Pick one of the following commands", Color.White);
                foreach (string commandName in Enum.GetNames(typeof(StartCommand))) // TODO: Also number the commands
                {
                    Console.WriteLine(commandName, Color.White);
                }
                // Get and parse input
                if (!Enum.TryParse(ConsoleManager.GetPriorityInput(), true, out command))
                {
                    Console.WriteLine("Input invalid, try again.", Color.Red);
                }
                // Break loop on successful parse
                else
                {
                    break;
                }
            }

            // Start game
            switch (command)
            {
            case StartCommand.Local:
                StartLocal();
                break;

            case StartCommand.P2P:
                StartPeerToPeer();
                break;

            case StartCommand.Client:
                StartClient();
                break;

            case StartCommand.Server:
                StartServer();
                break;

            case StartCommand.ClientAndServer:
                StartClientAndServer();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
示例#2
0
 public GameCore()
 {
     ConsoleManager.Start();
     graphics = new GraphicsDeviceManager(this);
     Content.RootDirectory = "Content";
     // Set to borderless window
     Window.IsBorderless = true;
     // Show mouse
     IsMouseVisible = true;
     // Enable multisampling
     graphics.PreferMultiSampling = true;
     // Disable v-sync
     graphics.SynchronizeWithVerticalRetrace = false;
 }