增加Tooltip的FontSize、FontStyle配置字体大小和样式

This commit is contained in:
monitor1394
2019-09-23 09:50:57 +08:00
parent 9be97bb223
commit d75d3bd402
4 changed files with 23 additions and 4 deletions

View File

@@ -174,7 +174,7 @@ namespace XCharts
return btnObj.GetComponent<Button>();
}
public static GameObject AddTooltipContent(string name, Transform parent, Font font)
public static GameObject AddTooltipContent(string name, Transform parent, Font font, int fontSize, FontStyle fontStyle)
{
var anchorMax = new Vector2(0, 1);
var anchorMin = new Vector2(0, 1);
@@ -184,7 +184,7 @@ namespace XCharts
var img = GetOrAddComponent<Image>(tooltipObj);
img.color = Color.black;
Text txt = AddTextObject("Text", tooltipObj.transform, font, Color.white, TextAnchor.UpperLeft,
anchorMin, anchorMax, pivot, sizeDelta);
anchorMin, anchorMax, pivot, sizeDelta, fontSize, 0, fontStyle);
txt.text = "Text";
txt.transform.localPosition = new Vector2(3, -3);
tooltipObj.transform.localPosition = Vector3.zero;