示例#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_QuerySwitchesResponse(eNetCmd cmd, UsCmd c)
        {
            int count = c.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                string name = c.ReadString();
                string path = c.ReadString();
                short initVal = c.ReadInt16();

                _switchersPanel.Dispatcher.Invoke(new Action(() =>
                {
                    AddSwitcher(name, path, initVal != 0);
                }));
            }

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

            for (int i = 0; i < count; i++)
            {
                string name    = c.ReadString();
                string path    = c.ReadString();
                short  initVal = c.ReadInt16();

                _switchersPanel.Dispatcher.Invoke(new Action(() =>
                {
                    AddSwitcher(name, path, initVal != 0);
                }));
            }

            return(true);
        }
示例#5
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);
        }