예제 #1
0
    private void WindowFunction(int id)
    {
        for (int i = 0; i < resourceCount; i++)
        {
            resourceRect.x = i * windowRect.width / resourceCount;
            ResourceReusable resourceReusable = resourceReusables[i];
            resourceReusable.Draw(resourceRect, ResourceController.GetResourceQuantityFromType(resourceReusable.resourceType));

            Rect   tooltipRect = GUIFunctions.AddRectAndRectCoords(resourceRect, windowRect);
            string stringID    = "resource-" + i;
            TooltipManager.SetTooltip(stringID, tooltipRect, resourceReusable.tooltipText);
        }
        GUI.DragWindow();
    }
예제 #2
0
    private void WindowFunction(int id)
    {
        //GUI.Button(new Rect(10, 10, 50, 50), "button!!");

        for (int i = 0; i < thingsPerRow; i++)
        {
            for (int j = 0; j < rowCount; j++)
            {
                Rect rect = thingIconRects [i, j];
                if (j == rowCount - 1)
                {
                    GUI.Label(rect, (i + 1).ToString(), GUIFunctions.hotkeyStyle);
                }

                Thing thing = things [i + j * thingsPerRow];
                if (thing == null)
                {
                    GUI.DrawTexture(rect, Thing.GetFrameInventoryTexture());
                }
                else
                {
                    GUIFunctions.DrawThing(rect, thing, true);
                    Rect tooltipRect = GUIFunctions.AddRectAndRectCoords(rect, windowRect);
                    TooltipManager.SetTooltip(thingTooltipIDs [i, j], tooltipRect, thing.longName);
                }
            }
        }

        if (dragThing == null)
        {
            GUI.DragWindow();
        }
        else
        {
            Rect rect = new Rect(Input.mousePosition.x - iconSize / 2 - windowRect.x,
                                 Screen.height - Input.mousePosition.y - iconSize / 2 - windowRect.y,
                                 iconSize, iconSize);
            if (dragThing.isBlueprint)
            {
                GUIFunctions.DrawThing(rect, dragThing, true);
            }
            else
            {
                GUIFunctions.DrawThing(rect, dragThing, false);
            }
        }
    }