public void Init(GameManager gameManager, CraftCategory category, Type itemType, string amount) { base.Init(gameManager); _itemType = itemType; ItemModel = BaseObjectFactory.GetItem(itemType); CanCraft = GameManager.PlayerModel.Inventory.CheckItems(ItemModel.CraftRecipe); Category = category; Icon.spriteName = ItemModel.IconName; AmountLabel.text = amount; if (Name != null) { Name.text = Localization.Get(ItemModel.LocalizationName); } if (CanCraftBackground != null) { CanCraftBackground.enabled = CanCraft; } UIEventListener.Get(gameObject).onClick += OnItemClick; }
public void SelectCategory(CraftCategory type, bool shopGoldCategory = false, NewShopCategory shopCategory = NewShopCategory.Items) { if (type == CraftCategory.Shop) { //ItemsMainObject.SetActive(false); //ShopView.Show(); //if (shopGoldCategory) // ShopView.SelectCategory(ShopCategory.Gold); GameManager.Player.MainHud.ShopPanel.Show(shopCategory); } else { ItemsMainObject.SetActive(true); //ShopView.Hide(); foreach (var craftItem in _items) { if (craftItem.Category == type) { craftItem.Show(); } else { craftItem.Hide(); } } } ItemsGrid.Reposition(); foreach (var craftTab in Tabs) { craftTab.SetActive(type == craftTab.TabType); } }