代码优化

This commit is contained in:
monitor1394
2022-12-22 21:51:08 +08:00
parent a5aa630b74
commit d7cfda2521
6 changed files with 25 additions and 17 deletions

View File

@@ -324,14 +324,20 @@ namespace XCharts.Runtime
if (background == null) return;
if (imageStyle.show)
{
background.gameObject.SetActive(true);
background.sprite = imageStyle.sprite;
background.color = imageStyle.color;
background.type = imageStyle.type;
if (imageStyle.width > 0 && imageStyle.height > 0)
{
background.rectTransform.sizeDelta = new Vector2(imageStyle.width, imageStyle.height);
}
}
else
{
background.sprite = null;
background.color = Color.clear;
background.gameObject.SetActive(false);
}
}