示例#1
0
        /// <summary>
        /// Start game, is in a seperate method for 2 reasons: We want to catch
        /// any exceptions here, but not for the unit tests and we also allow
        /// the unit tests to call this method if we don't want to unit test
        /// in debug mode.
        /// </summary>
        public static void StartGame()
        {
#if !XBOX360
            try
            {
#endif
                using (RacingGameManager game = new RacingGameManager())
                {
                    game.Run();
                }
#if !XBOX360
            }
            catch (NoSuitableGraphicsDeviceException)
            {

                MessageBox.Show("Pixel and vertex shaders 2.0 or greater are required.",
                    "RacingGame",
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (NotSupportedException ex/*OutOfVideoMemoryException*/)
            {
                GameSettings.SetMinimumGraphics();

                Console.WriteLine(ex.Message);
                Console.Write(ex.StackTrace);
                MessageBox.Show("Insufficent video memory.\n\n" +
                    "The graphics settings have been reconfigured to the minimum. " +
                    "Please restart the application. \n\nIf you continue to receive " +
                    "this error message, your system may not meet the " +
                    "minimum requirements.",
                    "RacingGame",
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
#endif
        }
示例#2
0
        /// <summary>
        /// Start game, is in a seperate method for 2 reasons: We want to catch
        /// any exceptions here, but not for the unit tests and we also allow
        /// the unit tests to call this method if we don't want to unit test
        /// in debug mode.
        /// </summary>
        public static void StartGame()
        {
#if !XBOX360
            try
            {
#endif
            using (RacingGameManager game = new RacingGameManager())
            {
                game.Run();
            }
#if !XBOX360
        }

        catch (MonoGameGLException)
        {
            MessageBox.Show("Pixel and vertex shaders 2.0 or greater are required.",
                            "RacingGame",
                            MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
        catch (NotSupportedException ex /*OutOfVideoMemoryException*/)
        {
            GameSettings.SetMinimumGraphics();

            Console.WriteLine(ex.Message);
            Console.Write(ex.StackTrace);
            MessageBox.Show("Insufficent video memory.\n\n" +
                            "The graphics settings have been reconfigured to the minimum. " +
                            "Please restart the application. \n\nIf you continue to receive " +
                            "this error message, your system may not meet the " +
                            "minimum requirements.",
                            "RacingGame",
                            MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
#endif
        }
示例#3
0
        /// <summary>
        /// Start game, is in a seperate method for 2 reasons: We want to catch
        /// any exceptions here, but not for the unit tests and we also allow
        /// the unit tests to call this method if we don't want to unit test
        /// in debug mode.
        /// </summary>
        public static void StartGame(string uid)
        {
            INetInterface netClient = InterfaceFactory.Instance.GetNetwork();

            bool result = netClient.Connect(uid);

            if (!result)
            {
                MessageBox.Show("Cannot connect to server.",
                                "RacingGame",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            Thread.Sleep(100);
            StartUpParameters sup = netClient.DownloadStartUpParameters();

#if !XBOX360
            try
            {
#endif
            using (RacingGameManager game = new RacingGameManager(netClient, uid, sup))
            {
                game.Run();
            }
#if !XBOX360
        }

        catch (NoSuitableGraphicsDeviceException)
        {
            MessageBox.Show("Pixel and vertex shaders 2.0 or greater are required.",
                            "RacingGame",
                            MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
        catch (OutOfVideoMemoryException)
        {
            GameSettings.SetMinimumGraphics();

            MessageBox.Show("Insufficent video memory.\n\n" +
                            "The graphics settings have been reconfigured to the minimum. " +
                            "Please restart the application. \n\nIf you continue to receive " +
                            "this error message, your system may not meet the " +
                            "minimum requirements.",
                            "RacingGame",
                            MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
#endif
            netClient.Disconnect();
        }
示例#4
0
 static void Main()
 {
     using (var game = new RacingGameManager())
         game.Run();
 }
示例#5
0
 static void Main(string [] args)
 {
     using (var game = new RacingGameManager()) {
         game.Run();
     }
 }