public ConnectToRegionMaster ( CloudRegionCode region ) : bool | ||
region | CloudRegionCode | |
return | bool |
public bool ConnectToRegionMaster(CloudRegionCode region)
{
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 = region;
if (this.State == global::PeerState.ConnectedToNameServer)
{
AuthenticationValues auth = this.CustomAuthenticationValues ?? new AuthenticationValues() { UserId = this.PlayerName };
return this.OpAuthenticate(this.mAppId, this.mAppVersionPun, auth, region.ToString(), requestLobbyStatistics);
}
string address = this.NameServerAddress;
if (!base.Connect(address, "ns"))
{
return false;
}
this.State = global::PeerState.ConnectingToNameServer;
return true;
}
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)); }