Ejemplo n.º 1
0
        protected override void OnLoad(BitStream stream, Action <MyInventory> loadingDoneHandler)
        {
            if (stream != null)
            {
                MySerializer.CreateAndRead(stream, out m_entityId);
                MySerializer.CreateAndRead(stream, out m_inventoryId);
            }

            MyEntities.CallAsync(delegate { LoadAsync(loadingDoneHandler); });
        }
Ejemplo n.º 2
0
 public override bool Serialize(BitStream stream, bool validate)
 {
     if (stream.Reading)
     {
         T newValue;
         MySerializer.CreateAndRead(stream, out newValue, SerializeInfo);
         return(SetValue(ref newValue, validate));
     }
     else
     {
         MySerializer.Write(stream, ref m_value, SerializeInfo);
         return(true);
     }
 }
Ejemplo n.º 3
0
        public override bool Serialize(BitStream stream, bool validate)
        {
#if !XB1 // !XB1_SYNC_NOREFLECTION
            if (stream.Reading)
            {
                T newValue;
                MySerializer.CreateAndRead(stream, out newValue, SerializeInfo);
                return(SetValue(ref newValue, validate));
            }
            else
            {
                MySerializer.Write(stream, ref m_value, SerializeInfo);
                return(true);
            }
#else // XB1
            System.Diagnostics.Debug.Assert(false);
            return(false);
#endif // XB1
        }
Ejemplo n.º 4
0
        protected override void OnLoad(BitStream stream, Action <MyLogicalEnvironmentSectorBase> loadingDoneHandler)
        {
            var planetEntityId = stream.ReadInt64();
            var packedSectorId = stream.ReadInt64();

            var planet = MyEntities.GetEntityById(planetEntityId) as MyPlanet;

            Debug.Assert(planet != null, "planet == null!!!");

            var env = planet.Components.Get <MyPlanetEnvironmentComponent>();

            MyLogicalEnvironmentSectorBase sector = env.GetLogicalSector(packedSectorId);

            var ob = MySerializer.CreateAndRead <MyObjectBuilder_EnvironmentSector>(stream, serialInfo);

            if (sector != null)
            {
                sector.Init(ob);
            }

            Debug.Assert(sector == null || !sector.ServerOwned);

            loadingDoneHandler(sector != null && sector.ServerOwned ? null : sector);
        }
Ejemplo n.º 5
0
        public void ReceiveWorld(MyPacket packet)
        {
            MyObjectBuilder_World world;

            MyObjectBuilderSerializer.DeserializeGZippedXML <MyObjectBuilder_World>(new MemoryStream(MySerializer.CreateAndRead <byte[]>(packet.BitStream, null)), out world);
            MyJoinGameHelper.WorldReceived(world, MyMultiplayer.Static);
        }