Ejemplo n.º 1
0
    public bool Deserialize(int serializer, Entity entity, uint snapshot, uint baseline, uint baseline2, uint baseline3,
                            ref DataStreamReader reader, NetworkCompressionModel compressionModel)
    {
        switch (serializer)
        {
        case 0:
            return(GhostReceiveSystem <LagCompensationGhostDeserializerCollection> .InvokeDeserialize(m_LagCubeSnapshotDataFromEntity, entity, snapshot, baseline, baseline2,
                                                                                                      baseline3, ref reader, compressionModel));

        case 1:
            return(GhostReceiveSystem <LagCompensationGhostDeserializerCollection> .InvokeDeserialize(m_LagPlayerSnapshotDataFromEntity, entity, snapshot, baseline, baseline2,
                                                                                                      baseline3, ref reader, compressionModel));

        default:
            throw new ArgumentException("Invalid serializer type");
        }
    }
    protected override void OnCreateManager()
    {
        m_ReceiveSys    = World.GetOrCreateManager <GhostReceiveSystem>();
        lastFrame       = 0;
        connectionGroup = GetComponentGroup(ComponentType.ReadWrite <NetworkSnapshotAck>());
        socket          = new DebugWebSocket(World.GetExistingManager <ClientSimulationSystemGroup>().ClientWorldIndex);

        ghostList = "Destroy";
        var list = GhostDeserializerCollection.CreateSerializerNameList();

        for (int i = 0; i < list.Length; ++i)
        {
            ghostList += ";" + list[i];
        }

        // 3 ints per ghost type, plus one for destroy
        ghostStatData = new byte[(list.Length + 1) * 3 * 4];
    }
Ejemplo n.º 3
0
    public void Spawn(int serializer, int ghostId, uint snapshot, ref DataStreamReader reader,
                      NetworkCompressionModel compressionModel)
    {
        switch (serializer)
        {
        case 0:
            m_LagCubeSnapshotDataNewGhostIds.Add(ghostId);
            m_LagCubeSnapshotDataNewGhosts.Add(GhostReceiveSystem <LagCompensationGhostDeserializerCollection> .InvokeSpawn <LagCubeSnapshotData>(snapshot, ref reader, compressionModel));
            break;

        case 1:
            m_LagPlayerSnapshotDataNewGhostIds.Add(ghostId);
            m_LagPlayerSnapshotDataNewGhosts.Add(GhostReceiveSystem <LagCompensationGhostDeserializerCollection> .InvokeSpawn <LagPlayerSnapshotData>(snapshot, ref reader, compressionModel));
            break;

        default:
            throw new ArgumentException("Invalid serializer type");
        }
    }
    public void Spawn(int serializer, int ghostId, uint snapshot, ref DataStreamReader reader,
                      NetworkCompressionModel compressionModel)
    {
        switch (serializer)
        {
        case 0:
            m_SphereSnapshotDataNewGhostIds.Add(ghostId);
            m_SphereSnapshotDataNewGhosts.Add(GhostReceiveSystem <MarchingSquaresGhostDeserializerCollection> .InvokeSpawn <SphereSnapshotData>(snapshot, ref reader, compressionModel));
            break;

        case 1:
            m_VoxelGridSnapshotDataNewGhostIds.Add(ghostId);
            m_VoxelGridSnapshotDataNewGhosts.Add(GhostReceiveSystem <MarchingSquaresGhostDeserializerCollection> .InvokeSpawn <VoxelGridSnapshotData>(snapshot, ref reader, compressionModel));
            break;

        default:
            throw new ArgumentException("Invalid serializer type");
        }
    }
    public bool Deserialize(int serializer, Entity entity, uint snapshot, uint baseline, uint baseline2, uint baseline3,
                            ref DataStreamReader reader, NetworkCompressionModel compressionModel)
    {
        switch (serializer)
        {
        case 0:
            return(GhostReceiveSystem <MobileRTSGhostDeserializerCollection> .InvokeDeserialize(m_PlayerSnapshotDataFromEntity, entity, snapshot, baseline, baseline2,
                                                                                                baseline3, ref reader, compressionModel));

        case 1:
            return(GhostReceiveSystem <MobileRTSGhostDeserializerCollection> .InvokeDeserialize(m_ArrowSnapshotDataFromEntity, entity, snapshot, baseline, baseline2,
                                                                                                baseline3, ref reader, compressionModel));

        case 2:
            return(GhostReceiveSystem <MobileRTSGhostDeserializerCollection> .InvokeDeserialize(m_AArcherSnapshotDataFromEntity, entity, snapshot, baseline, baseline2,
                                                                                                baseline3, ref reader, compressionModel));

        case 3:
            return(GhostReceiveSystem <MobileRTSGhostDeserializerCollection> .InvokeDeserialize(m_ACivilianSnapshotDataFromEntity, entity, snapshot, baseline, baseline2,
                                                                                                baseline3, ref reader, compressionModel));

        case 4:
            return(GhostReceiveSystem <MobileRTSGhostDeserializerCollection> .InvokeDeserialize(m_BArcherSnapshotDataFromEntity, entity, snapshot, baseline, baseline2,
                                                                                                baseline3, ref reader, compressionModel));

        case 5:
            return(GhostReceiveSystem <MobileRTSGhostDeserializerCollection> .InvokeDeserialize(m_BCivilianSnapshotDataFromEntity, entity, snapshot, baseline, baseline2,
                                                                                                baseline3, ref reader, compressionModel));

        case 6:
            return(GhostReceiveSystem <MobileRTSGhostDeserializerCollection> .InvokeDeserialize(m_A_BarracksSnapshotDataFromEntity, entity, snapshot, baseline, baseline2,
                                                                                                baseline3, ref reader, compressionModel));

        case 7:
            return(GhostReceiveSystem <MobileRTSGhostDeserializerCollection> .InvokeDeserialize(m_B_BarracksSnapshotDataFromEntity, entity, snapshot, baseline, baseline2,
                                                                                                baseline3, ref reader, compressionModel));

        default:
            throw new ArgumentException("Invalid serializer type");
        }
    }
