示例#1
0
        protected override void Reload()
        {
            assets.Clear();
#if USE_ADDRESSABLES
            assets.AddRange(AddrHelper.GetScenes());
#else
            assets.AddRange(ResourcesAssetHelper.GetScenes());
#endif
        }
示例#2
0
        protected override void Reload()
        {
            assets.Clear();

#if USE_ADDRESSABLES
            if (fieldInfo.GetChildValueType().BaseType.Name.Contains("LinkToScriptable"))
            {
                assets.AddRange(AddrHelper.GetScriptableObjectsWithInterface(type));
            }
            else
            {
                assets.AddRange(AddrHelper.GetPrefabsWithComponent(type));
            }
#else
            if (fieldInfo.GetChildValueType().BaseType.Name.Contains("LinkToScriptable"))
            {
                assets.AddRange(ResourcesAssetHelper.GetScriptableObjectsWithInterface(type));
            }
            else
            {
                assets.AddRange(ResourcesAssetHelper.GetPrefabsWithComponent(type));
            }
#endif

            if (fieldInfo != null)
            {
                LinkFilterAttribute interfaceFilter = fieldInfo.GetCustomAttribute <LinkFilterAttribute>();

                if (interfaceFilter != null)
                {
                    assets.RemoveAll(t =>
                    {
                        GameObject go = AssetDatabase.LoadAssetAtPath <GameObject>(t.AssetPath);
                        return(go.GetComponent(interfaceFilter.interfaceType) == null);
                    });
                }

                LinkTypeFilterAttribute typeFilter = fieldInfo.GetCustomAttribute <LinkTypeFilterAttribute>();

                if (typeFilter != null)
                {
                    assets.RemoveAll(t =>
                    {
                        GameObject go = AssetDatabase.LoadAssetAtPath <GameObject>(t.AssetPath);
                        return(go.GetComponent(typeFilter.type) != null);
                    });
                }
            }
        }
        protected override void Reload()
        {
            assets.Clear();


#if USE_ADDRESSABLES
            assets.AddRange(AddrHelper.GetAssets(type));
#else
            assets.AddRange(ResourcesAssetHelper.GetAssets(type));
#endif

            if (fieldInfo != null)
            {
                LinkFilterAttribute interfaceFilter = fieldInfo.GetCustomAttribute <LinkFilterAttribute>();

                if (interfaceFilter != null)
                {
                    assets.RemoveAll(t =>
                    {
                        Object asset = AssetDatabase.LoadAssetAtPath(t.AssetPath, typeof(Object));

                        if (type == typeof(MonoBehaviour))
                        {
                            return(((GameObject)asset).GetComponent(interfaceFilter.interfaceType) == null);
                        }

                        return(interfaceFilter.interfaceType.IsInstanceOfType(asset) == false);
                    });
                }

                LinkTypeFilterAttribute typeFilter = fieldInfo.GetCustomAttribute <LinkTypeFilterAttribute>();

                if (typeFilter != null)
                {
                    assets.RemoveAll(t =>
                    {
                        Object asset = AssetDatabase.LoadAssetAtPath(t.AssetPath, typeof(Object));
                        return(asset.GetType() != typeFilter.type);
                    });
                }
            }
        }