示例#1
0
 public UsLogPacket(UsCmd c)
 {
     SeqID   = (ushort)c.ReadInt16();
     LogType = (UsLogType)c.ReadInt32();
     Content = c.ReadString();
     RealtimeSinceStartup = c.ReadFloat();
 }
示例#2
0
 public UsLogPacket(UsCmd c)
 {
     SeqID = (ushort)c.ReadInt16();
     LogType = (UsLogType)c.ReadInt32();
     Content = c.ReadString();
     RealtimeSinceStartup = c.ReadFloat();
 }
示例#3
0
        bool NetHandle_QuerySlidersResponse(eNetCmd cmd, UsCmd c)
        {
            int count = c.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                string name = c.ReadString();
                float minVal = c.ReadFloat();
                float maxVal = c.ReadFloat();
                float initVal = c.ReadFloat();

                _slidersPanel.Dispatcher.Invoke(new Action(() =>
                {
                    AddSlider(name, minVal, maxVal, initVal);
                }));
            }

            return true;
        }
示例#4
0
        bool NetHandle_QuerySlidersResponse(eNetCmd cmd, UsCmd c)
        {
            int count = c.ReadInt32();

            for (int i = 0; i < count; i++)
            {
                string name    = c.ReadString();
                float  minVal  = c.ReadFloat();
                float  maxVal  = c.ReadFloat();
                float  initVal = c.ReadFloat();

                _slidersPanel.Dispatcher.Invoke(new Action(() =>
                {
                    AddSlider(name, minVal, maxVal, initVal);
                }));
            }

            return(true);
        }
示例#5
0
        public bool NetHandle_FrameDataV2(eNetCmd cmd, UsCmd c)
        {
            int   var = c.ReadInt32();
            float f1  = c.ReadFloat();

            f1 = c.ReadFloat();
            f1 = c.ReadFloat();
            var meshList     = UsCmdUtil.ReadIntList(c);
            var materialList = UsCmdUtil.ReadIntList(c);
            var textureList  = UsCmdUtil.ReadIntList(c);

            MeshGrid.Dispatcher.Invoke(new Action(() =>
            {
                if (MeshGrid.DataContext == null)
                {
                    MeshGrid.DataContext = new ObservableCollection <MeshObject>();
                }
                else
                {
                    ((ObservableCollection <MeshObject>)(MeshGrid.DataContext)).Clear();
                }
                title_mesh.Text = string.Format("Meshes ({0})", meshList.Count);
            }));

            {
                UsCmd req = new UsCmd();
                req.WriteNetCmd(eNetCmd.CL_FrameV2_RequestMeshes);
                UsCmdUtil.WriteIntList(req, meshList);
                NetManager.Instance.Send(req);
                UsLogging.Printf("eNetCmd.NetHandle_FrameDataV2 [b]({0} meshes expected)[/b].", meshList.Count);
            }

            {
                UsCmd req = new UsCmd();
                req.WriteNetCmd(eNetCmd.CL_FrameV2_RequestNames);
                UsCmdUtil.WriteIntList(req, meshList);
                NetManager.Instance.Send(req);
                UsLogging.Printf("eNetCmd.NetHandle_FrameDataV2 [b]({0} names expected)[/b].", meshList.Count);
            }

            return(true);
        }
示例#6
0
        public bool NetHandle_FrameDataV2_Meshes(eNetCmd cmd, UsCmd c)
        {
            MeshGrid.Dispatcher.Invoke(new Action(() =>
            {
                int count = c.ReadInt32();
                UsLogging.Printf("eNetCmd.NetHandle_FrameDataV2_Meshes [b]({0} got)[/b].", count);
                for (int i = 0; i < count; i++)
                {
                    var m     = new MeshObject();
                    m.Visible = true;
                    m.InstID  = c.ReadInt32();
                    m.VertCnt = c.ReadInt32();
                    m.MatCnt  = c.ReadInt32();
                    m.Size    = c.ReadFloat();
                    m.CamDist = c.ReadFloat();
                    ((ObservableCollection <MeshObject>)(MeshGrid.DataContext)).Add(m);
                }
            }));

            return(true);
        }
