private void Repaint(Vector2 position, InventoryItem item)
        {
            transform.position     = position;
            m_DescriptionText.text = item.Description;
            m_IconImage.sprite     = item.Icon;
            StringBuilder builder = new StringBuilder();

            builder.AppendLine();
            builder.AppendLine("<align=left>");
            for (int i = 0; i < item.Stats.Length; i++)
            {
                InventoryItemStatInstance inst = item.Stats[i];
                switch (inst.Type)
                {
                case StatType.Fixed:
                    builder.AppendLine(inst.Name + ": " + inst.Value + "/" + inst.MaxValue);
                    break;

                case StatType.Add:
                    builder.AppendLine((inst.Value >= 0 ? "<color=green>+" : "<color=red>-") + inst.Value + " " + inst.Name + "</color>");
                    break;
                }
            }
            m_DescriptionText.text += builder.ToString();
            m_NameText.text         = item.Name;
            m_DrawPosition          = position;
            SetVisible(true);
        }
        /// <summary>
        /// Calculate stat stacks.
        /// </summary>
        /// <returns></returns>
        public StackedStat[] CalculateStatTotal()
        {
            Dictionary <InventoryItemStatInstance, float> stacks = new Dictionary <InventoryItemStatInstance, float>();

            foreach (InventoryItem item in m_Slots)
            {
                if (item == null)
                {
                    continue;
                }
                for (int i = 0; i < item.Stats.Length; i++)
                {
                    InventoryItemStatInstance stat = item.Stats[i];

                    if (stat.Type != StatType.Add)
                    {
                        continue;
                    }

                    if (stacks.ContainsKey(stat))
                    {
                        stacks[stat] += stat.Value;
                    }
                    else
                    {
                        stacks[stat] = stat.Value;
                    }
                }
            }

            return(stacks.Select(x => new StackedStat(x.Key, x.Value)).ToArray());
        }