public static bool ConnectUsingSettings(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);
}
SwitchToProtocol(PhotonServerSettings.Protocol);
networkingPeer.SetApp(PhotonServerSettings.AppID, gameVersion);
if (PhotonServerSettings.HostType == ServerSettings.HostingOption.OfflineMode)
{
offlineMode = true;
return(true);
}
if (offlineMode)
{
Debug.LogWarning("ConnectUsingSettings() disabled the offline mode. No longer offline.");
}
offlineMode = false;
isMessageQueueRunning = true;
networkingPeer.IsInitialConnect = true;
if (PhotonServerSettings.HostType == ServerSettings.HostingOption.SelfHosted)
{
networkingPeer.IsUsingNameServer = false;
networkingPeer.MasterServerAddress = PhotonServerSettings.ServerAddress + ":" + PhotonServerSettings.ServerPort;
return(networkingPeer.Connect(networkingPeer.MasterServerAddress, ServerConnection.MasterServer));
}
if (PhotonServerSettings.HostType == ServerSettings.HostingOption.BestRegion)
{
return(ConnectToBestCloudServer(gameVersion));
}
return(networkingPeer.ConnectToRegionMaster(PhotonServerSettings.PreferredRegion));
}