private void InitializeData() { string typeName = AgentElement.GetClassifierName(Repository); TypeSuggestionProvider typeSuggestionProvider = SuggestionProvider as TypeSuggestionProvider; try { TypeDataModel setDataModel = typeSuggestionProvider.AvailableTypes.ToList().Find(model => model.Name.Equals(typeName)); if (setDataModel != null) { Type = setDataModel; } } catch (Exception) { } string name = AgentElement.Name; if (!name.StartsWith("FMC4SE Agent")) { Name = name; } else { Name = ""; } Kind = AgentElement.GetTaggedValueString("Type"); Notes = AgentElement.Notes; }
/// <summary> /// Initializes a new instance of the NewAgentViewModel class. /// </summary> public AgentPropertyViewModel(EAAPI.Repository repository, EAAPI.Element agentElement) : base(repository, agentElement) { SuggestionProvider = new TypeSuggestionProvider(repository); Kinds = new ObservableCollection <string> { "Standard", "Software", "Chain", "Electronic", "Mechanical", "WebService" }; InitializeData(); Title = "Agent Properties"; }
public ToolPropertyViewModel(EAAPI.Repository repository, EAAPI.Element agentElement) : base(repository, agentElement) { SuggestionProvider = new TypeSuggestionProvider(repository); Kinds = new ObservableCollection <string> { "<Nothing to select>" }; string name = AgentElement.Name; if (!name.StartsWith("Tool")) { Name = name; } else { Name = ""; } Title = "Tool Properties"; }
public override void OnInspectorGUI() { serializedObject.Update(); var tprop = serializedObject.FindProperty("_type"); var iprop = serializedObject.FindProperty("_instantiateOnAwake"); var bprop = serializedObject.FindProperty("_propertyBinding"); if (_autoSuggestField == null) { _suggestionProvider = new TypeSuggestionProvider(); _autoSuggestField = new AutoSuggestField( _suggestionProvider, new GUIContent(SearchFieldLabel), new AutoSuggestField.Options { DisplayMode = DisplayMode.Inline, }); } if (_searchString == null) { // On first frame, _searchString will be null. // After block line, it will be non-null. _tval = Type.GetType(tprop.stringValue); _searchString = _tval?.FullName ?? string.Empty; } _searchString = _autoSuggestField.OnGUI(_searchString); if (_suggestionProvider.SelectedTypeIsValid && Event.current.type == EventType.Layout) { _tval = _suggestionProvider.SelectedType; tprop.stringValue = _tval?.AssemblyQualifiedName; } if (_tval != null) { if (typeof(UnityEngine.Object).IsAssignableFrom(_tval)) { GUILayout.Label("Auto-instantiation not possible with UnityEngine.Object types"); } else { EditorGUILayout.PropertyField(iprop); EditorGUILayout.PropertyField(bprop); } } serializedObject.ApplyModifiedProperties(); var dc = target as DataContext; if (dc != null) { using (var disabledGroupScope = new EditorGUI.DisabledGroupScope(true)) { EditorGUILayout.Toggle("Value is non-null?", dc.Value != null); } } }