Ejemplo n.º 6
0
    public bool Deserialize(int serializer, Entity entity, uint snapshot, uint baseline, uint baseline2, uint baseline3,
                            ref DataStreamReader reader, NetworkCompressionModel compressionModel)
    {
        switch (serializer)
        {
        case 0:
            return(GhostReceiveSystem <MultiplayerPongGhostDeserializerCollection> .InvokeDeserialize(m_PaddleTheSideSnapshotDataFromEntity, entity, snapshot, baseline, baseline2,
                                                                                                      baseline3, ref reader, compressionModel));

        case 1:
            return(GhostReceiveSystem <MultiplayerPongGhostDeserializerCollection> .InvokeDeserialize(m_PaddleOtherSideSnapshotDataFromEntity, entity, snapshot, baseline, baseline2,
                                                                                                      baseline3, ref reader, compressionModel));

        case 2:
            return(GhostReceiveSystem <MultiplayerPongGhostDeserializerCollection> .InvokeDeserialize(m_SphereSnapshotDataFromEntity, entity, snapshot, baseline, baseline2,
                                                                                                      baseline3, ref reader, compressionModel));

        default:
            throw new ArgumentException("Invalid serializer type");
        }
    }
Ejemplo n.º 7
0
    public void Spawn(int serializer, int ghostId, uint snapshot, ref DataStreamReader reader,
                      NetworkCompressionModel compressionModel)
    {
        switch (serializer)
        {
        case 0:
            m_SpawnerSnapshotDataNewGhostIds.Add(ghostId);
            m_SpawnerSnapshotDataNewGhosts.Add(GhostReceiveSystem <DOTSGhostDeserializerCollection> .InvokeSpawn <SpawnerSnapshotData>(snapshot, ref reader, compressionModel));
            break;

        case 1:
            m_CubeSnapshotDataNewGhostIds.Add(ghostId);
            m_CubeSnapshotDataNewGhosts.Add(GhostReceiveSystem <DOTSGhostDeserializerCollection> .InvokeSpawn <CubeSnapshotData>(snapshot, ref reader, compressionModel));
            break;

        case 2:
            m_ItemSpawnerSnapshotDataNewGhostIds.Add(ghostId);
            m_ItemSpawnerSnapshotDataNewGhosts.Add(GhostReceiveSystem <DOTSGhostDeserializerCollection> .InvokeSpawn <ItemSpawnerSnapshotData>(snapshot, ref reader, compressionModel));
            break;

        case 3:
            m_CharacterSnapshotDataNewGhostIds.Add(ghostId);
            m_CharacterSnapshotDataNewGhosts.Add(GhostReceiveSystem <DOTSGhostDeserializerCollection> .InvokeSpawn <CharacterSnapshotData>(snapshot, ref reader, compressionModel));
            break;

        case 4:
            m_ItemSnapshotDataNewGhostIds.Add(ghostId);
            m_ItemSnapshotDataNewGhosts.Add(GhostReceiveSystem <DOTSGhostDeserializerCollection> .InvokeSpawn <ItemSnapshotData>(snapshot, ref reader, compressionModel));
            break;

        case 5:
            m_NetSessionSnapshotDataNewGhostIds.Add(ghostId);
            m_NetSessionSnapshotDataNewGhosts.Add(GhostReceiveSystem <DOTSGhostDeserializerCollection> .InvokeSpawn <NetSessionSnapshotData>(snapshot, ref reader, compressionModel));
            break;

        default:
            throw new ArgumentException("Invalid serializer type");
        }
    }
