コード例 #1
0
ファイル: ApiSignupWindow.cs プロジェクト: BuCai/Hit
 public void Update()
 {
     if (_shouldSignup)
     {
         _shouldSignup = false;
         ApiSignup.SignUp(_emailAddress, _invoiceNumber, OnSuccess);
         Repaint();
     }
 }
コード例 #2
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();
        }