コード例 #1
0
    void PaintRoomSelection(int windowID)
    {
        List <InventoryItem> selectableList = new List <InventoryItem> ();

        if (selectedRoom.fixedFunction != RoomSlotBehavior.RoomFunction.None)
        {
            for (int i = 0; i < Inventory.getRef().itemList.Count; i++)
            {
                if (Inventory.getRef().itemList [i].Function == selectedRoom.fixedFunction)
                {
                    selectableList.Add(Inventory.getRef().itemList [i]);
                }
            }
        }
        else
        {
            selectableList = Inventory.getRef().itemList;
        }

        if (selectedRoom.Item != null)
        {
            GUI.Label(new Rect(10, 15, windowRect.width - 20, 25), selectedRoom.Item.Name);
        }

        scrollWindowPos = GUI.BeginScrollView(new Rect(5, 45, windowRect.width - 10, windowRect.height - 35), scrollWindowPos, new Rect(0, 0, Screen.width - 40, selectableList.Count * 40));

        int spacer = 0;

        for (int i = 0; i < selectableList.Count; i++)
        {
            if (GUI.Button(new Rect(5, i * 34 + 5, windowRect.width - 30, 30), selectableList[i].Name))
            {
                selectedRoom.AddItem(Inventory.getRef().itemList[i]);
            }
        }
        GUI.EndScrollView();
    }