/// <summary> /// On enable view /// </summary> private void OnEnable() { _posrtField.text = _serverPort.ToString(); // on end edit save port _posrtField.onEndEdit.AddListener(delegate { _serverPort = int.TryParse(_posrtField.text, out _serverPort) ? _serverPort : 45555; _posrtField.text = _serverPort.ToString(); }); // add buttons on click events _startButton.OnClickAsObservable().Subscribe(p => { StartServerSignal.Dispatch(_serverPort); }); _restartButton.OnClickAsObservable().Subscribe(p => { GameServerService.Restart(_serverPort); }); _stopButton.OnClickAsObservable().Subscribe(p => { GameServerService.Shutdown(); }); }