mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-25 02:10:16 +00:00
重构Component相关代码,调整API接口
This commit is contained in:
@@ -204,15 +204,15 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
serieDataMenus.Clear();
|
||||
if (serie.GetType().IsDefined(typeof(SerieDataExtraComponentAttribute), false))
|
||||
if (serie.GetType().IsDefined(typeof(SerieDataComponentAttribute), false))
|
||||
{
|
||||
var attribute = serie.GetType().GetAttribute<SerieDataExtraComponentAttribute>();
|
||||
var attribute = serie.GetType().GetAttribute<SerieDataComponentAttribute>();
|
||||
foreach (var type in attribute.types)
|
||||
{
|
||||
var size = serieData.FindPropertyRelative(SerieData.extraComponentMap[type]).arraySize;
|
||||
serieDataMenus.Add(new HeaderMenuInfo("Add " + type.Name, () =>
|
||||
{
|
||||
serie.GetSerieData(index).GetOrAddComponent(type);
|
||||
serie.GetSerieData(index).EnsureComponent(type);
|
||||
EditorUtility.SetDirty(chart);
|
||||
}, size == 0));
|
||||
}
|
||||
|
||||
@@ -176,15 +176,15 @@ namespace XCharts.Editor
|
||||
ConvertSerie(editor.serie, type);
|
||||
}));
|
||||
}
|
||||
if (editor.serie.GetType().IsDefined(typeof(SerieExtraComponentAttribute), false))
|
||||
if (editor.serie.GetType().IsDefined(typeof(SerieComponentAttribute), false))
|
||||
{
|
||||
var attribute = editor.serie.GetType().GetAttribute<SerieExtraComponentAttribute>();
|
||||
var attribute = editor.serie.GetType().GetAttribute<SerieComponentAttribute>();
|
||||
foreach (var type in attribute.types)
|
||||
{
|
||||
var size = editor.FindProperty(Serie.extraComponentMap[type]).arraySize;
|
||||
editor.menus.Add(new HeaderMenuInfo("Add " + type.Name, () =>
|
||||
{
|
||||
editor.serie.AddExtraComponent(type);
|
||||
editor.serie.EnsureComponent(type);
|
||||
RefreshEditors();
|
||||
chart.RefreshAllComponent();
|
||||
EditorUtility.SetDirty(chart);
|
||||
@@ -195,7 +195,7 @@ namespace XCharts.Editor
|
||||
var size = editor.FindProperty(Serie.extraComponentMap[type]).arraySize;
|
||||
editor.menus.Add(new HeaderMenuInfo("Remove " + type.Name, () =>
|
||||
{
|
||||
editor.serie.RemoveExtraComponent(type);
|
||||
editor.serie.RemoveComponent(type);
|
||||
RefreshEditors();
|
||||
chart.RefreshAllComponent();
|
||||
EditorUtility.SetDirty(chart);
|
||||
|
||||
Reference in New Issue
Block a user