// Update is called once per frame protected internal override void NodeGUI() { #if UNITY_EDITOR GUILayout.BeginHorizontal(); // first the object field. _abstractCheckable = (AbstractCheckable)EditorGUILayout.ObjectField(_abstractCheckable, typeof(AbstractCheckable), true); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); // second row. GUILayout.BeginVertical(); // sole input Inputs[0].DisplayLayout(); GUILayout.EndVertical(); GUILayout.BeginVertical(); Outputs[0].DisplayLayout(); // true output GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); // third row Outputs[1].DisplayLayout(); // false output GUILayout.EndHorizontal(); #endif }
protected internal override void NodeGUI() { #if UNITY_EDITOR // if we ever manage to break the UI again, then we have scrollbars. scroller = GUILayout.BeginScrollView(scroller); rect.height = 128 + 18 * Inputs.Count; // we can calculate a fixed node size with a fixed calculation ingredientName = GUILayout.TextField(ingredientName); // main dialogue GUILayout.BeginHorizontal(); // new row to throw our pre check in GUILayout.BeginVertical(); _preCheckables = (AbstractCheckable)EditorGUILayout.ObjectField(_preCheckables, typeof(AbstractCheckable), true); GUILayout.EndVertical(); GUILayout.BeginVertical(); // and the output on the same line Outputs[0].DisplayLayout(); GUILayout.EndVertical(); GUILayout.EndHorizontal(); // node description GUILayout.BeginHorizontal(); GUILayout.BeginVertical(); description = GUILayout.TextField(description); GUILayout.EndVertical(); GUILayout.EndHorizontal(); // node price GUILayout.BeginHorizontal(); GUILayout.BeginVertical(); price = EditorGUILayout.IntField(price); GUILayout.EndVertical(); GUILayout.EndHorizontal(); foreach (NodeInput input in Inputs) // then add all outputs { GUILayout.BeginHorizontal(); GUILayout.BeginVertical(); input.DisplayLayout(); GUILayout.EndVertical(); GUILayout.EndHorizontal(); } GUILayout.FlexibleSpace(); // Fills out the bottom // node option panel GUILayout.BeginHorizontal(); GUILayout.BeginVertical(); if (GUILayout.Button("Add Ingredient")) { CreateInput("Ingredient", "Void"); CheckTitleType(); NodeGUI(); } GUILayout.EndVertical(); GUILayout.BeginVertical(); if (GUILayout.Button("Remove Ingredient")) { DeleteInput(Inputs[Inputs.Count - 1]); CheckTitleType(); } GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.EndScrollView(); #endif }