Show() 공개 정적인 메소드

public static Show ( Graph graph ) : GraphWindow
graph Graph
리턴 GraphWindow
예제 #1
0
파일: GraphWindow.cs 프로젝트: AJ213/Awitu
			public static bool ShowEditor (int instanceID, int line)
			{
				UnityEngine.Object obj = EditorUtility.InstanceIDToObject(instanceID);
				if (obj is Nodes.Graph graph) 
				{ 
					if (UI.current != null) UI.current.DrawAfter( new Action( ()=>GraphWindow.Show(graph) ) ); //if opened via graph while drawing it - opening after draw
					else Show(graph); 
					return true; 
				}
				if (obj is MapMagicObject) { GraphWindow.Show(((MapMagicObject)obj).graph); return true; }
				return false;
			}
예제 #2
0
파일: GraphWindow.cs 프로젝트: AJ213/Awitu
			private static void ShowWindow (GraphWindow window, bool inTab=false)
			/// Opens the graph window. But it should be created and graph assigned first.
			{
				Texture2D icon = TexturesCache.LoadTextureAtPath("MapMagic/Icons/Window"); 
				window.titleContent = new GUIContent("MapMagic Graph", icon);

				if (inTab) window.ShowTab();
				else window.Show();
				window.Focus();
				window.Repaint();

				window.ScrollZoomOnOpen(); //focusing after window has shown (since it needs window size)
			}
예제 #3
0
파일: GraphWindow.cs 프로젝트: AJ213/Awitu
			public static void ShowEditor ()
			{
				MapMagicObject mm = FindObjectOfType<MapMagicObject>();
				Graph gens = mm!=null? mm.graph : null;
				GraphWindow.Show(mm?.graph);
			}
예제 #4
0
        public void DrawGUI()
        {
            using (Cell.LinePx(32))
                Draw.Label("WARNING: Keeping this asset selected in \nInspector can slow down editor GUI performance.", style: UI.current.styles.helpBox);
            Cell.EmptyLinePx(5);

            using (Cell.LinePx(24)) if (Draw.Button("Open Editor"))
                {
                    GraphWindow.Show(graph);
                }
            using (Cell.LinePx(20)) if (Draw.Button("Open in New Tab"))
                {
                    GraphWindow.ShowInNewTab(graph);
                }

            //seed
            Cell.EmptyLinePx(5);
            using (Cell.LineStd)
            {
                int newSeed = Draw.Field(graph.random.Seed, "Seed");                         //
                if (newSeed != graph.random.Seed)
                {
                    graph.random.Seed = newSeed;
                    //Graph.OnChange.Raise(graph);
                }
            }

            using (Cell.LineStd) Draw.DualLabel("Nodes", graph.generators.Length.ToString());
            using (Cell.LineStd) Draw.DualLabel("MapMagic ver", graph.serializedVersion.ToString());
            Cell.EmptyLinePx(5);


            //global values

            /*using (Cell.LineStd)
             *      using (new Draw.FoldoutGroup (ref showShared, "Global Values"))
             *              if (showShared)
             *      {
             *              List<string> changedNames = new List<string>();
             *              List<object> changedVals = new List<object>();
             *
             *              (Type type, string name)[] typeNames = graph.sharedVals.GetTypeNames();
             *              for (int i=0; i<typeNames.Length; i++)
             *                      using (Cell.LineStd) GeneratorDraw.DrawGlobalVar(typeNames[i].type, typeNames[i].name);
             *
             *              if (Cell.current.valChanged)
             *              {
             *                      GraphWindow.current.mapMagic.ClearAllNodes();
             *                      GraphWindow.current.mapMagic.StartGenerate();
             *              }
             *      }*/

            //exposed values
            using (Cell.LineStd)
                using (new Draw.FoldoutGroup(ref showExposed, "Exposed Values"))
                    if (showExposed)
                    {
                        graph.exposed.ClearObsoleteEntries(graph);

                        if (graph.exposed.entries != null)
                        {
                            for (int e = 0; e < graph.exposed.entries.Length; e++)
                            {
                                Exposed.Entry entry = graph.exposed.entries[e];
                                IExposedGuid  gen   = graph.FindGenByGuid(entry.guid);
                                FieldInfo     field = gen.GetType().GetField(entry.fieldName);

                                using (Cell.LineStd)
                                {
                                    if (field == null)
                                    {
                                        Draw.DualLabel(entry.guiName, "unknown");
                                    }

                                    else
                                    {
                                        Draw.ClassField(
                                            field: field,
                                            type: entry.type,
                                            obj: gen,
                                            name: entry.guiName);
                                    }
                                }

                                if (Cell.current.valChanged)
                                {
                                    GraphWindow.RefreshMapMagic();
                                }
                            }
                        }
                    }

            //dependent graphs
            using (Cell.LineStd)
                using (new Draw.FoldoutGroup(ref showDependent, "Dependent Graphs"))
                    if (showDependent)
                    {
                        using (Cell.LinePx(0))
                            DrawDependentGraphs(graph);
                    }
        }
