Пример #1
0
        /// <summary>
        /// Refreshes so that it displays the correct item data.
        /// </summary>
        public void Refresh()
        {
            m_ItemIcon.enabled       = HasItem;
            m_StackDisplayer.enabled = HasItem && CurrentItem.CurrentInStack > 1;
            m_DurabilityBar.SetActive(HasItem && CurrentItem.HasProperty("Durability"));

            //interactable = HasItem;

            if (m_ItemIcon.enabled)
            {
                m_ItemIcon.sprite = CurrentItem.ItemData.Icon;
            }

            if (m_StackDisplayer.enabled)
            {
                m_StackDisplayer.text = string.Format("x{0}", CurrentItem.CurrentInStack);
            }

            if (m_DurabilityBar.Active)
            {
                m_DurabilityBar.SetFillAmount(CurrentItem.GetPropertyValue("Durability").Float.Ratio);
            }

            Refreshed.Send(this);
        }
Пример #2
0
        /// <summary>
        /// Refreshes so that it displays the correct item data.
        /// </summary>
        public void Refresh()
        {
            m_ItemIcon.enabled       = HasItem;
            m_StackDisplayer.enabled = HasItem && CurrentItem.CurrentInStack > 1;
            m_DurabilityBar.SetActive(HasItem && CurrentItem.HasProperty("Durability"));
            //error handly make sure ammo displayer variable hase a value
            if (m_AmmoDisplayer)
            {
                m_AmmoDisplayer.enabled = HasItem && CurrentItem.HasProperty("Ammo");
            }

            //interactable = HasItem;

            if (m_ItemIcon.enabled)
            {
                m_ItemIcon.sprite = CurrentItem.ItemData.Icon;
            }

            if (m_StackDisplayer.enabled)
            {
                m_StackDisplayer.text = string.Format("x{0}", CurrentItem.CurrentInStack);
            }
            //error handly make sure ammo displayer variable hase a value
            if (m_AmmoDisplayer && m_AmmoDisplayer.enabled)
            {
                m_AmmoDisplayer.text = string.Format("x{0}", CurrentItem.GetPropertyValue("Ammo").Int.Current);
            }

            if (m_DurabilityBar.Active)
            {
                m_DurabilityBar.SetFillAmount(CurrentItem.GetPropertyValue("Durability").Float.Ratio);
            }

            Refreshed.Send(this);
        }