示例#1
0
        public static void PhysicsThreadProc(Object Data)
        {
            Globals.game = new WorldRenderer();
            Globals.game.Run();
            PhysicsThreadEndDelegate PhysicsEndDelegate = Data as PhysicsThreadEndDelegate;

            if (PhysicsEndDelegate != null)
            {
                PhysicsEndDelegate();
            }
        }
示例#2
0
        private void btn_run_Click(object sender, EventArgs e)
        {
            MySQL.mySQLSettings.user     = "******";
            MySQL.mySQLSettings.password = passwordtxt.Text;
            MySQL.mySQLSettings.server   = Hosttxt.Text;
            MySQL.mySQLSettings.database = databasetxt.Text;

            if (MySQL.ConnectToMySQL() == true)
            {
                try
                {
                    InitializePackets();   //register packet handler functions
                    ServerSocket.Start();  //start the server tcp
                    ServerSocket.BeginAcceptTcpClient(new AsyncCallback(OnClientConnect), null);

                    databasetxt.Enabled = Hosttxt.Enabled = passwordtxt.Enabled = btn_run.Enabled = Porttxt.Enabled = false;
                    Thread NetworkingThread = new Thread(new ParameterizedThreadStart(NetworkingThreadProc));
                    NetworkingThreadEndDelegate NetworkingEndDelegate = NetworkingThreadEnd;
                    NetworkingThread.Start(NetworkingEndDelegate);
                    Thread PhysicsThread = new Thread(new ParameterizedThreadStart(PhysicsThreadProc));
                    PhysicsThreadEndDelegate PhysicsEndDelegate = PhysicsThreadEnd;
                    PhysicsThread.Start(PhysicsEndDelegate);

                    Console.Title = "MMO" + " -- Players online: " + 0 + " / Max online: " + 0 + "";
                    string msg = "Server:" + " Online";
                    tsslInfo.Text = "Running!";
                    SetStatus(msg);
                }
                catch (Exception)
                {
                    throw;
                }
            }
            else
            {
                string msg = "MySql:" + " Failed";
                tsslInfo.Text = "Error!";
                SetStatus(msg);
            }
        }