コード例 #1
0
    private void Expand(Item prototype_item, int count)
    {
        list.Update_Row(prototype_item.Internal_Name,
                        new List <ScrollableList.TextData>()
        {
            new ScrollableList.TextData("CountText", string.Format("{0}x", count), true),
            new ScrollableList.TextData("NameText", prototype_item.Name, true),
            new ScrollableList.TextData("DurabilityText", null, false)
        },
                        new List <ScrollableList.ImageData>()
        {
            new ScrollableList.ImageData("IconImage", prototype_item.UI_Sprite, prototype_item.UI_Sprite_Type, true)
        },
                        new List <ScrollableList.ButtonData>()
        {
            new ScrollableList.ButtonData("ExpandButton", "V", delegate() { Contract(prototype_item, count); }, true, true),
            new ScrollableList.ButtonData("InvisibleButton", null, delegate() { Select_Item(prototype_item, true); }, true, true)
        });
        int index = 1;

        foreach (Item item in Inventory.Get_Items(prototype_item.Internal_Name))
        {
            list.Add_Row(item.Id.ToString(),
                         new List <ScrollableList.TextData>()
            {
                new ScrollableList.TextData("CountText", null, false),
                new ScrollableList.TextData("NameText", item.Name, true),
                new ScrollableList.TextData("DurabilityText", string.Format("{0}%", item.Unbreaking ? "inf" : Helper.Float_To_String(item.Relative_Durability * 100.0f, 0)), true)
            },
                         new List <ScrollableList.ImageData>()
            {
                new ScrollableList.ImageData("IconImage", item.UI_Sprite, item.UI_Sprite_Type, true)
            },
                         new List <ScrollableList.ButtonData>()
            {
                new ScrollableList.ButtonData("ExpandButton", ">", delegate() { }, false, false),
                new ScrollableList.ButtonData("InvisibleButton", null, delegate() { Select_Item(item, false); }, true, true)
            }, list.Index_Of(prototype_item.Internal_Name) + index);
            index++;
        }
    }