コード例 #1
0
        protected virtual void CheckAutoReconnect()
        {
            if (!HasNetworker || _autoReconnectInterval <= 0f)
            {
                return;
            }

            if (_networker.IsBound)
            {
                if (!_autoReconnectDelay.HasStopped)
                {
                    _autoReconnectDelay.Stop();
                }

                return;
            }

            if (!_autoReconnectDelay.HasStopped)
            {
                if (!_autoReconnectDelay.HasPassed)
                {
                    return;
                }

                RaiseAutoReconnectAttempt();
                if (_networker.IsServer)
                {
                    StartAsServer();
                }
                else
                {
                    StartAsClient();
                }

                if (_networker.IsBound)
                {
                    _autoReconnectDelay.Stop();
                    RaiseAutoReconnect();
                }
                else
                {
                    _autoReconnectDelay.Start(_autoReconnectInterval);
                }
            }
            else
            {
                _autoReconnectDelay.Start(_autoReconnectInterval);
            }
        }
コード例 #2
0
 //Functions
 #region Unity
 protected virtual void Awake()
 {
     _autoReconnectDelay = new DelayFixedTime(GameTime.FixedTimeUpdater());
     _autoReconnectDelay.Stop();
     _settings              = new NetworkSceneManagerSetting();
     _pendingObjects        = new Dictionary <int, INetworkBehavior>();
     _pendingNetworkObjects = new Dictionary <int, NetworkObject>();
     _tmpMetadata           = new BMSByte();
     if (_networkBehaviorListSO != null)
     {
         _networkBehaviorListSO.behaviorList.Init();
     }
 }