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);
            }
        }
Ejemplo n.º 3
0
 public MySynchronizedTypeInfo Get(TypeId id)
 {
     Debug.Assert(id.Value < m_idToType.Count, "Invalid replication type ID");
     return m_idToType[(int)id.Value];
 }
Ejemplo n.º 4
0
 protected Type GetTypeByTypeId(TypeId typeId)
 {
     return m_typeTable.Get(typeId).Type;
 }
Ejemplo n.º 5
0
 public static void WriteTypeId(this VRage.Library.Collections.BitStream stream, TypeId typeId)
 {
     stream.WriteVariant((uint)typeId.Value);
 }