public MySynchronizedTypeInfo(Type type, TypeId id, MySynchronizedTypeInfo baseType, bool isReplicated) { Type = type; TypeId = id; TypeHash = GetHashFromType(type); TypeName = type.Name; FullTypeName = type.FullName; BaseType = baseType; IsReplicated = isReplicated; EventTable = new MyEventTable(this); }
public void Serialize(BitStream stream, Type baseType, ref Type obj) { if (stream.Reading) { var id = new TypeId(stream.ReadUInt32()); obj = MyMultiplayer.Static.ReplicationLayer.GetType(id); } else { var id = MyMultiplayer.Static.ReplicationLayer.GetTypeId(obj); stream.WriteUInt32(id); } }
public MySynchronizedTypeInfo Get(TypeId id) { Debug.Assert(id.Value < m_idToType.Count, "Invalid replication type ID"); return m_idToType[(int)id.Value]; }
protected Type GetTypeByTypeId(TypeId typeId) { return m_typeTable.Get(typeId).Type; }
public static void WriteTypeId(this VRage.Library.Collections.BitStream stream, TypeId typeId) { stream.WriteVariant((uint)typeId.Value); }