mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-28 03:58:49 +00:00
Fixed chart name repeat check error #183
This commit is contained in:
@@ -279,7 +279,7 @@ namespace XCharts
|
||||
public List<BaseChart> GetCharts(string chartName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(chartName)) return null;
|
||||
return m_ChartList.FindAll(chart => chartName.Equals(chartName));
|
||||
return m_ChartList.FindAll(chart => chartName.Equals(chart.chartName));
|
||||
}
|
||||
|
||||
public void RemoveChart(string chartName)
|
||||
@@ -299,6 +299,33 @@ namespace XCharts
|
||||
return m_ChartList.Contains(chart);
|
||||
}
|
||||
|
||||
public bool IsRepeatChartName(BaseChart chart, string chartName = null)
|
||||
{
|
||||
if(chartName == null)
|
||||
chartName = chart.chartName;
|
||||
if (string.IsNullOrEmpty(chartName))
|
||||
return false;
|
||||
foreach (var temp in m_ChartList)
|
||||
{
|
||||
if (temp != chart && chartName.Equals(temp.chartName))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public string GetRepeatChartNameInfo(BaseChart chart, string chartName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(chartName))
|
||||
return string.Empty;
|
||||
string result = "";
|
||||
foreach (var temp in m_ChartList)
|
||||
{
|
||||
if (temp != chart && chartName.Equals(temp.chartName))
|
||||
result += ChartHelper.GetFullName(temp.transform) + "\n";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void RemoveAllChartObject()
|
||||
{
|
||||
if (Instance.m_ChartList.Count == 0)
|
||||
|
||||
Reference in New Issue
Block a user