调整UI组件相关代码

This commit is contained in:
monitor1394
2024-01-16 22:29:15 +08:00
parent 6aa11249c5
commit daec83c4a5
12 changed files with 223 additions and 65 deletions

View File

@@ -368,6 +368,28 @@ namespace XCharts.Runtime
}
}
public static void SetBackground(Image background, Background imageStyle)
{
if (background == null) return;
if (imageStyle.show)
{
background.gameObject.SetActive(true);
background.sprite = imageStyle.image;
background.color = imageStyle.imageColor;
background.type = imageStyle.imageType;
if (imageStyle.imageWidth > 0 && imageStyle.imageHeight > 0)
{
background.rectTransform.sizeDelta = new Vector2(imageStyle.imageWidth, imageStyle.imageHeight);
}
}
else
{
background.sprite = null;
background.color = Color.clear;
background.gameObject.SetActive(false);
}
}
public static ChartLabel AddAxisLabelObject(int total, int index, string name, Transform parent,
Vector2 sizeDelta, Axis axis, ComponentTheme theme,
string content, Color autoColor, TextAnchor autoAlignment = TextAnchor.MiddleCenter, Color32 iconDefaultColor = default(Color32))