private bool DoTypeClear() { bool result = false; EditorGUILayout.LabelField("Type", TypeSelector.DotNetTypeNiceName(this.selectedType), new GUILayoutOption[0]); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); if (GUILayout.Button("Reset", EditorStyles.miniButton, new GUILayoutOption[0])) { this.selectedType = typeof(DummyNullType); result = true; } GUILayout.EndHorizontal(); return(result); }
private bool DoOtherEditing() { bool result = false; this.m_OtherTypeName = EditorGUILayout.TextField("Full type Name", this.m_OtherTypeName, new GUILayoutOption[0]); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); if (GUILayout.Button("Set", EditorStyles.miniButton, new GUILayoutOption[0])) { try { this.selectedType = TypeSelector.FindType(this.m_OtherTypeName); if (!this.m_OnlyComponents || typeof(Component).IsAssignableFrom(this.selectedType)) { this.m_OtherTypeName = string.Empty; this.m_EditingOther = false; this.m_ShownError = string.Empty; result = true; } this.m_ShownError = "Type must be derived from 'Component'."; } catch { this.m_ShownError = "Could not find a type '" + this.m_OtherTypeName + "'"; } } if (GUILayout.Button("Cancel", EditorStyles.miniButton, new GUILayoutOption[0])) { this.m_OtherTypeName = string.Empty; this.m_EditingOther = false; this.m_ShownError = string.Empty; } GUILayout.EndHorizontal(); if (!string.IsNullOrEmpty(this.m_ShownError)) { TypeSelector.ShowError(this.m_ShownError); } return(result); }
public TypeSelector() { this.Init(TypeSelector.GenericTypeSelectorCommonTypes(), false); }
public TypeSelector(bool onlyComponents) { this.Init((!onlyComponents) ? TypeSelector.GenericTypeSelectorCommonTypes() : TypeSelector.s_ComponentTypeNames, onlyComponents); }