public void Pack(Packer stream, object obj) { var v = (Vector2Int)obj; Int32Serializer.PackDirect(stream, v.x); Int32Serializer.PackDirect(stream, v.y); }
public void Pack(Packer packer, object obj) { var meta = (Packer.MetaType)obj; Int32Serializer.PackDirect(packer, meta.id); StringSerializer.PackDirect(packer, meta.type); }
public static void PackDirect(Packer packer, Packer.MetaType[] meta) { Int32Serializer.PackDirect(packer, meta.Length); for (int i = 0; i < meta.Length; ++i) { MetaTypeSerializer.PackDirect(packer, meta[i]); } }
public void Pack(Packer packer, object obj) { var rootType = obj.GetType(); var typeId = packer.GetMetaTypeId(rootType); Int32Serializer.PackDirect(packer, typeId); this.Pack(packer, obj, rootType); }
public void Pack(Packer packer, object obj) { var meta = (Packer.MetaType[])obj; Int32Serializer.PackDirect(packer, meta.Length); for (int i = 0; i < meta.Length; ++i) { packer.PackInternal(meta[i]); } }
public static void PackDirect(Packer packer, string obj) { var length = obj.Length; Int32Serializer.PackDirect(packer, length); for (int i = 0; i < obj.Length; ++i) { CharSerializer.PackDirect(packer, obj[i]); } }
public void Pack(Packer packer, object obj) { var arr = (System.Array)obj; Int32Serializer.PackDirect(packer, arr.Length); for (int i = 0; i < arr.Length; ++i) { packer.PackInternal(arr.GetValue(i)); } }
public void Pack(Packer packer, object obj) { var sentinel = (IDisposeSentinel)obj; var type = sentinel.GetType(); Int32Serializer.PackDirect(packer, packer.GetMetaTypeId(type.GetGenericTypeDefinition())); Int32Serializer.PackDirect(packer, packer.GetMetaTypeId(type.GenericTypeArguments[0])); Int32Serializer.PackDirect(packer, packer.GetMetaTypeId(type.GenericTypeArguments[1])); packer.PackInternal(sentinel.GetData()); Int64Serializer.PackDirect(packer, sentinel.GetTick()); }
public void Pack(Packer packer, object obj) { var dict = (ME.ECS.Collections.IDictionaryInt)obj; var type = dict.GetType(); Int32Serializer.PackDirect(packer, dict.Count); Int32Serializer.PackDirect(packer, packer.GetMetaTypeId(type.GenericTypeArguments[0])); Int32Serializer.PackDirect(packer, packer.GetMetaTypeId(type.GetGenericTypeDefinition())); foreach (DictionaryEntry entry in dict) { packer.PackInternal(entry.Key); packer.PackInternal(entry.Value); } }
public void Pack(Packer packer, object obj) { var pack = (ME.ECS.StatesHistory.HistoryEvent)obj; Int64Serializer.PackDirect(packer, pack.tick); Int32Serializer.PackDirect(packer, pack.order); Int32Serializer.PackDirect(packer, pack.rpcId); Int32Serializer.PackDirect(packer, pack.localOrder); Int32Serializer.PackDirect(packer, pack.objId); Int32Serializer.PackDirect(packer, pack.groupId); BooleanSerializer.PackDirect(packer, pack.storeInHistory); if (pack.parameters != null) { packer.WriteByte(1); var serializer = new ObjectArraySerializer(); serializer.Pack(packer, pack.parameters); } else { packer.WriteByte(0); } }
public static void PackDirect(Packer packer, byte[] arr) { Int32Serializer.PackDirect(packer, arr.Length); packer.WriteBytes(arr); }
public void Pack(Packer packer, object obj) { var arr = (IList)obj; var type = arr.GetType(); Int32Serializer.PackDirect(packer, arr.Count); if (type.IsArray == true) { var rank = type.GetArrayRank(); if (rank > 1) { packer.WriteByte(2); } else { packer.WriteByte(1); } Int32Serializer.PackDirect(packer, packer.GetMetaTypeId(type.GetElementType())); if (rank > 1) { Int32Serializer.PackDirect(packer, rank); var arrData = (System.Array)arr; for (int j = 0; j < rank; ++j) { Int32Serializer.PackDirect(packer, arrData.GetLength(j)); } void WrapDimension(int[] ids, int currentDimension) { if (currentDimension == rank) { packer.PackInternal(arrData.GetValue(ids)); } else { for (int i = 0, length = arrData.GetLength(currentDimension); i < length; i++) { ids[currentDimension] = i; WrapDimension(ids, currentDimension + 1); } } } WrapDimension(new int[rank], 0); } else { for (int i = 0; i < arr.Count; ++i) { packer.PackInternal(arr[i]); } } } else { packer.WriteByte(0); Int32Serializer.PackDirect(packer, packer.GetMetaTypeId(arr.GetType().GenericTypeArguments[0])); Int32Serializer.PackDirect(packer, packer.GetMetaTypeId(arr.GetType().GetGenericTypeDefinition())); for (int i = 0; i < arr.Count; ++i) { packer.PackInternal(arr[i]); } } }
public void Pack(Packer packer, object obj) { Int32Serializer.PackDirect(packer, (RPCId)obj); }
public static void PackDirect(Packer packer, Packer.MetaType meta) { Int32Serializer.PackDirect(packer, meta.id); StringSerializer.PackDirect(packer, meta.type); }