public virtual void UpdateView(Rect editorRect, Rect percentageRect, Event e, EncounterNodeGraph curGraph, GUISkin viewSkin) { this.viewSkin = viewSkin; if (this.viewSkin == null) { LoadEditorSkin(); return; } //Set the current Graph //this.curGraph = EncounterNodeEditorWindow.getInstance().getCurrentNodeGraph(); this.curGraph = curGraph; //Set title of our current graph name if (curGraph != null) { viewTitle = curGraph.graphName; } else { viewTitle = "No Graph"; } //Update View rectangle viewRect = new Rect(editorRect.x * percentageRect.x, editorRect.y * percentageRect.y, editorRect.width * percentageRect.width, editorRect.height * percentageRect.height ); }
/** * * */ public static void CreateNewGraph(string name) { EncounterNodeGraph curGraph = new EncounterNodeGraph(); if (curGraph != null) { curGraph.graphName = name; curGraph.InitGraph(); EncounterNodeEditorWindow curWindow = (EncounterNodeEditorWindow)EditorWindow.GetWindow <EncounterNodeEditorWindow> (); if (curWindow != null) { curWindow.curGraph = curGraph; } NodeBase nnode = curWindow.CreateNode(NodeType.Start, new Vector2(70f, 70f)); curWindow.curGraph.startNode = nnode; Save(); //save data file } else { EditorUtility.DisplayDialog("Node message:", "Unable to create graph", "OK"); } }
public static void LoadGraph() { EncounterNodeGraph curGraph = null; BinaryFormatter bf = new BinaryFormatter(); FileStream fs = File.Open(Application.dataPath + "/EncounterEditor/Database/data.dat", FileMode.Open); curGraph = (EncounterNodeGraph)bf.Deserialize(fs); fs.Close(); if (curGraph != null) { EncounterNodeEditorWindow curWindow = (EncounterNodeEditorWindow)EditorWindow.GetWindow <EncounterNodeEditorWindow> (); if (curWindow != null) { curWindow.curGraph = curGraph; } } else { EditorUtility.DisplayDialog("Node message", "Unable load data.dat", "OK"); } }
public override void UpdateView(Rect editorRect, Rect percentageRect, Event e, EncounterNodeGraph curGraph, GUISkin viewSkin) { base.UpdateView(editorRect, percentageRect, e, curGraph, viewSkin); GUI.Box(viewRect, viewTitle, viewSkin.GetStyle("ViewBg")); GUILayout.BeginArea(viewRect); GUILayout.Space(60); GUILayout.BeginHorizontal(); GUILayout.Space(30); /*if (curGraph != null) { * if (!curGraph.showProperties) { * EditorGUILayout.LabelField ("None"); * } else { * curGraph.selectedNode.DrawNodeProperties (); * } * }*/ GUILayout.EndHorizontal(); if (curGraph != null) { if (/*curGraph*/ EncounterNodeGraph.showProperties == true && _loaded == true) { EncounterNodeGraph.selectedNode.DrawNodeProperties(viewSkin); } } if (Event.current.type == EventType.Repaint) { _loaded = true; } GUILayout.EndArea(); ProcessEvents(e); }
public override void UpdateView(Rect editorRect, Rect percentageRect, Event e, EncounterNodeGraph curGraph, GUISkin viewSkin) { //Update, és Kirajzoltatás base.UpdateView(editorRect, percentageRect, e, curGraph, viewSkin); //Draw Workspace //pl. viewRect 0f,0f,W:=w*0.75f,H:=h*1f (a (0,0) == 'root' ablakjának pozicioja a monitoron) if (viewTitle == null) { Debug.LogError("viewTitle is null"); } if (viewSkin == null) { Debug.LogError("viewSkin is null"); } GUI.Box(viewRect, viewTitle, viewSkin.GetStyle("ViewBg")); //DrawGrid NodeUtils.DrawGrid(viewRect, 80f, 0.15f, Color.white); NodeUtils.DrawGrid(viewRect, 20f, 0.05f, Color.white); /* * //DrawBox * //scrollPos = GUI.BeginScrollView (viewRect, scrollPos, new Rect (0, 0, 1000, 1000)); * GUILayout.BeginArea (viewRect); * * //DrawGraph, and all the other stuff * if (curGraph != null) { * curGraph.UpdateGraphGUI (e, viewRect, viewSkin); * } * * GUILayout.EndArea (); * //GUI.EndScrollView (); */ ProcessEvents(e); }