public void Initialize()
        {
            // Infinitely reconnect.
            _networkManager.Disconnected.Subscribe(Observer.Create <Unit>(unit => {
                TryReconnect();
            }));

            _networkManager.Connect(allowOfflineMode: true).Subscribe(Observer.Create <NetworkConnectionResult>(result => {
                if (result.isServer)
                {
                    _sceneLoader.LoadScene(kEnocunterSelectionSCene, LoadSceneMode.Additive);
                }
                else
                {
                    _sceneLoader.LoadScene(kPlayerSelectionScene, LoadSceneMode.Additive);
                }
            },
                                                                                                                error => {
                _logger.LogError(LoggedFeature.Network, "Connection error: {0}. Will continue offline.", error);
                _sceneLoader.LoadScene(kEnocunterSelectionSCene, LoadSceneMode.Additive);
            }));
        }
Пример #2
0
 public void Connect(string address, int port)
 {
     Manager.Connect(address, port);
 }