Пример #1
0
        internal bool GetDrawConfig(IRefDraw refDrawer, out RefDrawConfig config)
        {
            bool drawTool = AnyToolInBot;

            config            = new RefDrawConfig(refDrawer);
            config.drawGlobal = !drawTool;
            config.drawInTop  = drawTool;
            config.isDraw     = true;
            return(drawTool);
        }
Пример #2
0
        internal int DrawConfig(RefDrawConfig config, Rect rectTop, Rect rectBot, ref bool WillRepaint)
        {
            if (config == null)
            {
                return(0);
            }

            if (config.refDrawer == null)
            {
                return(0);
            }

            if (!config.isDraw)
            {
                return(0);
            }

            var willRepaint = false;

            if (config.drawGlobal)
            {
                willRepaint = config.refDrawer.Draw();
            }
            else
            {
                if (config.drawInTop)
                {
                    GUILayout.BeginArea(rectTop);
                    willRepaint = config.refDrawer.Draw();
                    GUILayout.EndArea();
                }
                else if (config.isDrawTool)
                {
                    GUILayout.BeginArea(rectBot);
                    willRepaint = config.refDrawer.Draw();
                    DrawTool();
                    GUILayout.EndArea();
                }
                else
                {
                    GUILayout.BeginArea(rectBot);
                    willRepaint = config.refDrawer.Draw();
                    GUILayout.EndArea();
                }
            }

            if (willRepaint)
            {
                WillRepaint = true;
            }

            return(1);
        }
Пример #3
0
        internal bool GetDrawConfig(IRefDraw refTop, IRefDraw refBot, out RefDrawConfig config1,
                                    out RefDrawConfig config2)
        {
            var drawTool = true;

            config1        = new RefDrawConfig(refTop);
            config2        = new RefDrawConfig(refBot);
            config1.isDraw = config1.refDrawer.ElementCount() > 0;
            config2.isDraw = config2.refDrawer.ElementCount() > 0;

            if (AnyToolInBot)
            {
                if (refTop.ElementCount() > 0)
                {
                    config1.drawInTop = true;
                    if (refBot.ElementCount() > 0)
                    {
                        drawTool           = false;
                        config2.isDrawTool = true;
                    }
                }
                else
                {
                    config2.drawInTop = true;
                }
            }
            else
            {
                drawTool = false;
                if (refTop.ElementCount() > 0)
                {
                    config1.drawInTop = true;
                    if (refBot.ElementCount() > 0)
                    {
                        config2.drawInTop = false;
                    }
                    else
                    {
                        config1.drawGlobal = true;
                    }
                }
                else
                {
                    // config2.drawInTop = true;
                    config2.drawGlobal = true;
                }
            }

            return(drawTool);
        }
Пример #4
0
        protected override void OnGUI()
        {
            if (!CheckDrawHeader())
            {
                return;
            }

            Rect rectTop = GetTopPanelRect();
            Rect rectBot = GetBotPanelRect();

            RefDrawConfig config1 = null, config2 = null, config3 = null;
            var           drawTool  = false;
            var           drawCount = 0;

            if (IsFocusingUses || IsFocusingSceneToAsset)
            {
                drawTool = GetDrawConfig(SceneUsesDrawer, out config1);
            }
            else if (IsFocusingSceneInScene || IsFocusingFindInScene || IsFocusingUsedBy)
            {
                if (RefSceneInScene.ElementCount() <= 0)
                {
                    drawTool = GetDrawConfig(RefInScene, out config1);
                }
                else
                {
                    drawTool = GetDrawConfig(RefSceneInScene, out config2);
                }
            }

            if (!IsFocusingGUIDs && !IsFocusingUnused)
            {
                drawCount += DrawConfig(config1, rectTop, rectBot, ref willRepaint);
                drawCount += DrawConfig(config2, rectTop, rectBot, ref willRepaint);
                drawCount += DrawConfig(config3, rectTop, rectBot, ref willRepaint);
            }

            if (drawTool)
            {
                drawCount++;
                GUILayout.BeginArea(rectBot);
                DrawTool();
                GUILayout.EndArea();
            }

            DrawFooter();
            OnAfterGUI(drawCount);
        }
Пример #5
0
        // public static Rect windowRect;


        //return true if draw tool along


        protected override void OnGUI()
        {
            if (!CheckDrawHeader())
            {
                return;
            }

            //if (Selected.Count == 0){
            //  GUILayout.Label("Nothing selected");
            //}
            Rect rectTop = GetTopPanelRect();
            Rect rectBot = GetBotPanelRect();

            RefDrawConfig config1 = null, config2 = null, config3 = null;
            var           drawTool  = false;
            var           drawCount = 0;

            if (IsFocusingUses || IsFocusingSceneToAsset)
            {
                if (UsesDrawer.ElementCount() <= 0)
                {
                    drawTool = GetDrawConfig(SceneUsesDrawer, SceneToAssetDrawer, out config1, out config2);
                }
                else
                {
                    drawTool = GetDrawConfig(UsesDrawer, out config3);
                }
            }
            else if (IsFocusingSceneInScene || IsFocusingFindInScene || IsFocusingUsedBy)
            {
                if (RefSceneInScene.ElementCount() <= 0)
                {
                    drawTool = GetDrawConfig(RefInScene, UsedByDrawer, out config1, out config2);
                }
                else
                {
                    drawTool = GetDrawConfig(RefSceneInScene, out config3);
                }
            }
            else if (IsFocusingDuplicate)
            {
                drawTool = GetDrawConfig(Duplicated, out config1);
            }
            else if (IsFocusingGUIDs)
            {
                drawCount++;
                if (AnyToolInBot)
                {
                    GUILayout.BeginArea(rectTop);
                    DrawGUIDs();
                    GUILayout.EndArea();
                    drawTool = true;
                }
                else
                {
                    DrawGUIDs();
                    drawTool = false;
                }
            }
            else if (IsFocusingUnused)
            {
                drawCount++;
                if (AnyToolInBot)
                {
                    GUILayout.BeginArea(rectTop);
                    RefUnUse.Draw();
                    GUILayout.EndArea();
                    drawTool = true;
                }
                else
                {
                    RefUnUse.Draw();
                    drawTool = false;
                }
            }
            else if (IsFocusingUsedInBuild)
            {
                //Debug.Log("draw :" + IsFocusingUsedInBuild);
                //drawTool = GetDrawConfig(UsedInBuild, out config1);
                UsedInBuild.Draw();
            }

            if (!IsFocusingGUIDs && !IsFocusingUnused)
            {
                drawCount += DrawConfig(config1, rectTop, rectBot, ref willRepaint);
                drawCount += DrawConfig(config2, rectTop, rectBot, ref willRepaint);
                drawCount += DrawConfig(config3, rectTop, rectBot, ref willRepaint);
            }

            if (drawTool)
            {
                drawCount++;
                GUILayout.BeginArea(rectBot);
                DrawTool();
                GUILayout.EndArea();
            }

            DrawFooter();

            OnAfterGUI(drawCount);
        }