Пример #1
0
 /// <summary>
 /// 点击购买按钮
 /// </summary>
 public void OnBuyClick()
 {
     if (procedureMenu != null && currentSelectHeroPanel != null)
     {
         if (procedureMenu.BuyHero(currentSelectHeroPanel.GetHeroShop()))
         {
             textGold.text = PlayerData.Gold.ToString();
             OnHeroPanelClick(currentSelectHeroPanel);
         }
     }
 }
Пример #2
0
    /// <summary>
    /// 点击英雄面板
    /// </summary>
    public void OnHeroPanelClick(UIHeroShop_PanelHero heroPanel)
    {
        currentSelectHeroPanel = heroPanel;
        DRHeroShop drHeroShop = heroPanel.GetHeroShop();

        // 显示/隐藏购买按钮
        if (PlayerData.HasHero(drHeroShop.Id))
        {
            buttonBuy.SetActive(false);
            string boughtText = GameEntry.Localization.GetString("HeroShop.Bought");

            // 显示/隐藏出战按钮
            if (PlayerData.CurrentFightHeroID != drHeroShop.Id)
            {
                buttonFight.SetActive(true);
                textPrice.text = $"{boughtText}";
            }
            else
            {
                buttonFight.SetActive(false);

                string fightText = GameEntry.Localization.GetString("HeroShop.Fight");
                textPrice.text = $"{boughtText},{fightText}";
            }
        }
        else
        {
            buttonBuy.SetActive(true);
            buttonFight.SetActive(false);
            string goldText = GameEntry.Localization.GetString("Message.Gold");
            textPrice.text = $"{drHeroShop.Price}{goldText}";
        }
    }