/// <summary>
        /// Filters object based on asset tags, object tags and FilterMode
        /// </summary>
        /// <param name="asset"></param>
        /// <param name="discoverObject"></param>
        /// <returns>true to discard, false to keep</returns>
        static bool FilterDiscoverObject(DiscoverAsset asset, Discover discoverObject)
        {
            if (string.IsNullOrEmpty(asset.Tags))
            {
                asset.Tags = string.Empty;
            }
            if (string.IsNullOrEmpty(discoverObject.Tags))
            {
                discoverObject.Tags = string.Empty;
            }

            string[] assetTags  = asset.Tags.Split(' ');
            string[] objectTags = discoverObject.Tags.Split(' ');

            switch (asset.filterMode)
            {
            case DiscoverAsset.FilterMode.ShowAll: return(false);

            case DiscoverAsset.FilterMode.IncludeTags:
                return(!assetTags.Intersect(objectTags).Any());

            case DiscoverAsset.FilterMode.ExcludeTags:
                return(assetTags.Intersect(objectTags).Any());
            }
            return(false);
        }
 void SetDiscoverAsset(DiscoverAsset discover)
 {
     discoverAsset = discover;
     titleContent  = new GUIContent(discoverAsset.WindowTitle);
     minSize       = new Vector2(discoverAsset.WindowWidth, discoverAsset.WindowHeight);
     maxSize       = new Vector2(discoverAsset.WindowWidth, discoverAsset.WindowHeight);
 }
 public static void ShowDiscoverWindow(DiscoverAsset discoverAsset)
 {
     if (discoverAsset != null)
     {
         var window = GetWindow <DiscoverWindow>(!discoverAsset.dockable);
         window.SetDiscoverAsset(discoverAsset);
     }
     else
     {
         Debug.LogError("Could not open Discover Window : discoverAsset is null");
     }
 }
        static void InitShowAtStartup()
        {
            string[] guids = AssetDatabase.FindAssets("t:DiscoverAsset");
            foreach (var guid in guids)
            {
                DiscoverAsset asset = AssetDatabase.LoadAssetAtPath <DiscoverAsset>(AssetDatabase.GUIDToAssetPath(guid));
                if (asset.EnableShowAtStartup)
                {
                    if (s_StartupDiscoverAssets == null)
                    {
                        s_StartupDiscoverAssets = new List <DiscoverAsset>();
                    }

                    s_StartupDiscoverAssets.Add(asset);
                }
            }

            if (s_StartupDiscoverAssets != null && s_StartupDiscoverAssets.Count > 0)
            {
                EditorApplication.update += ShowAtStartup;
            }
        }