mirror of https://github.com/tuyoogame/YooAsset
parent
62f1c050ca
commit
3de44a416c
|
@ -25,13 +25,14 @@ namespace YooAsset.Editor
|
|||
private static void LoadSettingData()
|
||||
{
|
||||
// 加载配置文件
|
||||
_setting = AssetDatabase.LoadAssetAtPath<AssetBundleBuilderSetting>(EditorDefine.AssetBundleBuilderSettingFilePath);
|
||||
string settingFilePath = $"{EditorTools.GetYooAssetSettingPath()}/{nameof(AssetBundleBuilderSetting)}.asset";
|
||||
_setting = AssetDatabase.LoadAssetAtPath<AssetBundleBuilderSetting>(settingFilePath);
|
||||
if (_setting == null)
|
||||
{
|
||||
Debug.LogWarning($"Create new {nameof(AssetBundleBuilderSetting)}.asset : {EditorDefine.AssetBundleBuilderSettingFilePath}");
|
||||
Debug.LogWarning($"Create new {nameof(AssetBundleBuilderSetting)}.asset : {settingFilePath}");
|
||||
_setting = ScriptableObject.CreateInstance<AssetBundleBuilderSetting>();
|
||||
EditorTools.CreateFileDirectory(EditorDefine.AssetBundleBuilderSettingFilePath);
|
||||
AssetDatabase.CreateAsset(Setting, EditorDefine.AssetBundleBuilderSettingFilePath);
|
||||
EditorTools.CreateFileDirectory(settingFilePath);
|
||||
AssetDatabase.CreateAsset(Setting, settingFilePath);
|
||||
AssetDatabase.SaveAssets();
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace YooAsset.Editor
|
|||
VisualElement root = this.rootVisualElement;
|
||||
|
||||
// 加载布局文件
|
||||
string rootPath = EditorTools.GetYooAssetPath();
|
||||
string rootPath = EditorTools.GetYooAssetSourcePath();
|
||||
string uxml = $"{rootPath}/Editor/AssetBundleBuilder/{nameof(AssetBundleBuilderWindow)}.uxml";
|
||||
var visualAsset = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(uxml);
|
||||
if (visualAsset == null)
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace YooAsset.Editor
|
|||
VisualElement root = rootVisualElement;
|
||||
|
||||
// 加载布局文件
|
||||
string rootPath = EditorTools.GetYooAssetPath();
|
||||
string rootPath = EditorTools.GetYooAssetSourcePath();
|
||||
string uxml = $"{rootPath}/Editor/AssetBundleDebugger/{nameof(AssetBundleDebuggerWindow)}.uxml";
|
||||
var visualAsset = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(uxml);
|
||||
if (visualAsset == null)
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace YooAsset.Editor
|
|||
public void InitViewer()
|
||||
{
|
||||
// 加载布局文件
|
||||
string rootPath = EditorTools.GetYooAssetPath();
|
||||
string rootPath = EditorTools.GetYooAssetSourcePath();
|
||||
string uxml = $"{rootPath}/Editor/AssetBundleDebugger/VisualViewers/{nameof(AssetListDebuggerViewer)}.uxml";
|
||||
_visualAsset = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(uxml);
|
||||
if (_visualAsset == null)
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace YooAsset.Editor
|
|||
public void InitViewer()
|
||||
{
|
||||
// 加载布局文件
|
||||
string rootPath = EditorTools.GetYooAssetPath();
|
||||
string rootPath = EditorTools.GetYooAssetSourcePath();
|
||||
string uxml = $"{rootPath}/Editor/AssetBundleDebugger/VisualViewers/{nameof(BundleListDebuggerViewer)}.uxml";
|
||||
_visualAsset = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(uxml);
|
||||
if (_visualAsset == null)
|
||||
|
|
|
@ -106,13 +106,14 @@ namespace YooAsset.Editor
|
|||
private static void LoadSettingData()
|
||||
{
|
||||
// 加载配置文件
|
||||
_setting = AssetDatabase.LoadAssetAtPath<AssetBundleGrouperSetting>(EditorDefine.AssetBundleGrouperSettingFilePath);
|
||||
string settingFilePath = $"{EditorTools.GetYooAssetSettingPath()}/{nameof(AssetBundleGrouperSetting)}.asset";
|
||||
_setting = AssetDatabase.LoadAssetAtPath<AssetBundleGrouperSetting>(settingFilePath);
|
||||
if (_setting == null)
|
||||
{
|
||||
Debug.LogWarning($"Create new {nameof(AssetBundleGrouperSetting)}.asset : {EditorDefine.AssetBundleGrouperSettingFilePath}");
|
||||
Debug.LogWarning($"Create new {nameof(AssetBundleGrouperSetting)}.asset : {settingFilePath}");
|
||||
_setting = ScriptableObject.CreateInstance<AssetBundleGrouperSetting>();
|
||||
EditorTools.CreateFileDirectory(EditorDefine.AssetBundleGrouperSettingFilePath);
|
||||
AssetDatabase.CreateAsset(Setting, EditorDefine.AssetBundleGrouperSettingFilePath);
|
||||
EditorTools.CreateFileDirectory(settingFilePath);
|
||||
AssetDatabase.CreateAsset(Setting, settingFilePath);
|
||||
AssetDatabase.SaveAssets();
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace YooAsset.Editor
|
|||
_filterRuleList = AssetBundleGrouperSettingData.GetFilterRuleNames();
|
||||
|
||||
// 加载布局文件
|
||||
string rootPath = EditorTools.GetYooAssetPath();
|
||||
string rootPath = EditorTools.GetYooAssetSourcePath();
|
||||
string uxml = $"{rootPath}/Editor/AssetBundleGrouper/{nameof(AssetBundleGrouperWindow)}.uxml";
|
||||
var visualAsset = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(uxml);
|
||||
if (visualAsset == null)
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace YooAsset.Editor
|
|||
VisualElement root = this.rootVisualElement;
|
||||
|
||||
// 加载布局文件
|
||||
string rootPath = EditorTools.GetYooAssetPath();
|
||||
string rootPath = EditorTools.GetYooAssetSourcePath();
|
||||
string uxml = $"{rootPath}/Editor/AssetBundleReporter/{nameof(AssetBundleReporterWindow)}.uxml";
|
||||
var visualAsset = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(uxml);
|
||||
if (visualAsset == null)
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace YooAsset.Editor
|
|||
public void InitViewer()
|
||||
{
|
||||
// 加载布局文件
|
||||
string rootPath = EditorTools.GetYooAssetPath();
|
||||
string rootPath = EditorTools.GetYooAssetSourcePath();
|
||||
string uxml = $"{rootPath}/Editor/AssetBundleReporter/VisualViewers/{nameof(AssetListReporterViewer)}.uxml";
|
||||
_visualAsset = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(uxml);
|
||||
if (_visualAsset == null)
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace YooAsset.Editor
|
|||
public void InitViewer()
|
||||
{
|
||||
// 加载布局文件
|
||||
string rootPath = EditorTools.GetYooAssetPath();
|
||||
string rootPath = EditorTools.GetYooAssetSourcePath();
|
||||
string uxml = $"{rootPath}/Editor/AssetBundleReporter/VisualViewers/{nameof(BundleListReporterViewer)}.uxml";
|
||||
_visualAsset = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(uxml);
|
||||
if (_visualAsset == null)
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace YooAsset.Editor
|
|||
public void InitViewer()
|
||||
{
|
||||
// 加载布局文件
|
||||
string rootPath = EditorTools.GetYooAssetPath();
|
||||
string rootPath = EditorTools.GetYooAssetSourcePath();
|
||||
string uxml = $"{rootPath}/Editor/AssetBundleReporter/VisualViewers/{nameof(SummaryReporterViewer)}.uxml";
|
||||
_visualAsset = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(uxml);
|
||||
if (_visualAsset == null)
|
||||
|
|
|
@ -1,25 +1,9 @@
|
|||
|
||||
using System;
|
||||
using System;
|
||||
|
||||
namespace YooAsset.Editor
|
||||
{
|
||||
public class EditorDefine
|
||||
{
|
||||
/// <summary>
|
||||
/// 资源包构建工具的配置文件存储路径
|
||||
/// </summary>
|
||||
public const string AssetBundleBuilderSettingFilePath = "Assets/YooAssetSetting/AssetBundleBuilderSetting.asset";
|
||||
|
||||
/// <summary>
|
||||
/// 资源包分组工具的配置文件存储路径
|
||||
/// </summary>
|
||||
public const string AssetBundleGrouperSettingFilePath = "Assets/YooAssetSetting/AssetBundleGrouperSetting.asset";
|
||||
|
||||
/// <summary>
|
||||
/// 着色器变种收集工具的配置文件存储路径
|
||||
/// </summary>
|
||||
public const string ShaderVariantCollectorSettingFilePath = "Assets/YooAssetSetting/ShaderVariantCollectorSetting.asset";
|
||||
|
||||
/// <summary>
|
||||
/// 停靠窗口类型集合
|
||||
/// </summary>
|
||||
|
@ -55,16 +39,16 @@ namespace YooAsset.Editor
|
|||
/// </summary>
|
||||
public enum EAssetFileExtension
|
||||
{
|
||||
prefab, //预制体
|
||||
unity, //场景
|
||||
fbx, //模型
|
||||
anim, //动画
|
||||
controller, //控制器
|
||||
png, //图片
|
||||
jpg, //图片
|
||||
mat, //材质球
|
||||
shader, //着色器
|
||||
ttf, //字体
|
||||
cs, //脚本
|
||||
prefab,
|
||||
unity,
|
||||
fbx,
|
||||
anim,
|
||||
controller,
|
||||
png,
|
||||
jpg,
|
||||
mat,
|
||||
shader,
|
||||
ttf,
|
||||
cs,
|
||||
}
|
||||
}
|
|
@ -412,7 +412,8 @@ namespace YooAsset.Editor
|
|||
#endregion
|
||||
|
||||
#region 路径
|
||||
private static string YooAssetPath;
|
||||
private static string YooAssetSourcePath;
|
||||
private static string YooAssetSettingPath;
|
||||
|
||||
/// <summary>
|
||||
/// 获取规范的路径
|
||||
|
@ -423,27 +424,30 @@ namespace YooAsset.Editor
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取资源框架目录路径
|
||||
/// 获取资源框架源码路径
|
||||
/// </summary>
|
||||
public static string GetYooAssetPath()
|
||||
public static string GetYooAssetSourcePath()
|
||||
{
|
||||
if (string.IsNullOrEmpty(YooAssetPath) == false)
|
||||
return YooAssetPath;
|
||||
if (string.IsNullOrEmpty(YooAssetSourcePath) == false)
|
||||
{
|
||||
if (Directory.Exists(YooAssetSourcePath))
|
||||
return YooAssetSourcePath;
|
||||
}
|
||||
|
||||
// 从Pakcages目录下搜索
|
||||
string packagesPath = ("Packages/com.tuyoogame.yooasset/README.md");
|
||||
string packagesPath = "Packages/com.tuyoogame.yooasset/README.md";
|
||||
var obj = AssetDatabase.LoadAssetAtPath(packagesPath, typeof(TextAsset));
|
||||
if (obj != null)
|
||||
{
|
||||
YooAssetPath = "Packages/com.tuyoogame.yooasset/";
|
||||
return YooAssetPath;
|
||||
YooAssetSourcePath = "Packages/com.tuyoogame.yooasset/";
|
||||
return YooAssetSourcePath;
|
||||
}
|
||||
|
||||
// 从Assets目录下搜索
|
||||
string[] allDirectorys = Directory.GetDirectories(Application.dataPath, "YooAsset", SearchOption.AllDirectories);
|
||||
if (allDirectorys.Length == 0)
|
||||
{
|
||||
Debug.LogError("Not found YooAsset Package !");
|
||||
Debug.LogError("Not found YooAsset package !");
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
|
@ -463,8 +467,37 @@ namespace YooAsset.Editor
|
|||
return string.Empty;
|
||||
}
|
||||
|
||||
YooAssetPath = AbsolutePathToAssetPath(targetDirectory);
|
||||
return YooAssetPath;
|
||||
YooAssetSourcePath = AbsolutePathToAssetPath(targetDirectory);
|
||||
return YooAssetSourcePath;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取资源框架配置路径
|
||||
/// </summary>
|
||||
public static string GetYooAssetSettingPath()
|
||||
{
|
||||
if (string.IsNullOrEmpty(YooAssetSettingPath) == false)
|
||||
{
|
||||
if (Directory.Exists(YooAssetSettingPath))
|
||||
return YooAssetSettingPath;
|
||||
}
|
||||
|
||||
// 从Assets目录下搜索
|
||||
string[] allDirectorys = Directory.GetDirectories(Application.dataPath, "YooAssetSetting", SearchOption.AllDirectories);
|
||||
if (allDirectorys.Length == 0)
|
||||
{
|
||||
YooAssetSettingPath = "Assets/YooAssetSetting";
|
||||
return YooAssetSettingPath;
|
||||
}
|
||||
|
||||
string targetDirectory = allDirectorys[0];
|
||||
if (allDirectorys.Length != 1)
|
||||
{
|
||||
Debug.LogError("Found multiple YooAssetSetting folder !");
|
||||
}
|
||||
|
||||
YooAssetSettingPath = AbsolutePathToAssetPath(targetDirectory);
|
||||
return YooAssetSettingPath;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -26,13 +26,14 @@ namespace YooAsset.Editor
|
|||
private static void LoadSettingData()
|
||||
{
|
||||
// 加载配置文件
|
||||
_setting = AssetDatabase.LoadAssetAtPath<ShaderVariantCollectorSetting>(EditorDefine.ShaderVariantCollectorSettingFilePath);
|
||||
string settingFilePath = $"{EditorTools.GetYooAssetSettingPath()}/{nameof(ShaderVariantCollectorSetting)}.asset";
|
||||
_setting = AssetDatabase.LoadAssetAtPath<ShaderVariantCollectorSetting>(settingFilePath);
|
||||
if (_setting == null)
|
||||
{
|
||||
Debug.LogWarning($"Create new {nameof(ShaderVariantCollectorSetting)}.asset : {EditorDefine.ShaderVariantCollectorSettingFilePath}");
|
||||
Debug.LogWarning($"Create new {nameof(ShaderVariantCollectorSetting)}.asset : {settingFilePath}");
|
||||
_setting = ScriptableObject.CreateInstance<ShaderVariantCollectorSetting>();
|
||||
EditorTools.CreateFileDirectory(EditorDefine.ShaderVariantCollectorSettingFilePath);
|
||||
AssetDatabase.CreateAsset(Setting, EditorDefine.ShaderVariantCollectorSettingFilePath);
|
||||
EditorTools.CreateFileDirectory(settingFilePath);
|
||||
AssetDatabase.CreateAsset(Setting, settingFilePath);
|
||||
AssetDatabase.SaveAssets();
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue