protected virtual void OnGuiSetupCloudAppId() { GUILayout.Label(CurrentLang.AppIdLabel); GUILayout.BeginHorizontal(); this.cloudAppId = EditorGUILayout.TextField(this.cloudAppId); open = GUILayout.Toggle(open, HelpIcon, GUIStyle.none, GUILayout.ExpandWidth(false)); GUILayout.EndHorizontal(); if (open) { GUILayout.Label(CurrentLang.AppIdInfoLabel); } EditorGUILayout.Separator(); GUILayout.Label(CurrentLang.CloudRegionLabel); int selectedRegion = ServerSettings.FindRegionForServerAddress(this.photonAddress); GUILayout.BeginHorizontal(); int toolbarValue = GUILayout.Toolbar(selectedRegion, cloudServerRegionNames); // the enum CloudServerRegion is converted into a string[] in init (toolbar can't use enum) helpRegion = GUILayout.Toggle(helpRegion, HelpIcon, GUIStyle.none, GUILayout.ExpandWidth(false)); GUILayout.EndHorizontal(); if (helpRegion) { GUILayout.Label(CurrentLang.RegionalServersInfo); } if (selectedRegion != toolbarValue) { //Debug.Log("Replacing region: " + selectedRegion + " with: " + toolbarValue); this.photonAddress = ServerSettings.FindServerAddressForRegion(toolbarValue); } EditorGUILayout.Separator(); GUILayout.BeginHorizontal(); if (GUILayout.Button(CurrentLang.CancelButton)) { GUIUtility.keyboardControl = 0; this.ReApplySettingsToWindow(); } if (GUILayout.Button(CurrentLang.SaveButton)) { GUIUtility.keyboardControl = 0; this.cloudAppId = this.cloudAppId.Trim(); PhotonEditor.Current.UseCloud(this.cloudAppId, selectedRegion); PhotonEditor.Save(); EditorUtility.DisplayDialog(CurrentLang.SettingsSavedTitle, CurrentLang.SettingsSavedMessage, CurrentLang.OkButton); } GUILayout.EndHorizontal(); GUILayout.Space(20); GUILayout.Label(CurrentLang.SetupOwnServerLabel); if (GUILayout.Button(CurrentLang.SelfHostSettingsButton)) { this.photonAddress = ServerSettings.DefaultServerAddress; this.photonPort = ServerSettings.DefaultMasterPort; this.photonSetupState = PhotonSetupStates.SetupSelfHosted; } EditorGUILayout.Separator(); GUILayout.Label(CurrentLang.OwnHostCloudCompareLabel); if (GUILayout.Button(CurrentLang.ComparisonPageButton)) { Application.OpenURL(UrlCompare); } }
protected virtual void OnGuiSetupCloudAppId() { GUILayout.Label("Your AppId"); GUILayout.BeginHorizontal(); this.cloudAppId = EditorGUILayout.TextField(this.cloudAppId); open = GUILayout.Toggle(open, HelpIcon, GUIStyle.none, GUILayout.ExpandWidth(false)); GUILayout.EndHorizontal(); if (open) { GUILayout.Label("The AppId a Guid that identifies your game in the Photon Cloud. Find it on your dashboard page."); } EditorGUILayout.Separator(); GUILayout.Label("Cloud Region"); int selectedRegion = ServerSettings.FindRegionForServerAddress(this.photonAddress); GUILayout.BeginHorizontal(); int toolbarValue = GUILayout.Toolbar(selectedRegion, ServerSettings.CloudServerRegionNames); helpRegion = GUILayout.Toggle(helpRegion, HelpIcon, GUIStyle.none, GUILayout.ExpandWidth(false)); GUILayout.EndHorizontal(); if (helpRegion) { GUILayout.Label("Photon Cloud has regional servers. Picking one near your customers improves ping times. You could use more than one but this setup does not support it."); } if (selectedRegion != toolbarValue) { //Debug.Log("Replacing region: " + selectedRegion + " with: " + toolbarValue); this.photonAddress = ServerSettings.FindServerAddressForRegion(toolbarValue); } EditorGUILayout.Separator(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Cancel")) { GUIUtility.keyboardControl = 0; this.ReApplySettingsToWindow(); } if (GUILayout.Button("Save")) { GUIUtility.keyboardControl = 0; this.cloudAppId = this.cloudAppId.Trim(); PhotonEditor.Current.UseCloud(this.cloudAppId, selectedRegion); PhotonEditor.Save(); EditorUtility.DisplayDialog("Success", "Saved your settings.", "ok"); } GUILayout.EndHorizontal(); GUILayout.Space(20); GUILayout.Label("Running my app in the cloud was fun but...\nLet me setup my own Photon server."); if (GUILayout.Button("Open self-hosting settings")) { this.photonAddress = ServerSettings.DefaultServerAddress; this.photonPort = ServerSettings.DefaultMasterPort; this.photonSetupState = PhotonSetupStates.SetupSelfHosted; } EditorGUILayout.Separator(); GUILayout.Label("I am not quite sure how 'my own host' compares to 'cloud'."); if (GUILayout.Button("See comparison page")) { Application.OpenURL(UrlCompare); } }