Exemple #1
0
        public void Action()
        {
            try
            {
                while (IsReadyClose == 0)
                {
                    if (this.IsDisposed)
                    {
                        break;
                    }

                    ppDevice.RenderAll();

                    input.UpdateMousePoint(this.PointToClient(MousePosition));
                    input.UpdateMouseBottons(MouseButtons);

                    if (input.GetFlyUp() > 0 && input.GetBiSha() > 0 && input.GetNum4() == 1)
                    {
                        //↑ + space + 4  锁定/解锁窗口
                        Global.IsCameraFree = !Global.IsCameraFree;
                    }
                    if (input.GetFlyUp() > 0 && input.GetBiSha() > 0 && input.GetNum3() == 1)
                    {
                        //↑ + space + 3  开启/关闭调试模式
                        Global.IsDebug = !Global.IsDebug;
                    }

                    if (Global.GetRoom().UpdateInput() == 0)
                    {
                        if (Global.GetMapManager() != null)
                        {
                            Global.GetMapManager().Update();
                        }
                        camera.Update();
                    }

                    windowList.Action();
                    input.UpdateKey();
                    {
                        var clientC = Global.GetClientC();
                        if (clientC != null && clientC.IsConnect())
                        {
                            clientC.SendAll();
                            clientC.UpdateTime();
                            if (clientC.IsConnect() == false)
                            {
                                Global.GetRoom().Reset();
                            }
                            else
                            {
                                Global.GetRoom().DealSendData();
                            }
                        }
                    }

                    Other();
                }
            }
            catch (Exception ex)
            {
                FormParent.AddTextGame(ex.ToString());
                MessageBox.Show(ex.ToString());
                this.Close();
            }
        }