Ejemplo n.º 1
0
        void UpdateComment()
        {
            if (m_Comment == null)
            {
                m_Comment = serializedObject.FindProperty("m_Comment");
            }

            if (m_CommentEditor == null)
            {
                m_CommentEditor = new CommentEditor(serializedObject, m_Comment);
            }

            sceneComment = (serializedObject.targetObject as SceneComment);
        }
Ejemplo n.º 2
0
        public void DrawComment(Comment comment, bool requireEdit = false)
        {
            if (requireEdit)
            {
                editMessagePath = rootMessage.propertyPath;
                requireEdit     = false;
            }

            using (new GUILayout.HorizontalScope())
            {
                TypeLabel(comment.computedType);
                StateLabel(comment.computedState);
                PriorityLabel(comment.computedPriority);

                GUILayout.FlexibleSpace();
                EditorGUI.BeginChangeCheck();
                EditorGUI.BeginDisabledGroup(comment.message.from != CommentsWindow.user);
                bool editRoot = DrawEditButton(this.editRoot);
                EditorGUI.EndDisabledGroup();
                if (EditorGUI.EndChangeCheck())
                {
                    if (editRoot)
                    {
                        editMessagePath = rootMessage.propertyPath;
                    }
                    else
                    {
                        editMessagePath = string.Empty;
                    }
                }
            }

            GUILayout.Space(6);

            if (editRoot)
            {
                serializedObject.Update();
                EditorGUILayout.PropertyField(title);
                using (new GUILayout.HorizontalScope())
                {
                    EditorGUILayout.PropertyField(focus);

                    if (!m_IsAsset && GUILayout.Button("Align to SceneView", GUILayout.ExpandWidth(true)))
                    {
                        focus.boolValue = true;
                        if (SceneView.lastActiveSceneView != null)
                        {
                            SceneComment c = serializedObject.targetObject as SceneComment;
                            c.gameObject.transform.position = SceneView.lastActiveSceneView.camera.transform.position;
                            c.gameObject.transform.rotation = SceneView.lastActiveSceneView.camera.transform.rotation;
                        }
                    }
                }
                serializedObject.ApplyModifiedProperties();
                CommentsWindow.RequestRefresh();
            }
            else
            {
                GUILayout.Space(8);

                using (new GUILayout.HorizontalScope())
                {
                    GUILayout.Label(CommentEditor.GetPriorityContent(" " + title.stringValue, comment.computedPriority), Styles.title);
                    GUILayout.FlexibleSpace();
                }
            }

            GUILayout.Space(6);
            DrawMessage(rootMessage, -1);
            int replyCount = replies.arraySize;

            using (new GUILayout.HorizontalScope())
            {
                GUILayout.Space(16);
                using (new GUILayout.VerticalScope())
                {
                    for (int i = 0; i < replyCount; i++)
                    {
                        DrawMessage(replies.GetArrayElementAtIndex(i), i);
                    }
                }
            }
        }