private static void ConnectToServer() { if (!Client.Instance.isConnected) { Log("Connecting to Server..."); _connectionInfo.UpdateText("Connecting to server..."); if (_ipInput.GetText() != "") { MultiplayerClient.settings.host = _ipInput.GetText(); } if (_portInput.GetText() != "") { MultiplayerClient.settings.port = int.Parse(_portInput.GetText()); } if (_usernameInput.GetText() != "") { MultiplayerClient.settings.username = _usernameInput.GetText(); } PlayerManager.activeScene = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name; _connectRoutine = Client.Instance.StartCoroutine(Connect()); Log("Connected to Server!"); _connectionInfo.UpdateText("Connected to server."); } else { Log("Already connected to the server!"); } }
private static void SendMessage(string buttonName) { if (Client.Instance.isConnected) { Log(_chatInput.GetText()); ClientSend.Chat(Client.Instance.myId, _chatInput.GetText()); } MultiplayerClient.Instance.herochat.text = _chatInput.GetText(); }