Пример #1
0
 public void Assign(IKernel kernel)
 {
     _kernel    = kernel;
     _hierarchy = kernel.Hierarchy;
     _networkMessageSerialization = kernel.Get <INetworkMessageSerialization>();
     _networkEngine = kernel.Get <INetworkEngine>();
     _consoleHandle = kernel.Get <IConsoleHandle>(kernel.Hierarchy.Lookup(this));
     _pendingEntityPropertyMessages = new Dictionary <int, List <Tuple <int, Event> > >();
 }
Пример #2
0
        public DefaultNetworkEngine(
            INetworkFactory networkFactory,
            IProfiler profiler,
            INetworkMessageSerialization networkMessageSerialization)
        {
            _networkFactory = networkFactory;
            _profiler       = profiler;
            _networkMessageSerialization = networkMessageSerialization;
            _dispatchers             = new Dictionary <IWorld, MxDispatcher>();
            _serverDispatchers       = new Dictionary <IServerWorld, MxDispatcher>();
            _dispatcherChanged       = new Dictionary <IWorld, bool>();
            _serverDispatcherChanged = new Dictionary <IServerWorld, bool>();
            _currentDispatchers      = new MxDispatcher[1];
            _objectReferences        = new Dictionary <int, WeakReference>();
            _recentNetworkFrames     = new List <INetworkFrame>();
            _currentNetworkFrame     = new DefaultNetworkFrame(_networkFrameId++);

            _clientRenderDelayTicks = -200;
        }
        public NetworkSynchronisationComponent(
            IConsoleHandle consoleHandle,
            INetworkEngine networkEngine,
            IUniqueIdentifierAllocator uniqueIdentifierAllocator,
            INetworkMessageSerialization networkMessageSerialization,
            IDebugRenderer debugRenderer)
        {
            _consoleHandle               = consoleHandle;
            _networkEngine               = networkEngine;
            _uniqueIdentifierAllocator   = uniqueIdentifierAllocator;
            _networkMessageSerialization = networkMessageSerialization;
            _debugRenderer               = debugRenderer;

            _clientsEntityIsKnownOn     = new HashSet <MxClientGroup>();
            _synchronisedData           = new Dictionary <string, SynchronisedData>();
            _synchronisedDataToTransmit = new List <SynchronisedData>();

            _enabled = true;
        }