private void AddNewClient(string address) { ServerAddresses.Add(address); LANDiscoveryClient discoveryTCP = new LANDiscoveryClient(); DiscoveryTCPs.Add(discoveryTCP); discoveryTCP.Connect(address, PortNum); }
public void UpdateConnectionState(IMultiplayerSessionConnectionState sessionConnectionState) { Validate.NotNull(sessionConnectionState); string fromStage = CurrentState == null ? "null" : CurrentState.CurrentStage.ToString(); string username = AuthenticationContext == null ? "" : AuthenticationContext.Username; Log.Debug($"Updating session stage from '{fromStage}' to '{sessionConnectionState.CurrentStage}' for '{username}'"); CurrentState = sessionConnectionState; // Last connection state changed will not have any handlers ConnectionStateChanged?.Invoke(CurrentState); if (sessionConnectionState.CurrentStage == MultiplayerSessionConnectionStage.SESSION_RESERVED) { Log.PlayerName = username; LANDiscoveryClient.EndSearching(); } }