Exemple #1
0
        private void UpdateFrames()
        {
            if (_currentNetworkFrame != null)
            {
                _currentNetworkFrame.Calculate();
                _recentNetworkFrames.Add(_currentNetworkFrame);
            }

            if (_recentNetworkFrames.Count > 120)
            {
                _recentNetworkFrames.RemoveAt(0);
            }

            _currentNetworkFrame = new DefaultNetworkFrame(_networkFrameId++);
        }
Exemple #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;
        }