示例#1
0
        public bool NetHandle_Editor_SelectionChanged(eNetCmd cmd, UsCmd c)
        {
            int count = c.ReadInt32();
            UsLogging.Printf("eNetCmd.SV_Editor_SelectionChanged received ({0}, inst count: {1}).", c.Buffer.Length, count);

            _instances.Clear();
            for (int i = 0; i < count; i++)
            {
                int instID = c.ReadInt32();
                _instances.Add(instID);
            }

            MeshGrid.Dispatcher.Invoke(new Action(() =>
            {
                ClearAllSelectionsAndHighlightedObjects();
                var meshes = HighlightMeshes(_instances, Colors.PaleTurquoise);
                foreach (var mesh in meshes)
                {
                    var matLst = HighlightMaterialByMesh(mesh, Colors.PaleTurquoise);
                    foreach (var mat in matLst)
                        HighlightTextureByMaterial(mat, Colors.PaleTurquoise);
                }
            }));

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

            UsLogging.Printf("eNetCmd.SV_Editor_SelectionChanged received ({0}, inst count: {1}).", c.Buffer.Length, count);

            _instances.Clear();
            for (int i = 0; i < count; i++)
            {
                int instID = c.ReadInt32();
                _instances.Add(instID);
            }

            MeshGrid.Dispatcher.Invoke(new Action(() =>
            {
                ClearAllSelectionsAndHighlightedObjects();
                var meshes = HighlightMeshes(_instances, Colors.PaleTurquoise);
                foreach (var mesh in meshes)
                {
                    var matLst = HighlightMaterialByMesh(mesh, Colors.PaleTurquoise);
                    foreach (var mat in matLst)
                    {
                        HighlightTextureByMaterial(mat, Colors.PaleTurquoise);
                    }
                }
            }));

            return(true);
        }
示例#3
0
        public bool NetHandle_FrameData_Material(eNetCmd cmd, UsCmd c)
        {
            UsLogging.Printf("eNetCmd.Handle_FrameData_Material received ({0}).", c.Buffer.Length);

            var materials = new ObservableCollection <MaterialObject>();
            int count     = c.ReadInt32();

            for (int i = 0; i < count; i++)
            {
                var m = new MaterialObject();
                m.InstID     = c.ReadInt32();
                m.Name       = c.ReadString();
                m.ShaderName = c.ReadString();
                m.RefCnt     = c.ReadInt32();

                m.RefList = new List <int>();
                for (int k = 0; k < m.RefCnt; k++)
                {
                    int owner = c.ReadInt32();
                    m.RefList.Add(owner);
                }

                materials.Add(m);
            }

            MaterialGrid.Dispatcher.Invoke(new Action(() =>
            {
                title_material.Text      = string.Format("Materials ({0})", materials.Count);
                MaterialGrid.DataContext = materials;
            }));
            return(true);
        }
示例#4
0
        public bool NetHandle_FrameDataV2_Names(eNetCmd cmd, UsCmd c)
        {
            MeshGrid.Dispatcher.Invoke(new Action(() =>
            {
                int count = c.ReadInt32();
                UsLogging.Printf("eNetCmd.NetHandle_FrameDataV2_Names [b]({0} got)[/b].", count);
                for (int i = 0; i < count; i++)
                {
                    int instID      = c.ReadInt32();
                    string instName = c.ReadString();
                    foreach (var item in MeshGrid.Items)
                    {
                        MeshObject mo = item as MeshObject;
                        if (mo != null && mo.InstID == instID)
                        {
                            mo.Name = instName;
                        }
                    }
                }

                MeshGrid.Items.Refresh();
            }));

            return(true);
        }
示例#5
0
        public bool NetHandle_FrameData_Texture(eNetCmd cmd, UsCmd c)
        {
            UsLogging.Printf("eNetCmd.Handle_FrameData_Texture received ({0}).", c.Buffer.Length);

            var textures = new ObservableCollection <TextureObject>();
            int count    = c.ReadInt32();

            for (int i = 0; i < count; i++)
            {
                var m = new TextureObject();
                m.InstID    = c.ReadInt32();
                m.Name      = c.ReadString();
                m.PixelSize = c.ReadString();
                m.MemSize   = c.ReadString();
                m.RefCnt    = c.ReadInt32();
                m.RefList   = new List <int>();
                for (int k = 0; k < m.RefCnt; k++)
                {
                    int owner = c.ReadInt32();
                    m.RefList.Add(owner);
                }

                textures.Add(m);
            }

            TextureGrid.Dispatcher.Invoke(new Action(() =>
            {
                title_texture.Text      = string.Format("Textures ({0})", textures.Count);
                TextureGrid.DataContext = textures;
            }));
            return(true);
        }
