private void DrawSetupPhoton() { DrawInputWithLabel("Photon Cloud Setup", () => { GUILayout.BeginVertical(); GUILayout.Space(5); GUILayout.Label(BoltWizardText.PHOTON, textLabel); GUILayout.EndVertical(); GUILayout.BeginHorizontal(); GUILayout.Label(BoltWizardText.PHOTON_DASH, textLabel); if (GUILayout.Button("Visit Dashboard", minimalButton)) { OpenURL("https://dashboard.photonengine.com/")(); } GUILayout.EndHorizontal(); }, false); GUILayout.Space(15); BoltRuntimeSettings settings = BoltRuntimeSettings.instance; DrawInputWithLabel("Photon Bolt App ID", () => { GUILayout.BeginVertical(); settings.photonAppId = EditorGUILayout.TextField(settings.photonAppId, centerInputText); GUILayout.EndVertical(); }, false, true); DrawInputWithLabel("Connection Mode", () => { settings.photonUseOnPremise = BoltEditorGUI.ToggleDropdown("Custom Hosted", "Photon Cloud", settings.photonUseOnPremise); }, true, true); if (settings.photonUseOnPremise) { DrawInputWithLabel("Master Server IP Address", () => { GUILayout.BeginVertical(); settings.photonOnPremiseIpAddress = EditorGUILayout.TextField(settings.photonOnPremiseIpAddress); GUILayout.EndVertical(); }, true, true); } else { DrawInputWithLabel("Region", () => { settings.photonCloudRegionIndex = EditorGUILayout.Popup(settings.photonCloudRegionIndex, BoltRuntimeSettings.photonCloudRegions); }, true, true); } DrawInputWithLabel("NAT Punchthrough Enabled", () => { settings.photonUsePunch = BoltEditorGUI.Toggle(settings.photonUsePunch); }, true, true); // Action if (beforeNextCallback == null) { beforeNextCallback = () => { if (!IsAppId(settings.photonAppId)) { ShowNotification(new GUIContent("Please specify a valid Bolt App ID.")); return(false); } return(true); }; } }
private void DrawSetupPhoton() { DrawInputWithLabel("Photon Cloud Setup", () => { GUILayout.BeginVertical(); GUILayout.Space(5); GUILayout.Label(BoltWizardText.PHOTON, textLabel); GUILayout.EndVertical(); GUILayout.BeginHorizontal(); GUILayout.Label(BoltWizardText.PHOTON_DASH, textLabel); if (GUILayout.Button("Visit Dashboard", minimalButton)) { OpenURL("https://dashboard.photonengine.com/")(); } GUILayout.EndHorizontal(); }, false); GUILayout.Space(15); BoltRuntimeSettings settings = BoltRuntimeSettings.instance; DrawInputWithLabel("Photon Bolt App ID or Email", () => { GUILayout.BeginVertical(); AppIdOrEmail = EditorGUILayout.TextField(AppIdOrEmail, centerInputText); GUILayout.EndVertical(); }, false, true, 300); DrawInputWithLabel("Connection Mode", () => { settings.photonUseOnPremise = BoltEditorGUI.ToggleDropdown("Custom Hosted", "Photon Cloud", settings.photonUseOnPremise); }, true, true); if (settings.photonUseOnPremise) { DrawInputWithLabel("Master Server IP Address", () => { GUILayout.BeginVertical(); settings.photonOnPremiseIpAddress = EditorGUILayout.TextField(settings.photonOnPremiseIpAddress); GUILayout.EndVertical(); }, true, true); } else { DrawInputWithLabel("Region", () => { settings.photonCloudRegionIndex = EditorGUILayout.Popup(settings.photonCloudRegionIndex, BoltRuntimeSettings.photonCloudRegions); }, true, true); } DrawInputWithLabel("NAT Punchthrough Enabled", () => { settings.photonUsePunch = BoltEditorGUI.Toggle(settings.photonUsePunch); }, true, true); // Action if (beforeNextCallback == null) { beforeNextCallback = () => { if (IsEmail(AppIdOrEmail)) { try { EditorUtility.DisplayProgressBar(BoltWizardText.CONNECTION_TITLE, BoltWizardText.CONNECTION_INFO, 0.5f); BoltLog.Info("Starting request"); string result = new AccountService().RegisterByEmail(AppIdOrEmail); if (!string.IsNullOrEmpty(result) && IsAppId(result)) { settings.photonAppId = result; AppIdOrEmail = result; BoltLog.Info("You new App ID: {0}", settings.photonAppId); return(true); } } catch (Exception ex) { EditorUtility.DisplayDialog("Error", ex.Message, "ok"); //ShowNotification(new GUIContent(ex.Message)); } finally { EditorUtility.ClearProgressBar(); BoltLog.Info("Finished request"); } } else if (IsAppId(AppIdOrEmail)) { settings.photonAppId = AppIdOrEmail; return(true); } else { ShowNotification(new GUIContent("Please specify a valid Bolt App ID or Email.")); } return(false); }; } }