Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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");
            }
        }
Ejemplo n.º 3
0
        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");
            }
        }