Example #1
0
    public void ShowItemTooltip(Item item)
    {
        ItemDataBase db = ItemDataBase.instance;

        this.item = item;
        if (this.item != null && this.item.value > 0)
        {
            if (!item.type.ToString().Equals(((float)TypeOfItem.Type.Other).ToString()))
            {
                Name.text  = GetItemName(item.type, item.id);
                HP.text    = ": " + item.hp;
                Dame.text  = ": " + item.dame;
                Power.text = ": " + item.power;

                if (db != null)
                {
                    Name.color        = db.GetColor(item.levelUpgrade);
                    Background.sprite = db.GetBackground(item.levelUpgrade);
                    Icon.sprite       = db.GetItemSprite(item.type.ToString(), item.id.ToString(), item.levelUpgrade.ToString());
                    // Type.color = db.GetItemType(item.type.ToString());
                    // Type.gameObject.SetActive(true);
                }
                _equip.gameObject.SetActive(true);
                _unequip.gameObject.SetActive(false);
                Other.SetActive(false);
                NotOther.SetActive(true);
            }
            else
            {
                OtherText.text = "That's item which is so f*****g incredible";
                if (db != null)
                {
                    if (item.id.ToString().Equals("0"))
                    {
                        Background.sprite = db.GetBackground(item.levelUpgrade);
                    }
                    else
                    {
                        Background.color = new Color(0, 0, 0, 0);
                    }
                    Icon.sprite = db.GetItemSprite(item.type.ToString(), item.id.ToString(), item.levelUpgrade.ToString());
                    //Type.gameObject.SetActive(false);
                }
                _equip.gameObject.SetActive(false);
                _unequip.gameObject.SetActive(false);
                Other.SetActive(true);
                NotOther.SetActive(false);
            }
            Background.gameObject.SetActive(true);
            Icon.gameObject.SetActive(true);
        }
        else
        {
            HideItemTooltip();
        }
    }