Esempio n. 1
0
    public GameObject AddItemTitle(ItemDataBlock itemdb, IInventoryItem itemInstance = null, float aboveSpace = 0)
    {
        float      contentHeight = this.GetContentHeight();
        GameObject obj2          = NGUITools.AddChild(this.addParent, this.itemTitlePrefab);

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

        componentInChildren.material = componentInChildren.material.Clone();
        componentInChildren.material.Set("_MainTex", itemdb.GetIconTexture());
        componentInChildren.color = ((itemInstance == null) || !itemInstance.IsBroken()) ? Color.white : Color.red;
        obj2.transform.SetLocalPositionY(-(contentHeight + aboveSpace));
        return(obj2);
    }
Esempio n. 2
0
 public GameObject AddConditionInfo(IInventoryItem item)
 {
     if (item == null || !item.datablock.DoesLoseCondition())
     {
         return null;
     }
     Color color = Color.green;
     if (item.condition <= 0.6f)
     {
         color = Color.yellow;
     }
     else if (item.IsBroken())
     {
         color = Color.red;
     }
     float single = 100f * item.condition;
     float single1 = 100f * item.maxcondition;
     GameObject gameObject = this.AddBasicLabel(string.Concat("Condition : ", single.ToString("0"), "/", single1.ToString("0")), 15f, color);
     return gameObject;
 }
Esempio n. 3
0
    public GameObject AddConditionInfo(IInventoryItem item)
    {
        if ((item == null) || !item.datablock.DoesLoseCondition())
        {
            return(null);
        }
        Color green = Color.green;

        if (item.condition <= 0.6f)
        {
            green = Color.yellow;
        }
        else if (item.IsBroken())
        {
            green = Color.red;
        }
        float num  = 100f * item.condition;
        float num2 = 100f * item.maxcondition;

        return(this.AddBasicLabel("Condition : " + num.ToString("0") + "/" + num2.ToString("0"), 15f, green));
    }
Esempio n. 4
0
    public GameObject AddConditionInfo(IInventoryItem item)
    {
        if (item == null || !item.datablock.DoesLoseCondition())
        {
            return(null);
        }
        Color color = Color.green;

        if (item.condition <= 0.6f)
        {
            color = Color.yellow;
        }
        else if (item.IsBroken())
        {
            color = Color.red;
        }
        float      single     = 100f * item.condition;
        float      single1    = 100f * item.maxcondition;
        GameObject gameObject = this.AddBasicLabel(string.Concat("Condition : ", single.ToString("0"), "/", single1.ToString("0")), 15f, color);

        return(gameObject);
    }
Esempio n. 5
0
    private void SetItem(IInventoryItem item)
    {
        if (item == null)
        {
            this.MakeEmpty();
            return;
        }
        this._myDisplayItem = item;
        if (!item.datablock.IsSplittable())
        {
            this._stackLabel.color = Color.yellow;
            this._stackLabel.text  = (item.datablock._maxUses <= item.datablock.GetMinUsesForDisplay() ? string.Empty : item.uses.ToString());
        }
        else
        {
            this._stackLabel.color = Color.white;
            if (item.uses <= 1)
            {
                this._stackLabel.text = string.Empty;
            }
            else
            {
                UILabel uILabel = this._stackLabel;
                int     num     = item.uses;
                uILabel.text = string.Concat("x", num.ToString());
            }
        }
        if (this._amountBackground)
        {
            if (this._stackLabel.text != string.Empty)
            {
                Vector2 vector2 = this._stackLabel.font.CalculatePrintedSize(this._stackLabel.text, true, UIFont.SymbolStyle.None);
                this._amountBackground.enabled = true;
                Transform vector3  = this._amountBackground.transform;
                float     single   = vector2.x;
                Vector3   vector31 = this._stackLabel.transform.localScale;
                vector3.localScale = new Vector3(single * vector31.x + 12f, 16f, 1f);
            }
            else
            {
                this._amountBackground.enabled = false;
            }
        }
        if (ItemDataBlock.LoadIconOrUnknown <Texture>(item.datablock.icon, ref item.datablock.iconTex))
        {
            Material material = TextureMaterial.GetMaterial(RPOSInventoryCell._myMaterial, item.datablock.iconTex);
            this._icon.material = (UIMaterial)material;
            this._icon.enabled  = true;
        }
        IHeldItem heldItem  = item as IHeldItem;
        IHeldItem heldItem1 = heldItem;
        int       num1      = (heldItem != null ? heldItem1.totalModSlots : 0);
        int       num2      = (num1 != 0 ? heldItem1.usedModSlots : 0);

        for (int i = 0; i < (int)this.modSprites.Length; i++)
        {
            if (i >= num1)
            {
                this.modSprites[i].enabled = false;
            }
            else
            {
                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;
            }
        }
        if (item.IsBroken())
        {
            this._icon.color = Color.red;
        }
        else if (item.condition / item.maxcondition > 0.4f)
        {
            this._icon.color = Color.white;
        }
        else
        {
            this._icon.color = Color.yellow;
        }
    }
