コード例 #1
0
        private void AddNewClient(string address)
        {
            ServerAddresses.Add(address);
            LANDiscoveryClient discoveryTCP = new LANDiscoveryClient();

            DiscoveryTCPs.Add(discoveryTCP);
            discoveryTCP.Connect(address, PortNum);
        }
コード例 #2
0
        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();
            }
        }