public void Draw() { //draw the toolbar buttons and windows if they are activated. GUI.depth = 1; foreach (ToolbarButton toolbarButton in toolbarButtons) { if (toolbarButton.activated) { GUI.color = Color.cyan; } else { GUI.color = Color.white; } if (GUI.Button(toolbarButton.GetDrawRect(), toolbarButton.buttonTexture)) { toolbarButton.activated = !toolbarButton.activated; } if (toolbarButton.activated) { DrawWindow(toolbarButton.windowType); } //Rect tooltipRect = GUIFunctions.AddRectAndRectCoords(toolbarButton.GetDrawRect(), toolbarRect); TooltipManager.SetTooltip(toolbarButton.tooltipID, toolbarButton.GetDrawRect(), toolbarButton.tooltipText); } }
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(); }
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); } } }
public void OnPointerEnter(PointerEventData eventData) { tooltip.SetTooltip(ModelData.name, ModelData.description); tooltip.ShowTooltip(); }