| 1234567891011121314151617181920212223242526272829303132333435363738394041 | using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEditor;using UnityEditor.UIElements;using UnityEditor.Experimental.GraphView;using UnityEngine.UIElements;using System.Linq;namespace GraphProcessor{	public class ExposedParameterFieldView : BlackboardField	{		protected BaseGraphView	graphView;		public ExposedParameter	parameter { get; private set; }		public ExposedParameterFieldView(BaseGraphView graphView, ExposedParameter param) : base(null, param.name, param.shortType)		{			this.graphView = graphView;			parameter = param;			this.AddManipulator(new ContextualMenuManipulator(BuildContextualMenu));			this.Q("icon").AddToClassList("parameter-" + param.shortType);			this.Q("icon").visible = true;			(this.Q("textField") as TextField).RegisterValueChangedCallback((e) => {				param.name = e.newValue;				text = e.newValue;				graphView.graph.UpdateExposedParameterName(param, e.newValue);			});        }		void BuildContextualMenu(ContextualMenuPopulateEvent evt)        {            evt.menu.AppendAction("Rename", (a) => OpenTextEditor(), DropdownMenuAction.AlwaysEnabled);            evt.menu.AppendAction("Delete", (a) => graphView.graph.RemoveExposedParameter(parameter), DropdownMenuAction.AlwaysEnabled);            evt.StopPropagation();        }	}}
 |