本文整理匯總了C#中NetworkClient.Disconnect方法的典型用法代碼示例。如果您正苦於以下問題:C# NetworkClient.Disconnect方法的具體用法?C# NetworkClient.Disconnect怎麽用?C# NetworkClient.Disconnect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類NetworkClient
的用法示例。
在下文中一共展示了NetworkClient.Disconnect方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: DoStep
public bool DoStep(NetworkClient networkClient, GameClient client)
{
//Get game servers list
List<object> gameServersList = client.AdditionalData[ObjectPropertyName.GAME_SERVER];
//If servers list is available
if (gameServersList != null)
{
//Connect to the game server
while (gameServersList.Count > 0)
{
//Pop a first game server in the list
string server = (string) gameServersList[0];
gameServersList.Remove(server);
//Out log message
networkClient.OutLogMessage(string.Format("Connecting to the game server: {0}...", server));
//Try to connect
bool isConnected = networkClient.ConnectToGameServer(server);
if (isConnected)
{
if (networkClient.DoAuthorization())
{
return true;
}
}
}
}
//Connection failed
networkClient.Disconnect();
return false;
}
示例2: OnLoginFailResponse
/// <summary>
/// Occurs when the client was not authenticated by the loginserver.
/// Called by UILoginDialog.cs.
/// </summary>
/// <param name="Client">The client that received the packet.</param>
/// <param name="Packet">The packet that was received.</param>
/// <param name="Screen">A UIScreen instance on which to display a messagebox to inform the player of the
/// failure state.</param>
public static void OnLoginFailResponse(ref NetworkClient Client, ProcessedPacket Packet)
{
EventObject Event;
switch (Packet.ReadByte())
{
case 0x01:
Event = new EventObject(EventCodes.BAD_USERNAME);
EventSink.RegisterEvent(Event);
break;
case 0x02:
Event = new EventObject(EventCodes.BAD_PASSWORD);
EventSink.RegisterEvent(Event);
break;
}
Client.Disconnect();
}
示例3: Reconnect
/// <summary>
/// Reconnects to a CityServer.
/// </summary>
public void Reconnect(ref NetworkClient Client, CityInfo SelectedCity, LoginArgsContainer LoginArgs)
{
Client.Disconnect();
Client.Connect(LoginArgs);
}
示例4: OnInvalidVersionResponse
public static void OnInvalidVersionResponse(ref NetworkClient Client, ProcessedPacket Packet)
{
Client.Disconnect();
}
示例5: Reconnect
/// <summary>
/// Reconnects to a CityServer.
/// </summary>
public void Reconnect(ref NetworkClient Client, CityInfo SelectedCity, LoginArgsContainer LoginArgs)
{
Client.Disconnect();
if (LoginArgs.Enc == null)
{
Debug.WriteLine("LoginArgs.Enc was null!");
LoginArgs.Enc = new GonzoNet.Encryption.AESEncryptor(Convert.ToBase64String(PlayerAccount.Hash));
}
else if (LoginArgs.Username == null || LoginArgs.Password == null)
{
Debug.WriteLine("LoginArgs.Username or LoginArgs.Password was null!");
LoginArgs.Username = PlayerAccount.Username;
LoginArgs.Password = Convert.ToBase64String(PlayerAccount.Hash);
}
Client.Connect(LoginArgs);
}