コード例 #1
0
 public static Rect GetOverlayRect(Rect drawRect)
 {
     return(Overlay.GetOverlayRect(drawRect));
 }
コード例 #2
0
        private void DrawItem(ListItem item, Rect area, float x, float y, bool focus, bool selected)
        {
            bool flag  = item == this.dragTarget;
            bool flag2 = selected;

            if (selected)
            {
                Texture2D image = (!focus) ? this.greyTex : this.blueTex;
                GUI.DrawTexture(new Rect(area.x, y, area.width, 16f), image, ScaleMode.StretchToFill, false);
            }
            else if (flag)
            {
                ListControl.SelectDirection selectDirection = this.dragAdjust;
                if (selectDirection != ListControl.SelectDirection.Up)
                {
                    if (selectDirection != ListControl.SelectDirection.Down)
                    {
                        if (item.CanAccept)
                        {
                            GUI.DrawTexture(new Rect(area.x, y, area.width, 16f), this.yellowTex, ScaleMode.StretchToFill, false);
                            flag2 = true;
                        }
                    }
                    else
                    {
                        GUI.DrawTexture(new Rect(x, y + 16f - 1f, area.width, 2f), this.yellowTex, ScaleMode.StretchToFill, false);
                    }
                }
                else if (item.PrevOpenVisible != item.Parent)
                {
                    GUI.DrawTexture(new Rect(x, y - 1f, area.width, 2f), this.yellowTex, ScaleMode.StretchToFill, false);
                }
            }
            else if (this.dragTarget != null && item == this.dragTarget.Parent && this.dragAdjust != ListControl.SelectDirection.Current)
            {
                GUI.DrawTexture(new Rect(area.x, y, area.width, 16f), this.yellowTex, ScaleMode.StretchToFill, false);
                flag2 = true;
            }
            if (item.HasActions)
            {
                for (int i = 0; i < item.Actions.Length; i++)
                {
                    this.calcSizeTmpContent.text = item.Actions[i];
                    Vector2 vector = GUI.skin.button.CalcSize(this.calcSizeTmpContent);
                    if (GUI.Button(new Rect(x, y, vector.x, 16f), item.Actions[i]))
                    {
                        this.actionDelegate(item, i);
                    }
                    x += vector.x + 4f;
                }
            }
            if (item.CanExpand)
            {
                EditorGUI.Foldout(new Rect(x, y, 16f, 16f), item.Expanded, GUIContent.none);
            }
            Texture texture      = item.Icon;
            Color   color        = GUI.color;
            Color   contentColor = GUI.contentColor;

            if (item.Dummy)
            {
                GUI.color = new Color(0.65f, 0.65f, 0.65f);
            }
            if (!item.Dummy)
            {
                if (texture == null)
                {
                    texture = InternalEditorUtility.GetIconForFile(item.Name);
                }
                Rect rect = new Rect(x + 14f, y, 16f, 16f);
                if (texture != null)
                {
                    GUI.DrawTexture(rect, texture);
                }
                if (item.Asset != null)
                {
                    Rect itemRect = rect;
                    itemRect.width += 12f;
                    itemRect.x     -= 6f;
                    Overlay.DrawOverlay(item.Asset, itemRect);
                }
            }
            string  text    = this.DisplayName(item);
            Vector2 vector2 = EditorStyles.label.CalcSize(EditorGUIUtility.TempContent(text));
            float   num     = x + 32f;

            if (flag2)
            {
                GUI.contentColor = new Color(3f, 3f, 3f);
                GUI.Label(new Rect(num, y, area.width - num, 18f), text);
            }
            else
            {
                GUI.Label(new Rect(num, y, area.width - num, 18f), text);
            }
            if (this.HasHiddenMetaFile(item))
            {
                GUI.color = new Color(0.55f, 0.55f, 0.55f);
                float num2 = num + vector2.x + 2f;
                GUI.Label(new Rect(num2, y, area.width - num2, 18f), "+meta");
            }
            GUI.contentColor = contentColor;
            GUI.color        = color;
        }