/// <summary>Search for an ancestor of this asset (or this asset itself) that has the given type.</summary> /// <typeparam name="TAsset"></typeparam> /// <returns></returns> public TAsset FindAncestor <TAsset>() where TAsset : Asset { for (Asset parent = this; ; parent = parent.Parent) { TAsset parentAsset = parent as TAsset; if (!ReferenceEquals(parentAsset, null) || ReferenceEquals(parent, null)) { return(parentAsset); } } }
public virtual void OnClean() { Window = null; Asset = null; }
public virtual void OnLoad(TWindow window) { Window = window; Asset = window.Asset; }
/// <summary> /// Collects assets of the specified prefab type. /// </summary> /// <typeparam name="TPrefab">The type of the prefab.</typeparam> /// <typeparam name="TAsset">The type of the asset.</typeparam> /// <returns>A sequence of assets of the specified type.</returns> protected static IEnumerable <AssetInfo> CollectPrefabs <TPrefab, TAsset>() where TPrefab : PrefabInfo where TAsset : AssetInfo, new() { return(PrefabHelper.Collect <TPrefab>() .Select(p => { AssetInfo a = new TAsset(); a.Initialize(p); return a; }) .Where(a => a.Initialized)); }