private void CallbackMessage(bool isError, string content) { this.blurFocus = true; if (isError) { Debug.LogError(content); EditorUtility.DisplayDialog(DIALOG_ERROR_SERVER_TITLE, DIALOG_ERROR_SERVER_SUBTL, "Ok"); this.state = State.Writing; return; } EditorPrefs.SetString(KEY_EDITORPREF_NAME, ""); EditorPrefs.SetString(KEY_EDITORPREF_MAIL, ""); EditorPrefs.SetString(KEY_EDITORPREF_CONT, ""); EditorPrefs.SetInt(KEY_EDITORPREF_FEED, 0); this.userFeedbackType = DatabaseFeedback.FeedbackType.General; this.userName = ""; this.userMail = ""; this.userCont = ""; this.state = State.Sent; }
// INITIALIZE: ------------------------------------------------------------------------------------------------- private void OnEnable() { if (target == null || serializedObject == null) { return; } this.state = State.Writing; this.stylesInitialize = false; this.userName = EditorPrefs.GetString(KEY_EDITORPREF_NAME); this.userMail = EditorPrefs.GetString(KEY_EDITORPREF_MAIL); this.userCont = EditorPrefs.GetString(KEY_EDITORPREF_CONT); this.userFeedbackType = (DatabaseFeedback.FeedbackType)EditorPrefs.GetInt(KEY_EDITORPREF_FEED, 0); }
private void PaintWriting() { EditorGUILayout.BeginVertical(this.styleBox); EditorGUILayout.LabelField(MSG_TITLE, EditorStyles.boldLabel); EditorGUILayout.LabelField(MSG_SUBTL); EditorGUILayout.EndVertical(); EditorGUI.BeginDisabledGroup(this.state == State.Sending); EditorGUILayout.Space(); this.userName = EditorGUILayout.TextField(FIELD_NAME, this.userName); this.userMail = EditorGUILayout.TextField(FIELD_MAIL, this.userMail); EditorGUILayout.Space(); this.userFeedbackType = (DatabaseFeedback.FeedbackType)EditorGUILayout.EnumPopup( FIELD_TYPE, this.userFeedbackType ); this.userCont = EditorGUILayout.TextArea(this.userCont, GUILayout.Height(CONT_HEIGHT)); EditorPrefs.SetString(KEY_EDITORPREF_NAME, this.userName); EditorPrefs.SetString(KEY_EDITORPREF_MAIL, this.userMail); EditorPrefs.SetString(KEY_EDITORPREF_CONT, this.userCont); EditorPrefs.SetInt(KEY_EDITORPREF_FEED, (int)this.userFeedbackType); if (GUILayout.Button(this.state == State.Writing ? "Send" : "Sending...")) { if (string.IsNullOrEmpty(this.userName) || string.IsNullOrEmpty(this.userCont)) { EditorUtility.DisplayDialog(DIALOG_ERROR_SEND_TITLE, DIALOG_ERROR_SEND_SUBTL, "Ok"); } else { this.state = State.Sending; this.SendMessage(); } } EditorGUI.EndDisabledGroup(); }