Example #1
0
 public void Update()
 {
     if (_shouldSignup)
     {
         _shouldSignup = false;
         ApiSignup.SignUp(_emailAddress, _invoiceNumber, OnSuccess);
         Repaint();
     }
 }
Example #2
0
        private void DrawBugReporterArea()
        {
            EditorGUILayout.BeginHorizontal();

            EditorGUILayout.PropertyField(_apiKeyProperty);

            if (GUILayout.Button("Verify", GUILayout.ExpandWidth(false)))
            {
                EditorUtility.DisplayDialog("Verify API Key", ApiSignup.Verify(_apiKeyProperty.stringValue), "OK");
            }

            EditorGUILayout.EndHorizontal();

            GUI.enabled = !string.IsNullOrEmpty(_apiKeyProperty.stringValue);

            EditorGUILayout.PropertyField(_enableBugReporterProperty);

            GUI.enabled = true;

            if (GUILayout.Button("Need API Key?"))
            {
                ApiSignupWindow.Open();
            }
        }
Example #3
0
        private void DrawBugReportSignupForm()
        {
            var isWeb = false;

#if UNITY_WEBPLAYER
            EditorGUILayout.HelpBox("Signup form is not available when build target is Web Player.", MessageType.Error);
            isWeb = true;
#endif

            EditorGUI.BeginDisabledGroup(isWeb || !_enableTabChange);

            GUILayout.Label("Signup Form", SRDebugEditorUtil.Styles.HeaderLabel);
            GUILayout.Label(
                "SRDebugger requires a free API key to enable the bug reporter system. This form will acquire one for you.",
                SRDebugEditorUtil.Styles.ParagraphLabel);

            if (
                SRDebugEditorUtil.ClickableLabel(
                    "Already got an API key? <color={0}>Click here</color>.".Fmt(SRDebugEditorUtil.Styles.LinkColour),
                    SRDebugEditorUtil.Styles.RichTextLabel))
            {
                _showBugReportSignupForm = false;
                Repaint();
            }

            EditorGUILayout.Space();

            GUILayout.Label("Invoice Number", EditorStyles.boldLabel);

            GUILayout.Label(
                "Enter the invoice number from your Asset Store purchase invoice.",
                EditorStyles.miniLabel);

            _invoiceNumber = EditorGUILayout.TextField(_invoiceNumber);

            EditorGUILayout.Space();

            GUILayout.Label("Email Address", EditorStyles.boldLabel);

            GUILayout.Label(
                "Provide an email address where the bug reports should be sent.",
                EditorStyles.miniLabel);

            _emailAddress = EditorGUILayout.TextField(_emailAddress);

            EditorGUILayout.Space();

            EditorGUILayout.BeginHorizontal();

            if (SRDebugEditorUtil.ClickableLabel(
                    "I agree to the <color={0}>terms and conditions</color>.".Fmt(SRDebugEditorUtil.Styles.LinkColour),
                    SRDebugEditorUtil.Styles.RichTextLabel))
            {
                ApiSignupTermsWindow.Open();
            }

            _agreeLegal = EditorGUILayout.Toggle(_agreeLegal);

            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Space();

            var isEnabled = !string.IsNullOrEmpty(_invoiceNumber) && !string.IsNullOrEmpty(_emailAddress) && _agreeLegal;
            EditorGUI.BeginDisabledGroup(!isEnabled);

            if (GUILayout.Button("Submit"))
            {
                _errorMessage    = null;
                _enableTabChange = false;

                EditorApplication.delayCall += () =>
                {
                    ApiSignup.SignUp(_emailAddress, _invoiceNumber, OnSignupResult);
                    Repaint();
                };
            }

            EditorGUI.EndDisabledGroup();

            if (!string.IsNullOrEmpty(_errorMessage))
            {
                EditorGUILayout.HelpBox(_errorMessage, MessageType.Error, true);
            }

            GUILayout.FlexibleSpace();

            GUILayout.Label("Having trouble? Please email [email protected] for assistance.",
                            EditorStyles.miniLabel);

            EditorGUI.EndDisabledGroup();
        }
Example #4
0
        private void DrawTabBugReporter()
        {
            if (_showBugReportSignupForm)
            {
                DrawBugReportSignupForm();
                return;
            }

            GUILayout.Label("Bug Reporter", SRDebugEditorUtil.Styles.HeaderLabel);

            EditorGUI.BeginDisabledGroup(string.IsNullOrEmpty(Settings.Instance.ApiKey));

            Settings.Instance.EnableBugReporter = EditorGUILayout.Toggle("Enable Bug Reporter",
                                                                         Settings.Instance.EnableBugReporter);

            EditorGUI.EndDisabledGroup();

            EditorGUILayout.BeginHorizontal();

            Settings.Instance.ApiKey = EditorGUILayout.TextField("API Key", Settings.Instance.ApiKey);

            if (GUILayout.Button("Verify", GUILayout.ExpandWidth(false)))
            {
                EditorUtility.DisplayDialog("Verify API Key", ApiSignup.Verify(Settings.Instance.ApiKey), "OK");
            }

            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Space();

            GUILayout.Label(
                "If you need to change your account email address, or have any other questions or concerns, please email us at [email protected].",
                SRDebugEditorUtil.Styles.ParagraphLabel);

            GUILayout.FlexibleSpace();

            if (!string.IsNullOrEmpty(Settings.Instance.ApiKey))
            {
                GUILayout.Label("Reset", SRDebugEditorUtil.Styles.InspectorHeaderStyle);
                GUILayout.Label("Click the button below to clear the API key and show the signup form.",
                                SRDebugEditorUtil.Styles.ParagraphLabel);

                EditorGUILayout.BeginHorizontal();

                _enableButton = EditorGUILayout.Toggle("Enable Button", _enableButton, GUILayout.ExpandWidth(false));

                EditorGUI.BeginDisabledGroup(!_enableButton);

                if (GUILayout.Button("Reset"))
                {
                    Settings.Instance.ApiKey            = null;
                    Settings.Instance.EnableBugReporter = false;
                    _enableButton            = false;
                    _showBugReportSignupForm = true;
                }

                EditorGUI.EndDisabledGroup();

                EditorGUILayout.EndHorizontal();

                EditorGUILayout.Space();
            }
            else
            {
                if (GUILayout.Button("Show Signup Form"))
                {
                    _showBugReportSignupForm = true;
                }
            }
        }