/// <summary> /// Called by the login server when the results to our login attempt are available /// </summary> protected virtual void OnLoginServer_AuthenticationResolved(LoginServerOutboundConnection loginConnection, PacketLoginResult lr) { //System.Diagnostics.Debug.WriteLine("Game Servers Available: " + m_LoginCon.GameServers.Count); Log.LogMsg("Game Servers Available: " + m_LoginCon.GameServers.Count); SystemMessages.AddMessage(string.Format("Login server authenticated: {0}. {1}", lr.ReplyCode == ReplyType.OK, lr.ReplyMessage), SystemMessageType.Networking); if (lr.ReplyCode == ReplyType.OK) { ReadProfileFromLoginPacket(lr); } FireLoginServerResult(loginConnection, lr); }
private void RemoveHandler_LoginServerResult(LoginServerOutboundConnection.LoginResultDelegate value) { LoginServerResultInvoker = (LoginServerOutboundConnection.LoginResultDelegate)Delegate.Remove(LoginServerResultInvoker, value); }
private void AddHandler_LoginServerResult(LoginServerOutboundConnection.LoginResultDelegate value) { LoginServerResultInvoker = (LoginServerOutboundConnection.LoginResultDelegate)Delegate.Combine(LoginServerResultInvoker, value); }
private void FireLoginServerResult(LoginServerOutboundConnection con, PacketLoginResult result) { if (LoginServerResultInvoker != null) { LoginServerResultInvoker(con, result); } }
/// <summary> /// Disconnects and cleans up any current Login server connection and initizialzed a new one (m_LoginCon) /// </summary> protected virtual void SetupLoginServerConnection(bool isBlocking) { if (m_LoginCon != null) { if (m_LoginCon != null) { if (m_LoginCon.IsAlive || m_LoginCon.ConnectionInProgress) { m_LoginCon.KillConnection("Client requested disconnection."); } } //if (m_GameServer != null && (m_GameServer.IsAlive || m_GameServer.ConnectionInProgress)) //{ // m_GameServer.KillConnection("Client requested disconnection."); //} //if (m_CentralServer != null && (m_CentralServer.IsAlive || m_CentralServer.ConnectionInProgress)) //{ // m_CentralServer.KillConnection("Client requested disconnection."); //} m_LoginCon.SocketKilled -= new SocketKilledDelegate(OnLoginServer_Disconnected); m_LoginCon.LoginResolved -= new LoginServerOutboundConnection.LoginResultDelegate(OnLoginServer_AuthenticationResolved); m_LoginCon.ServerTransferDirective -= new ServerTransferDirectiveDelegate(OnLoginServer_ServerTransferResult); m_LoginCon.SocketSecured -= new EventHandler(OnLoginServer_LineSecuredResult); #if !UNITY m_LoginCon.BeforeLoginRequest -= new ClientConnection.BeforeLoginRequestDelegate(OnLoginServer_BeforeLoginRequest); #else m_LoginCon.BeforeLoginRequest -= new UnityClientConnection.BeforeLoginRequestDelegate(OnLoginServer_BeforeLoginRequest); #endif } m_LoginCon = OnLoginServerConnectionCreate(isBlocking); m_LoginCon.ProcessIncomingPacketsImmediately = ProcessNetworkingImmediately; m_LoginCon.SocketKilled += new SocketKilledDelegate(OnLoginServer_Disconnected); m_LoginCon.LoginResolved += new LoginServerOutboundConnection.LoginResultDelegate(OnLoginServer_AuthenticationResolved); m_LoginCon.ServerTransferDirective += new ServerTransferDirectiveDelegate(OnLoginServer_ServerTransferResult); m_LoginCon.SocketSecured += new EventHandler(OnLoginServer_LineSecuredResult); #if !UNITY m_LoginCon.BeforeLoginRequest += new ClientConnection.BeforeLoginRequestDelegate(OnLoginServer_BeforeLoginRequest); #else m_LoginCon.BeforeLoginRequest += new UnityClientConnection.BeforeLoginRequestDelegate(OnLoginServer_BeforeLoginRequest); #endif }