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); } }
public virtual void FindNetworkSceneTemplate(string pSceneName) { if (!NodeManager.IsInitialized || !NodeManager.Instance.IsServer || _currentLookup != null || !_findSceneDelay.HasPassed) { return; } // Lookup if the scene resides on our Node if (_nodeTemplate == null) { NetworkSceneTemplate foundTemplate = NodeManager.Instance.FindNetworkSceneTemplate(pSceneName, false, true, true, false); if (foundTemplate != null) { _nodeTemplate = new NodeNetworkSceneTemplate(NodeManager.Instance.CurrentNode.NodeId, foundTemplate); return; } } // Lookup the NodeMap if there is a static NetworkScene we can find on another Node if (_nodeTemplate == null && NodeManager.Instance.NodeMapSO != null) { _nodeTemplate = NodeManager.Instance.NodeMapSO.nodeMap.GetNodeTemplateBySceneName(pSceneName); if (_nodeTemplate != null) { return; } } // Lookup if the scene is a dynamic NetworkScene on another Node if (_nodeTemplate == null && _enableLookup && _currentLookup == null) { _currentLookup = NodeManager.Instance.LookUpNetworkSceneTemplate(pSceneName); if (_currentLookup.State == ServiceCallbackStateEnum.RESPONSE_SUCCESS) { _nodeTemplate = _currentLookup.ResponseDataOfT; _currentLookup = null; } else if (_currentLookup.State == ServiceCallbackStateEnum.AWAITING_RESPONSE) { _currentLookup.OnResponseOfT += CurrentLookup_OnResponseOfT; _currentLookup.OnTimeout += CurrentLookup_OnTimeout; } else { _pendingObjects.Clear(); _currentLookup = null; } } _findSceneDelay.Start(_findSceneInterval); }