示例#1
0
    public void DrawErrors(Rect rect)
    {
        GUIHelpers.IsInsepctor = false;
        if (InvertGraphEditor.PlatformDrawer == null)
        {
            return;
        }

        var d = InvertGraphEditor.PlatformDrawer as UnityDrawer;

        d.DrawStretchBox(rect, CachedStyles.WizardListItemBoxStyle, 10);


        if (!ErrorInfo.Any())
        {
            var textRect   = rect;
            var cacheColor = GUI.color;
            GUI.color = new Color(GUI.color.r, GUI.color.g, GUI.color.b, 0.4f);
            d.DrawLabel(textRect, "No Issues Found", CachedStyles.WizardSubBoxTitleStyle, DrawingAlignment.MiddleCenter);
            GUI.color = cacheColor;
            return;
        }

        if (ErrorInfoList == null)
        {
            return;
        }
        if (ErrorInfoList.IsDirty)
        {
            ErrorInfoList.Refresh();
        }

        Signal <IDrawTreeView>(_ => _.DrawTreeView(rect, ErrorInfoList, (m, i) =>
        {
            var bp = i as ErrorInfo;
            if (bp != null && bp.SourceNode != null)
            {
                Execute(new NavigateToNodeCommand()
                {
                    Node   = bp.SourceNode,
                    Select = true
                });
            }
        }));


//        // var itemRect = new Rect(0f, 0f, rect.width, 25);
//        if (GUIHelpers.DoToolbarEx("Issues"))
//        {
//
//            foreach (var item in ErrorInfo)
//            {
//                var item1 = item;
//                var name = string.Empty;
//                var node = item.Record as GraphNode;
//                if (node != null)
//                {
//                    var filter = node.Filter;
//                    if (filter != null)
//                        name = filter.Name + ": ";
//                }
//                if (GUILayout.Button(name + item1.Message,EventButtonStyleSmall))
//                {
//
//                    if (node != null)
//                        Execute(new NavigateToNodeCommand()
//                        {
//                            Node = node
//                        });
//                }
//
//                var lastRect = GUILayoutUtility.GetLastRect();
//                PlatformDrawer.DrawImage(lastRect.WithWidth(lastRect.height).PadSides(3),"WarningIcon",true);
//                //InvertGraphEditor.PlatformDrawer.DoButton(itemRect.Pad(25f,0f,0f,0f),item.Message,CachedStyles.DefaultLabel, () =>
//                //{
//
//                //});
//                //itemRect.y += 26;
//                //var lineRect = itemRect;
//                //lineRect.height -= 24;
//                //InvertGraphEditor.PlatformDrawer.DrawRect(lineRect,new Color(0f,0f,0f,0.3f));
//            }
//        }
//
    }