private void DrawWindows() { foreach (CatGraph.Node node in _catGraph.Nodes) { DrawActualWindow(node, node.Size.position); } for (int i = 0; i < _catGraph.Actions.Count; i++) { CatGraph.ActionWrapper wrapper = _catGraph.Actions[i]; Rect rect = new Rect(_gridStart + new Vector2(-150, i * 150), new Vector2(100, 100)); DrawActualWindow(wrapper, rect); } for (int i = 0; i < _catGraph.Moods.Count; i++) { CatGraph.MoodWrapper wrapper = _catGraph.Moods[i]; Rect rect = new Rect(_gridStart + new Vector2(i * 200, -150), new Vector2(150, 100)); DrawActualWindow(wrapper, rect); } }
private void MoodWindowFunction(int id) { CatGraph.MoodWrapper wrapper = _catGraph.GetMoodWrapper(id); if (wrapper == null) { return; } float height = 15; float distance = height + 2f; float width = 150; if (GUI.Button(new Rect(10, 10, width - 20, height), "Remove")) { Undo.RecordObject(_catGraph, "Remove Mood"); _catGraph.RemoveMood(wrapper); } GUI.Label(new Rect(10, 100 / 2 - distance, width, height), "Mood"); wrapper.SetMood((Mood)EditorGUI.ObjectField(new Rect(5, 100 / 2, width - 10, height), wrapper.Mood, typeof(Mood), false)); }
private void DrawActualWindow(CatGraph.MoodWrapper wrapper, Rect rect) { GUIStyle style = wrapper.ChooseStyle(); GUI.Window(wrapper.ID, rect, MoodWindowFunction, string.Empty, style); }