示例#6
0
 public static List<int> ReadIntList(UsCmd c)
 {
     List<int> ret = new List<int>();
     int count = c.ReadInt32 ();
     for (int i = 0; i < count; i++) {
         ret.Add(c.ReadInt32());
     }
     return ret;
 }
示例#7
0
    public static List <int> ReadIntList(UsCmd c)
    {
        List <int> intList = new List <int>();
        int        num     = c.ReadInt32();

        for (int index = 0; index < num; ++index)
        {
            intList.Add(c.ReadInt32());
        }
        return(intList);
    }
示例#8
0
    public static List <int> ReadIntList(UsCmd c)
    {
        List <int> ret   = new List <int>();
        int        count = c.ReadInt32();

        for (int i = 0; i < count; i++)
        {
            ret.Add(c.ReadInt32());
        }
        return(ret);
    }
示例#9
0
 public UsLogPacket(UsCmd c)
 {
     SeqID   = (ushort)c.ReadInt16();
     LogType = (UsLogType)c.ReadInt32();
     Content = c.ReadString();
     RealtimeSinceStartup = c.ReadFloat();
 }
示例#10
0
 public UsLogPacket(UsCmd c)
 {
     SeqID = (ushort)c.ReadInt16();
     LogType = (UsLogType)c.ReadInt32();
     Content = c.ReadString();
     RealtimeSinceStartup = c.ReadFloat();
 }
示例#11
0
    private bool NetHandle_FlyToObject(eNetCmd cmd, UsCmd c)
    {
        int instID = c.ReadInt32();

        UsEditorNotifer.Instance.PostMessage_FlyToObject(instID);
        return(true);
    }
示例#12
0
        private bool Handle_ExecCommandResponse(eNetCmd cmd, UsCmd c)
        {
            int code = c.ReadInt32();

            UsLogging.Printf(string.Format("command executing result: [b]{0}[/b]", code));

            return(true);
        }
示例#13
0
    private bool Handle_ExecCommandResponse(eNetCmd cmd, UsCmd c)
    {
        int code = c.ReadInt32();

        NetUtil.Log("command executing result: [b]{0}[/b]", code);

        return(true);
    }
示例#14
0
 bool NetHandle_StartAnalysePixels(eNetCmd cmd, UsCmd c)
 {
     int count = c.ReadInt32();
     for (int i = 0; i < count; ++i )
     {
         string msg = c.ReadString();
         UsLogging.Printf(msg);
     }
     return true;
 }
示例#15
0
        bool NetHandle_StartAnalysePixels(eNetCmd cmd, UsCmd c)
        {
            int count = c.ReadInt32();

            for (int i = 0; i < count; ++i)
            {
                string msg = c.ReadString();
                UsLogging.Printf(msg);
            }
            return(true);
        }
示例#16
0
        private 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.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);
        }
示例#17
0
        bool NetHandle_StressTestResult(eNetCmd cmd, UsCmd c)
        {
            string name     = c.ReadString();
            int    avgMS    = c.ReadInt32();
            int    maxMS    = c.ReadInt32();
            int    drawcall = c.ReadInt32();
            int    parCount = c.ReadInt32();

            EffectGrid.Dispatcher.Invoke(new Action(() =>
            {
                foreach (var item in EffectGrid.Items)
                {
                    EffectObject mo = item as EffectObject;
                    if (mo != null && mo.Name == name)
                    {
                        if (_highlighted != null)
                        {
                            DataGridUtil.ClearHighlighted(EffectGrid, _highlighted);
                        }

                        mo.MSAvg          = avgMS;
                        mo.MSMax          = maxMS;
                        mo.DrawCallCount  = drawcall;
                        mo.TotalParticles = parCount;

                        DataGridUtil.MarkAsHighlighted(EffectGrid, item, Colors.Chartreuse);
                        _highlighted = mo;

                        break;
                    }
                }
            }));

            RunNextEffectStressTest();

            return(true);
        }
示例#18
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;
        }
示例#19
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;
        }
示例#20
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);
        }
