Exemplo n.º 1
0
        private void DrawChapterContent(int position)
        {
            bool isActiveChapter = (activeChapter == position);

            GUILayout.BeginHorizontal();
            {
                GUILayout.Space(TabSpace);
                if (isActiveChapter)
                {
                    GUILayout.Space(ChapterPadding);
                }

                EditorColorUtils.SetTransparency(isActiveChapter ? 0.8f : 0.25f);
                GUILayout.Label(folderIcon.Texture, GUILayout.Width(ButtonSize), GUILayout.Height(ButtonSize));
                EditorColorUtils.ResetColor();

                GUIStyle style = new GUIStyle(GUI.skin.label);
                style.alignment = TextAnchor.MiddleLeft;
                GUILayout.Label(Course.Data.Chapters[position].Data.Name, style, GUILayout.Width(160f), GUILayout.Height(20f));
                Rect labelPosition = GUILayoutUtility.GetLastRect();

                GUILayout.FlexibleSpace();
                AddMoveUpButton(position);
                AddMoveDownButton(position);
                AddRemoveButton(position, Course.Data.Chapters.Count == 1);
                AddRenameButton(position, labelPosition);
            }
            GUILayout.EndHorizontal();
        }
Exemplo n.º 2
0
        private static bool FlatIconButton(Texture icon)
        {
            EditorColorUtils.SetTransparency(0.25f);
            bool isTriggered = GUILayout.Button(icon, EditorStyles.label, GUILayout.Width(ButtonSize), GUILayout.Height(ButtonSize));
            // Creating a highlight effect if the mouse is currently hovering the button.
            Rect buttonRect = GUILayoutUtility.GetLastRect();

            if (buttonRect.Contains(Event.current.mousePosition))
            {
                EditorColorUtils.SetTransparency(0.5f);
                GUI.Label(buttonRect, icon);
            }

            EditorColorUtils.ResetColor();
            return(isTriggered);
        }