public override void OnBodyGUI() { BaseNode node = target as BaseNode; StateGraph graph = node.graph as StateGraph; base.OnBodyGUI(); NodePort input = null; if (node.InstanceInputs.Count() > 0) { input = node.InstanceInputs.First(); } NodePort output = null; if (node.InstanceOutputs.Count() > 0) { output = node.InstanceOutputs.First(); } if (input == null) { NodeEditorGUILayout.VerticalPortField(null, output); } else if (output == null) { NodeEditorGUILayout.VerticalPortField(null, input); } else { NodeEditorGUILayout.VerticalPortPair(input, output); } }
private static void Show(DetailNode obj, Action beforeProperties = null) { //General NodeEditorGUILayout.PortField(obj.GetInputPort("Constraint")); NodeEditorGUILayout.PortField(obj.GetInputPort("Modifier")); obj.DistributionType = (DetailNode.Distribution)EditorGUILayout.EnumPopup("Distribution", obj.DistributionType); if (obj.DistributionType == DetailNode.Distribution.PoissonDisc) { obj.Spread = EditorGUIExtension.MinMaxFloatField("Spread", obj.Spread, 1f, 50f); } else { obj.UniformResolution = EditorGUIExtension.MinMaxIntField("Resolution", obj.UniformResolution, 2, 1024); } obj.MaxObjects = EditorGUILayout.IntField("Max Objects", obj.MaxObjects); if (beforeProperties != null) { beforeProperties(); } EditorGUIExtension.DrawMinMax("Width Scale", ref obj.WidthScale.x, ref obj.WidthScale.y); EditorGUIExtension.DrawMinMax("Height Scale", ref obj.HeightScale.x, ref obj.HeightScale.y); if (obj.MaxObjects < 1) { obj.MaxObjects = 1; } }
// Modify display method public override void OnBodyGUI() { if (_basicTileNode == null) { _basicTileNode = (BasicTileNode)target; } // Specifying the update method onUpdateNode = NodeUpdate; serializedObject.Update(); // Not needed can use TileNode field //SerializedProperty sp = serializedObject.FindProperty("tile"); //Tile tile = (Tile) sp.objectReferenceValue; //sp.objectReferenceValue = EditorGUILayout.ObjectField("Tile", tile, typeof(Tile), false); // Specific unity object picker for tile _basicTileNode.tile = (Tile)EditorGUILayout.ObjectField("Tile", _basicTileNode.tile, typeof(Tile), false, GUILayout.ExpandWidth(true)); // Refresh image preview if (_basicTileNode.tile != null) { LoadTexture(_basicTileNode.tile.sprite); } if (_tileImg != null) { EditorGUILayout.LabelField(new GUIContent(_tileImg)); } NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("tile")); serializedObject.ApplyModifiedProperties(); }
public override void OnBodyGUI() { if (_actionSetterNode == null) { _actionSetterNode = (ActionSetterNode)target; } serializedObject.Update(); if (_actionSetterNode.SelectedSerializableInfo != null && _actionSetterNode.SerializableInfos.Count > 0) { NodePort valuePort = _actionSetterNode.GetPort(nameof(_actionSetterNode.Value)); valuePort.ValueType = _actionSetterNode.SelectedSerializableInfo.Type; NodeEditorGUILayout.PortField(valuePort); string[] choices = _actionSetterNode.SerializableInfos.Select(info => info.Name).ToArray(); int choiceIndex = EditorGUILayout.Popup(_actionSetterNode.ChoiceIndex, choices); if (choiceIndex != _actionSetterNode.ChoiceIndex) { UpdateChoice(choiceIndex); } _actionSetterNode.SelectedSerializableInfo = _actionSetterNode.SerializableInfos.ElementAt(_actionSetterNode.ChoiceIndex); NodePort dataPort = _actionSetterNode.GetPort(nameof(_actionSetterNode.Data)); NodeEditorGUILayout.AddPortField(dataPort); NodePort linkedOptionPort = _actionSetterNode.GetPort(nameof(_actionSetterNode.LinkedOption)); NodeEditorGUILayout.AddPortField(linkedOptionPort); } else { NodeEditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(_actionSetterNode.Data))); } serializedObject.ApplyModifiedProperties(); }
/// <summary> /// Shows a map in this node with the passed information /// </summary> /// <param name="mapProperty">Name of the serialized map generator property</param> /// <param name="minMaxMaskProperty">Name of the serialized float min max mask property</param> /// <param name="useMapProperty">Name of the serialized bool use map property</param> /// <param name="displayName">Display name of this map (heightmap, temperature, etc)</param> private void ShowMapField(string mapProperty, string minMaxMaskProperty, string useMapProperty, string displayName) { SerializedProperty mapProp = serializedObject.FindProperty(mapProperty); SerializedProperty minMaxProp = serializedObject.FindProperty(minMaxMaskProperty); SerializedProperty useMapProp = serializedObject.FindProperty(useMapProperty); EditorGUILayout.PropertyField(useMapProp, new GUIContent(displayName)); //Use this map as a mask if (useMapProp.boolValue) { EditorGUI.indentLevel++; NodeEditorGUILayout.PropertyField(mapProp, new GUIContent("Generator")); //Min / Max Slider Rect ctrl = EditorGUILayout.GetControlRect(false, EditorGUIUtility.singleLineHeight); EditorGUI.BeginProperty(ctrl, GUIContent.none, minMaxProp); EditorGUI.BeginChangeCheck(); Vector2 minMaxVal = minMaxProp.vector2Value; EditorGUI.MinMaxSlider(ctrl, ref minMaxVal.x, ref minMaxVal.y, 0f, 1f); //Modify serialized value if changed if (EditorGUI.EndChangeCheck()) { minMaxProp.vector2Value = minMaxVal; } EditorGUI.EndProperty(); EditorGUI.indentLevel--; } }
public override void OnBodyGUI() { ChannelInNode target = ((ChannelInNode)this.target); foreach (NodePort port in target.Inputs) { NodeEditorGUILayout.PortField(port); } foreach (NodePort port in target.Outputs) { NodeEditorGUILayout.PortField(port); } if (target.initialized) { target.Link(); if (target.Receiver != null) { target.address = EditorGUILayout.TextField("Address:", target.address); target.Bind(target.Receiver, target.address); if (target.channel != null) { EditorGUILayout.LabelField("Value:", target.channel.value.ToString()); } } //Selection.activeGameObject = target.Receiver.gameObject; } }
public override void OnBodyGUI() { _subgraph = serializedObject.FindProperty("subgraph"); serializedObject.Update(); EditorGUIUtility.labelWidth = 60; foreach (var stateIn in _node.inputStates) { NodeEditorGUILayout.PortField(stateIn); } foreach (var stateOut in _node.outputStates) { NodeEditorGUILayout.PortField(stateOut); } EditorGUILayout.Space(); NodeEditorGUILayout.PropertyField(_subgraph); serializedObject.ApplyModifiedProperties(); if (!(_node.graph is IBrainGraph graph)) { return; } if (!ReferenceEquals(graph.StartingNode, _node) && GUILayout.Button(C.LABEL_SET_AS_STARTING_STATE)) { graph.StartingNode = _node; } }
public override void OnBodyGUI() { OSCReceiverNode target = ((OSCReceiverNode)this.target); foreach (NodePort port in target.Inputs) { NodeEditorGUILayout.PortField(port); } foreach (NodePort port in target.Outputs) { NodeEditorGUILayout.PortField(port); } if (target.initialized) { target.Link(); if (target.Receiver != null) { foreach (string channel in target.Receiver.values.Keys) { EditorGUILayout.TextField(channel, target.Receiver.values[channel].ToString()); } } } }
public override void OnBodyGUI() { //Because we're not calling base.OnBodyGUI //change checks need to be performed manually EditorGUI.BeginChangeCheck(); //IO NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("Output")); NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("Generator")); NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("Uniform")); if (Sn.Uniform) { NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("Amount")); } else { NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("Factor")); } if (EditorGUI.EndChangeCheck()) { Sn.OnValueChange(); } }
/// <summary>Draw node's body GUI.</summary> public override void OnBodyGUI() { base.OnBodyGUI(); _decorator = target as BTDecoratorNode; // Check if we need to create new exit. _child = target.GetOutputPort("_child"); if (_child == null) { _child = target.AddInstanceOutput(typeof(BTConnection), Node.ConnectionType.Override, "_child"); } // Output port field. GUILayout.BeginHorizontal(); EditorGUILayout.Space(); NodeEditorGUILayout.PortField(_child, GUILayout.Width(60)); GUILayout.EndHorizontal(); // Update connection values. if (_child.Connection == null) { _connection = null; _decorator.Child = null; } else if (_child.Connection.node != _connection) { _connection = _child.Connection.node; _decorator.Child = new BTConnection(_decorator, _child.fieldName); } }
public override void OnBodyGUI() { if (_dataSelectorNode == null) { _dataSelectorNode = (DataSelectorNode)target; } serializedObject.Update(); if (_dataSelectorNode.SerializableInfos.Count > 0) { string[] choices = _dataSelectorNode.SerializableInfos.Select(info => info.Name).ToArray(); //BUG-fred ArgumentException: Getting control 2's position in a group with only 2 controls when doing mouseUp _dataSelectorNode.ChoiceIndex = EditorGUILayout.Popup(_dataSelectorNode.ChoiceIndex, choices); _dataSelectorNode.SelectedSerializableInfo = _dataSelectorNode.SerializableInfos.ElementAt(_dataSelectorNode.ChoiceIndex); NodePort dataPort = _dataSelectorNode.GetPort(nameof(_dataSelectorNode.Data)); NodeEditorGUILayout.AddPortField(dataPort); NodePort nodePort = _dataSelectorNode.GetPort(nameof(_dataSelectorNode.Output)); nodePort.ValueType = _dataSelectorNode.SelectedSerializableInfo.Type; NodeEditorGUILayout.AddPortField(nodePort); } else { NodeEditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(_dataSelectorNode.Data))); } serializedObject.ApplyModifiedProperties(); }
public override void OnBodyGUI() { GUI.color = Color.white; NodeEditorGUILayout.PortField(target.GetInputPort("enter")); NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("message"), GUIContent.none); DrawFooterGUI(); }
public void drawComponent(NodeIComponent component) { SirenixEditorGUI.BeginBoxHeader(); component.style.unfolded = SirenixEditorGUI.Foldout(component.style.unfolded, component.component.GetType().ToString()); Rect rect = GUILayoutUtility.GetLastRect(); SirenixEditorGUI.EndBoxHeader(); NodeEditorGUILayout.AddPortField(component.port); if (component.style.unfolded) { SirenixEditorGUI.BeginBox(); if (component.tree == null) { GUILayout.Label("the tree is null somehow"); } if (component.tree != null) { component.tree.Draw(false); } else { component.tree = PropertyTree.Create(component.component); component.tree.Draw(false); } //Debug.Log(component.tree.WeakTargets); SirenixEditorGUI.EndBox(); } }
public void drawEntity(NodeMEntity entity) { string name = "Entity"; if (entity.entityName != "") { name = entity.entityName; } if (entity.orientation == PortOrientation.In) { //SirenixEditorGUI. SirenixEditorGUI.BeginIndentedHorizontal(); SirenixEditorGUI.BeginBox(); Rect rect = EditorGUILayout.GetControlRect(); // rect = EditorGUI.PrefixLabel(rect, new GUIContent(" ")); rect = EditorGUI.PrefixLabel(rect, new GUIContent(name)); if (GUI.Button(rect.AlignRight(15), EditorIcons.ArrowDown.Raw)) { entity.style.unfolded = !entity.style.unfolded; } ; SirenixEditorGUI.EndBox(); SirenixEditorGUI.EndIndentedHorizontal(); // NodeEditorGUILayout.AddPortField(entity.port); } else { SirenixEditorGUI.BeginBox(); Rect rect = EditorGUILayout.GetControlRect(); EditorGUI.LabelField(rect.AlignRight(80), name); if (GUI.Button(rect.AlignLeft(15), EditorIcons.ArrowDown.Raw)) { entity.style.unfolded = !entity.style.unfolded; } ; SirenixEditorGUI.EndBox(); // NodeEditorGUILayout.AddPortField(entity.port); } // entity.style.unfolded = SirenixEditorGUI.Foldout(entity.style.unfolded, ""); if (entity.style.unfolded) { SirenixEditorGUI.BeginBox(); for (int i = 0; i < entity.components.Count; i++) { drawComponent(entity.components[i]); } SirenixEditorGUI.EndBox(); } else { NodeEditorGUILayout.AddPortField(entity.port); } }
/// <inheritdoc /> public override void OnBodyGUI() { SOFlowEditorUtilities.AdjustTextContrast(GetTint()); serializedObject.Update(); BranchNode branch = (BranchNode)target; NodePort entryPort = GetDynamicPort("Entry", true, Node.ConnectionType.Multiple); NodePort defaultPort = GetDynamicPort("Default", false); SOFlowEditorUtilities.DrawHorizontalColourLayer(SOFlowEditorSettings.TertiaryLayerColour, () => { NodeEditorGUILayout.PortField(entryPort); }); SOFlowEditorUtilities.RestoreTextContrast(); NodeEditorGUILayout.DynamicPortList(nameof(branch.Conditions), typeof(Node), serializedObject, NodePort.IO.Output, Node.ConnectionType.Override); SOFlowEditorUtilities.DrawHorizontalColourLayer(SOFlowEditorSettings.TertiaryLayerColour, () => { NodeEditorGUILayout.PortField(defaultPort); }); serializedObject.ApplyModifiedProperties(); }
public override void OnBodyGUI() { NodeEditorGUILayout.PortField(target.GetPort("input")); OutNode noiseNode = target as OutNode; Rect lastRect = GUILayoutUtility.GetLastRect(); Rect toggleRect = new Rect(lastRect) { width = 18, height = 18, y = lastRect.y + EditorGUIUtility.singleLineHeight, x = (GetWidth() - 18f) / 2 }; noiseNode.ShowTextureInEditor = EditorGUI.Toggle(toggleRect, noiseNode.ShowTextureInEditor, NodeEditorResources.styles.preview); GUILayoutUtility.GetRect(toggleRect.width, toggleRect.height); if (noiseNode.ShowTextureInEditor) { if (noiseNode.HasTexture) { Rect textureRect = new Rect(toggleRect) { width = GetWidth() * 0.95f, height = GetWidth() * 0.8f / noiseNode.GetGraph.Ratio, y = toggleRect.y + EditorGUIUtility.singleLineHeight * 2 }; textureRect.x = (GetWidth() - textureRect.width) / 2; GUILayoutUtility.GetRect(textureRect.width, textureRect.height + EditorGUIUtility.singleLineHeight); EditorGUI.DrawPreviewTexture(textureRect, noiseNode.GetInputTexture); } } }
public override void OnBodyGUI() { if (node == null) { node = target as MovesetAttackNode; } serializedObject.Update(); NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("lastNode")); NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("attackDefinition")); executeList.DoLayoutList(); inputSequence.DoLayoutList(); // Draw GUI NodeEditorGUILayout.DynamicPortList( "nextNode", // field name typeof(nextNodeDefinition), // field type serializedObject, // serializable object NodePort.IO.Output); // onCreate override. This is where the magic happens. serializedObject.ApplyModifiedProperties(); }
private void DrawPorts(Group node) { EditorGUILayout.BeginHorizontal(); NodeEditorGUILayout.PortField(new GUIContent("Input"), target.GetInputPort("input"), GUILayout.MinWidth(0)); NodeEditorGUILayout.PortField(new GUIContent("Output"), target.GetOutputPort("output"), GUILayout.MinWidth(0)); EditorGUILayout.EndHorizontal(); }
public override void OnBodyGUI() { // Only change the selected bool when the event is Layout, if it is changed on another event, // the gui throws an exception due to mismatched state between calls if (Event.current.type == EventType.Layout) { _selected = Selection.activeObject == target; } if (_variableNode == null) { _variableNode = (DialogueVariableNode)target; } serializedObject.Update(); var dialogueGraph = (DialogueGraph)_variableNode.graph; var options = dialogueGraph.Variables.Keys.ToArray(); var selectedValue = EditorGUILayout.Popup("Variable:", options.ToList().IndexOf(_variableNode.VariableName), options); _variableNode.VariableName = selectedValue >= 0 ? options[selectedValue] : ""; if (!string.IsNullOrWhiteSpace(_variableNode.VariableName)) { EditorGUILayout.LabelField($"Value:\t{dialogueGraph.Variables[_variableNode.VariableName]}"); } NodeEditorGUILayout.AddPortField(_variableNode.GetPort(nameof(_variableNode.Value))); // Apply property modifications serializedObject.ApplyModifiedProperties(); }
public override void OnBodyGUI() { _statesIn = serializedObject.FindProperty("statesIn"); if (Selection.activeObject == _node) { var optionsList = _node.graph.nodes .OfType <AIBrainStateNode>() .Select(node => node.name) .ToList(); optionsList.AddRange(_node.graph.nodes .OfType <AIBrainSubgraphNode>() .SelectMany(node => node.inputStates .Select(inputState => GeneratorUtils.GetSubgraphStateName(node.name, inputState.fieldName)))); if (optionsList.Count > 0) { var options = optionsList.ToArray(); _stateIndex = EditorGUILayout.Popup(_stateIndex, options); EditorGUILayout.Space(); _node.stateName = options[_stateIndex]; } else { EditorGUILayout.LabelField(C.LABEL_NO_STATE_AVAILABLE); EditorGUILayout.Space(); } } serializedObject.Update(); NodeEditorGUILayout.PropertyField(_statesIn); serializedObject.ApplyModifiedProperties(); }
public override void OnBodyGUI() { if (target == null) { Debug.LogWarning("Null target node for node editor!"); return; } NodePort input = target.GetPort("input"); GUILayout.BeginHorizontal(); if (input != null) { NodeEditorGUILayout.PortField(GUIContent.none, input, GUILayout.MinWidth(0)); } var node = target as ActionNode; var graph = node.graph as DecisionTreeGraph; node.Selected = EditorGUILayout.Popup(node.Selected, graph.ActionTypes, GUILayout.Width(150)); GUILayout.EndHorizontal(); EditorGUIUtility.labelWidth = 60; base.OnBodyGUI(); }
public override void OnBodyGUI() { serializedObject.Update(); DialogueChatNode node = target as DialogueChatNode; EditorGUILayout.PropertyField(serializedObject.FindProperty("character"), GUIContent.none); if (node.answers == null || node.answers.Count == 0) { GUILayout.BeginHorizontal(); NodeEditorGUILayout.PortField(GUIContent.none, target.GetInputPort("input"), GUILayout.MinWidth(0)); NodeEditorGUILayout.PortField(GUIContent.none, target.GetOutputPort("output"), GUILayout.MinWidth(0)); GUILayout.EndHorizontal(); } else { NodeEditorGUILayout.PortField(GUIContent.none, target.GetInputPort("input")); } GUILayout.Space(-30); NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("content"), GUIContent.none); NodeEditorGUILayout.DynamicPortList("answers", typeof(DialogueBaseNode), serializedObject, NodePort.IO.Output, Node.ConnectionType.Override); serializedObject.ApplyModifiedProperties(); }
public override void OnBodyGUI() { // Only change the selected bool when the event is Layout, if it is changed on another event, // the gui throws an exception due to mismatched state between calls if (Event.current.type == EventType.Layout) { _selected = Selection.activeObject == target; } if (_numberForkNode == null) { _numberForkNode = (DialogueNumberForkNode)target; } NodeEditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(_numberForkNode.InputNode))); NodeEditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(_numberForkNode.Variable))); var validFloat = float.TryParse(EditorGUILayout.TextField("Compare To", _numberForkNode.ComparisonValue.ToString(CultureInfo.CurrentCulture)), out var parsed); if (validFloat) { _numberForkNode.ComparisonValue = parsed; } NodeEditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(_numberForkNode.Bigger))); NodeEditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(_numberForkNode.Equal))); NodeEditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(_numberForkNode.Smaller))); serializedObject.ApplyModifiedProperties(); }
public override void OnBodyGUI() { if (_actionLauncherNode == null) { _actionLauncherNode = (ActionLauncherNode)target; } serializedObject.Update(); if (_actionLauncherNode.SerializableInfos.Count > 0) { foreach (NodePort dynamicInput in _actionLauncherNode.DynamicInputs) { NodeEditorGUILayout.PortField(dynamicInput); } string[] choices = _actionLauncherNode.SerializableInfos.Select(info => info.Name).ToArray(); //BUG-fred ArgumentException: Getting control 2's position in a group with only 2 controls when doing mouseUp int choiceIndex = EditorGUILayout.Popup(_actionLauncherNode.ChoiceIndex, choices); if (choiceIndex != _actionLauncherNode.ChoiceIndex) { UpdateChoice(choiceIndex); } _actionLauncherNode.SelectedSerializableInfo = _actionLauncherNode.SerializableInfos .ElementAt(_actionLauncherNode.ChoiceIndex); NodePort dataPort = _actionLauncherNode.GetPort(nameof(_actionLauncherNode.Data)); NodeEditorGUILayout.AddPortField(dataPort); NodePort linkedOptionPort = _actionLauncherNode.GetPort(nameof(_actionLauncherNode.LinkedOption)); NodeEditorGUILayout.AddPortField(linkedOptionPort); } else { NodeEditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(_actionLauncherNode.Data))); } serializedObject.ApplyModifiedProperties(); }
public static void DrawPortHandle(NodePort port, int overridePortHeight = -1) { var nodeEditorWindow = NodeEditorWindow.current; if (nodeEditorWindow == null) { return; } NodeEditor nodeEditor = NodeEditor.GetEditor(port.node, nodeEditorWindow); var portPosition = EditorGUILayout.GetControlRect(false, 0, GUILayout.Width(0), GUILayout.Height(overridePortHeight >= 0 ? overridePortHeight : EditorGUIUtility.singleLineHeight)); // Inputs go on the left, outputs on the right if (port.IsInput) { NodeEditorGUILayout.PortField( new Vector2(0, portPosition.y), port ); } else { NodeEditorGUILayout.PortField( new Vector2(nodeEditor.GetWidth() - 16, portPosition.y), port ); } }
public override void OnBodyGUI() { serializedObject.Update(); var node = target as HumanItemConditionNode; EditorGUIUtility.labelWidth = 60; NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("itemId")); if (node.itemId != null && node.itemId.Length > 0) { var style = new GUIStyle(GUI.skin.label) { alignment = TextAnchor.MiddleRight }; if (MMX.ItemStorage.shared.items.ContainsKey(node.itemId)) { var item = MMX.ItemStorage.shared.items[node.itemId]; EditorGUILayout.LabelField(item.name, style, GUILayout.ExpandWidth(true)); } else { EditorGUILayout.LabelField("Invalid Item Id", style, GUILayout.ExpandWidth(true)); } } NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("comparisonOperator")); NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("count")); NodeEditorGUILayout.PortField(target.GetOutputPort("output")); serializedObject.ApplyModifiedProperties(); }
public override void OnBodyGUI() { // Only change the selected bool when the event is Layout, if it is changed on another event, // the gui throws an exception due to mismatched state between calls if (Event.current.type == EventType.Layout) { _selected = Selection.activeObject == target; } if (_variableChangeNode == null) { _variableChangeNode = (DialogueVariableChangeNode)target; } serializedObject.Update(); var dialogueGraph = (DialogueGraph)_variableChangeNode.graph; NodeEditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(_variableChangeNode.PredecessorNode))); NodeEditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(_variableChangeNode.SuccessorNode))); var options = dialogueGraph.Variables.Keys.ToArray(); var selectedValue = EditorGUILayout.Popup("Variable:", options.ToList().IndexOf(_variableChangeNode.VariableName), options); _variableChangeNode.VariableName = selectedValue >= 0 ? options[selectedValue] : ""; NodeEditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(_variableChangeNode.Value))); // Apply property modifications serializedObject.ApplyModifiedProperties(); }
public override void OnBodyGUI() { serializedObject.Update(); GUILayout.BeginHorizontal(); { NodeEditorGUILayout.PortField(new GUIContent("Prev"), target.GetInputPort("prev"), GUILayout.Width(30)); DrawTextSupplements(); GUILayout.BeginVertical(GUILayout.Width(55)); { NodeEditorGUILayout.PortField(new GUIContent("Success"), target.GetOutputPort("success"), GUILayout.Width(55)); NodeEditorGUILayout.PortField(new GUIContent("Fail"), target.GetOutputPort("fail"), GUILayout.Width(55)); } GUILayout.EndVertical(); } GUILayout.EndHorizontal(); NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("text"), new GUIContent("Text"), false); NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("synonims")); GUILayout.BeginHorizontal(); { NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("blacklist"), true, GUILayout.Width(100)); NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("whitelist"), true, GUILayout.Width(10)); } GUILayout.EndHorizontal(); // Apply property modifications serializedObject.ApplyModifiedProperties(); }
public override void OnBodyGUI() { if (_dataReaderNode == null) { _dataReaderNode = (DataReaderNode)target; } serializedObject.Update(); EditorGUILayout.LabelField("Iterated Data", EditorStyles.boldLabel); foreach (KeyValuePair <string, SerializableInfo> valuePair in _dataReaderNode.InfoDictionary.OrderBy(pair => pair.Value.Order)) { if (!valuePair.Value.IsIteratable) { continue; } NodeEditorGUILayout.PortField(_dataReaderNode.GetOutputPort(valuePair.Value.PortName)); } EditorGUILayout.LabelField("Simple Data", EditorStyles.boldLabel); foreach (KeyValuePair <string, SerializableInfo> valuePair in _dataReaderNode.InfoDictionary.OrderBy(pair => pair.Value.Order)) { if (valuePair.Value.IsIteratable) { continue; } NodeEditorGUILayout.PortField(_dataReaderNode.GetOutputPort(valuePair.Value.PortName)); } serializedObject.ApplyModifiedProperties(); }
public override void OnBodyGUI() { AnimatorParameterNode target = ((AnimatorParameterNode)this.target); target.parameter = (AnimatorParameterSetter)EditorGUILayout.ObjectField("Parameter", target.parameter, typeof(AnimatorParameterSetter), true); foreach (NodePort port in target.Inputs) { NodeEditorGUILayout.PortField(port); } foreach (NodePort port in target.Outputs) { NodeEditorGUILayout.PortField(port); } if (target.initialized) { target.Link(); if (target.animator != null) { string[] options = new string[target.animator.parameterCount]; for (int p = 0; p < target.animator.parameterCount; ++p) { options[p] = target.animator.parameters[p].name; } target.selected = EditorGUILayout.Popup("Label", target.selected, options); //target.parameterName = EditorGUILayout.TextField("Parameter name:", options[target.selected]); target.Bind(target.animator, target.parameterName); if (target.parameter != null) { EditorGUILayout.LabelField("Value:", target.parameter.value.ToString()); } } } }