This commit is contained in:
monitor1394
2022-05-31 08:17:54 +08:00
parent 5740882d1c
commit e370bedc09
9 changed files with 117 additions and 56 deletions

View File

@@ -13,6 +13,7 @@ namespace XCharts.Runtime
public virtual bool useDataNameForColor { get { return false; } }
public virtual bool titleJustForSerie { get { return false; } }
public virtual bool useSortData { get { return false; } }
public virtual bool multiDimensionLabel { get { return false; } }
public bool anyDirty { get { return vertsDirty || componentDirty; } }
public Painter painter { get { return m_Painter; } set { m_Painter = value; } }
public Action refreshComponent { get; set; }

View File

@@ -14,8 +14,7 @@ namespace XCharts.Runtime
public XCResourcesImporter() { }
public void OnDestroy()
{ }
public void OnDestroy() { }
public void OnGUI()
{
@@ -38,7 +37,7 @@ namespace XCharts.Runtime
{
var sourPath = Path.Combine(packageFullPath, "Resources");
var destPath = Path.Combine(Application.dataPath, "XCharts/Resources");
if (RuntimeUtil.CopyFolder(sourPath, destPath))
if (CopyFolder(sourPath, destPath))
{
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
@@ -54,6 +53,37 @@ namespace XCharts.Runtime
GUILayout.Space(5f);
}
private static bool CopyFolder(string sourPath, string destPath)
{
try
{
if (!Directory.Exists(destPath))
{
Directory.CreateDirectory(destPath);
}
var files = Directory.GetFiles(sourPath);
foreach (var file in files)
{
var name = Path.GetFileName(file);
var path = Path.Combine(destPath, name);
File.Copy(file, path);
}
var folders = Directory.GetDirectories(sourPath);
foreach (var folder in folders)
{
var name = Path.GetFileName(folder);
var path = Path.Combine(destPath, name);
CopyFolder(folder, path);
}
return true;
}
catch (Exception e)
{
Debug.LogError("CopyFolder:" + e.Message);
return false;
}
}
internal void RegisterResourceImportCallback()
{
AssetDatabase.importPackageCompleted += ImportCallback;

View File

@@ -154,6 +154,7 @@ namespace XCharts.Runtime
}
}
#if UNITY_EDITOR
public static bool ExistAssetFile()
{
return System.IO.File.Exists("Assets/XCharts/Resources/XCSettings.asset");
@@ -184,6 +185,7 @@ namespace XCharts.Runtime
}
return null;
}
#endif
public static bool AddCustomTheme(Theme theme)
{

View File

@@ -126,6 +126,7 @@ namespace XCharts.Runtime
}
}
#if UNITY_EDITOR
public static string GetPackageFullPath()
{
string packagePath = Path.GetFullPath("Packages/com.monitor1394.xcharts");
@@ -167,8 +168,6 @@ namespace XCharts.Runtime
return null;
}
#if UNITY_EDITOR
[UnityEditor.Callbacks.DidReloadScripts]
static void OnEditorReload()
{