Ejemplo n.º 8
0
    public bool Deserialize(int serializer, Entity entity, uint snapshot, uint baseline, uint baseline2, uint baseline3,
                            DataStreamReader reader,
                            ref DataStreamReader.Context ctx, NetworkCompressionModel compressionModel)
    {
        switch (serializer)
        {
        case 0:
            return(GhostReceiveSystem <AsteroidsGhostDeserializerCollection> .InvokeDeserialize(m_ShipSnapshotDataFromEntity, entity, snapshot, baseline, baseline2,
                                                                                                baseline3, reader, ref ctx, compressionModel));

        case 1:
            return(GhostReceiveSystem <AsteroidsGhostDeserializerCollection> .InvokeDeserialize(m_AsteroidSnapshotDataFromEntity, entity, snapshot, baseline, baseline2,
                                                                                                baseline3, reader, ref ctx, compressionModel));

        case 2:
            return(GhostReceiveSystem <AsteroidsGhostDeserializerCollection> .InvokeDeserialize(m_BulletSnapshotDataFromEntity, entity, snapshot, baseline, baseline2,
                                                                                                baseline3, reader, ref ctx, compressionModel));

        default:
            throw new ArgumentException("Invalid serializer type");
        }
    }
    public void Spawn(int serializer, int ghostId, uint snapshot, ref DataStreamReader reader,
                      NetworkCompressionModel compressionModel)
    {
        switch (serializer)
        {
        case 0:
            m_CubeSnapshotDataNewGhostIds.Add(ghostId);
            m_CubeSnapshotDataNewGhosts.Add(GhostReceiveSystem <dotsnetcodesampleGhostDeserializerCollection> .InvokeSpawn <CubeSnapshotData>(snapshot, ref reader, compressionModel));
            break;

        case 1:
            m_ServerCubeSnapshotDataNewGhostIds.Add(ghostId);
            m_ServerCubeSnapshotDataNewGhosts.Add(GhostReceiveSystem <dotsnetcodesampleGhostDeserializerCollection> .InvokeSpawn <ServerCubeSnapshotData>(snapshot, ref reader, compressionModel));
            break;

        case 2:
            m_ProjectileSnapshotDataNewGhostIds.Add(ghostId);
            m_ProjectileSnapshotDataNewGhosts.Add(GhostReceiveSystem <dotsnetcodesampleGhostDeserializerCollection> .InvokeSpawn <ProjectileSnapshotData>(snapshot, ref reader, compressionModel));
            break;

        default:
            throw new ArgumentException("Invalid serializer type");
        }
    }