示例#7
0
        private bool NetHandle_FrameData_Mesh(eNetCmd cmd, UsCmd c)
        {
            short subCmd = c.ReadInt16();

            switch ((eSubCmd_TransmitStage)subCmd)
            {
            case eSubCmd_TransmitStage.DataBegin:
            {
                MeshGrid.Dispatcher.Invoke(new Action(() =>
                    {
                        if (_meshes == null)
                        {
                            _meshes = new ObservableCollection <MeshObject>();
                        }
                        else
                        {
                            _meshes.Clear();
                        }
                        _meshExpectedCount = c.ReadInt32();
                        UsLogging.Printf("eNetCmd.NetHandle_FrameData_Mesh [b](DataBegin)[/b] ({0}).", _meshExpectedCount);
                    }));
            }
            break;

            case eSubCmd_TransmitStage.DataSlice:
            {
                int count = c.ReadInt32();
                UsLogging.Printf("eNetCmd.NetHandle_FrameData_Mesh [b](DataSlice)[/b] ({0}).", count);
                if (count > 0)
                {
                    MeshGrid.Dispatcher.Invoke(new Action(() =>
                        {
                            for (int i = 0; i < count; i++)
                            {
                                var m     = new MeshObject();
                                m.InstID  = c.ReadInt32();
                                m.Name    = c.ReadString();
                                m.VertCnt = c.ReadInt32();
                                m.MatCnt  = c.ReadInt32();
                                m.Size    = (float)c.ReadFloat();
                                _meshes.Add(m);
                            }
                        }));
                }
            }
            break;

            case eSubCmd_TransmitStage.DataEnd:
            {
                UsLogging.Printf("eNetCmd.NetHandle_FrameData_Mesh [b](DataEnd)[/b] (expected: {0} actual: {1}).", _meshExpectedCount, _meshes.Count);
                if (_meshExpectedCount != _meshes.Count)
                {
                    UsLogging.Printf(LogWndOpt.Bold, "The actually received mesh count is mismatched with expected.");
                }

                MeshGrid.Dispatcher.Invoke(new Action(() =>
                    {
                        title_mesh.Text      = string.Format("Meshes ({0})", _meshes.Count);
                        MeshGrid.DataContext = _meshes;
                    }));
            }
            break;

            default:
                break;
            }
            return(true);
        }
示例#8
0
        public bool NetHandle_FrameDataV2(eNetCmd cmd, UsCmd c)
        {
            int var = c.ReadInt32();
            float f1 = c.ReadFloat();
            f1 = c.ReadFloat();
            f1 = c.ReadFloat();
            var meshList = UsCmdUtil.ReadIntList(c);
            var materialList = UsCmdUtil.ReadIntList(c);
            var textureList = UsCmdUtil.ReadIntList(c);

            MeshGrid.Dispatcher.Invoke(new Action(() =>
            {
                if (MeshGrid.DataContext == null)
                {
                    MeshGrid.DataContext = new ObservableCollection<MeshObject>();
                }
                else
                {
                    ((ObservableCollection<MeshObject>)(MeshGrid.DataContext)).Clear();
                }
            }));

            {
                UsCmd req = new UsCmd();
                req.WriteNetCmd(eNetCmd.CL_FrameV2_RequestMeshes);
                UsCmdUtil.WriteIntList(req, meshList);
                NetManager.Instance.Send(req);
                UsLogging.Printf("eNetCmd.NetHandle_FrameDataV2 [b]({0} meshes expected)[/b].", meshList.Count);
            }

            {
                UsCmd req = new UsCmd();
                req.WriteNetCmd(eNetCmd.CL_FrameV2_RequestNames);
                UsCmdUtil.WriteIntList(req, meshList);
                NetManager.Instance.Send(req);
                UsLogging.Printf("eNetCmd.NetHandle_FrameDataV2 [b]({0} names expected)[/b].", meshList.Count);
            }

            return true;
        }
示例#9
0
        public bool NetHandle_FrameDataV2_Meshes(eNetCmd cmd, UsCmd c)
        {
            MeshGrid.Dispatcher.Invoke(new Action(() =>
            {
                int count = c.ReadInt32();
                UsLogging.Printf("eNetCmd.NetHandle_FrameDataV2_Meshes [b]({0} got)[/b].", count);
                for (int i = 0; i < count; i++)
                {
                    var m = new MeshObject();
                    m.Visible = true;
                    m.InstID = c.ReadInt32();
                    m.VertCnt = c.ReadInt32();
                    m.TriCnt = c.ReadInt32();
                    m.MatCnt = c.ReadInt32();
                    m.Size = c.ReadFloat();
                    ((ObservableCollection<MeshObject>)(MeshGrid.DataContext)).Add(m);
                }
            }));

            return true;
        }