public static void SetupSubtypeInfoTooltip(TooltipController_TitleAndText tooltipController, string titleString, string textString) { tooltipController.TooltipPrefabType = subtypeInfoTooltip; tooltipController.titleString = titleString; tooltipController.textString = textString; }
public static TooltipController_TitleAndText SetupSubtypeInfoTooltip(GameObject gameObject, string titleString, string textString) { TooltipController_TitleAndText tooltipController = gameObject.AddOrGetComponent <TooltipController_TitleAndText>(); tooltipController.TooltipPrefabType = subtypeInfoTooltip; tooltipController.titleString = titleString; tooltipController.textString = textString; return(tooltipController); }
/// <summary> /// Create a tooltip object for a given GameObject, containing both /// a title and a subtitle. /// </summary> /// <param name="gameObj">GameObject to which we want to add a tooltip</param> /// <param name="title">Highlighted text for the tooltip</param> /// <param name="text">Less emphasized text for the tooltip</param> public static void SetTooltip(this GameObject gameObj, string title, string text) { if (gameObj != null) { TooltipController_TitleAndText tt = (gameObj?.GetComponent <TooltipController_TitleAndText>() ?? gameObj?.AddComponent <TooltipController_TitleAndText>()); if (tt != null) { tt.prefab = titleAndTextTooltipPrefab; tt.titleString = title; tt.textString = text; } } }