Ejemplo n.º 10
0
    public void Spawn(int serializer, int ghostId, uint snapshot, ref DataStreamReader reader,
                      NetworkCompressionModel compressionModel)
    {
        switch (serializer)
        {
        case 0:
            m_PaddleTheSideSnapshotDataNewGhostIds.Add(ghostId);
            m_PaddleTheSideSnapshotDataNewGhosts.Add(GhostReceiveSystem <MultiplayerPongGhostDeserializerCollection> .InvokeSpawn <PaddleTheSideSnapshotData>(snapshot, ref reader, compressionModel));
            break;

        case 1:
            m_PaddleOtherSideSnapshotDataNewGhostIds.Add(ghostId);
            m_PaddleOtherSideSnapshotDataNewGhosts.Add(GhostReceiveSystem <MultiplayerPongGhostDeserializerCollection> .InvokeSpawn <PaddleOtherSideSnapshotData>(snapshot, ref reader, compressionModel));
            break;

        case 2:
            m_SphereSnapshotDataNewGhostIds.Add(ghostId);
            m_SphereSnapshotDataNewGhosts.Add(GhostReceiveSystem <MultiplayerPongGhostDeserializerCollection> .InvokeSpawn <SphereSnapshotData>(snapshot, ref reader, compressionModel));
            break;

        default:
            throw new ArgumentException("Invalid serializer type");
        }
    }
    public void Spawn(int serializer, int ghostId, uint snapshot, DataStreamReader reader,
                      ref DataStreamReader.Context ctx, NetworkCompressionModel compressionModel)
    {
        switch (serializer)
        {
        case 0:
            m_ShipSnapshotDataNewGhostIds.Add(ghostId);
            m_ShipSnapshotDataNewGhosts.Add(GhostReceiveSystem <GhostDeserializerCollection> .InvokeSpawn <ShipSnapshotData>(snapshot, reader, ref ctx, compressionModel));
            break;

        case 1:
            m_AsteroidSnapshotDataNewGhostIds.Add(ghostId);
            m_AsteroidSnapshotDataNewGhosts.Add(GhostReceiveSystem <GhostDeserializerCollection> .InvokeSpawn <AsteroidSnapshotData>(snapshot, reader, ref ctx, compressionModel));
            break;

        case 2:
            m_BulletSnapshotDataNewGhostIds.Add(ghostId);
            m_BulletSnapshotDataNewGhosts.Add(GhostReceiveSystem <GhostDeserializerCollection> .InvokeSpawn <BulletSnapshotData>(snapshot, reader, ref ctx, compressionModel));
            break;

        default:
            throw new ArgumentException("Invalid serializer type");
        }
    }
Ejemplo n.º 12
0
    public void Spawn(int serializer, int ghostId, uint snapshot, DataStreamReader reader,
                      ref DataStreamReader.Context ctx, NetworkCompressionModel compressionModel)
    {
        switch ((GhostSerializerCollection.SerializerType)serializer)
        {
        case GhostSerializerCollection.SerializerType.Ship:
            shipNewGhostIds.Add(ghostId);
            shipNewGhosts.Add(GhostReceiveSystem.InvokeSpawn <ShipSnapshotData>(snapshot, reader, ref ctx, compressionModel));
            break;

        case GhostSerializerCollection.SerializerType.Asteroid:
            asteroidNewGhostIds.Add(ghostId);
            asteroidNewGhosts.Add(GhostReceiveSystem.InvokeSpawn <AsteroidSnapshotData>(snapshot, reader, ref ctx, compressionModel));
            break;

        case GhostSerializerCollection.SerializerType.Bullet:
            bulletNewGhostIds.Add(ghostId);
            bulletNewGhosts.Add(GhostReceiveSystem.InvokeSpawn <BulletSnapshotData>(snapshot, reader, ref ctx, compressionModel));
            break;

        default:
            throw new ArgumentException("Invalid serializer type");
        }
    }
Ejemplo n.º 13
0
 protected override void OnCreateManager()
 {
     m_recvSystem = World.GetOrCreateManager <GhostReceiveSystem>();
 }