public bool DoTypeKindGUI() { bool changed = GUI.changed; GUI.changed = false; this.selectedTypeKind = (TypeSelector.TypeKind)EditorGUILayout.Popup("Kind", (int)this.selectedTypeKind, TypeSelector.s_TypeKindNames, new GUILayoutOption[0]); bool changed2 = GUI.changed; GUI.enabled |= changed; return(changed2); }
public static Type GetFinalType(TypeSelector.TypeKind typeKind, Type baseType) { switch (typeKind) { case TypeSelector.TypeKind.Simple: return(baseType); case TypeSelector.TypeKind.List: return(typeof(List <>).MakeGenericType(new Type[] { baseType })); case TypeSelector.TypeKind.Array: return(baseType.MakeArrayType()); default: throw new ArgumentException("Internal error: got weird type kind"); } }
public static Type GetBaseType(TypeSelector.TypeKind typeKind, Type finalType) { if (finalType == null) { return(null); } switch (typeKind) { case TypeSelector.TypeKind.Simple: return(finalType); case TypeSelector.TypeKind.List: return(finalType.GetGenericArguments()[0]); case TypeSelector.TypeKind.Array: return(finalType.GetElementType()); default: throw new ArgumentException("Internal error: got weird type kind"); } }