示例#21
0
        bool NetHandle_StressTestNames(eNetCmd cmd, UsCmd c)
        {
            var effects = new ObservableCollection <EffectObject>();
            int count   = c.ReadInt32();

            for (int i = 0; i < count; i++)
            {
                var e = new EffectObject();
                e.Name = c.ReadString();
                effects.Add(e);
            }

            EffectGrid.Dispatcher.Invoke(new Action(() =>
            {
                EffectGrid.DataContext = effects;
            }));
            return(true);
        }
示例#22
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);
        }
示例#23
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);
        }
示例#24
0
    public bool NetHandle_RequestStackData(eNetCmd cmd, UsCmd c)
    {
        int    instID = c.ReadInt32();
        string str    = c.ReadString();

        Debug.Log((object)string.Format("NetHandle_RequestStackData instanceID={0} className={1}", (object)instID, (object)str));
        ResourceRequestInfo allocInfo = ResourceTracker.Instance.GetAllocInfo(instID);
        UsCmd cmd1 = new UsCmd();

        cmd1.WriteNetCmd(eNetCmd.SV_QueryStacksResponse);
        if (allocInfo == null)
        {
            cmd1.WriteString("<no_callstack_available>");
        }
        else
        {
            cmd1.WriteString(ResourceTracker.Instance.GetStackTrace(allocInfo));
        }
        UsNet.Instance.SendCommand(cmd1);
        return(true);
    }
示例#25
0
    public bool NetHandle_RequestStackData(eNetCmd cmd, UsCmd c)
    {
        int    instanceID = c.ReadInt32();
        string className  = c.ReadString();

        UnityEngine.Debug.Log(string.Format("NetHandle_RequestStackData instanceID={0} className={1}", instanceID, className));

        ResourceRequestInfo requestInfo = ResourceTracker.Instance.GetAllocInfo(instanceID);

        UsCmd pkt = new UsCmd();

        pkt.WriteNetCmd(eNetCmd.SV_QueryStacksResponse);
        if (requestInfo == null)
        {
            pkt.WriteString("<no_callstack_available>");
        }
        else
        {
            pkt.WriteString(ResourceTracker.Instance.GetStackTrace(requestInfo));
        }
        UsNet.Instance.SendCommand(pkt);
        return(true);
    }
示例#26
0
        bool NetHandle_StressTestNames(eNetCmd cmd, UsCmd c)
        {
            var effects = new ObservableCollection<EffectObject>();
            int count = c.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                var e = new EffectObject();
                e.Name = c.ReadString();
                effects.Add(e);
            }

            EffectGrid.Dispatcher.Invoke(new Action(() =>
            {
                EffectGrid.DataContext = effects;
            }));
            return true;
        }
示例#27
0
        bool NetHandle_StressTestResult(eNetCmd cmd, UsCmd c)
        {
            string name = c.ReadString();
            int avgMS = c.ReadInt32();
            int maxMS = c.ReadInt32();
            int drawcall = c.ReadInt32();
            int parCount = c.ReadInt32();

            EffectGrid.Dispatcher.Invoke(new Action(() =>
            {
                foreach (var item in EffectGrid.Items)
                {
                    EffectObject mo = item as EffectObject;
                    if (mo != null && mo.Name == name)
                    {
                        if (_highlighted != null)
                        {
                            DataGridUtil.ClearHighlighted(EffectGrid, _highlighted);
                        }

                        mo.MSAvg = avgMS;
                        mo.MSMax = maxMS;
                        mo.DrawCallCount = drawcall;
                        mo.TotalParticles = parCount;

                        DataGridUtil.MarkAsHighlighted(EffectGrid, item, Colors.Chartreuse);
                        _highlighted = mo;

                        break;
                    }
                }
            }));

            RunNextEffectStressTest();

            return true;
        }
