mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-14 20:00:09 +00:00
修复Legend初始化异常的问题
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
|
||||
# 更新日志
|
||||
|
||||
* (2020.04.09) 修复`Legend`初始化异常的问题
|
||||
* (2020.04.08) 增加`PieChart`通过`ItemStyle`设置边框的支持
|
||||
* (2020.03.29) 增加`Axis`的`ceilRate`设置最大最小值的取整倍率
|
||||
* (2020.03.29) 增加`BarChart`可通过`itemStyle`的`cornerRadius`设置`圆角柱图`
|
||||
|
||||
@@ -172,13 +172,13 @@ namespace XCharts
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
Awake();
|
||||
ChartHelper.ActiveAllObject(transform, true);
|
||||
}
|
||||
|
||||
protected override void OnDisable()
|
||||
{
|
||||
base.OnDisable();
|
||||
ChartHelper.HideAllObject(transform);
|
||||
ChartHelper.ActiveAllObject(transform, false);
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
|
||||
@@ -77,19 +77,22 @@ namespace XCharts
|
||||
}
|
||||
|
||||
public static void HideAllObject(Transform parent, string match = null)
|
||||
{
|
||||
ActiveAllObject(parent, false, match);
|
||||
}
|
||||
|
||||
public static void ActiveAllObject(Transform parent, bool active, string match = null)
|
||||
{
|
||||
for (int i = 0; i < parent.childCount; i++)
|
||||
{
|
||||
if (match == null)
|
||||
SetActive(parent.GetChild(i), false);
|
||||
//parent.GetChild(i).gameObject.SetActive(false);
|
||||
SetActive(parent.GetChild(i), active);
|
||||
else
|
||||
{
|
||||
var go = parent.GetChild(i);
|
||||
if (go.name.StartsWith(match))
|
||||
{
|
||||
SetActive(go, false);
|
||||
//go.gameObject.SetActive(false);
|
||||
SetActive(go, active);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -97,24 +100,17 @@ namespace XCharts
|
||||
|
||||
public static void DestroyAllChildren(Transform parent)
|
||||
{
|
||||
#if UNITY_2019_1_OR_NEWER
|
||||
#else
|
||||
if (parent == null) return;
|
||||
#if UNITY_EDITOR && UNITY_2018_3_OR_NEWER
|
||||
if (PrefabUtility.IsPartOfAnyPrefab(parent.gameObject))
|
||||
var childCount = parent.childCount;
|
||||
for (int i = childCount - 1; i >= 0; i--)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
while (parent.childCount > 0)
|
||||
{
|
||||
var go = parent.GetChild(0);
|
||||
var go = parent.GetChild(i);
|
||||
if (go != null)
|
||||
{
|
||||
GameObject.DestroyImmediate(go.gameObject);
|
||||
//GameObject.Destroy(go.gameObject);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public static string GetFullName(Transform transform)
|
||||
|
||||
Reference in New Issue
Block a user