Esempio n. 1
0
        protected override void OnCreate()
        {
            base.OnCreate();

            m_IncomingDataQuery = GetEntityQuery(new EntityQueryDesc
            {
                All  = new ComponentType[] { typeof(CommandTargetComponent), typeof(NetworkStreamInGame) },
                None = new ComponentType[] { typeof(NetworkStreamDisconnected), typeof(NetworkStreamRequestDisconnect) }
            });
            m_CommandCollectionSystem     = World.GetOrCreateSystem <CommandCollectionSystem>();
            m_ReceiveSystem               = World.GetOrCreateSystem <NetworkStreamReceiveSystem>();
            m_ClientSimulationSystemGroup = World.GetOrCreateSystem <ClientSimulationSystemGroup>();

            m_NetworkCompressionModel = new NetworkCompressionModel(Allocator.Persistent);
        }
        protected override void OnCreate()
        {
#if ENABLE_UNITY_COLLECTIONS_CHECKS
            UnityEngine.Debug.Assert(UnsafeUtility.SizeOf <OutgoingRpcDataStreamBufferComponent>() == 1);
            UnityEngine.Debug.Assert(UnsafeUtility.SizeOf <IncomingRpcDataStreamBufferComponent>() == 1);
#endif
            m_Barrier        = World.GetOrCreateSystem <BeginSimulationEntityCommandBufferSystem>();
            m_RpcBufferGroup = GetEntityQuery(
                ComponentType.ReadWrite <IncomingRpcDataStreamBufferComponent>(),
                ComponentType.ReadWrite <OutgoingRpcDataStreamBufferComponent>(),
                ComponentType.ReadWrite <NetworkStreamConnection>(),
                ComponentType.Exclude <NetworkStreamDisconnected>());
            RequireForUpdate(m_RpcBufferGroup);

            RegisterRpc(ComponentType.ReadWrite <RpcSetNetworkId>(), default(RpcSetNetworkId).CompileExecute());
            m_ReceiveSystem        = World.GetOrCreateSystem <NetworkStreamReceiveSystem>();
            m_GhostSimulationGroup = World.GetExistingSystem <GhostSimulationSystemGroup>();
            m_RpcErrors            = new NativeQueue <RpcReceiveError>(Allocator.Persistent);
        }
Esempio n. 3
0
        protected override void OnCreate()
        {
#if UNITY_EDITOR || DEVELOPMENT_BUILD
            m_GhostStatsCollectionSystem = World.GetOrCreateSystem <GhostStatsCollectionSystem>();
            m_NetStats = new NativeArray <uint>(2, Allocator.Persistent);
#endif
            m_ReceiveSystem = World.GetOrCreateSystem <NetworkStreamReceiveSystem>();
            m_ClientSimulationSystemGroup = World.GetOrCreateSystem <ClientSimulationSystemGroup>();
            m_CompressionModel            = new NetworkCompressionModel(Allocator.Persistent);
            RequireForUpdate(EntityManager.CreateEntityQuery(
                                 ComponentType.ReadOnly <NetworkStreamInGame>(),
                                 ComponentType.ReadOnly <NetworkStreamConnection>(),
                                 ComponentType.ReadOnly <NetworkSnapshotAckComponent>(),
                                 ComponentType.ReadOnly <CommandTargetComponent>(),
                                 ComponentType.Exclude <NetworkStreamDisconnected>()));
            if (typeof(TCommandData) != typeof(NullCommandData))
            {
                RequireForUpdate(EntityManager.CreateEntityQuery(ComponentType.ReadOnly <TCommandData>()));
            }
        }
Esempio n. 4
0
        protected override void OnCreate()
        {
            base.OnCreate();

            m_SerializeLookup = new Dictionary <Entity, ReferencableSerializeClientData>(32);
            m_ConnectionGroup = GetEntityQuery(new EntityQueryDesc
            {
                All = new ComponentType[] { typeof(NetworkStreamConnection), typeof(NetworkSnapshotAckComponent), /*typeof(NetworkStreamInGame)*/ }
            });
            m_ConnectionWithoutSnapshotBufferGroup = GetEntityQuery(new EntityQueryDesc
            {
                All  = new ComponentType[] { typeof(NetworkStreamConnection), /* typeof(NetworkStreamInGame)*/ },
                None = new ComponentType[] { typeof(ClientSnapshotBuffer) }
            });
            m_ServerSimulationSystemGroup = World.GetOrCreateSystem <ServerSimulationSystemGroup>();
            m_ReceiveSystem        = World.GetOrCreateSystem <NetworkStreamReceiveSystem>();
            m_CreateSnapshotSystem = World.GetOrCreateSystem <CreateSnapshotSystem>();

            m_DataStream = new DataStreamWriter(32_768, Allocator.Persistent);
        }
        protected override void OnCreate()
        {
            m_CanRegister        = true;
            m_RpcData            = new NativeList <RpcData>(16, Allocator.Persistent);
            m_RpcTypeHashToIndex = new NativeHashMap <ulong, int>(16, Allocator.Persistent);
#if ENABLE_UNITY_COLLECTIONS_CHECKS
            Debug.Assert(UnsafeUtility.SizeOf <OutgoingRpcDataStreamBufferComponent>() == 1);
            Debug.Assert(UnsafeUtility.SizeOf <IncomingRpcDataStreamBufferComponent>() == 1);
#endif
            m_Barrier        = World.GetOrCreateSystem <BeginSimulationEntityCommandBufferSystem>();
            m_RpcBufferGroup = GetEntityQuery(
                ComponentType.ReadWrite <IncomingRpcDataStreamBufferComponent>(),
                ComponentType.ReadWrite <OutgoingRpcDataStreamBufferComponent>(),
                ComponentType.ReadWrite <NetworkStreamConnection>(),
                ComponentType.Exclude <NetworkStreamDisconnected>());
            RequireForUpdate(m_RpcBufferGroup);

            RegisterRpc(ComponentType.ReadWrite <RpcSetNetworkId>(), default(RpcSetNetworkId).CompileExecute());
            m_ReceiveSystem = World.GetOrCreateSystem <NetworkStreamReceiveSystem>();
        }