Exemplo n.º 1
0
    void OnGUI()
    {
        //draw reticle
        Vector2 size        = GUI.skin.label.CalcSize(new GUIContent("+"));
        Rect    reticleRect = new Rect(0, 0, size.x, size.y);

        reticleRect.center = new Vector2(Screen.width, Screen.height) / 2f;
        GUI.Label(reticleRect, "+");

        if (selectedThing != null)
        {
            GUIFunctions.DrawThing(selectedThingRect, selectedThing, true);
            GUI.Label(selectedLabelRect, selectedSlotIndex.ToString(), GUIFunctions.hotkeyStyle);
            GUI.Label(selectedNameRect, selectedThing.longName, GUIFunctions.hotkeyStyle);
        }
    }
Exemplo n.º 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);
            }
        }
    }