本文整理匯總了C#中NetworkClient.ConnectToGameServer方法的典型用法代碼示例。如果您正苦於以下問題:C# NetworkClient.ConnectToGameServer方法的具體用法?C# NetworkClient.ConnectToGameServer怎麽用?C# NetworkClient.ConnectToGameServer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類NetworkClient
的用法示例。
在下文中一共展示了NetworkClient.ConnectToGameServer方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
}