示例#28
0
    public bool NetHandle_RequestStackSummary(eNetCmd cmd, UsCmd c)
    {
        string str = c.ReadString();

        if (string.IsNullOrEmpty(str))
        {
            return(false);
        }
        if (str.Equals("begin"))
        {
            this._stackUnavailableDict.Clear();
            return(true);
        }
        if (str.Equals("end"))
        {
            Debug.Log((object)"Stack Category Statistical Information:");
            int num1   = 0;
            int num2   = 0;
            int bytes1 = 0;
            int bytes2 = 0;
            int num3   = c.ReadInt32();
            for (int index = 0; index < num3; ++index)
            {
                string key = c.ReadString();
                List <ResourceTracker.stackParamater> stackParamaterList;
                this._stackUnavailableDict.TryGetValue(key, out stackParamaterList);
                if (stackParamaterList != null)
                {
                    int num4   = c.ReadInt32();
                    int bytes3 = c.ReadInt32();
                    num1   += num4;
                    bytes1 += bytes3;
                    num2   += stackParamaterList.Count;
                    int bytes4 = 0;
                    foreach (ResourceTracker.stackParamater stackParamater in stackParamaterList)
                    {
                        bytes4 += stackParamater.Size;
                    }
                    bytes2 += bytes4;
                    Debug.Log((object)string.Format("[{0} =({1}/{2},{3}/{4})]", (object)key, (object)stackParamaterList.Count, (object)num4, (object)ResourceTrackerConst.FormatBytes(bytes4), (object)ResourceTrackerConst.FormatBytes(bytes3)));
                }
            }
            Debug.Log((object)string.Format("[total =({0}/{1},{2}/{3})]", (object)num2, (object)num1, (object)ResourceTrackerConst.FormatBytes(bytes2), (object)ResourceTrackerConst.FormatBytes(bytes1)));
            return(true);
        }
        string key1 = str;
        int    num5 = c.ReadInt32();

        for (int index = 0; index < num5; ++index)
        {
            int instID = c.ReadInt32();
            int num1   = c.ReadInt32();
            if (ResourceTracker.Instance.GetAllocInfo(instID) == null)
            {
                if (!this._stackUnavailableDict.ContainsKey(key1))
                {
                    this._stackUnavailableDict.Add(key1, new List <ResourceTracker.stackParamater>());
                }
                List <ResourceTracker.stackParamater> stackParamaterList;
                this._stackUnavailableDict.TryGetValue(key1, out stackParamaterList);
                stackParamaterList.Add(new ResourceTracker.stackParamater()
                {
                    InstanceID = instID,
                    Size       = num1
                });
            }
        }
        return(true);
    }
示例#29
0
    public bool NetHandle_RequestStackSummary(eNetCmd cmd, UsCmd c)
    {
        string flag = c.ReadString();

        if (string.IsNullOrEmpty(flag))
        {
            return(false);
        }

        if (flag.Equals("begin"))
        {
            _stackUnavailableDict.Clear();
            return(true);
        }

        if (flag.Equals("end"))
        {
            UnityEngine.Debug.Log("Stack Category Statistical Information:");
            //NetUtil.Log("堆栈类型统计信息:");
            int totalCount            = 0;
            int unavailableTotalCount = 0;
            int totalSize             = 0;
            int unavailableTotalSize  = 0;
            int categoryCount         = c.ReadInt32();
            for (int i = 0; i < categoryCount; i++)
            {
                string category = c.ReadString();
                List <stackParamater> unavailableList;
                _stackUnavailableDict.TryGetValue(category, out unavailableList);
                if (unavailableList != null)
                {
                    int CategoryCount = c.ReadInt32();
                    int CategorySize  = c.ReadInt32();
                    totalCount            += CategoryCount;
                    totalSize             += CategorySize;
                    unavailableTotalCount += unavailableList.Count;
                    int categoryTotalSize = 0;
                    foreach (var info in unavailableList)
                    {
                        categoryTotalSize += info.Size;
                    }
                    unavailableTotalSize += categoryTotalSize;
                    UnityEngine.Debug.Log(string.Format("[{0} =({1}/{2},{3}/{4})]", category, unavailableList.Count, CategoryCount, ResourceTrackerConst.FormatBytes(categoryTotalSize), ResourceTrackerConst.FormatBytes(CategorySize)));
                    //NetUtil.Log("【{0} =({1}/{2},{3}/{4})】", category, unavailableList.Count, CategoryCount, ResourceTrackerConst.FormatBytes(categoryTotalSize), ResourceTrackerConst.FormatBytes(CategorySize));
                }
            }
            UnityEngine.Debug.Log(string.Format("[total =({0}/{1},{2}/{3})]", unavailableTotalCount, totalCount, ResourceTrackerConst.FormatBytes(unavailableTotalSize), ResourceTrackerConst.FormatBytes(totalSize)));
            //NetUtil.Log("【total =({0}/{1},{2}/{3})】", unavailableTotalCount, totalCount, ResourceTrackerConst.FormatBytes(unavailableTotalSize), ResourceTrackerConst.FormatBytes(totalSize));
            return(true);
        }

        string className = flag;
        int    count     = c.ReadInt32();

        for (int i = 0; i < count; i++)
        {
            int instanceID = c.ReadInt32();
            int size       = c.ReadInt32();
            ResourceRequestInfo requestInfo = ResourceTracker.Instance.GetAllocInfo(instanceID);
            if (requestInfo == null)
            {
                if (!_stackUnavailableDict.ContainsKey(className))
                {
                    _stackUnavailableDict.Add(className, new List <stackParamater>());
                }
                List <stackParamater> stackUnavailableList;
                _stackUnavailableDict.TryGetValue(className, out stackUnavailableList);
                stackParamater info = new stackParamater();
                info.InstanceID = instanceID;
                info.Size       = size;
                stackUnavailableList.Add(info);
            }
        }
        return(true);
    }
