예제 #1
0
        internal void ConnectionAccepted(NetworkMessage message)
        {
            if (client.ClientStatus.Connected || !ConnectionEstablisherHelper.Connecting)
            {
                return;
            }

            ConnectionEstablisherHelper.ConnectEnd();

            if (message.Data.Any(d => d.Object == LiNGSMarkers.Ok) && message.Data.Any(d => d.Object == LiNGSMarkers.SessionUserId))
            {
                MessageData md = message.Data.FirstOrDefault(d => d.Object == LiNGSMarkers.UsingSavedState);
                bool        usingSavedState = (md != null && md.Value == true.ToString());

                //Connection to server was successfull
                Server = new InternalNetworkClient()
                {
                    EndPoint = message.From
                };
                client.ClientStatus.SessionUserId = message.Data.First(d => d.Object == LiNGSMarkers.SessionUserId).Value;
                client.ClientStatus.Connected     = true;
                client.ClientStatus.WasConnected  = true;
                client.NetworkManager.SendMessage(new NetworkMessage(LiNGS.Common.Network.NetworkMessage.MessageType.Ack, new MessageData()
                {
                    Object = LiNGSMarkers.Id, Value = message.MessageId.ToString()
                }));
                client.NetworkedClientInstance.ConnectionAccepted(message, usingSavedState);
            }
        }
예제 #2
0
 internal void UnableToConnect(String reason = null)
 {
     ConnectionEstablisherHelper.ConnectEnd();
     client.NetworkedClientInstance.UnableToConnect(reason);
 }
예제 #3
0
 internal void ConnectionRefused(NetworkMessage message)
 {
     ConnectionEstablisherHelper.ConnectEnd();
     client.NetworkedClientInstance.ConnectionRefused(message);
 }