Example #1
0
 public static void WriteIntList(UsCmd c, List <int> l)
 {
     c.WriteInt32(l.Count);
     foreach (var item in l)
     {
         c.WriteInt32(item);
     }
 }
Example #2
0
        public UsCmd CreatePacket()
        {
            UsCmd c = new UsCmd();

            c.WriteNetCmd(eNetCmd.SV_App_Logging);
            c.WriteInt16((short)SeqID);
            c.WriteInt32((int)LogType);
            c.WriteStringStripped(Content, MAX_CONTENT_LEN);
            c.WriteFloat(RealtimeSinceStartup);
            return(c);
        }
        private void writeNetCmd(UsCmd uscmd)
        {
            uscmd.ClearCmd();
            uscmd.WriteNetCmd(eNetCmd.SV_VarTracerInfo);
            //group count
            uscmd.WriteInt32(_cmdCacher.GetUsedGroupCount());
            foreach (var package in _cmdCacher.GroupCmdPackage)
            {
                if (package.Value.IsUse())
                {
                    //group name
                    uscmd.WriteString(package.Key);

                    //variable count
                    uscmd.WriteInt32(_cmdCacher.GetUsedVariableCount(package.Value));
                    foreach (var list in package.Value.VariableDict)
                    {
                        if (list.Value.IsUse())
                        {
                            //variable name
                            uscmd.WriteString(list.Key);
                            //session count
                            uscmd.WriteInt32(list.Value.UseIndex);
                            var cacheList = list.Value;
                            int usedCount = cacheList.UseIndex;
                            for (int i = 0; i < usedCount; i++)
                            {
                                //UnityEngine.Debug.LogFormat("send stamp= {0}", list.Value.VarChacheList[i]._stamp);
                                //stamp
                                uscmd.WriteLong(list.Value.VarChacheList[i]._stamp);
                                //value
                                uscmd.WriteFloat(list.Value.VarChacheList[i]._value);
                            }
                        }
                    }

                    //event count
                    uscmd.WriteInt32(_cmdCacher.GetUsedEventCount(package.Value));
                    foreach (var list in package.Value.EventDict)
                    {
                        if (list.Value.IsUse())
                        {
                            //event name
                            uscmd.WriteString(list.Key);
                            //session count
                            uscmd.WriteInt32(list.Value.UseIndex);
                            var cacheList = list.Value;
                            int usedCount = cacheList.UseIndex;
                            for (int i = 0; i < usedCount; i++)
                            {
                                //stamp
                                uscmd.WriteLong(list.Value.VarChacheList[i]._stamp);
                                //duration
                                uscmd.WriteFloat(list.Value.VarChacheList[i]._duration);
                            }
                        }
                    }
                }
            }

            UsNet.Instance.SendCommand(uscmd);
        }