private void RenderCompilationOutput()
        {
            if (string.IsNullOrEmpty(compilationOutput))
            {
                return;
            }

            if (RequestErrorMessage.IsRequestError(compilationOutput))
            {
                RequestErrorMessage.Draw(ref compilationOutput);
                return;
            }

            EditorGUILayout.BeginHorizontal(GUILayout.MaxWidth(EditorGUIUtility.currentViewWidth));
            compilationFoldout = EditorGUILayout.Foldout(compilationFoldout, "Compilation output");
            if (GUILayout.Button("Clear"))
            {
                compilationOutput = null;
                return;
            }
            EditorGUILayout.EndHorizontal();

            if (!compilationFoldout)
            {
                return;
            }

            EditorGUILayout.BeginVertical("Box", GUILayout.ExpandHeight(true));
            scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
            var lines = compilationOutput.Split(new[] { "\t\n" }, StringSplitOptions.None);

            foreach (var line in lines)
            {
                var split = line.Split('\t');

                EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                EditorGUILayout.LabelField(split[0], new GUIStyle {
                    normal = { textColor = GetOutputNoteColor(split[0]) }, alignment = TextAnchor.MiddleRight, fontStyle = FontStyle.Bold
                }, GUILayout.Width(70));

                EditorGUILayout.BeginVertical();
                EditorGUILayout.LabelField(split[1], EditorStyles.boldLabel);
                EditorGUI.LabelField(GUILayoutUtility.GetRect(new GUIContent(split[2]), "label"), split[2]);
                EditorGUILayout.EndVertical();

                EditorGUILayout.EndHorizontal();
                EditorGUILayout.Space();
            }
            EditorGUILayout.EndScrollView();
            EditorGUILayout.EndVertical();
        }
Пример #2
0
        private void OnGUI()
        {
            if (MichelangeloSession.IsUnreachable)
            {
                EditorGUILayout.HelpBox("Michelangelo web server seems to be unreachable\nPlease try again later...", MessageType.Error);
                if (GUILayout.Button("Refresh"))
                {
                    Refresh();
                }
                GUI.enabled = false;
            }
            else if (MichelangeloSession.IsLoading)
            {
                EditorGUILayout.HelpBox("Loading, please wait...", MessageType.Info);
                GUI.enabled = false;
            }

            if (MichelangeloSession.IsAuthenticated)
            {
                if (MichelangeloSession.User == null)
                {
                    MichelangeloSession.UpdateUserInfo().Then(_ => { Repaint(); }).Catch(OnRejected);
                    MichelangeloSession.UpdateGrammarList();
                    return;
                }

                LoggedIn();
            }
            else
            {
                NotLoggedIn();
            }

            EditorGUILayout.Space();
            if (RequestErrorMessage.IsRequestError(errorMessage))
            {
                RequestErrorMessage.Draw(ref errorMessage);
            }
        }
 public RequestErrorModel(RequestErrorType reqErrorType, RequestErrorMessage reqErrorMessage, int crimeIndex)
 {
     this.RequestErrorTypeEnum = reqErrorType;
     this.RequestErrorMessageEnum = reqErrorMessage;
     this.CrimeRequestIndex = crimeIndex;
 }
 public RequestErrorModel(RequestErrorType reqErrorType, RequestErrorMessage reqErrorMessage)
 {
     this.RequestErrorTypeEnum = reqErrorType;
     this.RequestErrorMessageEnum = reqErrorMessage;
 }