protected override void onGUI() { PortalExecution myTarget = (PortalExecution)target; EditorGUIExtension.SimpleBox("", 5, "", delegate() { // IS INPUT if (_outputPortals.Count > 0) { myTarget.IsInput = InputToggle(myTarget.IsInput); } else { EditorGUILayout.Toggle("Is Input", myTarget.IsInput); EditorGUILayout.HelpBox("You can't set this node to Input," + "You need at least one output execution portal in the graph", MessageType.Info); } // PORTAL NAME if (myTarget.IsInput) { if (_portalNames.Draw("Portal Name")) { // Set the connected portal. myTarget.OutputPortal = _outputPortals[_portalNames.Index]; } } else { myTarget.PortalName = PortalNameField(myTarget.PortalName); } }); }
public override void OnInspectorGUI() { Node myTarget = (Node)target; EditorGUI.BeginChangeCheck(); if (myTarget is INodeCollection || NameEditable) { EditorGUIExtension.SimpleBox("", 5, "", delegate() { myTarget.Name = EditorGUILayout.TextField("Name", myTarget.Name); }); } else if (myTarget is ITypedNode) { ITypedNode t = (ITypedNode)myTarget; EditorGUIExtension.SimpleBox("", 5, "", delegate() { if (_typePopup == null) { int index = 0; List <string> names = new List <string>(); for (int cnt = 0; cnt < t.AllowedTypes.Count; cnt++) { if (t.Type == t.AllowedTypes[cnt]) { index = cnt; } names.Add(TypeUtils.GetPrettyName(t.AllowedTypes[cnt])); } _typePopup = new SmartPopup(names, index); } if (_typePopup.Draw("Value Type")) { t.Type = t.AllowedTypes[_typePopup.Index]; } }); } EditorGUILayout.Space(); onGUI(); if (EditorGUI.EndChangeCheck()) { myTarget.HasChanges = true; } }