public void Init(IShopExecute item) { base.Init(null,false); NameLabel.text = "Level:" + item.Parameter; mainIcon.sprite = item.icon; this.item = item; InitCost(item.CrystalCost, item.MoneyCost); }
public void Init(IShopExecute shopExecute, Action<IShopExecute> callback) { this.shopExecute = shopExecute; this.callback = callback; icon.sprite = shopExecute.icon; lvlField.text = "Level:" + shopExecute.Parameter; isOpen = shopExecute.CanBuy; overlay.gameObject.SetActive(!isOpen); }
public void Init(IShopExecute item) { Clear(); SpecIcon.gameObject.SetActive(false); NameLabel.text = "Level:" + item.Parameter; mainIcon.sprite = item.icon; InitCost(item.CrystalCost, item.MoneyCost); OnInitCallback(null,ItemOwner.Shop); }
public void Init(IShopExecute item) { Clear(); ShopSellElement ShopSellElement = DataBaseController.GetItem(DataBaseController.Instance.DataStructs.PrefabsStruct.ShopSellElement); ShopSellElement.Init(item); CurItemInfo = ShopSellElement; Link(); // if (OnInitCallback != null) // OnInitCallback(null, ItemOwner.Shop); }
private void NullSelection() { ItemInfoElement.gameObject.SetActive(false); EquipButton.gameObject.SetActive(false); UnEquipButton.gameObject.SetActive(false); UpgradeButton.gameObject.SetActive(false); SellButton.gameObject.SetActive(false); selectedShopElement = null; selectedPlayerItem = null; }
private void OnShopSelected(IShopExecute obj) { selectedShopElement = obj; ItemInfoElement.gameObject.SetActive(true); ItemInfoElement.Init(selectedShopElement); }
private void NullSelection() { selectedShopElement = null; selectedPlayerItem = null; // Debug.Log("child count " + layoutMyInventory.childCount); // LayoutRebuilder.ForceRebuildLayoutImmediate(layoutMyInventory.GetComponent<RectTransform>()); // if (layoutMyInventory.childCount > 0) // { // var tmp = layoutMyInventory.GetChild(0); // var shopExec = tmp.GetComponent<PlayerItemElement>(); // if (shopExec != null) // OnSelected(shopExec); // } StartCoroutine(WaitBeforSelect()); }
private void CreatShopElement(IShopExecute exec) { var element = DataBaseController.GetItem<ShopItemElement>(PrefabShopItemElement); element.Init(exec, OnShopSelected); exec.transform.SetParent(element.transform,false); element.transform.SetParent(layoutShopItems, false); }
protected bool EnoughtMoney(IShopExecute selectedShopElement) { bool haveMoney = MainController.Instance.PlayerData.CanPay(ItemId.money, selectedShopElement.MoneyCost); bool haveCrystal = MainController.Instance.PlayerData.CanPay(ItemId.crystal, selectedShopElement.CrystalCost); return haveMoney && haveCrystal; }