Ejemplo n.º 1
0
        string subsearchWarning()
        {
            if (searchDepth > 0)
            {
                // This is the last search!
                SearchItem         p     = parent;
                SearchItemProperty child = this;
                if (child.subScope == SubsearchScope.SameObject)
                {
                    //Check parent info.
                    if (p is SearchItemProperty)
                    {
                        SearchItemProperty pItem = (SearchItemProperty)p;
                        if (pItem.objID.obj != null)
                        {
                            Type pt = pItem.objID.obj.GetType();
                            if (pItem.objID.obj is MonoScript)
                            {
                                pt = ((MonoScript)pItem.objID.obj).GetClass();
                            }

                            // We know this is a searchable type :)
                            if (objID.obj != null)
                            {
                                Type ct = child.objID.obj.GetType();
                                if (child.objID.obj is MonoScript)
                                {
                                    ct = ((MonoScript)child.objID.obj).GetClass();
                                }
                                if (pt.IsAssignableFrom(ct))
                                {
                                    //all good
                                }
                                else
                                {
                                    // Debug.Log("[SearchItemProperty] warn!!"+pt+" "+ ct);
                                    return(ct.Name + " does not inherit from " + pt.Name + " but the scope is set to 'Same Object'. This search will probably yield no results.");
                                }
                            }
                        }
                    }
                }
            }
            return(string.Empty);
        }
Ejemplo n.º 2
0
        public override void Draw()
        {
#if PSR_FULL
            if (dtd.parent.searchItem is SearchItemProperty)
            {
                SearchItemProperty propSearch = dtd.parent.searchItem as SearchItemProperty;
                if (objID.obj != propSearch.objID.obj)
                {
                    ObjectUtil.ValidateAndAssign(propSearch.objID.obj, objID, searchProperty, ref initializationContext);
                }
            }
            else
            {
                showDragAndDrop();
            }
            searchProperty.Draw();
            if (searchProperty.HasOptions())
            {
                initializationContext.updateFieldData(searchProperty.fieldData);
                // propertyCriteria.SetType(initializationContext);
                initializationContext.forceUpdate = false;

                // SearchOptions typeFieldOptions = options.Copy();
                // if(subsearch != null)
                // {
                //   typeFieldOptions.searchType = SearchType.Search;
                // }

                // propertyCriteria.Draw(typeFieldOptions);
                setType(initializationContext.fieldData.fieldType);

                if (subItem != null)
                {
                    subItem.options         = options;
                    subItem.showMoreOptions = showMoreOptions;
                    subItem.Draw();
                }
                else
                {
                    EditorGUILayout.LabelField("Unsupported type:" + type);
                }
            }
#endif
        }
Ejemplo n.º 3
0
        public void AddNew(string searchFor)
        {
            switch (searchFor)
            {
            case Keys.Property:
                SearchItemProperty itemProp = new SearchItemProperty();
                AddNew(itemProp);
                break;

            case Keys.Global:
                SearchItemGlobal itemGlobal = new SearchItemGlobal();
                AddNew(itemGlobal);
                break;

            case Keys.Instances:
                SearchItemInstances itemInstances = new SearchItemInstances();
                AddNew(itemInstances);
                break;
            }
            SRWindow.Instance.PersistSearch(this);
        }