예제 #5
0
        public void DrawGUI()
        {
            using (Cell.LinePx(32))
                Draw.Label("WARNING: Keeping this asset selected in \nInspector can slow down editor GUI performance.", style: UI.current.styles.helpBox);
            Cell.EmptyLinePx(5);

            using (Cell.LinePx(24)) if (Draw.Button("Open Editor"))
                {
                    GraphWindow.Show(graph);
                }
            using (Cell.LinePx(20)) if (Draw.Button("Open in New Tab"))
                {
                    GraphWindow.ShowInNewTab(graph);
                }

            //seed
            Cell.EmptyLinePx(5);
            using (Cell.LineStd)
            {
                int newSeed = Draw.Field(graph.random.Seed, "Seed");                         //
                if (newSeed != graph.random.Seed)
                {
                    graph.random.Seed = newSeed;
                    //Graph.OnChange.Raise(graph);
                }
            }

            using (Cell.LineStd) Draw.DualLabel("Nodes", graph.generators.Length.ToString());
            using (Cell.LineStd) Draw.DualLabel("MapMagic ver", graph.serializedVersion.ToString());
            Cell.EmptyLinePx(5);


            //global values

            /*using (Cell.LineStd)
             *      using (new Draw.FoldoutGroup (ref showShared, "Global Values"))
             *              if (showShared)
             *      {
             *              List<string> changedNames = new List<string>();
             *              List<object> changedVals = new List<object>();
             *
             *              (Type type, string name)[] typeNames = graph.sharedVals.GetTypeNames();
             *              for (int i=0; i<typeNames.Length; i++)
             *                      using (Cell.LineStd) GeneratorDraw.DrawGlobalVar(typeNames[i].type, typeNames[i].name);
             *
             *              if (Cell.current.valChanged)
             *              {
             *                      GraphWindow.current.mapMagic.ClearAllNodes();
             *                      GraphWindow.current.mapMagic.StartGenerate();
             *              }
             *      }*/

            //exposed values
            using (Cell.LineStd)
                using (new Draw.FoldoutGroup(ref graph.guiShowExposed, "Overridden Variables"))
                    if (graph.guiShowExposed)
                    {
                        using (Cell.LinePx(0))
                            OverrideInspector.DrawLayeredOverride(graph);
                    }

            //dependent graphs
            using (Cell.LineStd)
                using (new Draw.FoldoutGroup(ref graph.guiShowDependent, "Dependent Graphs"))
                    if (graph.guiShowDependent)
                    {
                        using (Cell.LinePx(0))
                            DrawDependentGraphs(graph);
                    }

            //debug
                                #if MM_DEBUG
            using (Cell.LineStd)
                using (new Draw.FoldoutGroup(ref graph.guiShowDebug, "Debug"))
                    if (graph.guiShowDebug)
                    {
                        using (Cell.LineStd) Draw.Toggle(ref graph.debugGenerate, "Generate");
                        using (Cell.LineStd) Draw.Toggle(ref graph.debugGenInfo, "Info");
                        using (Cell.LineStd) Draw.Toggle(ref graph.debugGraphBackground, "Background");
                        using (Cell.LineStd) Draw.Field(ref graph.debugGraphBackColor, "Back Color");
                        using (Cell.LineStd) Draw.Toggle(ref graph.debugGraphFps, "Graph FPS");
                        using (Cell.LineStd) Draw.Toggle(ref graph.drawInSceneView, "Draw In Scene View");
                    }
                                #endif
        }