public bool Connect(string serverAddress, ServerConnection type)
{
if (PhotonHandler.AppQuits)
{
Debug.LogWarning("Ignoring Connect() because app gets closed. If this is an error, check PhotonHandler.AppQuits.");
return false;
}
if (PhotonNetwork.connectionStateDetailed == global::PeerState.Disconnecting)
{
Debug.LogError("Connect() failed. Can't connect while disconnecting (still). Current state: " + PhotonNetwork.connectionStateDetailed);
return false;
}
// connect might fail, if the DNS name can't be resolved or if no network connection is available
bool connecting = base.Connect(serverAddress, "");
if (connecting)
{
switch (type)
{
case ServerConnection.NameServer:
State = global::PeerState.ConnectingToNameServer;
break;
case ServerConnection.MasterServer:
State = global::PeerState.ConnectingToMasterserver;
break;
case ServerConnection.GameServer:
State = global::PeerState.ConnectingToGameserver;
break;
}
}
return connecting;
}