Beispiel #1
0
        private static void Main(String[] args)
        {
            //Process.Start("..\\..\\..\\LeafMeAloneServer\\bin\\Debug\\LeafMeAloneServer.exe");

            // Initialize static classes
            GraphicsRenderer.Init();

            //catch (FormatException e)
            //{
            //    IPHostEntry ipHostInfo = Dns.GetHostEntry(args[0]);
            //    ipAddress = ipHostInfo.AddressList[0];
            //}
            // }

            // Create a new camera with a specified offset.
            Camera activeCamera =
                new Camera(CAMERA_OFFSET, Vector3.Zero, Vector3.UnitY);

            GraphicsManager.Init(activeCamera);
            AudioManager.Init();
            AudioManager.SetListenerVolume(4.0f);
            AnimationManager.Init();

            GameClient Client = new GameClient();

            GlobalUIManager.Init();
            GraphicsRenderer.connectButton.Click += (sender, eventArgs) =>
            {
                if (!Client.hasConnected)
                {
                    Client.hasConnected = true;
                    IPAddress ipAddress = IPAddress.Loopback;
                    if (GraphicsRenderer.networkedCheckbox.Checked)
                    {
                        ipAddress = IPAddress.Parse(GraphicsRenderer.ipTextbox.Text);
                        Console.WriteLine($@" ip is {ipAddress.ToString()}");
                    }

                    Client.Init(new NetworkClient(ipAddress));

                    GraphicsRenderer.panel1.Visible = false;
                    GraphicsRenderer.panel1.Hide();
                    GraphicsRenderer.Form.Focus();
                }
            };

            MessagePump.Run(GraphicsRenderer.Form, Client.DoGameLoop);

            GraphicsRenderer.Dispose();
        }