Exemplo n.º 1
0
        private void DrawHeader()
        {
            GUILayout.Space(VerticalSpace);
            GUILayout.Space(VerticalSpace);

            GUILayout.BeginHorizontal();
            {
                GUIStyle   labelStyle   = new GUIStyle(EditorStyles.boldLabel);
                GUIContent labelContent = new GUIContent("Course Name:");
                EditorGUILayout.LabelField(labelContent, labelStyle, GUILayout.Width(labelStyle.CalcSize(labelContent).x));

                GUIStyle nameStyle = new GUIStyle(EditorStyles.label)
                {
                    wordWrap = true
                };
                GUIContent nameContent = new GUIContent(Course.Data.Name, Course.Data.Name);

                if (renameCoursePopup == null || renameCoursePopup.IsClosed)
                {
                    EditorGUILayout.LabelField(Course.Data.Name, nameStyle, GUILayout.Width(180f), GUILayout.Height(nameStyle.CalcHeight(nameContent, 180f))); Rect labelPosition = GUILayoutUtility.GetLastRect();
                    if (FlatIconButton(editIcon.Texture))
                    {
                        labelPosition     = new Rect(labelPosition.x + ParentWindow.position.x - 2, labelPosition.height + labelPosition.y + ParentWindow.position.y + 4 + ExpandButtonHeight, labelPosition.width, labelPosition.height);
                        renameCoursePopup = RenameCoursePopup.Open(Course, labelPosition, scrollPosition);
                    }
                }
            }
            GUILayout.EndHorizontal();

            GUILayout.Space(VerticalSpace);

            GUILayout.BeginHorizontal();
            {
                GUILayout.FlexibleSpace();
                AddSaveButton();
            }
            GUILayout.EndHorizontal();
        }
Exemplo n.º 2
0
        public static RenameCoursePopup Open(ICourse course, Rect labelPosition, Vector2 offset)
        {
            if (instance != null)
            {
                instance.Close();
            }

            instance = CreateInstance <RenameCoursePopup>();

            instance.course  = course;
            instance.newName = instance.course.Data.Name;

            instance.position = new Rect(labelPosition.x - offset.x, labelPosition.y - offset.y, labelPosition.width, labelPosition.height);
            instance.ShowPopup();
            instance.Focus();

            AssemblyReloadEvents.beforeAssemblyReload += () =>
            {
                instance.Close();
                instance.IsClosed = true;
            };

            return(instance);
        }