protected override void Init() { _aQNameProperty = serializedObject.FindProperty(GetAQNamePropertyName()); if (_aQNameProperty == null) { throw new NullReferenceException($"没有找到名为:'{GetAQNamePropertyName()}'的属性"); } var types = TypeUtil.GetRuntimeFilterTypes .Where(x => GetBaseType().IsAssignableFrom(x) && !x.IsInterface && !x.IsAbstract); if (types.Count() == 0) { Debug.LogWarning($"No {GetBaseType()} Types"); return; } _typeSelectWindow = new SimpleTypeSelectPopupWindow(true, types); _typeSelectWindow.OnChangeTypeSelect = type => { _aQNameProperty.stringValue = type.AssemblyQualifiedName; serializedObject.ApplyModifiedProperties(); UpdateDynamicPort(); }; }
private void OnEnable() { if (_types == null) { _types = TypeUtil.GetRuntimeFilterTypes.ToArray(); _ValueEditPopup = new ValueEditPopupWindow(); _ValueEditPopup.OnEdit = _save; _simpleTypeSelect = new SimpleTypeSelectPopupWindow(true, _types); } _varMapSer = serializedObject.FindProperty(IcSkillGroup.VarMapFieldName); _group = (IcSkillGroup)target; }
protected override void Init() { _valueNode = (ValueNode)target; _valueOutPut = _valueNode.GetOutputPort(ValueNode.ValueOutPutPortName); if (_valueOutPut != null) { if (_valueOutPut.ValueType == null) { _valueOutPut.ValueType = _valueNode.ValueType; } } windowContent = new SimpleTypeSelectPopupWindow(true); windowContent.OnChangeTypeSelect = type => { _valueOutPut.ValueType = type; windowContent.editorWindow.Close(); serializedObject.ApplyModifiedProperties(); serializedObject.UpdateIfRequiredOrScript(); }; }
private void _valueTypeSelect(ReorderableList list, Rect rect, int index, bool isActive, bool isFocused) { if (_typeSelectPopupWindow == null) { _typeSelectPopupWindow = new SimpleTypeSelectPopupWindow(true, TypeUtil.GetRuntimeTypes); } var newRect = new Rect(rect); newRect.position = new Vector2(GetWidth() - 40, newRect.position.y); newRect.size = new Vector2(18, 18); if (GUI.Button(newRect, "T")) { _typeSelectPopupWindow.OnChangeTypeSelect = type => { _typeSelectPopupWindow.editorWindow.Close(); NodePort port = (NodePort)list.list[index]; port.ValueType = type; _updateGetChildNodeGroup((group, node) => { var nodePort = node.GetPort(port.fieldName); nodePort.ValueType = type; }); }; newRect = rect; newRect.position += new Vector2(0, 20); PopupWindow.Show(newRect, _typeSelectPopupWindow); } }
protected override void OnInit() { _valueNode = (SystemObjectConditionNode)target; if (windowContent == null) { List <Type> types = new List <Type>(); foreach (var unityRuntimeType in TypeUtil.UnityRuntimeTypes) { if (typeof(ValueNode).IsAssignableFrom(unityRuntimeType)) { var valueField = unityRuntimeType.GetField("_value", BindingFlags.Instance | BindingFlags.NonPublic); if (valueField != null) { types.Add(valueField.FieldType); } } } windowContent = new SimpleTypeSelectPopupWindow(true, types); } _refreshInputPort(); windowContent.OnChangeTypeSelect = type => { _aInput.ValueType = type; _bInput.ValueType = type; windowContent.editorWindow.Close(); serializedObject.ApplyModifiedProperties(); serializedObject.UpdateIfRequiredOrScript(); }; }