示例#30
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;
        }
示例#31
0
        public bool NetHandle_FrameDataV2_Names(eNetCmd cmd, UsCmd c)
        {
            MeshGrid.Dispatcher.Invoke(new Action(() =>
            {
                int count = c.ReadInt32();
                UsLogging.Printf("eNetCmd.NetHandle_FrameDataV2_Names [b]({0} got)[/b].", count);
                for (int i = 0; i < count; i++)
                {
                    int instID = c.ReadInt32();
                    string instName = c.ReadString();
                    foreach (var item in MeshGrid.Items)
                    {
                        MeshObject mo = item as MeshObject;
                        if (mo != null && mo.InstID == instID)
                        {
                            mo.Name = instName;
                        }
                    }
                }

                MeshGrid.Items.Refresh();
            }));

            return true;
        }
示例#32
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;
        }
示例#33
0
 private bool Handle_ExecCommandResponse(eNetCmd cmd, UsCmd c)
 {
     NetUtil.Log("command executing result: [b]{0}[/b]", (object)c.ReadInt32());
     return(true);
 }
示例#34
0
        public bool NetHandle_FrameData_Material(eNetCmd cmd, UsCmd c)
        {
            UsLogging.Printf("eNetCmd.Handle_FrameData_Material received ({0}).", c.Buffer.Length);

            var materials = new ObservableCollection<MaterialObject>();
            int count = c.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                var m = new MaterialObject();
                m.InstID = c.ReadInt32();
                m.Name = c.ReadString();
                m.ShaderName = c.ReadString();
                m.RefCnt = c.ReadInt32();

                m.RefList = new List<int>();
                for (int k = 0; k < m.RefCnt; k++)
                {
                    int owner = c.ReadInt32();
                    m.RefList.Add(owner);
                }

                materials.Add(m);
            }

            MaterialGrid.Dispatcher.Invoke(new Action(() =>
            {
                title_material.Text = string.Format("Materials ({0})", materials.Count);
                MaterialGrid.DataContext = materials;
            }));
            return true;
        }
示例#35
0
        public bool NetHandle_FrameData_Texture(eNetCmd cmd, UsCmd c)
        {
            UsLogging.Printf("eNetCmd.Handle_FrameData_Texture received ({0}).", c.Buffer.Length);

            var textures = new ObservableCollection<TextureObject>();
            int count = c.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                var m = new TextureObject();
                m.InstID = c.ReadInt32();
                m.Name = c.ReadString();
                m.PixelSize = c.ReadString();
                m.MemSize = c.ReadString();
                m.RefCnt = c.ReadInt32();
                m.RefList = new List<int>();
                for (int k = 0; k < m.RefCnt; k++)
                {
                    int owner = c.ReadInt32();
                    m.RefList.Add(owner);
                }

                textures.Add(m);
            }

            TextureGrid.Dispatcher.Invoke(new Action(() =>
            {
                title_texture.Text = string.Format("Textures ({0})", textures.Count);
                TextureGrid.DataContext = textures;
            }));
            return true;
        }
示例#36
0
        private bool Handle_ExecCommandResponse(eNetCmd cmd, UsCmd c)
        {
            int code = c.ReadInt32();
            UsLogging.Printf(string.Format("command executing result: [b]{0}[/b]", code));

            return true;
        }
示例#37
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);
        }
示例#38
0
 private bool NetHandle_FlyToObject(eNetCmd cmd, UsCmd c)
 {
     int instID = c.ReadInt32 ();
     UsEditorNotifer.Instance.PostMessage_FlyToObject (instID);
     return true;
 }