public static List <CatalogItemPack> GetCatalogItemPacksFilteredByCategories() { var assetPacks = DataStore.i.dataStoreBuilderInWorld.catalogItemPackDict.GetValues(); Dictionary <string, CatalogItemPack> assetPackDic = new Dictionary <string, CatalogItemPack>(); if (DataStore.i.dataStoreBuilderInWorld.catalogItemPackDict.ContainsKey(BIWSettings.ASSETS_COLLECTIBLES)) { assetPackDic.Add(BIWSettings.ASSETS_COLLECTIBLES, DataStore.i.dataStoreBuilderInWorld.catalogItemPackDict[BIWSettings.ASSETS_COLLECTIBLES]); } else { CreateNewCollectiblePack(); } foreach (CatalogItemPack catalogAssetPack in assetPacks) { foreach (CatalogItem catalogItem in catalogAssetPack.assets) { if (catalogItem.IsNFT()) { continue; } if (!assetPackDic.ContainsKey(catalogItem.category)) { CatalogItemPack categoryAssetPack = new CatalogItemPack(); categoryAssetPack.SetThumbnailULR(catalogItem.thumbnailURL); categoryAssetPack.title = catalogItem.category; categoryAssetPack.assets = new List <CatalogItem>(); catalogItem.categoryName = catalogAssetPack.title; categoryAssetPack.assets.Add(catalogItem); if (!string.IsNullOrEmpty(categoryAssetPack.title)) { if (categoryAssetPack.title.Length == 1) { categoryAssetPack.title = categoryAssetPack.title.ToUpper(); } else { categoryAssetPack.title = char.ToUpper(categoryAssetPack.title[0]) + categoryAssetPack.title.Substring(1); } } assetPackDic.Add(catalogItem.category, categoryAssetPack); continue; } else { catalogItem.categoryName = catalogAssetPack.title; assetPackDic[catalogItem.category].assets.Add(catalogItem); } } } return(assetPackDic.Values.OrderBy(x => x.title).ToList()); }
public static CatalogItemPack CreateCatalogItemPack(SceneAssetPack sceneAssetPack) { CatalogItemPack catalogItemPack = new CatalogItemPack(); catalogItemPack.id = sceneAssetPack.id; catalogItemPack.title = sceneAssetPack.title; catalogItemPack.assets = new List <CatalogItem>(); catalogItemPack.SetThumbnailULR(sceneAssetPack.ComposeThumbnailUrl()); foreach (SceneObject sceneObject in sceneAssetPack.assets) { catalogItemPack.assets.Add(CreateCatalogItem(sceneObject)); } return(catalogItemPack); }
public static List <CatalogItemPack> GetCatalogItemPacksFilteredByCategories() { var assetPacks = DataStore.i.builderInWorld.catalogItemPackDict.GetValues(); Dictionary <string, CatalogItemPack> assetPackDic = new Dictionary <string, CatalogItemPack>(); foreach (CatalogItemPack catalogAssetPack in assetPacks) { foreach (CatalogItem catalogItem in catalogAssetPack.assets) { if (!assetPackDic.ContainsKey(catalogItem.category)) { CatalogItemPack categoryAssetPack = new CatalogItemPack(); categoryAssetPack.SetThumbnailULR(catalogItem.thumbnailURL); categoryAssetPack.title = catalogItem.category; categoryAssetPack.assets = new List <CatalogItem>(); catalogItem.categoryName = catalogAssetPack.title; categoryAssetPack.assets.Add(catalogItem); if (!string.IsNullOrEmpty(categoryAssetPack.title)) { if (categoryAssetPack.title.Length == 1) { categoryAssetPack.title = categoryAssetPack.title.ToUpper(); } else { categoryAssetPack.title = char.ToUpper(categoryAssetPack.title[0]) + categoryAssetPack.title.Substring(1); } } assetPackDic.Add(catalogItem.category, categoryAssetPack); continue; } else { catalogItem.categoryName = catalogAssetPack.title; assetPackDic[catalogItem.category].assets.Add(catalogItem); } } } return(assetPackDic.Values.ToList()); }
public static CatalogItemPack CreateCatalogItemPack(SceneAssetPack sceneAssetPack) { CatalogItemPack catalogItemPack = new CatalogItemPack(); catalogItemPack.id = sceneAssetPack.id; catalogItemPack.title = sceneAssetPack.title; catalogItemPack.assets = new List <CatalogItem>(); catalogItemPack.SetThumbnailULR(sceneAssetPack.ComposeThumbnailUrl()); foreach (SceneObject sceneObject in sceneAssetPack.assets) { //TODO: SmartItems disabled until kernel has them implemented if (!sceneObject.IsSmartItem()) { catalogItemPack.assets.Add(CreateCatalogItem(sceneObject)); } } return(catalogItemPack); }