This commit is contained in:
monitor1394
2022-03-26 21:34:38 +08:00
parent 3fbf5bc906
commit ed393ea560
13 changed files with 79 additions and 121 deletions

View File

@@ -21,7 +21,8 @@ namespace XCharts.Runtime
public void OnGUI()
{
m_EssentialResourcesImported = File.Exists("Assets/XCharts/Resources/XCSettings.asset");
m_EssentialResourcesImported = Resources.Load<XCSettings>("XCSettings") != null ||
XCSettings.ExistAssetFile();
GUILayout.BeginVertical();
{
@@ -125,17 +126,17 @@ namespace XCharts.Runtime
}
}
public class XChartsPackageResourceImporterWindow : UnityEditor.EditorWindow
public class XCResourceImporterWindow : UnityEditor.EditorWindow
{
[SerializeField] XCResourcesImporter m_ResourceImporter;
static XChartsPackageResourceImporterWindow m_ImporterWindow;
static XCResourceImporterWindow m_ImporterWindow;
public static void ShowPackageImporterWindow()
{
if (m_ImporterWindow == null)
{
m_ImporterWindow = GetWindow<XChartsPackageResourceImporterWindow>();
m_ImporterWindow = GetWindow<XCResourceImporterWindow>();
m_ImporterWindow.titleContent = new GUIContent("XCharts Importer");
}

View File

@@ -129,9 +129,8 @@ namespace XCharts.Runtime
#if UNITY_EDITOR
if (s_Instance == null)
{
var isExist = System.IO.File.Exists("Assets/XCharts/Resources/XCSettings.asset");
if(isExist)
XChartsPackageResourceImporterWindow.ShowPackageImporterWindow();
if (!ExistAssetFile())
XCResourceImporterWindow.ShowPackageImporterWindow();
}
else
{
@@ -152,6 +151,11 @@ namespace XCharts.Runtime
}
}
public static bool ExistAssetFile()
{
return System.IO.File.Exists("Assets/XCharts/Resources/XCSettings.asset");
}
public static bool AddCustomTheme(Theme theme)
{
if (theme == null) return false;

View File

@@ -86,33 +86,6 @@ 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)