Esempio n. 1
0
        public DynamicTypeData GetDTDFor(Type type)
        {
            DynamicTypeData retVal = null;

            typeHash.TryGetValue(type, out retVal);
            return(retVal);
        }
Esempio n. 2
0
 public override void SetParent(DynamicTypeData p)
 {
     base.SetParent(p);
     if (p is P)
     {
         parent = (P)p;
     }
 }
Esempio n. 3
0
        /**
         * When a user takes an action that changes the search, it may change the type.
         * This means we'll need to re-initialize the type of search we're doing.
         * The search item will create an InitializationContext which this class can
         * use to negotiate what DTD to use via various tests and reflection.
         */
        public void SetType(InitializationContext ic)
        {
            Type t = ic.fieldData.fieldType;

            if (t == type && !ic.forceUpdate)
            {
                return; //return early.
            }
            type = t;
            //Save the initial type, but check inheritance to find our editor.
            Type fieldType = type;

            if (typeof(UnityEngine.Object).IsAssignableFrom(type))
            {
                fieldType = typeof(UnityEngine.Object);
            }

            if (typeof(System.Enum).IsAssignableFrom(type))
            {
                fieldType = typeof(System.Enum);
            }
            if (type.IsArray)
            {
                fieldType = typeof(Array);
            }
            if (type.IsGenericType && type.GetGenericTypeDefinition().IsAssignableFrom(typeof(List <>)))
            {
                fieldType = typeof(List <>);
            }
            if (type.IsGenericType && type.GetGenericTypeDefinition().IsAssignableFrom(typeof(PropSheet <>)))
            {
                fieldType = typeof(PropSheet <>);
            }

            typeHash.TryGetValue(fieldType, out typeData);
            if (typeData == null && type.IsSerializable)
            {
                if (type.ToString().IndexOf("System.") == 0)
                {
                    // Debug.Log("[DynamicTypeField] ignoring system type..."+type);
                    return;
                }
                else
                {
                    //Failed finding field!
                    // Debug.Log("[DynamicTypeField] Failed finding field for:"+type);
                    // Debug.Log("[DynamicTypeField] using custom data.");
                    typeData = dynamicCustomData;
                }
            }
            // Debug.Log("[DynamicTypeField] type:"+typeData + " for field:"+fieldType + " fieldData.type:"+t);
            typeData.OnSelect(ic);
        }
Esempio n. 4
0
 public override void SetParent(DynamicTypeData p)
 {
     base.SetParent(p);
     replaceItemString.SetParent(p);
 }