public void BuilderInWorldToggleFavorite() { BuilderInWorldTestHelper.CreateTestCatalogLocalSingleObject(); CatalogItem item = DataStore.i.builderInWorld.catalogItemDict.GetValues()[0]; FavoritesController favoritesController = new FavoritesController(new GameObject("_FavoritesController").AddComponent <CatalogGroupListView>()); favoritesController.ToggleFavoriteState(item, null); Assert.IsTrue(item.IsFavorite()); favoritesController.ToggleFavoriteState(item, null); Assert.IsFalse(item.IsFavorite()); }
public void SetContent(CatalogItem catalogItem) { this.catalogItem = catalogItem; if (favImg != null) { if (catalogItem.IsFavorite()) { favImg.color = onFavoriteColor; } else { favImg.color = offFavoriteColor; } } smartItemGO.SetActive(catalogItem.IsSmartItem()); GetThumbnail(); lockedGO.gameObject.SetActive(false); if (catalogItem.IsNFT() && BuilderInWorldNFTController.i.IsNFTInUse(catalogItem.id)) { lockedGO.gameObject.SetActive(true); } }
public void ToggleFavoriteState(CatalogItem catalogItem, CatalogItemAdapter adapter) { if (!favoritesCatalogItems.Contains(catalogItem)) { favoritesCatalogItems.Add(catalogItem); catalogItem.SetFavorite(true); } else { favoritesCatalogItems.Remove(catalogItem); catalogItem.SetFavorite(false); } adapter?.SetFavorite(catalogItem.IsFavorite()); }
public void SetContent(CatalogItem catalogItem) { this.catalogItem = catalogItem; if (favImg != null) { favImg.color = catalogItem.IsFavorite() ? onFavoriteColor : offFavoriteColor; } if (backgroundImg != null) { backgroundImg.color = catalogItem.IsSmartItem() ? smartItemColor : normalColor; } smartItemGO.SetActive(catalogItem.IsSmartItem()); GetThumbnail(); lockedGO.gameObject.SetActive(false); if (catalogItem.IsNFT() && BIWNFTController.i.IsNFTInUse(catalogItem.id)) { lockedGO.gameObject.SetActive(true); } }