Ejemplo n.º 1
0
 void searchPropertyInternal(SearchJob job, SearchItem item, SerializedProperty prop, SerializedProperty iterator)
 {
     if (iterator.propertyType == typeField.PropertyType())
     {
         // Debug.Log("[SearchItemGlobal] Searching:"+iterator.propertyPath);
         if (typeField.ValueEqualsWithConditional(iterator))
         {
             if (item.subsearch != null)
             {
                 SearchItem subItem = (SearchItem)item.subsearch;
                 subItem.SubsearchProperty(job, prop);
             }
             else
             {
                 SearchResultProperty result = new SearchResultProperty(iterator, typeField.StringValueFor(iterator), job);
                 // If the prefab type is 'instance' then only add the
                 // search result if it is a modification to the original
                 // prefab.
                 // We iterate over prefab separately and the PrefabType will simply
                 // be 'Prefab' and we should handle that before we handle scenes.
                 if (result.pathInfo.prefabType == PrefabType.PrefabInstance)
                 {
                     if (job.options.searchType == SearchType.SearchAndReplace)
                     {
                         result.actionTaken = SearchAction.InstanceReplaced;
                     }
                     else
                     {
                         result.actionTaken = SearchAction.InstanceFound;
                     }
                     // if(item.subsearch == null && PrefabUtil.isInstanceModification(iterator))
                     // {
                     //Apply change, only if change already exists!
                     typeField.ReplaceProperty(job, iterator, result);
                     // }
                     job.MatchFound(result, item);
                 }
                 else
                 {
                     if (item.subsearch == null)
                     {
                         typeField.ReplaceProperty(job, iterator, result);
                     }
                     job.MatchFound(result, item);
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
        public override void SearchProperty(SearchJob job, SearchItem item, SerializedProperty prop)
        {
            //Time for some freakish magic!
            SerializedProperty iterator = prop.Copy();

            while (iterator.NextVisible(true))
            {
                if (typeField.PropertyType() == iterator.propertyType)
                {
                    //might need to add a guard against collections or something?
                    typeField.SearchProperty(job, item, iterator);
                }
            }
            // iterator.Next(true);
            // iterator.Next(true);
            // int count = iterator.intValue;
            // for(int i=0;i < count; i++)
            // {
            //   iterator.Next(false);
            //   typeField.SearchProperty(job, item, iterator);
            // }
        }
Ejemplo n.º 3
0
        public override void SearchProperty(SearchJob job, SearchItem item, SerializedProperty prop)
        {
            //Time for some freakish magic!
            SerializedProperty iterator = prop.Copy();

            while (iterator.NextVisible(true))
            {
                if (typeField.PropertyType() == iterator.propertyType)
                {
                    if (isSearchByName)
                    {
                        // path = prop.propertyPath + .data[x].second
                        var path = iterator.propertyPath;
                        // path = data[x].second
                        path = path.Substring(prop.propertyPath.Length + 1);
                        // path = data[x]
                        const string endOfPath = "].";
                        path = path.Substring(0, path.LastIndexOf(endOfPath) + endOfPath.Length);
                        if (prop.FindPropertyRelative(path + "first").stringValue != searchByNameValue)
                        {
                            continue;
                        }
                    }
                    //might need to add a guard against collections or something?
                    typeField.SearchProperty(job, item, iterator);
                }
            }
            // iterator.Next(true);
            // iterator.Next(true);
            // int count = iterator.intValue;
            // for(int i=0;i < count; i++)
            // {
            //   iterator.Next(false);
            //   typeField.SearchProperty(job, item, iterator);
            // }
        }