示例#1
0
 /// <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);
         }
     }
 }
示例#2
0
 public virtual void OnClean()
 {
     Window = null;
     Asset  = null;
 }
示例#3
0
 public virtual void OnLoad(TWindow window)
 {
     Window = window;
     Asset  = window.Asset;
 }
示例#4
0
 /// <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));
 }