private static FindType ( string typeName ) : |
||
typeName | string | |
Résultat |
private bool DoTypeSelector() { if (this.m_EditingOther) { return(this.DoOtherEditing()); } int num = EditorGUILayout.Popup("Choose a type", -1, this.m_TypeNames, new GUILayoutOption[0]); if (num == -1) { return(false); } string text = this.m_TypeNames[num]; if (text == "Other...") { this.m_EditingOther = true; this.m_OtherTypeName = string.Empty; return(false); } int num2 = text.IndexOf('('); if (num2 != -1) { text = text.Substring(num2 + 1, text.IndexOf(')') - num2 - 1); } this.selectedType = TypeSelector.FindType(text); return(true); }
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); }