mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-24 18:00:26 +00:00
优化自定义主题Theme的自动刷新 (#148)
This commit is contained in:
@@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
## master
|
## master
|
||||||
|
|
||||||
|
* (2021.06.04) Optimized auto-refresh of custom `Theme` (#148)
|
||||||
* (2021.06.04) Fixed `Gauge` having an abnormal pointer position when the minimum value is negative
|
* (2021.06.04) Fixed `Gauge` having an abnormal pointer position when the minimum value is negative
|
||||||
|
|
||||||
## v2.2.0
|
## v2.2.0
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
## master
|
## master
|
||||||
|
|
||||||
|
* (2021.06.04) 优化自定义主题`Theme`的自动刷新 (#148)
|
||||||
* (2021.06.04) 修复`Gauge`在最小值为负数时指针指示位置异常的问题
|
* (2021.06.04) 修复`Gauge`在最小值为负数时指针指示位置异常的问题
|
||||||
|
|
||||||
## v2.2.0
|
## v2.2.0
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using System.IO;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
@@ -23,6 +24,12 @@ namespace XCharts
|
|||||||
|
|
||||||
public static void CheckAddedAsset(string assetPath)
|
public static void CheckAddedAsset(string assetPath)
|
||||||
{
|
{
|
||||||
|
var fileName = Path.GetFileName(assetPath);
|
||||||
|
if (fileName.Equals("XChartsSettings.asset"))
|
||||||
|
{
|
||||||
|
XThemeMgr.ReloadThemeList();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!IsThemeAsset(assetPath)) return;
|
if (!IsThemeAsset(assetPath)) return;
|
||||||
var obj = AssetDatabase.LoadAssetAtPath<TextAsset>(assetPath);
|
var obj = AssetDatabase.LoadAssetAtPath<TextAsset>(assetPath);
|
||||||
if (obj == null || obj.text == null) return;
|
if (obj == null || obj.text == null) return;
|
||||||
|
|||||||
@@ -94,6 +94,14 @@ namespace XCharts
|
|||||||
newtheme.theme = Theme.Custom;
|
newtheme.theme = Theme.Custom;
|
||||||
newtheme.themeName = themeNewName;
|
newtheme.themeName = themeNewName;
|
||||||
|
|
||||||
|
if (!Directory.Exists(Application.dataPath + "/XCharts"))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(Application.dataPath + "/XCharts");
|
||||||
|
}
|
||||||
|
if (!Directory.Exists(Application.dataPath + "/XCharts/Resources"))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(Application.dataPath + "/XCharts/Resources");
|
||||||
|
}
|
||||||
var themeFileName = "XTheme-" + newtheme.themeName;
|
var themeFileName = "XTheme-" + newtheme.themeName;
|
||||||
var assetPath = string.Format("Assets/XCharts/Resources/{0}", themeFileName);
|
var assetPath = string.Format("Assets/XCharts/Resources/{0}", themeFileName);
|
||||||
var filePath = string.Format("{0}/../{1}.json", Application.dataPath, assetPath);
|
var filePath = string.Format("{0}/../{1}.json", Application.dataPath, assetPath);
|
||||||
|
|||||||
Reference in New Issue
Block a user