// Token: 0x060028E8 RID: 10472 RVA: 0x00095C10 File Offset: 0x00093E10
    public GameObject AddItemTitle(global::ItemDataBlock itemdb, global::IInventoryItem itemInstance = null, float aboveSpace = 0f)
    {
        float      contentHeight = this.GetContentHeight();
        GameObject gameObject    = global::NGUITools.AddChild(this.addParent, this.itemTitlePrefab);

        gameObject.GetComponentInChildren <global::UILabel>().text = ((itemInstance == null) ? itemdb.name : itemInstance.toolTip);
        global::UITexture componentInChildren = gameObject.GetComponentInChildren <global::UITexture>();

        componentInChildren.material = componentInChildren.material.Clone();
        componentInChildren.material.Set("_MainTex", itemdb.GetIconTexture());
        componentInChildren.color = ((itemInstance == null || !itemInstance.IsBroken()) ? Color.white : Color.red);
        gameObject.transform.SetLocalPositionY(-(contentHeight + aboveSpace));
        return(gameObject);
    }
 // Token: 0x060028ED RID: 10477 RVA: 0x00095DB4 File Offset: 0x00093FB4
 public GameObject AddConditionInfo(global::IInventoryItem item)
 {
     if (item != null && item.datablock.DoesLoseCondition())
     {
         Color col = Color.green;
         if (item.condition <= 0.6f)
         {
             col = Color.yellow;
         }
         else if (item.IsBroken())
         {
             col = Color.red;
         }
         float num  = 100f * item.condition;
         float num2 = 100f * item.maxcondition;
         return(this.AddBasicLabel("Condition : " + num.ToString("0") + "/" + num2.ToString("0"), 15f, col));
     }
     return(null);
 }
Beispiel #3
0
    // Token: 0x06002A3E RID: 10814 RVA: 0x0009CB68 File Offset: 0x0009AD68
    private void SetItem(global::IInventoryItem item)
    {
        if (item == null)
        {
            this.MakeEmpty();
            return;
        }
        this._myDisplayItem = item;
        if (item.datablock.IsSplittable())
        {
            this._stackLabel.color = Color.white;
            if (item.uses > 1)
            {
                this._stackLabel.text = "x" + item.uses.ToString();
            }
            else
            {
                this._stackLabel.text = string.Empty;
            }
        }
        else
        {
            this._stackLabel.color = Color.yellow;
            this._stackLabel.text  = ((item.datablock._maxUses <= item.datablock.GetMinUsesForDisplay()) ? string.Empty : item.uses.ToString());
        }
        if (this._amountBackground)
        {
            if (this._stackLabel.text == string.Empty)
            {
                this._amountBackground.enabled = false;
            }
            else
            {
                Vector2 vector = this._stackLabel.font.CalculatePrintedSize(this._stackLabel.text, true, global::UIFont.SymbolStyle.None);
                this._amountBackground.enabled = true;
                this._amountBackground.transform.localScale = new Vector3(vector.x * this._stackLabel.transform.localScale.x + 12f, 16f, 1f);
            }
        }
        if (global::ItemDataBlock.LoadIconOrUnknown <Texture>(item.datablock.icon, ref item.datablock.iconTex))
        {
            Material material = global::TextureMaterial.GetMaterial(global::RPOSInventoryCell._myMaterial, item.datablock.iconTex);
            this._icon.material = (global::UIMaterial)material;
            this._icon.enabled  = true;
        }
        global::IHeldItem heldItem;
        int num  = ((heldItem = (item as global::IHeldItem)) != null) ? heldItem.totalModSlots : 0;
        int num2 = (num != 0) ? heldItem.usedModSlots : 0;

        for (int i = 0; i < this.modSprites.Length; i++)
        {
            if (i < num)
            {
                this.modSprites[i].enabled    = true;
                this.modSprites[i].sprite     = ((i >= num2) ? this.mod_empty : this.mod_full);
                this.modSprites[i].spriteName = this.modSprites[i].sprite.name;
            }
            else
            {
                this.modSprites[i].enabled = false;
            }
        }
        if (item.IsBroken())
        {
            this._icon.color = Color.red;
        }
        else if (item.condition / item.maxcondition <= 0.4f)
        {
            this._icon.color = Color.yellow;
        }
        else
        {
            this._icon.color = Color.white;
        }
    }