public bool ConnectToNameServer()
{
if (PhotonHandler.AppQuits)
{
Debug.LogWarning("Ignoring Connect() because app gets closed. If this is an error, check PhotonHandler.AppQuits.");
return false;
}
IsUsingNameServer = true;
this.CloudRegion = CloudRegionCode.none;
if (this.State == global::PeerState.ConnectedToNameServer)
{
return true;
}
string address = this.NameServerAddress;
if (!base.Connect(address, "ns"))
{
return false;
}
this.State = global::PeerState.ConnectingToNameServer;
return true;
}
public static bool ConnectToBestCloudServer(string gameVersion) { if (PhotonServerSettings == null) { Debug.LogError("Can't connect: Loading settings failed. ServerSettings asset must be in any 'Resources' folder as: PhotonServerSettings"); return(false); } if (PhotonServerSettings.HostType == ServerSettings.HostingOption.OfflineMode) { return(ConnectUsingSettings(gameVersion)); } networkingPeer.IsInitialConnect = true; networkingPeer.SetApp(PhotonServerSettings.AppID, gameVersion); var bestRegionCodeInPreferences = PhotonHandler.BestRegionCodeInPreferences; if (bestRegionCodeInPreferences != CloudRegionCode.none) { Debug.Log("Best region found in PlayerPrefs. Connecting to: " + bestRegionCodeInPreferences); return(networkingPeer.ConnectToRegionMaster(bestRegionCodeInPreferences)); } return(networkingPeer.ConnectToNameServer()); }