Esempio n. 6
0
 private void SetItem(IInventoryItem item)
 {
     if (item == null)
     {
         this.MakeEmpty();
     }
     else
     {
         IHeldItem item2;
         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 != null)
         {
             if (this._stackLabel.text == string.Empty)
             {
                 this._amountBackground.enabled = false;
             }
             else
             {
                 Vector2 vector = this._stackLabel.font.CalculatePrintedSize(this._stackLabel.text, true, UIFont.SymbolStyle.None);
                 this._amountBackground.enabled = true;
                 this._amountBackground.transform.localScale = new Vector3((vector.x * this._stackLabel.transform.localScale.x) + 12f, 16f, 1f);
             }
         }
         if (ItemDataBlock.LoadIconOrUnknown <Texture>(item.datablock.icon, ref item.datablock.iconTex))
         {
             Material material = TextureMaterial.GetMaterial(_myMaterial, item.datablock.iconTex);
             this._icon.material = (UIMaterial)material;
             this._icon.enabled  = true;
         }
         int num  = ((item2 = item as IHeldItem) != null) ? item2.totalModSlots : 0;
         int num2 = (num != 0) ? item2.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;
         }
     }
 }
Esempio n. 7
0
 private void SetItem(IInventoryItem item)
 {
     if (item == null)
     {
         this.MakeEmpty();
         return;
     }
     this._myDisplayItem = item;
     if (!item.datablock.IsSplittable())
     {
         this._stackLabel.color = Color.yellow;
         this._stackLabel.text = (item.datablock._maxUses <= item.datablock.GetMinUsesForDisplay() ? string.Empty : item.uses.ToString());
     }
     else
     {
         this._stackLabel.color = Color.white;
         if (item.uses <= 1)
         {
             this._stackLabel.text = string.Empty;
         }
         else
         {
             UILabel uILabel = this._stackLabel;
             int num = item.uses;
             uILabel.text = string.Concat("x", num.ToString());
         }
     }
     if (this._amountBackground)
     {
         if (this._stackLabel.text != string.Empty)
         {
             Vector2 vector2 = this._stackLabel.font.CalculatePrintedSize(this._stackLabel.text, true, UIFont.SymbolStyle.None);
             this._amountBackground.enabled = true;
             Transform vector3 = this._amountBackground.transform;
             float single = vector2.x;
             Vector3 vector31 = this._stackLabel.transform.localScale;
             vector3.localScale = new Vector3(single * vector31.x + 12f, 16f, 1f);
         }
         else
         {
             this._amountBackground.enabled = false;
         }
     }
     if (ItemDataBlock.LoadIconOrUnknown<Texture>(item.datablock.icon, ref item.datablock.iconTex))
     {
         Material material = TextureMaterial.GetMaterial(RPOSInventoryCell._myMaterial, item.datablock.iconTex);
         this._icon.material = (UIMaterial)material;
         this._icon.enabled = true;
     }
     IHeldItem heldItem = item as IHeldItem;
     IHeldItem heldItem1 = heldItem;
     int num1 = (heldItem != null ? heldItem1.totalModSlots : 0);
     int num2 = (num1 != 0 ? heldItem1.usedModSlots : 0);
     for (int i = 0; i < (int)this.modSprites.Length; i++)
     {
         if (i >= num1)
         {
             this.modSprites[i].enabled = false;
         }
         else
         {
             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;
         }
     }
     if (item.IsBroken())
     {
         this._icon.color = Color.red;
     }
     else if (item.condition / item.maxcondition > 0.4f)
     {
         this._icon.color = Color.white;
     }
     else
     {
         this._icon.color = Color.yellow;
     }
 }
Esempio n. 8
0
 public GameObject AddItemTitle(ItemDataBlock itemdb, IInventoryItem itemInstance = null, float aboveSpace = 0)
 {
     float contentHeight = this.GetContentHeight();
     GameObject gameObject = NGUITools.AddChild(this.addParent, this.itemTitlePrefab);
     gameObject.GetComponentInChildren<UILabel>().text = (itemInstance == null ? itemdb.name : itemInstance.toolTip);
     UITexture componentInChildren = gameObject.GetComponentInChildren<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;
 }