This commit is contained in:
monitor1394
2022-03-29 22:06:10 +08:00
parent b784900fda
commit 1ad87920d0
17 changed files with 130 additions and 117 deletions

View File

@@ -481,5 +481,11 @@ namespace XCharts.Runtime
m_PainterTop.material = material;
}
}
public Color32 GetChartBackgroundColor()
{
var background = GetChartComponent<Background>();
return theme.GetBackgroundColor(background);
}
}
}

View File

@@ -112,7 +112,7 @@ namespace XCharts.Runtime
Vector3 pos, Color32 color, Color32 toColor, Color32 emptyColor, Color32 borderColor,
float gap, float[] cornerRadius, Vector3 startPos)
{
var backgroundColor = theme.GetBackgroundColor(GetChartComponent<Background>());
var backgroundColor = GetChartBackgroundColor();
if (ChartHelper.IsClearColor(emptyColor))
emptyColor = backgroundColor;
var smoothness = settings.cicleSmoothness;

View File

@@ -597,7 +597,9 @@ namespace XCharts.Runtime
protected virtual void DrawBackground(VertexHelper vh)
{
if (HasChartComponent<Background>()) return;
var background = GetChartComponent<Background>();
if (background != null && background.show)
return;
Vector3 p1 = new Vector3(chartX, chartY + chartHeight);
Vector3 p2 = new Vector3(chartX + chartWidth, chartY + chartHeight);
Vector3 p3 = new Vector3(chartX + chartWidth, chartY);

View File

@@ -86,6 +86,33 @@ namespace XCharts.Runtime
return chartList.Contains(chart);
}
public static bool IsRepeatChartName(BaseChart chart, string chartName = null)
{
if (chartName == null)
chartName = chart.chartName;
if (string.IsNullOrEmpty(chartName))
return false;
foreach (var temp in chartList)
{
if (temp != chart && chartName.Equals(temp.chartName))
return true;
}
return false;
}
public static string GetRepeatChartNameInfo(BaseChart chart, string chartName)
{
if (string.IsNullOrEmpty(chartName))
return string.Empty;
string result = "";
foreach (var temp in chartList)
{
if (temp != chart && chartName.Equals(temp.chartName))
result += ChartHelper.GetFullName(temp.transform) + "\n";
}
return result;
}
public static void RemoveAllChartObject()
{
if (chartList.Count == 0)