コード例 #1
0
        public void CustomDrawElement(Rect r, int index, bool isActive, bool isFocused)
        {
            Event evt = Event.current;

            if (evt.type == EventType.MouseUp && evt.button == 1 && r.Contains(evt.mousePosition))
            {
                SnapshotMenu.Show(r, m_Snapshots[index], this);
                evt.Use();
            }

            const float iconSize = 16f;
            const float spacing  = 5f;

            bool isSelected = (index == m_ReorderableListWithRenameAndScrollView.list.index) && !m_ReorderableListWithRenameAndScrollView.IsRenamingIndex(index);

            // Text
            r.width -= iconSize + spacing;
            m_ReorderableListWithRenameAndScrollView.DrawElementText(r, index, isActive, isSelected, isFocused);

            // Startup icon
            if (m_Controller.startSnapshot == m_Snapshots[index])
            {
                r.x     = r.xMax + spacing + 5f;
                r.y     = r.y + (r.height - iconSize) / 2;
                r.width = r.height = iconSize;
                GUI.Label(r, s_Styles.starIcon, GUIStyle.none);
            }
        }
コード例 #2
0
        public void CustomDrawElement(Rect r, int index, bool isActive, bool isFocused)
        {
            Event current = Event.current;

            if (((current.type == EventType.MouseUp) && (current.button == 1)) && r.Contains(current.mousePosition))
            {
                SnapshotMenu.Show(r, this.m_Snapshots[index], this);
                current.Use();
            }
            bool isSelected = (index == this.m_ReorderableListWithRenameAndScrollView.list.index) && !this.m_ReorderableListWithRenameAndScrollView.IsRenamingIndex(index);

            r.width -= 19f;
            this.m_ReorderableListWithRenameAndScrollView.DrawElementText(r, index, isActive, isSelected, isFocused);
            if (this.m_Controller.startSnapshot == this.m_Snapshots[index])
            {
                r.x  = (r.xMax + 5f) + 5f;
                r.y += (r.height - 14f) / 2f;
                float num = 14f;
                r.height = num;
                r.width  = num;
                GUI.Label(r, s_Styles.starIcon, GUIStyle.none);
            }
        }