Exemple #1
0
        public void SetItem(Entity item)
        {
            CleanUpCurrentItem();
            if (item == null)
            {
                DisableSlotDetails();
                return;
            }
            Data          = item;
            _tooltip      = item.Get <TooltipComponent>();
            InventoryItem = Data.Get <InventoryItem>();
            SetSprite(item.Get <IconComponent>()?.Sprite);
            var action = item.Get <Action>();

            if (action != null && action.Ammo != null)
            {
                _currentAmmo = action.Ammo.Amount;
                _currentAmmo.OnResourceChanged += CheckAmmo;
                CheckAmmo();
            }
            if (_cooldownImage != null)
            {
                Data.AddObserver(EntitySignals.CooldownTimerChanged, CheckCooldown);
            }
            Data.AddObserver(this);
            CheckContent(Data);
        }
 public virtual void Clear()
 {
     CleanUpCurrentItem();
     DisableSlotDetails();
     _tooltip = null;
     Data     = null;
 }
 public void Clear()
 {
     CleanUpCurrentItem();
     DisableSlotDetails();
     _currentAmmo = null;
     _entity      = null;
     _tooltip     = null;
 }
Exemple #4
0
 public override void Clear()
 {
     CleanUpCurrentItem();
     DisableSlotDetails();
     if (_label != null)
     {
         _label.fontSizeMin = _minMainText;
     }
     Data     = null;
     _tooltip = null;
 }
 public virtual void SetData(Entity data)
 {
     Clear();
     if (data == null)
     {
         DisableSlotDetails();
         return;
     }
     Data     = data;
     _tooltip = data.Get <TooltipComponent>();
     SetSprite(data.Get <IconComponent>()?.Sprite);
     RefreshItem();
 }
        private void SetItem(Entity item)
        {
            CleanUpCurrentItem();
            _entity              = item;
            _tooltip             = item.Get <TooltipComponent>();
            _iconDisplay.sprite  = item.Get <IconComponent>().Sprite;
            _iconDisplay.enabled = _iconDisplay.sprite != null;
            var ammo = item.Get <AmmoComponent>();

            if (ammo != null)
            {
                _currentAmmo = ammo.Amount;
                _currentAmmo.OnResourceChanged += CheckAmmo;
                CheckAmmo();
            }
            if (_cooldownImage != null)
            {
                item.AddObserver(EntitySignals.CooldownTimerChanged, CheckCooldown);
            }
            item.AddObserver(this);
            RefreshItem();
        }
 public TooltipDisplaying(TooltipComponent target)
 {
     Target = target;
 }