protected override TreeViewItem BuildRoot() { var id = 0; var worlds = AssetFinder.ListMainAssets <World>(); var rootItem = new TreeViewItem { id = id++, depth = -1, displayName = "Root" }; foreach (var world in worlds) { var worldItem = new WorldItem { World = world, id = id++, displayName = world.name }; rootItem.AddChild(worldItem); foreach (var zone in world.Zones) { var name = worlds.Count > 1 ? string.Format("{0}/{1}", world.name, zone.name) : zone.name; var zoneItem = new ZoneItem { Zone = zone, id = id++, displayName = name }; rootItem.AddChild(zoneItem); } } rootItem.children.Sort((left, right) => left.displayName.CompareTo(right.displayName)); SetupDepthsFromParentsAndChildren(rootItem); return(rootItem); }
public static AssetList GetMainAssetList(Type type) { AssetList list; if (!_mainAssetLists.TryGetValue(type, out list)) { list = new AssetList { Type = type }; _mainAssetLists.Add(type, list); } if (list.Assets == null) { var assets = AssetFinder.ListMainAssets(type); BuildAssetList(list, assets); } return(list); }
public static AssetList GetMainAssetList <T>() where T : ScriptableObject { AssetList list; if (!_mainAssetLists.TryGetValue(typeof(T), out list)) { list = new AssetList { Type = typeof(T) }; _mainAssetLists.Add(typeof(T), list); } if (list.Assets == null) { var assets = AssetFinder.ListMainAssets <T>(); BuildAssetList(list, assets); } return(list); }
protected virtual void FindAssets() { _assets = AssetFinder.ListMainAssets <AssetType>(); }