Ejemplo n.º 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);
    }
 private bool NetHandle_FrameV2_RequestNames(eNetCmd cmd, UsCmd c)
 {
     if (DataCollector.Instance != null)
     {
         foreach (List <int> intList in UsGeneric.Slice <int>(UsCmdUtil.ReadIntList(c), this.SLICE_COUNT))
         {
             UsCmd cmd1 = new UsCmd();
             cmd1.WriteNetCmd(eNetCmd.SV_FrameDataV2_Names);
             cmd1.WriteInt32(intList.Count);
             foreach (int instID in intList)
             {
                 DataCollector.Instance.WriteName(instID, cmd1);
             }
             UsNet.Instance.SendCommand(cmd1);
         }
     }
     return(true);
 }
Ejemplo n.º 3
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);
        }
    private bool NetHandle_FrameV2_RequestNames(eNetCmd cmd, UsCmd c)
    {
        if (usmooth.DataCollector.Instance != null)
        {
            List <int> instIDs = UsCmdUtil.ReadIntList(c);
            foreach (var slice in UsGeneric.Slice(instIDs, SLICE_COUNT))
            {
                UsCmd fragment = new UsCmd();
                fragment.WriteNetCmd(eNetCmd.SV_FrameDataV2_Names);
                fragment.WriteInt32(slice.Count);
                foreach (int instID in slice)
                {
                    usmooth.DataCollector.Instance.WriteName(instID, fragment);
                }
                UsNet.Instance.SendCommand(fragment);
            }
        }

        return(true);
    }
    private bool NetHandle_FrameV2_RequestMeshes(eNetCmd cmd, UsCmd c)
    {
        if (usmooth.DataCollector.Instance != null)
        {
            List <int> meshIDs = UsCmdUtil.ReadIntList(c);
            //Debug.Log(string.Format("requesting meshes - count ({0})", meshIDs.Count));
            foreach (var slice in UsGeneric.Slice(meshIDs, SLICE_COUNT))
            {
                UsCmd fragment = new UsCmd();
                fragment.WriteNetCmd(eNetCmd.SV_FrameDataV2_Meshes);
                fragment.WriteInt32(slice.Count);
                foreach (int meshID in slice)
                {
                    usmooth.DataCollector.Instance.MeshTable.WriteMesh(meshID, fragment);
                }
                UsNet.Instance.SendCommand(fragment);
            }
        }

        return(true);
    }