Ejemplo n.º 1
0
 /// <summary>
 /// 增加物品数量
 /// </summary>
 /// <param name="amount">Amount.</param>
 public void AddAmount(int amount = 1)
 {
     Amount           += amount;
     TxtItemCount.text = Amount.ToString();
     if (Amount > 1)
     {
         TxtItemCount.Show();
         ImgItemCount.Show();
     }
     else
     {
         TxtItemCount.Hide();
         ImgItemCount.Hide();
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 显示物品
        /// </summary>
        /// <param name="item">Item.</param>
        /// <param name="amount">Amount.</param>
        public void SetItemUI(Item item, int amount = 1)
        {
            Item   = item;
            Amount = amount;

            // update UI
            ImgItem.sprite    = Resources.Load <Sprite>(Item.Sprite);
            TxtItemCount.text = Amount.ToString();
            if (Amount > 1)
            {
                TxtItemCount.Show();
                ImgItemCount.Show();
            }
            else
            {
                TxtItemCount.Hide();
                ImgItemCount.Hide();
            }
        }