Ejemplo n.º 1
0
        // Fixes nulls in serialization manually...*sigh*.
        public override void OnDeserialization()
        {
            if (typeField == null)
            {
                typeField = new DynamicTypeField();
            }
            typeHash                  = new Dictionary <string, Type>();
            typeHash["Object"]        = typeof(UnityEngine.Object);
            typeHash["Text"]          = typeof(string);
            typeHash["Float, Double"] = typeof(float);
            typeHash["Integer, Long"] = typeof(long);
            typeHash["Boolean"]       = typeof(bool);
            typeHash["Color"]         = typeof(Color);
            typeHash["Vector2"]       = typeof(Vector2);
            typeHash["Vector3"]       = typeof(Vector3);
            typeHash["Vector4"]       = typeof(Vector4);
            typeHash["Quaternion"]    = typeof(Quaternion);
            typeHash["Rect"]          = typeof(Rect);
            string classSearchLabel = "Scripts";

            typeHash[classSearchLabel] = typeof(Type);
            typeOptions = typeHash.Keys.ToArray();
            subTypeHash = new Dictionary <string, Type>(typeHash);
            subTypeHash.Remove(classSearchLabel);
            subTypeOptions = subTypeHash.Keys.ToArray();

            typeField.OnDeserialization(); // sigh...this is getting old.
            typeField.showMoreOptions = showMoreOptions;

            typeField.depth       = depth;
            initializationContext = new InitializationContext(typeHash[typeOptions[typeIndex]]);
            typeField.SetType(initializationContext);
            OnDeserializeSubSearch();
        }
Ejemplo n.º 2
0
        // Fixes nulls in serialization manually...*sigh*.
        public override void OnDeserialization()
        {
            if (objID == null)
            {
                objID = new ObjectID();
            }
            objID.OnDeserialization();
            if (searchProperty == null)
            {
                searchProperty = new PropertyPopupData();
            }
            searchProperty.label = "Property:";

            if (propertyCriteria == null)
            {
                propertyCriteria = new DynamicTypeField();
            }
            propertyCriteria.searchItem = this;
            propertyCriteria.OnDeserialization(); // sigh...this is getting old.
            propertyCriteria.showMoreOptions = showMoreOptions;

            searchProperty.SetType(objID.obj);
            initializationContext = new InitializationContext(searchProperty.fieldData, objID.obj);
            if (searchProperty.HasOptions())
            {
                propertyCriteria.SetType(initializationContext);
            }
            if (searchDepth == 0)
            {
                root = this;
            }
            OnDeserializeSubSearch();
        }
Ejemplo n.º 3
0
 void initTypeField()
 {
     if (typeField == null)
     {
         typeField = new DynamicTypeField();
         typeField.OnDeserialization();
     }
 }
Ejemplo n.º 4
0
        public override void Draw(SearchOptions options)
        {
            Type subType = parent.type.GetGenericArguments()[0];

            initializationContext = new InitializationContext(subType);

            // Debug.Log("[DynamicTypeCollection] array of "+subType);
            if (typeField == null)
            {
                typeField = new DynamicTypeField();
                typeField.OnDeserialization();
            }
            typeField.SetType(initializationContext);
            typeField.Draw(options);
        }
        // Fixes nulls in serialization manually...*sigh*.
        public override void OnDeserialization()
        {
            if (typeField == null)
            {
                typeField = new DynamicTypeField();
                typeField.showMoreOptions = true;
            }

            typeField.searchItem      = this;
            typeHash                  = new Dictionary <string, Type>();
            typeHash["Text"]          = typeof(string);
            typeHash["Object"]        = typeof(UnityEngine.Object);
            typeHash["Float, Double"] = typeof(float);
            typeHash["Integer, Long"] = typeof(long);
            typeHash["Boolean"]       = typeof(bool);
            typeHash["Color"]         = typeof(Color);
            typeHash["Vector2"]       = typeof(Vector2);
            typeHash["Vector3"]       = typeof(Vector3);
            typeHash["Vector4"]       = typeof(Vector4);
            typeHash["Quaternion"]    = typeof(Quaternion);
            typeHash["Rect"]          = typeof(Rect);
            string classSearchLabel = "Scripts";

            typeHash[classSearchLabel] = typeof(Type);
            typeOptions = typeHash.Keys.ToArray();
            subTypeHash = new Dictionary <string, Type>(typeHash);
            subTypeHash.Remove(classSearchLabel);
            subTypeOptions = subTypeHash.Keys.ToArray();

            typeField.OnDeserialization(); // sigh...this is getting old.
            typeField.showMoreOptions = showMoreOptions;

            typeField.depth       = depth;
            initializationContext = new InitializationContext(typeHash[typeOptions[typeIndex]]);

            // I feel like this could be improved. If perhaps we implement more places where
            // replace functionality becomes more complicated this should be revisited.
            DynamicTypeObject objData = (DynamicTypeObject)GetDTDFor(typeof(UnityEngine.Object));

            objData.InitReplaceOptionsForGlobal();
            typeField.SetType(initializationContext);
            OnDeserializeSubSearch();
        }
Ejemplo n.º 6
0
        public override void Draw(SearchOptions options)
        {
            Type subType = parent.type.GetGenericArguments()[0];

            initializationContext = new InitializationContext(subType);

//      Debug.Log("[DynamicTypeCollection] array of "+subType);
            if (typeField == null)
            {
                typeField = new DynamicTypeField();
                typeField.OnDeserialization();
            }
            if (isSearchByName)
            {
                EditorGUILayout.BeginHorizontal();
                GUILayout.Label("Field:", GUILayout.Width(SRWindow.compactLabelWidthNP));
                searchByNameValue = EditorGUILayout.TextField(searchByNameValue);
                EditorGUILayout.EndHorizontal();
            }
            typeField.SetType(initializationContext);
            typeField.Draw(options);
        }