Exemple #1
0
 /// <summary>
 /// 更新显示的UI,Sale
 /// </summary>
 public void InitializeSale(int num)
 {
     // 只有可出售且数目>0的才会显示出来
     if (num <= 0 || !UiStore.Props[ID].CanSale)
     {
         img.sprite = null;
         img.color  = Color.clear;
         HasProp    = false;
         Price.gameObject.SetActive(false);
     }
     else
     {
         IProp prop = UiStore.Props[ID];
         if (prop == null)
         {
             Debug.LogError("数据库中没有这个道具");
             return;
         }
         img.sprite = prop.GetIcon();
         HasProp    = true;
         img.color  = Color.white;
         Price.gameObject.SetActive(true);
         Price.text = prop.SalePrice.ToString();
     }
 }
Exemple #2
0
 /// <summary>
 /// 更新显示的UI,只在数量变化时改变
 /// </summary>
 public void UpdateImage(int num)
 {
     E.gameObject.SetActive(Selected);
     if (num == Num)
     {
         return;
     }
     Num = num;
     // 数目>=0和数目<0的不同显示
     if (num < 0)
     {
         img.sprite = null;
         img.color  = Color.clear;
         HasItem    = false;
         count.gameObject.SetActive(false);
     }
     else
     {
         IProp prop = UiInventory.Props[ID];
         if (prop == null)
         {
             Debug.LogError("数据库中没有这个道具");
             return;
         }
         img.sprite = prop.GetIcon();
         HasItem    = true;
         img.color  = Color.white;
         count.gameObject.SetActive(true);
         count.text = num.ToString();
     }
 }
Exemple #3
0
        /// <summary>
        /// 只在初始化时执行一次
        /// </summary>
        /// <param name="hasProp"></param>
        public void InitializeBuy(bool hasProp)
        {
            // 更新显示
            HasProp = hasProp;
            if (!hasProp)
            {
                return;
            }
            IProp prop = UiStore.Props[ID];

            if (prop == null)
            {
                Debug.LogError("数据库中没有这个道具");
                return;
            }
            img.sprite = prop.GetIcon();
            img.color  = Color.white;
            Price.gameObject.SetActive(true);
            Price.text = prop.Price.ToString();
        }