mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-30 13:28:47 +00:00
3.0
This commit is contained in:
@@ -275,7 +275,7 @@
|
|||||||
## v1.6.0
|
## v1.6.0
|
||||||
|
|
||||||
* (2020.08.24) 发布`v1.6.0`版本
|
* (2020.08.24) 发布`v1.6.0`版本
|
||||||
* (2020.08.23) 重构代码,将与绘制相关的`Color`改为`Color32`,减少隐式转换(更新后会导致自定义的颜色丢失,可参考[问答29](https://github.com/XCharts-Team/XCharts/blob/master/Assets/XCharts/Documentation/XChartsFQA-ZH.md)进行升级)
|
* (2020.08.23) 重构代码,将与绘制相关的`Color`改为`Color32`,减少隐式转换(更新后会导致自定义的颜色丢失,可参考[问答29](https://github.com/XCharts-Team/XCharts/blob/master/Assets/XCharts/Documentation/XChartsFAQ-ZH.md)进行升级)
|
||||||
* (2020.08.15) 优化`PieChart`绘制表现效果#85
|
* (2020.08.15) 优化`PieChart`绘制表现效果#85
|
||||||
* (2020.08.11) 增加`LiquidChart`数据变更动画#83
|
* (2020.08.11) 增加`LiquidChart`数据变更动画#83
|
||||||
* (2020.08.11) 优化`PieChart`文本堆叠和引线效果#85
|
* (2020.08.11) 优化`PieChart`文本堆叠和引线效果#85
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ Since the data type is upgraded to `double`, the implicit conversion of `float`
|
|||||||
## v1.6.0
|
## v1.6.0
|
||||||
|
|
||||||
* (2020.08.24) Release `v1.6.0` version
|
* (2020.08.24) Release `v1.6.0` version
|
||||||
* (2020.08.23) Refactor code, replace `Color` with `Color32` for reduce implicit conversion (Can cause custom colors to lose, reference [Q&A 29](https://github.com/XCharts-Team/XCharts/blob/master/Assets/XCharts/Documentation/XChartsFQA-ZH.md) to upgrade)
|
* (2020.08.23) Refactor code, replace `Color` with `Color32` for reduce implicit conversion (Can cause custom colors to lose, reference [FAQ 29](https://github.com/XCharts-Team/XCharts/blob/master/Assets/XCharts/Documentation/XChartsFAQ-ZH.md) to upgrade)
|
||||||
* (2020.08.15) Optimized `PieChart` drawing performance effect #85
|
* (2020.08.15) Optimized `PieChart` drawing performance effect #85
|
||||||
* (2020.08.11) Added `LiquidChart` data change animation#83
|
* (2020.08.11) Added `LiquidChart` data change animation#83
|
||||||
* (2020.08.11) Optimized `PieChart` text stack and lead line effects#85
|
* (2020.08.11) Optimized `PieChart` text stack and lead line effects#85
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
[XCharts Homepage](https://github.com/XCharts-Team/XCharts)</br>
|
[XCharts Homepage](https://github.com/XCharts-Team/XCharts)</br>
|
||||||
[XCharts Configuration](XChartsConfiguration-EN.md)</br>
|
[XCharts Configuration](XChartsConfiguration-EN.md)</br>
|
||||||
[XCharts Q&A](XChartsFQA-EN.md)
|
[XCharts FAQ](XChartsFAQ-EN.md)
|
||||||
|
|
||||||
## Class
|
## Class
|
||||||
|
|
||||||
@@ -999,4 +999,4 @@ Inherits or Implemented: [UnityEditor.EditorWindow](#UnityEditor.EditorWindow)
|
|||||||
|
|
||||||
[XCharts Homepage](https://github.com/XCharts-Team/XCharts)</br>
|
[XCharts Homepage](https://github.com/XCharts-Team/XCharts)</br>
|
||||||
[XCharts Configuration](XChartsConfiguration-EN.md)</br>
|
[XCharts Configuration](XChartsConfiguration-EN.md)</br>
|
||||||
[XCharts Q&A](XChartsFQA-EN.md)
|
[XCharts FAQ](XChartsFAQ-EN.md)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
[XCharts主页](https://github.com/XCharts-Team/XCharts)</br>
|
[XCharts主页](https://github.com/XCharts-Team/XCharts)</br>
|
||||||
[XCharts配置项手册](XChartsConfiguration-ZH.md)</br>
|
[XCharts配置项手册](XChartsConfiguration-ZH.md)</br>
|
||||||
[XCharts问答](XChartsFQA-ZH.md)
|
[XCharts问答](XChartsFAQ-ZH.md)
|
||||||
|
|
||||||
## Class
|
## Class
|
||||||
|
|
||||||
@@ -999,4 +999,4 @@ Inherits or Implemented: [UnityEditor.EditorWindow](#UnityEditor.EditorWindow)
|
|||||||
|
|
||||||
[XCharts主页](https://github.com/XCharts-Team/XCharts)</br>
|
[XCharts主页](https://github.com/XCharts-Team/XCharts)</br>
|
||||||
[XCharts配置项手册](XChartsConfiguration-ZH.md)</br>
|
[XCharts配置项手册](XChartsConfiguration-ZH.md)</br>
|
||||||
[XCharts问答](XChartsFQA-ZH.md)
|
[XCharts问答](XChartsFAQ-ZH.md)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
[XCharts Homepage](https://github.com/XCharts-Team/XCharts)</br>
|
[XCharts Homepage](https://github.com/XCharts-Team/XCharts)</br>
|
||||||
[XCharts API](XChartsAPI-EN.md)</br>
|
[XCharts API](XChartsAPI-EN.md)</br>
|
||||||
[XCharts Q&A](XChartsFQA-EN.md)
|
[XCharts FAQ](XChartsFAQ-EN.md)
|
||||||
|
|
||||||
## Serie
|
## Serie
|
||||||
|
|
||||||
@@ -1416,4 +1416,4 @@ The x axis in cartesian(rectangular) coordinate.
|
|||||||
|
|
||||||
[XCharts Homepage](https://github.com/XCharts-Team/XCharts)</br>
|
[XCharts Homepage](https://github.com/XCharts-Team/XCharts)</br>
|
||||||
[XCharts API](XChartsAPI-EN.md)</br>
|
[XCharts API](XChartsAPI-EN.md)</br>
|
||||||
[XCharts Q&A](XChartsFQA-EN.md)
|
[XCharts FAQ](XChartsFAQ-EN.md)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
[XCharts主页](https://github.com/XCharts-Team/XCharts)</br>
|
[XCharts主页](https://github.com/XCharts-Team/XCharts)</br>
|
||||||
[XChartsAPI接口](XChartsAPI-ZH.md)</br>
|
[XChartsAPI接口](XChartsAPI-ZH.md)</br>
|
||||||
[XCharts问答](XChartsFQA-ZH.md)
|
[XCharts问答](XChartsFAQ-ZH.md)
|
||||||
|
|
||||||
## Serie 系列
|
## Serie 系列
|
||||||
|
|
||||||
@@ -1416,4 +1416,4 @@ Inherits or Implemented: [Axis](#Axis)
|
|||||||
|
|
||||||
[XCharts主页](https://github.com/XCharts-Team/XCharts)</br>
|
[XCharts主页](https://github.com/XCharts-Team/XCharts)</br>
|
||||||
[XChartsAPI接口](XChartsAPI-ZH.md)</br>
|
[XChartsAPI接口](XChartsAPI-ZH.md)</br>
|
||||||
[XCharts问答](XChartsFQA-ZH.md)
|
[XCharts问答](XChartsFAQ-ZH.md)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# XCharts Q&A
|
# XCharts FAQ
|
||||||
|
|
||||||
[XCharts Homepage](https://github.com/XCharts-Team/XCharts)</br>
|
[XCharts Homepage](https://github.com/XCharts-Team/XCharts)</br>
|
||||||
[XCharts API](XChartsAPI-EN.md)</br>
|
[XCharts API](XChartsAPI-EN.md)</br>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 2929481916a9540ed9ecc270be6a3b0e
|
guid: e803ae0ae73794ec6891fed7551fe01d
|
||||||
TextScriptImporter:
|
TextScriptImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
userData:
|
userData:
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: f2d61cadf902a4e20a2690f3c7d2ceea
|
guid: 4df833a2a1e6c4a7da37a08379dd2e18
|
||||||
TextScriptImporter:
|
TextScriptImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
userData:
|
userData:
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
# 教程:5分钟上手 XCharts 3.0
|
# 教程:5分钟上手 XCharts 3.0
|
||||||
|
|
||||||
[XCharts主页](https://github.com/XCharts-Team/XCharts)</br>
|
[XCharts主页](https://github.com/XCharts-Team/XCharts)</br>
|
||||||
[XCharts问答](XChartsFQA-ZH.md)</br>
|
[XCharts问答](XChartsFAQ-ZH.md)</br>
|
||||||
[XChartsAPI接口](XChartsAPI-ZH.md)</br>
|
[XChartsAPI接口](XChartsAPI-ZH.md)</br>
|
||||||
[XCharts配置项手册](XChartsConfiguration-ZH.md)
|
[XCharts配置项手册](XChartsConfiguration-ZH.md)
|
||||||
|
|
||||||
@@ -226,6 +226,6 @@ itemStyle.color = Color.blue;
|
|||||||
```
|
```
|
||||||
|
|
||||||
[XCharts主页](https://github.com/XCharts-Team/XCharts)</br>
|
[XCharts主页](https://github.com/XCharts-Team/XCharts)</br>
|
||||||
[XCharts问答](XChartsFQA-ZH.md)</br>
|
[XCharts问答](XChartsFAQ-ZH.md)</br>
|
||||||
[XChartsAPI接口](XChartsAPI-ZH.md)</br>
|
[XChartsAPI接口](XChartsAPI-ZH.md)</br>
|
||||||
[XCharts配置项手册](XChartsConfiguration-ZH.md)
|
[XCharts配置项手册](XChartsConfiguration-ZH.md)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# 教程:5分钟上手 XCharts 3.0
|
# 教程:5分钟上手 XCharts 3.0
|
||||||
|
|
||||||
[XCharts主页](https://github.com/XCharts-Team/XCharts)</br>
|
[XCharts主页](https://github.com/XCharts-Team/XCharts)</br>
|
||||||
[XCharts问答](XChartsFQA-ZH.md)</br>
|
[XCharts问答](XChartsFAQ-ZH.md)</br>
|
||||||
[XChartsAPI接口](XChartsAPI-ZH.md)</br>
|
[XChartsAPI接口](XChartsAPI-ZH.md)</br>
|
||||||
[XCharts配置项手册](XChartsConfiguration-ZH.md)
|
[XCharts配置项手册](XChartsConfiguration-ZH.md)
|
||||||
|
|
||||||
@@ -226,6 +226,6 @@ itemStyle.color = Color.blue;
|
|||||||
```
|
```
|
||||||
|
|
||||||
[XCharts主页](https://github.com/XCharts-Team/XCharts)</br>
|
[XCharts主页](https://github.com/XCharts-Team/XCharts)</br>
|
||||||
[XCharts问答](XChartsFQA-ZH.md)</br>
|
[XCharts问答](XChartsFAQ-ZH.md)</br>
|
||||||
[XChartsAPI接口](XChartsAPI-ZH.md)</br>
|
[XChartsAPI接口](XChartsAPI-ZH.md)</br>
|
||||||
[XCharts配置项手册](XChartsConfiguration-ZH.md)
|
[XCharts配置项手册](XChartsConfiguration-ZH.md)
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ namespace XCharts.Editor
|
|||||||
public static void CheckDeletedAsset(string assetPath)
|
public static void CheckDeletedAsset(string assetPath)
|
||||||
{
|
{
|
||||||
if (!IsThemeAsset(assetPath)) return;
|
if (!IsThemeAsset(assetPath)) return;
|
||||||
|
if (XCSettings.Instance == null) return;
|
||||||
var themes = XCSettings.customThemes;
|
var themes = XCSettings.customThemes;
|
||||||
var changed = false;
|
var changed = false;
|
||||||
|
|
||||||
|
|||||||
73
README.md
73
README.md
@@ -47,48 +47,55 @@
|
|||||||
|
|
||||||
[XCharts3.0 教程](Documentation/XChartsTutorial01-ZH.md)
|
[XCharts3.0 教程](Documentation/XChartsTutorial01-ZH.md)
|
||||||
[XCharts3.0 API](Documentation/XChartsAPI-ZH.md)
|
[XCharts3.0 API](Documentation/XChartsAPI-ZH.md)
|
||||||
[XCharts3.0 问答](Documentation/XChartsFQA-ZH.md)
|
[XCharts3.0 问答](Documentation/XChartsFAQ-ZH.md)
|
||||||
[XCharts3.0 配置项手册](Documentation/XChartsConfiguration-ZH.md)
|
[XCharts3.0 配置项手册](Documentation/XChartsConfiguration-ZH.md)
|
||||||
[XCharts3.0 更新日志](CHANGELOG.md)
|
[XCharts3.0 更新日志](CHANGELOG.md)
|
||||||
|
|
||||||
## 特性
|
## 特性
|
||||||
|
|
||||||
* 参数可视化配置,效果实时预览,纯代码绘制,无需额外资源。
|
- 参数可视化配置,效果实时预览,纯代码绘制,无需额外资源。
|
||||||
* 支持折线图、柱状图、饼图、雷达图、散点图、热力图、环形图、K线图、极坐标、平行坐标等十种常见免费内置图表。
|
- 支持折线图、柱状图、饼图、雷达图、散点图、热力图、环形图、K线图、极坐标、平行坐标等十种常见免费内置图表。
|
||||||
* 支持3D柱图、漏斗图、金字塔、仪表盘、水位图、象形柱图、甘特图、矩形树图等多种付费扩展图表。
|
- 支持3D柱图、漏斗图、金字塔、仪表盘、水位图、象形柱图、甘特图、矩形树图等多种付费扩展图表。
|
||||||
* 支持直线图、曲线图、面积图、阶梯线图等折线图。
|
- 支持直线图、曲线图、面积图、阶梯线图等折线图。
|
||||||
* 支持并列柱图、堆叠柱图、堆积百分比柱图、斑马柱图等柱状图。
|
- 支持并列柱图、堆叠柱图、堆积百分比柱图、斑马柱图等柱状图。
|
||||||
* 支持环形图、玫瑰图等饼图。
|
- 支持环形图、玫瑰图等饼图。
|
||||||
* 支持内置图表的任意组合,同一图表中可同时显示多个相同或不同类型的图表。
|
- 支持内置图表的任意组合,同一图表中可同时显示多个相同或不同类型的图表。
|
||||||
* 支持实线、曲线、阶梯线、虚线、点线、点划线、双点划线等线条。
|
- 支持实线、曲线、阶梯线、虚线、点线、点划线、双点划线等线条。
|
||||||
* 支持主题定制、导入和导出,内置两种默认主题。
|
- 支持主题定制、导入和导出,内置两种默认主题。
|
||||||
* 支持自定义图表内容绘制,提供绘制点、直线、曲线、三角形、四边形、圆形、环形、扇形、边框、箭头等强大的绘图API。
|
- 支持自定义图表内容绘制,提供绘制点、直线、曲线、三角形、四边形、圆形、环形、扇形、边框、箭头等强大的绘图API。
|
||||||
* 支持PC端和手机端上的数据筛选、视图缩放、细节展示等交互操作。
|
- 支持PC端和手机端上的数据筛选、视图缩放、细节展示等交互操作。
|
||||||
* 支持万级大数据绘制。
|
- 支持万级大数据绘制。
|
||||||
* 支持`TexMeshPro`。
|
- 支持`TexMeshPro`。
|
||||||
|
|
||||||
## XCharts3.0 比 2.0 的改进
|
## XCharts3.0 相比XCharts2.0 的改进
|
||||||
|
|
||||||
* 更健壮的底层框架。
|
- 更健壮的底层框架。
|
||||||
* 更小的序列化文件。
|
- 更小的序列化文件。
|
||||||
* 更强大的性能。
|
- 更强大的性能。
|
||||||
* 更好的交互体验。
|
- 更好的交互体验。
|
||||||
* 更多的组件支持。
|
- 更多的组件支持。
|
||||||
* 更合理的组件调整。
|
- 更合理的组件调整。
|
||||||
* 更灵活的组件插拔。
|
- 更灵活的组件插拔。
|
||||||
* 更方便的二次开发。
|
- 更方便的二次开发。
|
||||||
* 更丰富的Demo示例。
|
- 更丰富的Demo示例。
|
||||||
|
|
||||||
## XCharts3.0 新功能
|
## XCharts3.0 新功能
|
||||||
|
|
||||||
* 增加Time时间轴。
|
- 增加Time时间轴。
|
||||||
* 增加SingleAxis单轴。
|
- 增加SingleAxis单轴。
|
||||||
* 增加多种坐标系:Grid、Polar、Radar、SingleAxis。
|
- 增加多种坐标系:Grid、Polar、Radar、SingleAxis。
|
||||||
* 增加多种动画方式。
|
- 增加多种动画方式。
|
||||||
* 增加多种图表交互。
|
- 增加多种图表交互。
|
||||||
* 增加国际化支持。
|
- 增加国际化支持。
|
||||||
* 增加Widgets小组件。
|
- 增加Widgets小组件。
|
||||||
* 增加多种扩展图表。
|
- 增加多种扩展图表。
|
||||||
|
|
||||||
|
## 注意
|
||||||
|
|
||||||
|
- XCharts3.0 不兼容 XCharts2.0 版本,建议旧项目还是继续使用XCharts2.0,新项目使用XCharts3.0。
|
||||||
|
- XCharts2.0 进入维护阶段,后续只修复严重bug理论上不再加新功能。
|
||||||
|
- XCharts 理论上支持Unity 5.6及以上版本,但由于版本测试有限难免疏漏,发现版本兼容问题可提Issue。
|
||||||
|
- XCharts 内置图表都为常见的图表,可以免费使用;扩展图表大部分为不常使用的图表,有需要的可付费获取,感谢对XCharts的支持。
|
||||||
|
|
||||||
## 截图
|
## 截图
|
||||||
|
|
||||||
@@ -102,6 +109,8 @@
|
|||||||
|
|
||||||
[XCharts教程:5分钟上手教程](Documentation/XChartsTutorial01-ZH.md)
|
[XCharts教程:5分钟上手教程](Documentation/XChartsTutorial01-ZH.md)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 日志
|
## 日志
|
||||||
|
|
||||||
[更新日志](CHANGELOG.md)
|
[更新日志](CHANGELOG.md)
|
||||||
|
|||||||
@@ -21,8 +21,7 @@ namespace XCharts.Runtime
|
|||||||
|
|
||||||
public void OnGUI()
|
public void OnGUI()
|
||||||
{
|
{
|
||||||
m_EssentialResourcesImported = Resources.Load<XCSettings>("XCSettings") != null ||
|
m_EssentialResourcesImported = Resources.Load<XCSettings>("XCSettings") != null;
|
||||||
XCSettings.ExistAssetFile();
|
|
||||||
|
|
||||||
GUILayout.BeginVertical();
|
GUILayout.BeginVertical();
|
||||||
{
|
{
|
||||||
@@ -33,15 +32,19 @@ namespace XCharts.Runtime
|
|||||||
GUILayout.Space(5f);
|
GUILayout.Space(5f);
|
||||||
|
|
||||||
GUI.enabled = !m_EssentialResourcesImported;
|
GUI.enabled = !m_EssentialResourcesImported;
|
||||||
|
GUI.enabled = true;
|
||||||
if (GUILayout.Button("Import XCharts Essentials"))
|
if (GUILayout.Button("Import XCharts Essentials"))
|
||||||
{
|
{
|
||||||
string packageFullPath = GetPackageFullPath();
|
string packageFullPath = XChartsMgr.GetPackageFullPath();
|
||||||
var sourPath = Path.Combine(packageFullPath, "Resources");
|
if (packageFullPath != null)
|
||||||
var destPath = Path.Combine(Application.dataPath, "XCharts/Resources");
|
|
||||||
if (RuntimeUtil.CopyFolder(sourPath, destPath))
|
|
||||||
{
|
{
|
||||||
AssetDatabase.SaveAssets();
|
var sourPath = Path.Combine(packageFullPath, "Resources");
|
||||||
AssetDatabase.Refresh();
|
var destPath = Path.Combine(Application.dataPath, "XCharts/Resources");
|
||||||
|
if (RuntimeUtil.CopyFolder(sourPath, destPath))
|
||||||
|
{
|
||||||
|
AssetDatabase.SaveAssets();
|
||||||
|
AssetDatabase.Refresh();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GUILayout.Space(5f);
|
GUILayout.Space(5f);
|
||||||
@@ -75,55 +78,6 @@ namespace XCharts.Runtime
|
|||||||
|
|
||||||
AssetDatabase.importPackageCompleted -= ImportCallback;
|
AssetDatabase.importPackageCompleted -= ImportCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
static string GetPackageFullPath()
|
|
||||||
{
|
|
||||||
// Check for potential UPM package
|
|
||||||
string packagePath = Path.GetFullPath("Packages/com.monitor1394.xcharts");
|
|
||||||
if (Directory.Exists(packagePath))
|
|
||||||
{
|
|
||||||
return packagePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
packagePath = Path.GetFullPath("Assets/..");
|
|
||||||
if (Directory.Exists(packagePath))
|
|
||||||
{
|
|
||||||
// Search default location for development package
|
|
||||||
if (Directory.Exists(packagePath + "/Assets/Packages/com.monitor1394.xcharts/Resources"))
|
|
||||||
{
|
|
||||||
return packagePath + "/Assets/Packages/com.monitor1394.xcharts";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Search for default location of normal XCharts AssetStore package
|
|
||||||
if (Directory.Exists(packagePath + "/Assets/XCharts/Resources"))
|
|
||||||
{
|
|
||||||
return packagePath + "/Assets/XCharts";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Search for potential alternative locations in the user project
|
|
||||||
string[] matchingPaths = Directory.GetDirectories(packagePath, "XCharts", SearchOption.AllDirectories);
|
|
||||||
string path = ValidateLocation(matchingPaths, packagePath);
|
|
||||||
if (path != null) return packagePath + path;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
static string ValidateLocation(string[] paths, string projectPath)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < paths.Length; i++)
|
|
||||||
{
|
|
||||||
// Check if the Editor Resources folder exists.
|
|
||||||
if (Directory.Exists(paths[i] + "/Package Resources"))
|
|
||||||
{
|
|
||||||
string folderPath = paths[i].Replace(projectPath, "");
|
|
||||||
folderPath = folderPath.TrimStart('\\', '/');
|
|
||||||
return folderPath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class XCResourceImporterWindow : UnityEditor.EditorWindow
|
public class XCResourceImporterWindow : UnityEditor.EditorWindow
|
||||||
@@ -134,13 +88,16 @@ namespace XCharts.Runtime
|
|||||||
|
|
||||||
public static void ShowPackageImporterWindow()
|
public static void ShowPackageImporterWindow()
|
||||||
{
|
{
|
||||||
if (m_ImporterWindow == null)
|
var packagePath = XChartsMgr.GetPackageFullPath();
|
||||||
|
if (packagePath != null)
|
||||||
{
|
{
|
||||||
m_ImporterWindow = GetWindow<XCResourceImporterWindow>();
|
if (m_ImporterWindow == null)
|
||||||
m_ImporterWindow.titleContent = new GUIContent("XCharts Importer");
|
{
|
||||||
|
m_ImporterWindow = GetWindow<XCResourceImporterWindow>();
|
||||||
|
m_ImporterWindow.titleContent = new GUIContent("XCharts Importer");
|
||||||
|
}
|
||||||
|
m_ImporterWindow.Focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ImporterWindow.Focus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnEnable()
|
void OnEnable()
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
#if dUI_TextMeshPro
|
#if dUI_TextMeshPro
|
||||||
using TMPro;
|
using TMPro;
|
||||||
#endif
|
#endif
|
||||||
@@ -129,8 +130,11 @@ namespace XCharts.Runtime
|
|||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
if (s_Instance == null)
|
if (s_Instance == null)
|
||||||
{
|
{
|
||||||
if (!ExistAssetFile())
|
var assetPath = GetSettingAssetPath();
|
||||||
|
if (string.IsNullOrEmpty(assetPath))
|
||||||
XCResourceImporterWindow.ShowPackageImporterWindow();
|
XCResourceImporterWindow.ShowPackageImporterWindow();
|
||||||
|
else
|
||||||
|
s_Instance = AssetDatabase.LoadAssetAtPath<XCSettings>(assetPath);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -156,6 +160,32 @@ namespace XCharts.Runtime
|
|||||||
return System.IO.File.Exists("Assets/XCharts/Resources/XCSettings.asset");
|
return System.IO.File.Exists("Assets/XCharts/Resources/XCSettings.asset");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string GetSettingAssetPath()
|
||||||
|
{
|
||||||
|
var path = "Assets/XCharts/Resources/XCSettings.asset";
|
||||||
|
if (File.Exists(path)) return path;
|
||||||
|
var dir = Application.dataPath;
|
||||||
|
string[] matchingPaths = Directory.GetDirectories(dir);
|
||||||
|
foreach (var match in matchingPaths)
|
||||||
|
{
|
||||||
|
if (match.Contains("XCharts"))
|
||||||
|
{
|
||||||
|
var jsonPath = string.Format("{0}/package.json", match);
|
||||||
|
if (File.Exists(jsonPath))
|
||||||
|
{
|
||||||
|
var jsonText = File.ReadAllText(jsonPath);
|
||||||
|
if (jsonText.Contains("\"displayName\": \"XCharts\""))
|
||||||
|
{
|
||||||
|
path = string.Format("{0}/Resources/XCSettings.asset", match);
|
||||||
|
if (File.Exists(path))
|
||||||
|
return path.Substring(path.IndexOf("/Assets/") + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public static bool AddCustomTheme(Theme theme)
|
public static bool AddCustomTheme(Theme theme)
|
||||||
{
|
{
|
||||||
if (theme == null) return false;
|
if (theme == null) return false;
|
||||||
|
|||||||
@@ -109,24 +109,20 @@ namespace XCharts.Runtime
|
|||||||
packagePath = Path.GetFullPath("Assets/..");
|
packagePath = Path.GetFullPath("Assets/..");
|
||||||
if (Directory.Exists(packagePath))
|
if (Directory.Exists(packagePath))
|
||||||
{
|
{
|
||||||
// Search default location for development package
|
if (File.Exists(packagePath + "/Assets/Packages/XCharts/package.json"))
|
||||||
if (File.Exists(packagePath + "/Assets/Packages/com.monitor1394.xcharts/package.json"))
|
|
||||||
{
|
{
|
||||||
return packagePath + "/Assets/Packages/com.monitor1394.xcharts";
|
return packagePath + "/Assets/Packages/XCharts";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search for default location of normal XCharts AssetStore package
|
|
||||||
if (File.Exists(packagePath + "/Assets/XCharts/package.json"))
|
if (File.Exists(packagePath + "/Assets/XCharts/package.json"))
|
||||||
{
|
{
|
||||||
return packagePath + "/Assets/XCharts";
|
return packagePath + "/Assets/XCharts";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search for potential alternative locations in the user project
|
|
||||||
string[] matchingPaths = Directory.GetDirectories(packagePath, "XCharts", SearchOption.AllDirectories);
|
string[] matchingPaths = Directory.GetDirectories(packagePath, "XCharts", SearchOption.AllDirectories);
|
||||||
string path = ValidateLocation(matchingPaths, packagePath);
|
string path = ValidateLocation(matchingPaths, packagePath);
|
||||||
if (path != null) return Path.Combine(packagePath, path);
|
if (path != null) return Path.Combine(packagePath, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,7 +137,6 @@ namespace XCharts.Runtime
|
|||||||
return folderPath;
|
return folderPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user