コード例 #1
0
    public UsCmd CreatePacket()
    {
        UsCmd c = new UsCmd();

        c.WriteNetCmd(eNetCmd.SV_FrameDataV2);
        c.WriteInt32(this._frameCount);
        c.WriteFloat(this._frameDeltaTime);
        c.WriteFloat(this._frameRealTime);
        c.WriteFloat(this._frameStartTime);
        UsCmdUtil.WriteIntList(c, this._frameMeshes);
        UsCmdUtil.WriteIntList(c, this._frameMaterials);
        UsCmdUtil.WriteIntList(c, this._frameTextures);
        return(c);
    }
コード例 #2
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);
        }