3.0 commit

This commit is contained in:
monitor1394
2021-11-23 13:20:07 +08:00
parent d87e0f8267
commit 1b3fa7fb43
796 changed files with 410878 additions and 1656601 deletions

View File

@@ -13,6 +13,17 @@ namespace XChartsDemo
internal static class UIUtil
{
public static GameObject Instantiate(GameObject clone, Transform parent)
{
var obj = GameObject.Instantiate(clone);
obj.layer = LayerMask.NameToLayer("UI");
obj.transform.SetParent(parent, true);
obj.transform.localScale = Vector3.one;
obj.transform.localPosition = Vector3.zero;
obj.SetActive(true);
return obj;
}
public static RectTransform GetRectTransform(Transform transform, string path)
{
if (!string.IsNullOrEmpty(path))
@@ -70,5 +81,17 @@ namespace XChartsDemo
}
}
}
public static void SetText(GameObject parent, string text, string subPath = null)
{
if (!string.IsNullOrEmpty(subPath))
{
parent.transform.Find(subPath).GetComponent<Text>().text = text;
}
else
{
parent.GetComponent<Text>().text = text;
}
}
}
}