public void RenderBlock(SkillData data, System.Action onBuy, int currentMoney)
 {
     gameObject.SetActive(true);
     Name.text         = data.Name.ToUpper();
     Desc.text         = data.Desc;
     Cost.text         = "$" + data.Cost;
     Icon.sprite       = data.Icon;
     CurrentCount.text = "x" + InventoryHelper.GetCurrentSkillCount(data.Id).ToString();
     if (currentMoney >= data.Cost)
     {
         BuyButton.interactable = true;
         CostOutline.enabled    = true;
     }
     else
     {
         BuyButton.interactable = false;
         CostOutline.enabled    = false;
     }
     BuyButton.onClick.RemoveAllListeners();
     BuyButton.onClick.AddListener(delegate() {
         onBuy?.Invoke();
     });
 }
Beispiel #2
0
 public void RenderSkillBlock(SkillData data)
 {
     currentSkill = data;
     gameObject.SetActive(true);
     currentCount = InventoryHelper.GetCurrentSkillCount(data.Id);
     if (currentCount > 0)
     {
         icon.color      = Helper.HexToColor("FFFFFFFF");
         icon.sprite     = data.Icon;
         totalCount.text = currentCount.ToString();
         button.onClick.RemoveAllListeners();
         button.onClick.AddListener(delegate() {
             if (currentCount > 0)
             {
                 GameEventSystem.RaiseGameEvent(GAME_EVENT.USE_SKILL, data.Id);
             }
         });
         DoAnimation();
     }
     else
     {
         gameObject.SetActive(false);
     }
 }