Optimized the loading method of the setting file

优化了配置文件的加载方式和途径。
This commit is contained in:
hevinci
2022-05-13 23:53:19 +08:00
parent a054740de6
commit 8dc0560537
38 changed files with 308 additions and 265 deletions
@@ -9,7 +9,7 @@ using UnityEngine.UIElements;
namespace YooAsset.Editor
{
internal class AssetListDebuggerViewer
internal class DebuggerAssetListViewer
{
private VisualTreeAsset _visualAsset;
private TemplateContainer _root;
@@ -23,13 +23,11 @@ namespace YooAsset.Editor
/// </summary>
public void InitViewer()
{
// 加载布局文件
string rootPath = EditorTools.GetYooAssetSourcePath();
string uxml = $"{rootPath}/Editor/AssetBundleDebugger/VisualViewers/{nameof(AssetListDebuggerViewer)}.uxml";
_visualAsset = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(uxml);
// 加载布局文件
_visualAsset = YooAssetEditorSettingsData.Setting.DebuggerAssetListViewerUXML;
if (_visualAsset == null)
{
Debug.LogError($"Not found {nameof(AssetListDebuggerViewer)}.uxml : {uxml}");
Debug.LogError($"Not found {nameof(DebuggerAssetListViewer)}.uxml in settings.");
return;
}
_root = _visualAsset.CloneTree();
@@ -9,7 +9,7 @@ using UnityEngine.UIElements;
namespace YooAsset.Editor
{
internal class BundleListDebuggerViewer
internal class DebuggerBundleListViewer
{
private VisualTreeAsset _visualAsset;
private TemplateContainer _root;
@@ -24,12 +24,10 @@ namespace YooAsset.Editor
public void InitViewer()
{
// 加载布局文件
string rootPath = EditorTools.GetYooAssetSourcePath();
string uxml = $"{rootPath}/Editor/AssetBundleDebugger/VisualViewers/{nameof(BundleListDebuggerViewer)}.uxml";
_visualAsset = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(uxml);
_visualAsset = YooAssetEditorSettingsData.Setting.DebuggerBundleListViewerUXML;
if (_visualAsset == null)
{
Debug.LogError($"Not found {nameof(BundleListDebuggerViewer)}.uxml : {uxml}");
Debug.LogError($"Not found {nameof(DebuggerBundleListViewer)}.uxml in settings.");
return;
}
_root = _visualAsset.CloneTree();