Compare commits

...

10 Commits

Author SHA1 Message Date
hevinci
4ee6b3cdc2 Update CHANGELOG.md 2022-05-22 15:14:27 +08:00
hevinci
d5636a71b1 Update package.json 2022-05-22 15:08:45 +08:00
hevinci
b1ca47fc14 Update EditorHelper.cs 2022-05-22 15:03:40 +08:00
hevinci
ddb35620cb Update document 2022-05-22 00:40:15 +08:00
hevinci
a906a84721 Optimized the loading method of the setting file
优化了配置文件的加载方式和途径。
2022-05-22 00:39:22 +08:00
hevinci
d43d30f72f The collector window supports undo operations
资源收集界面支持撤销操作
2022-05-21 23:41:58 +08:00
hevinci
e9841a65c6 Added pause method and resume method to patch downloader
补丁下载器增加暂停方法和恢复方法
2022-05-21 22:36:06 +08:00
hevinci
2dd3ba847e Bundle build system adds builtin files copy options
资源构建增加内置文件拷贝的选项
2022-05-21 22:24:05 +08:00
hevinci
0dcbe0574c Fixed load sprite issues in editor simulate mode
修复加载精灵图片失败的问题在编辑器模拟模式下。
2022-05-16 20:16:10 +08:00
hevinci
d01dce438c Fixed window opening issues
修复了资源收集配置存在多个的时候,导致后续无法打开窗口的问题。
2022-05-16 15:48:23 +08:00
34 changed files with 259 additions and 299 deletions

View File

@@ -2,6 +2,20 @@
All notable changes to this package will be documented in this file.
## [1.0.10] - 2022-05-22
### Fixed
- 修复了资源收集配置存在多个的时候,导致后续无法打开窗口的问题。
- 修复了在编辑器模拟模式下加载精灵图片失败的问题。
- 修复了在Unity2019版本无法识别配置文件的问题。
### Changed
- 资源构建增加内置资源文件(首包资源文件)拷贝的选项。
- 补丁下载器增加暂停方法和恢复方法。
- 在资源收集界面对Collector的增加和删除支持撤销和恢复操作。
## [1.0.9] - 2022-05-14
### Fixed

View File

@@ -16,7 +16,7 @@ namespace YooAsset.Editor
public EBuildMode BuildMode = EBuildMode.ForceRebuild;
/// <summary>
/// 内置资源标签
/// 内置资源标签(首包资源标签)
/// </summary>
public string BuildTags = string.Empty;
@@ -34,5 +34,10 @@ namespace YooAsset.Editor
/// 附加后缀格式
/// </summary>
public bool AppendExtension = false;
/// <summary>
/// 拷贝内置资源文件(首包资源文件)
/// </summary>
public bool CopyBuildinTagFiles = true;
}
}

View File

@@ -24,7 +24,7 @@ namespace YooAsset.Editor
/// </summary>
private static void LoadSettingData()
{
_setting = YooAssetEditorSettingsHelper.LoadSettingData<AssetBundleBuilderSetting>();
_setting = EditorHelper.LoadSettingData<AssetBundleBuilderSetting>();
}
/// <summary>

View File

@@ -25,11 +25,12 @@ namespace YooAsset.Editor
private TextField _buildOutputField;
private IntegerField _buildVersionField;
private EnumField _buildModeField;
private TextField _buildTagsField;
private TextField _buildinTagsField;
private PopupField<string> _encryptionField;
private EnumField _compressionField;
private Toggle _appendExtensionToggle;
private Toggle _copyBuildinTagFilesToggle;
public void CreateGUI()
{
try
@@ -37,12 +38,10 @@ namespace YooAsset.Editor
VisualElement root = this.rootVisualElement;
// 加载布局文件
var visualAsset = YooAssetEditorSettingsData.Setting.AssetBundleBuilderUXML;
var visualAsset = EditorHelper.LoadWindowUXML<AssetBundleBuilderWindow>();
if (visualAsset == null)
{
Debug.LogError($"Not found {nameof(AssetBundleBuilderWindow)}.uxml in settings.");
return;
}
visualAsset.CloneTree(root);
_buildTarget = EditorUserBuildSettings.activeBuildTarget;
@@ -76,11 +75,11 @@ namespace YooAsset.Editor
});
// 内置资源标签
_buildTagsField = root.Q<TextField>("BuildinTags");
_buildTagsField.SetValueWithoutNotify(AssetBundleBuilderSettingData.Setting.BuildTags);
_buildTagsField.RegisterValueChangedCallback(evt =>
_buildinTagsField = root.Q<TextField>("BuildinTags");
_buildinTagsField.SetValueWithoutNotify(AssetBundleBuilderSettingData.Setting.BuildTags);
_buildinTagsField.RegisterValueChangedCallback(evt =>
{
AssetBundleBuilderSettingData.Setting.BuildTags = _buildTagsField.value;
AssetBundleBuilderSettingData.Setting.BuildTags = _buildinTagsField.value;
});
// 加密方法
@@ -123,6 +122,14 @@ namespace YooAsset.Editor
AssetBundleBuilderSettingData.Setting.AppendExtension = _appendExtensionToggle.value;
});
// 拷贝首包文件
_copyBuildinTagFilesToggle = root.Q<Toggle>("CopyBuildinFiles");
_copyBuildinTagFilesToggle.SetValueWithoutNotify(AssetBundleBuilderSettingData.Setting.CopyBuildinTagFiles);
_copyBuildinTagFilesToggle.RegisterValueChangedCallback(evt =>
{
AssetBundleBuilderSettingData.Setting.CopyBuildinTagFiles = _copyBuildinTagFilesToggle.value;
});
// 构建按钮
var buildButton = root.Q<Button>("Build");
buildButton.clicked += BuildButton_clicked; ;
@@ -141,11 +148,13 @@ namespace YooAsset.Editor
private void RefreshWindow()
{
bool enableElement = AssetBundleBuilderSettingData.Setting.BuildMode == EBuildMode.ForceRebuild;
_buildTagsField.SetEnabled(enableElement);
var buildMode = AssetBundleBuilderSettingData.Setting.BuildMode;
bool enableElement = buildMode == EBuildMode.ForceRebuild;
_buildinTagsField.SetEnabled(enableElement);
_encryptionField.SetEnabled(enableElement);
_compressionField.SetEnabled(enableElement);
_appendExtensionToggle.SetEnabled(enableElement);
_copyBuildinTagFilesToggle.SetEnabled(buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild);
}
private void BuildButton_clicked()
{
@@ -172,10 +181,11 @@ namespace YooAsset.Editor
buildParameters.BuildTarget = _buildTarget;
buildParameters.BuildMode = (EBuildMode)_buildModeField.value;
buildParameters.BuildVersion = _buildVersionField.value;
buildParameters.BuildinTags = _buildTagsField.value;
buildParameters.BuildinTags = _buildinTagsField.value;
buildParameters.VerifyBuildingResult = true;
buildParameters.EnableAddressable = AssetBundleCollectorSettingData.Setting.EnableAddressable;
buildParameters.AppendFileExtension = _appendExtensionToggle.value;
buildParameters.CopyBuildinTagFiles = _copyBuildinTagFilesToggle.value;
buildParameters.EncryptionServices = CreateEncryptionServicesInstance();
buildParameters.CompressOption = (ECompressOption)_compressionField.value;

View File

@@ -7,6 +7,7 @@
<ui:VisualElement name="EncryptionContainer" style="height: 24px;" />
<uie:EnumField label="Compression" value="Center" name="Compression" />
<ui:Toggle label="Append Extension" name="AppendExtension" style="height: 15px;" />
<ui:Toggle label="Copy BuildinTag Files" name="CopyBuildinFiles" style="height: 15px;" />
<ui:TextField picking-mode="Ignore" label="Buildin Tags" name="BuildinTags" />
<ui:Button text="构建" display-tooltip-when-elided="true" name="Build" style="height: 50px; background-color: rgb(40, 106, 42); margin-top: 10px;" />
</ui:VisualElement>

View File

@@ -30,7 +30,7 @@ namespace YooAsset.Editor
public int BuildVersion;
/// <summary>
/// 内置资源的标记列表
/// 内置资源标签集合(首包资源标签)
/// 注意:分号为分隔符
/// </summary>
public string BuildinTags;
@@ -51,6 +51,11 @@ namespace YooAsset.Editor
/// </summary>
public bool AppendFileExtension = false;
/// <summary>
/// 拷贝内置资源文件(首包资源文件)
/// </summary>
public bool CopyBuildinTagFiles = false;
/// <summary>
/// 加密类
@@ -74,7 +79,7 @@ namespace YooAsset.Editor
/// <summary>
/// 获取内置标记列表
/// 获取内置资源标签列表(首包资源标签)
/// </summary>
public List<string> GetBuildinTags()
{

View File

@@ -53,6 +53,11 @@ namespace YooAsset.Editor
/// </summary>
public bool AppendFileExtension;
/// <summary>
/// 拷贝内置资源文件
/// </summary>
public bool CopyBuildinTagFiles;
/// <summary>
/// 自动收集着色器
/// </summary>

View File

@@ -13,7 +13,7 @@ namespace YooAsset.Editor
{
// 注意:我们只有在强制重建的时候才会拷贝
var buildParameters = context.GetContextObject<AssetBundleBuilder.BuildParametersContext>();
if (buildParameters.Parameters.BuildMode == EBuildMode.ForceRebuild)
if (buildParameters.Parameters.CopyBuildinTagFiles)
{
// 清空流目录
AssetBundleBuilderHelper.ClearStreamingAssetsFolder();

View File

@@ -58,9 +58,7 @@ namespace YooAsset.Editor
{
List<PatchBundle> result = new List<PatchBundle>(1000);
// 内置标记列表
List<string> buildinTags = buildParameters.Parameters.GetBuildinTags();
var buildMode = buildParameters.Parameters.BuildMode;
bool standardBuild = buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild;
foreach (var bundleInfo in buildMapContext.BundleInfos)
@@ -90,7 +88,7 @@ namespace YooAsset.Editor
}
private bool IsBuildinBundle(string[] bundleTags, List<string> buildinTags)
{
// 注意:没有任何标记的Bundle文件默认为内置文件
// 注意:没有任何分类标签的Bundle文件默认为内置文件
if (bundleTags.Length == 0)
return true;

View File

@@ -42,6 +42,7 @@ namespace YooAsset.Editor
buildReport.Summary.BuildinTags = buildParameters.Parameters.BuildinTags;
buildReport.Summary.EnableAddressable = buildParameters.Parameters.EnableAddressable;
buildReport.Summary.AppendFileExtension = buildParameters.Parameters.AppendFileExtension;
buildReport.Summary.CopyBuildinTagFiles = buildParameters.Parameters.CopyBuildinTagFiles;
buildReport.Summary.AutoCollectShaders = AssetBundleCollectorSettingData.Setting.AutoCollectShaders;
buildReport.Summary.ShadersBundleName = AssetBundleCollectorSettingData.Setting.ShadersBundleName;
buildReport.Summary.EncryptionServicesClassName = buildParameters.Parameters.EncryptionServices == null ?

View File

@@ -105,7 +105,7 @@ namespace YooAsset.Editor
/// </summary>
private static void LoadSettingData()
{
_setting = YooAssetEditorSettingsHelper.LoadSettingData<AssetBundleCollectorSetting>();
_setting = EditorHelper.LoadSettingData<AssetBundleCollectorSetting>();
// IPackRule
{

View File

@@ -31,33 +31,33 @@ namespace YooAsset.Editor
private TextField _groupDescTxt;
private TextField _groupAssetTagsTxt;
private VisualElement _groupContainer;
private string _lastModifyGroup = string.Empty;
public void CreateGUI()
{
Undo.undoRedoPerformed -= RefreshWindow;
Undo.undoRedoPerformed += RefreshWindow;
_collectorTypeList = new List<string>()
{
$"{nameof(ECollectorType.MainAssetCollector)}",
$"{nameof(ECollectorType.StaticAssetCollector)}",
$"{nameof(ECollectorType.DependAssetCollector)}"
};
_addressRuleList = AssetBundleCollectorSettingData.GetAddressRuleNames();
_packRuleList = AssetBundleCollectorSettingData.GetPackRuleNames();
_filterRuleList = AssetBundleCollectorSettingData.GetFilterRuleNames();
try
{
_collectorTypeList = new List<string>()
{
$"{nameof(ECollectorType.MainAssetCollector)}",
$"{nameof(ECollectorType.StaticAssetCollector)}",
$"{nameof(ECollectorType.DependAssetCollector)}"
};
_addressRuleList = AssetBundleCollectorSettingData.GetAddressRuleNames();
_packRuleList = AssetBundleCollectorSettingData.GetPackRuleNames();
_filterRuleList = AssetBundleCollectorSettingData.GetFilterRuleNames();
VisualElement root = this.rootVisualElement;
// 加载布局文件
var visualAsset = YooAssetEditorSettingsData.Setting.AssetBundleCollectorUXML;
var visualAsset = EditorHelper.LoadWindowUXML<AssetBundleCollectorWindow>();
if (visualAsset == null)
{
Debug.LogError($"Not found {nameof(AssetBundleCollectorWindow)}.uxml in settings.");
return;
}
visualAsset.CloneTree(root);
// 导入导出按钮
@@ -164,6 +164,9 @@ namespace YooAsset.Editor
}
public void OnDestroy()
{
// 注意:清空所有撤销操作
Undo.ClearAll();
if (AssetBundleCollectorSettingData.IsDirty)
AssetBundleCollectorSettingData.SaveFile();
}
@@ -203,6 +206,16 @@ namespace YooAsset.Editor
_groupListView.ClearSelection();
_groupListView.itemsSource = AssetBundleCollectorSettingData.Setting.Groups;
_groupListView.Rebuild();
for (int index = 0; index < AssetBundleCollectorSettingData.Setting.Groups.Count; index++)
{
var group = AssetBundleCollectorSettingData.Setting.Groups[index];
if (group.GroupName == _lastModifyGroup)
{
_groupListView.selectedIndex = index;
break;
}
}
}
private VisualElement MakeGroupListViewItem()
{
@@ -236,7 +249,7 @@ namespace YooAsset.Editor
}
private void AddGroupBtn_clicked()
{
Undo.RecordObject(AssetBundleCollectorSettingData.Setting, "YooAsset AddGroup");
Undo.RecordObject(AssetBundleCollectorSettingData.Setting, "YooAsset.AssetBundleCollectorWindow AddGroup");
AssetBundleCollectorSettingData.CreateGroup("Default Group");
FillGroupViewData();
}
@@ -246,8 +259,7 @@ namespace YooAsset.Editor
if (selectGroup == null)
return;
Undo.RecordObject(AssetBundleCollectorSettingData.Setting, "YooAsset RemoveGroup");
Undo.RecordObject(AssetBundleCollectorSettingData.Setting, "YooAsset.AssetBundleCollectorWindow RemoveGroup");
AssetBundleCollectorSettingData.RemoveGroup(selectGroup);
FillGroupViewData();
}
@@ -262,6 +274,7 @@ namespace YooAsset.Editor
return;
}
_lastModifyGroup = selectGroup.GroupName;
_groupContainer.visible = true;
_groupNameTxt.SetValueWithoutNotify(selectGroup.GroupName);
_groupDescTxt.SetValueWithoutNotify(selectGroup.GroupDesc);
@@ -550,6 +563,7 @@ namespace YooAsset.Editor
if (selectGroup == null)
return;
Undo.RecordObject(AssetBundleCollectorSettingData.Setting, "YooAsset.AssetBundleCollectorWindow AddCollector");
AssetBundleCollectorSettingData.CreateCollector(selectGroup, string.Empty);
FillCollectorViewData();
}
@@ -560,6 +574,8 @@ namespace YooAsset.Editor
return;
if (selectCollector == null)
return;
Undo.RecordObject(AssetBundleCollectorSettingData.Setting, "YooAsset.AssetBundleCollectorWindow RemoveCollector");
AssetBundleCollectorSettingData.RemoveCollector(selectGroup, selectCollector);
FillCollectorViewData();
}

View File

@@ -53,12 +53,10 @@ namespace YooAsset.Editor
VisualElement root = rootVisualElement;
// 加载布局文件
var visualAsset = YooAssetEditorSettingsData.Setting.AssetBundleDebuggerUXML;
var visualAsset = EditorHelper.LoadWindowUXML<AssetBundleDebuggerWindow>();
if (visualAsset == null)
{
Debug.LogError($"Not found {nameof(AssetBundleDebuggerWindow)}.uxml in settings.");
return;
}
visualAsset.CloneTree(root);
// 采样按钮

View File

@@ -24,12 +24,10 @@ namespace YooAsset.Editor
public void InitViewer()
{
// 加载布局文件
_visualAsset = YooAssetEditorSettingsData.Setting.DebuggerAssetListViewerUXML;
_visualAsset = EditorHelper.LoadWindowUXML<DebuggerAssetListViewer>();
if (_visualAsset == null)
{
Debug.LogError($"Not found {nameof(DebuggerAssetListViewer)}.uxml in settings.");
return;
}
_root = _visualAsset.CloneTree();
_root.style.flexGrow = 1f;

View File

@@ -24,12 +24,10 @@ namespace YooAsset.Editor
public void InitViewer()
{
// 加载布局文件
_visualAsset = YooAssetEditorSettingsData.Setting.DebuggerBundleListViewerUXML;
_visualAsset = EditorHelper.LoadWindowUXML<DebuggerBundleListViewer>();
if (_visualAsset == null)
{
Debug.LogError($"Not found {nameof(DebuggerBundleListViewer)}.uxml in settings.");
return;
}
_root = _visualAsset.CloneTree();
_root.style.flexGrow = 1f;
@@ -37,12 +35,12 @@ namespace YooAsset.Editor
_bundleListView = _root.Q<ListView>("TopListView");
_bundleListView.makeItem = MakeAssetListViewItem;
_bundleListView.bindItem = BindAssetListViewItem;
#if UNITY_2020_1_OR_NEWER
_bundleListView.onSelectionChange += BundleListView_onSelectionChange;
#else
_bundleListView.onSelectionChanged += BundleListView_onSelectionChange;
#endif
// 使用列表
_usingListView = _root.Q<ListView>("BottomListView");
_usingListView.makeItem = MakeIncludeListViewItem;

View File

@@ -55,12 +55,10 @@ namespace YooAsset.Editor
VisualElement root = this.rootVisualElement;
// 加载布局文件
var visualAsset = YooAssetEditorSettingsData.Setting.AssetBundleReporterUXML;
var visualAsset = EditorHelper.LoadWindowUXML<AssetBundleReporterWindow>();
if (visualAsset == null)
{
Debug.LogError($"Not found {nameof(AssetBundleReporterWindow)}.uxml in settings.");
return;
}
visualAsset.CloneTree(root);
// 导入按钮

View File

@@ -38,46 +38,36 @@ namespace YooAsset.Editor
public void InitViewer()
{
// 加载布局文件
_visualAsset = YooAssetEditorSettingsData.Setting.ReporterAssetListViewerUXML;
_visualAsset = EditorHelper.LoadWindowUXML<ReporterAssetListViewer>();
if (_visualAsset == null)
{
Debug.LogError($"Not found {nameof(ReporterAssetListViewer)}.uxml in settings.");
return;
}
try
{
_root = _visualAsset.CloneTree();
_root.style.flexGrow = 1f;
_root = _visualAsset.CloneTree();
_root.style.flexGrow = 1f;
// 顶部按钮栏
_topBar1 = _root.Q<ToolbarButton>("TopBar1");
_topBar2 = _root.Q<ToolbarButton>("TopBar2");
_topBar1.clicked += TopBar1_clicked;
_topBar2.clicked += TopBar2_clicked;
// 顶部按钮栏
_topBar1 = _root.Q<ToolbarButton>("TopBar1");
_topBar2 = _root.Q<ToolbarButton>("TopBar2");
_topBar1.clicked += TopBar1_clicked;
_topBar2.clicked += TopBar2_clicked;
// 底部按钮栏
_bottomBar1 = _root.Q<ToolbarButton>("BottomBar1");
// 底部按钮栏
_bottomBar1 = _root.Q<ToolbarButton>("BottomBar1");
// 资源列表
_assetListView = _root.Q<ListView>("TopListView");
_assetListView.makeItem = MakeAssetListViewItem;
_assetListView.bindItem = BindAssetListViewItem;
// 资源列表
_assetListView = _root.Q<ListView>("TopListView");
_assetListView.makeItem = MakeAssetListViewItem;
_assetListView.bindItem = BindAssetListViewItem;
#if UNITY_2020_1_OR_NEWER
_assetListView.onSelectionChange += AssetListView_onSelectionChange;
_assetListView.onSelectionChange += AssetListView_onSelectionChange;
#else
_assetListView.onSelectionChanged += AssetListView_onSelectionChange;
_assetListView.onSelectionChanged += AssetListView_onSelectionChange;
#endif
// 依赖列表
_dependListView = _root.Q<ListView>("BottomListView");
_dependListView.makeItem = MakeDependListViewItem;
_dependListView.bindItem = BindDependListViewItem;
}
catch (Exception e)
{
Debug.LogError(e.ToString());
}
// 依赖列表
_dependListView = _root.Q<ListView>("BottomListView");
_dependListView.makeItem = MakeDependListViewItem;
_dependListView.bindItem = BindDependListViewItem;
}
/// <summary>

View File

@@ -42,56 +42,46 @@ namespace YooAsset.Editor
public void InitViewer()
{
// 加载布局文件
_visualAsset = YooAssetEditorSettingsData.Setting.ReporterBundleListViewerUXML;
_visualAsset = EditorHelper.LoadWindowUXML<ReporterBundleListViewer>();
if (_visualAsset == null)
{
Debug.LogError($"Not found {nameof(ReporterBundleListViewer)}.uxml in settings.");
return;
}
try
{
_root = _visualAsset.CloneTree();
_root.style.flexGrow = 1f;
_root = _visualAsset.CloneTree();
_root.style.flexGrow = 1f;
// 顶部按钮栏
_topBar1 = _root.Q<ToolbarButton>("TopBar1");
_topBar2 = _root.Q<ToolbarButton>("TopBar2");
_topBar3 = _root.Q<ToolbarButton>("TopBar3");
_topBar4 = _root.Q<ToolbarButton>("TopBar4");
_topBar1.clicked += TopBar1_clicked;
_topBar2.clicked += TopBar2_clicked;
_topBar3.clicked += TopBar3_clicked;
_topBar4.clicked += TopBar4_clicked;
// 顶部按钮栏
_topBar1 = _root.Q<ToolbarButton>("TopBar1");
_topBar2 = _root.Q<ToolbarButton>("TopBar2");
_topBar3 = _root.Q<ToolbarButton>("TopBar3");
_topBar4 = _root.Q<ToolbarButton>("TopBar4");
_topBar1.clicked += TopBar1_clicked;
_topBar2.clicked += TopBar2_clicked;
_topBar3.clicked += TopBar3_clicked;
_topBar4.clicked += TopBar4_clicked;
// 底部按钮栏
_bottomBar1 = _root.Q<ToolbarButton>("BottomBar1");
// 底部按钮栏
_bottomBar1 = _root.Q<ToolbarButton>("BottomBar1");
// 资源包列表
_bundleListView = _root.Q<ListView>("TopListView");
_bundleListView.makeItem = MakeBundleListViewItem;
_bundleListView.bindItem = BindBundleListViewItem;
// 资源包列表
_bundleListView = _root.Q<ListView>("TopListView");
_bundleListView.makeItem = MakeBundleListViewItem;
_bundleListView.bindItem = BindBundleListViewItem;
#if UNITY_2020_1_OR_NEWER
_bundleListView.onSelectionChange += BundleListView_onSelectionChange;
_bundleListView.onSelectionChange += BundleListView_onSelectionChange;
#else
_bundleListView.onSelectionChanged += BundleListView_onSelectionChange;
_bundleListView.onSelectionChanged += BundleListView_onSelectionChange;
#endif
// 包含列表
_includeListView = _root.Q<ListView>("BottomListView");
_includeListView.makeItem = MakeIncludeListViewItem;
_includeListView.bindItem = BindIncludeListViewItem;
}
catch (Exception e)
{
Debug.LogError(e.ToString());
}
// 包含列表
_includeListView = _root.Q<ListView>("BottomListView");
_includeListView.makeItem = MakeIncludeListViewItem;
_includeListView.bindItem = BindIncludeListViewItem;
}
/// <summary>
/// 填充页面数据
/// </summary>
public void FillViewData( BuildReport buildReport, string reprotFilePath, string searchKeyWord)
public void FillViewData(BuildReport buildReport, string reprotFilePath, string searchKeyWord)
{
_buildReport = buildReport;
_reportFilePath = reprotFilePath;

View File

@@ -37,12 +37,10 @@ namespace YooAsset.Editor
public void InitViewer()
{
// 加载布局文件
_visualAsset = YooAssetEditorSettingsData.Setting.ReporterSummaryViewerUXML;
_visualAsset = EditorHelper.LoadWindowUXML<ReporterSummaryViewer>();
if (_visualAsset == null)
{
Debug.LogError($"Not found {nameof(ReporterSummaryViewer)}.uxml in settings.");
return;
}
_root = _visualAsset.CloneTree();
_root.style.flexGrow = 1f;
@@ -70,6 +68,7 @@ namespace YooAsset.Editor
_items.Add(new ItemWrapper("启用可寻址资源定位", $"{buildReport.Summary.EnableAddressable}"));
_items.Add(new ItemWrapper("追加文件扩展名", $"{buildReport.Summary.AppendFileExtension}"));
_items.Add(new ItemWrapper("拷贝内置资源文件", $"{buildReport.Summary.CopyBuildinTagFiles}"));
_items.Add(new ItemWrapper("自动收集着色器", $"{buildReport.Summary.AutoCollectShaders}"));
_items.Add(new ItemWrapper("着色器资源包名称", $"{buildReport.Summary.ShadersBundleName}"));
_items.Add(new ItemWrapper("加密服务类名称", $"{buildReport.Summary.EncryptionServicesClassName}"));

View File

@@ -0,0 +1,84 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
namespace YooAsset.Editor
{
public class EditorHelper
{
#if UNITY_2019_4_OR_NEWER
private readonly static Dictionary<System.Type, string> _uxmlDic = new Dictionary<System.Type, string>();
static EditorHelper()
{
// 资源包收集
_uxmlDic.Add(typeof(AssetBundleCollectorWindow), "355c4ac5cdebddc4c8362bed6f17a79e");
// 资源包构建
_uxmlDic.Add(typeof(AssetBundleBuilderWindow), "28ba29adb4949284e8c48893218b0d9a");
// 资源包调试
_uxmlDic.Add(typeof(AssetBundleDebuggerWindow), "790db12999afd334e8fb6ba70ef0a947");
_uxmlDic.Add(typeof(DebuggerAssetListViewer), "31c6096c1cb29b4469096b7b4942a322");
_uxmlDic.Add(typeof(DebuggerBundleListViewer), "932a25ffd05c13c47994d66e9d73bc37");
// 构建报告
_uxmlDic.Add(typeof(AssetBundleReporterWindow), "9052b72c383e95043a0c7e7f369b1ad7");
_uxmlDic.Add(typeof(ReporterSummaryViewer), "f8929271050855e42a1ccc6b14993a04");
_uxmlDic.Add(typeof(ReporterAssetListViewer), "5f81bc15a55ee0a49a266f9d71e2372b");
_uxmlDic.Add(typeof(ReporterBundleListViewer), "56d6dbe0d65ce334a8996beb19612989");
}
/// <summary>
/// 加载窗口的布局文件
/// </summary>
public static UnityEngine.UIElements.VisualTreeAsset LoadWindowUXML<TWindow>() where TWindow : class
{
var windowType = typeof(TWindow);
if (_uxmlDic.TryGetValue(windowType, out string uxmlGUID))
{
string assetPath = AssetDatabase.GUIDToAssetPath(uxmlGUID);
if (string.IsNullOrEmpty(assetPath))
throw new System.Exception($"Invalid YooAsset uxml guid : {uxmlGUID}");
var visualTreeAsset = AssetDatabase.LoadAssetAtPath<UnityEngine.UIElements.VisualTreeAsset>(assetPath);
if (visualTreeAsset == null)
throw new System.Exception($"Failed to load {windowType}.uxml");
return visualTreeAsset;
}
else
{
throw new System.Exception($"Invalid YooAsset window type : {windowType}");
}
}
#endif
/// <summary>
/// 加载相关的配置文件
/// </summary>
public static TSetting LoadSettingData<TSetting>() where TSetting : ScriptableObject
{
var settingType = typeof(TSetting);
var guids = AssetDatabase.FindAssets($"t:{settingType.Name}");
if (guids.Length == 0)
{
Debug.LogWarning($"Create new {settingType.Name}.asset");
var setting = ScriptableObject.CreateInstance<TSetting>();
string filePath = $"Assets/{settingType.Name}.asset";
AssetDatabase.CreateAsset(setting, filePath);
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
return setting;
}
else
{
if (guids.Length != 1)
throw new System.Exception($"Found multiple {settingType.Name} files !");
string filePath = AssetDatabase.GUIDToAssetPath(guids[0]);
var setting = AssetDatabase.LoadAssetAtPath<TSetting>(filePath);
return setting;
}
}
}
}

View File

@@ -25,7 +25,7 @@ namespace YooAsset.Editor
/// </summary>
private static void LoadSettingData()
{
_setting = YooAssetEditorSettingsHelper.LoadSettingData<ShaderVariantCollectorSetting>();
_setting = EditorHelper.LoadSettingData<ShaderVariantCollectorSetting>();
}
/// <summary>

View File

@@ -1,32 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4eff45040ac501b4fa978c46f72f2e64, type: 3}
m_Name: YooAssetEditorSettings
m_EditorClassIdentifier:
AssetBundleCollectorUXML: {fileID: 9197481963319205126, guid: 355c4ac5cdebddc4c8362bed6f17a79e,
type: 3}
AssetBundleBuilderUXML: {fileID: 9197481963319205126, guid: 28ba29adb4949284e8c48893218b0d9a,
type: 3}
AssetBundleDebuggerUXML: {fileID: 9197481963319205126, guid: 790db12999afd334e8fb6ba70ef0a947,
type: 3}
DebuggerAssetListViewerUXML: {fileID: 9197481963319205126, guid: 31c6096c1cb29b4469096b7b4942a322,
type: 3}
DebuggerBundleListViewerUXML: {fileID: 9197481963319205126, guid: 932a25ffd05c13c47994d66e9d73bc37,
type: 3}
AssetBundleReporterUXML: {fileID: 9197481963319205126, guid: 9052b72c383e95043a0c7e7f369b1ad7,
type: 3}
ReporterSummaryViewerUXML: {fileID: 9197481963319205126, guid: f8929271050855e42a1ccc6b14993a04,
type: 3}
ReporterAssetListViewerUXML: {fileID: 9197481963319205126, guid: 5f81bc15a55ee0a49a266f9d71e2372b,
type: 3}
ReporterBundleListViewerUXML: {fileID: 9197481963319205126, guid: 56d6dbe0d65ce334a8996beb19612989,
type: 3}

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: b0b43f68477734743a5f2fc507b5bda6
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,25 +0,0 @@
using UnityEngine;
using UnityEngine.UIElements;
namespace YooAsset.Editor
{
public class YooAssetEditorSettings : ScriptableObject
{
// 资源包收集
public VisualTreeAsset AssetBundleCollectorUXML;
// 资源包构建
public VisualTreeAsset AssetBundleBuilderUXML;
// 资源包调试
public VisualTreeAsset AssetBundleDebuggerUXML;
public VisualTreeAsset DebuggerAssetListViewerUXML;
public VisualTreeAsset DebuggerBundleListViewerUXML;
// 构建报告
public VisualTreeAsset AssetBundleReporterUXML;
public VisualTreeAsset ReporterSummaryViewerUXML;
public VisualTreeAsset ReporterAssetListViewerUXML;
public VisualTreeAsset ReporterBundleListViewerUXML;
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 4eff45040ac501b4fa978c46f72f2e64
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,35 +0,0 @@
using UnityEngine;
using UnityEditor;
namespace YooAsset.Editor
{
public class YooAssetEditorSettingsData
{
private static YooAssetEditorSettings _setting = null;
public static YooAssetEditorSettings Setting
{
get
{
if (_setting == null)
LoadEditorSettingData();
return _setting;
}
}
/// <summary>
/// 加载配置文件
/// </summary>
private static void LoadEditorSettingData()
{
var guids = AssetDatabase.FindAssets($"t:{nameof(YooAssetEditorSettings)}", new[] { "Assets", "Packages" });
if (guids.Length == 0)
throw new System.Exception($"Not found {nameof(YooAssetEditorSettings)} file !");
if (guids.Length != 1)
throw new System.Exception($"Found multiple {nameof(YooAssetEditorSettings)} files !");
string settingFilePath = AssetDatabase.GUIDToAssetPath(guids[0]);
_setting = AssetDatabase.LoadAssetAtPath<YooAssetEditorSettings>(settingFilePath);
Debug.Log($"Load {nameof(YooAssetEditorSettings)}.asset ok !");
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: e39f1b67d310bb54e8b1220bcf06afc4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,36 +0,0 @@
using UnityEngine;
using UnityEditor;
namespace YooAsset.Editor
{
public class YooAssetEditorSettingsHelper
{
/// <summary>
/// 加载相关的配置文件
/// </summary>
public static TSetting LoadSettingData<TSetting>() where TSetting : ScriptableObject
{
var settingType = typeof(TSetting);
var guids = AssetDatabase.FindAssets($"t:{settingType.Name}");
if (guids.Length == 0)
{
Debug.LogWarning($"Create new {settingType.Name}.asset");
var setting = ScriptableObject.CreateInstance<TSetting>();
string filePath = $"Assets/{settingType.Name}.asset";
AssetDatabase.CreateAsset(setting, filePath);
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
return setting;
}
else
{
if (guids.Length != 1)
throw new System.Exception($"Found multiple {settingType.Name} files !");
string filePath = AssetDatabase.GUIDToAssetPath(guids[0]);
var setting = AssetDatabase.LoadAssetAtPath<TSetting>(filePath);
return setting;
}
}
}
}

View File

@@ -59,19 +59,6 @@ namespace YooAsset
// 2. 检测加载结果
if (Status == EStatus.Checking)
{
if (AssetObject != null)
{
if (UnityEditor.AssetDatabase.IsMainAsset(AssetObject) == false)
{
AssetObject = null;
Status = EStatus.Fail;
LastError = $"The loaded asset object is not main asset : {MainAssetInfo.AssetPath} AssetType : {MainAssetInfo.AssetType}";
YooLogger.Error(LastError);
InvokeCompletion();
return;
}
}
Status = AssetObject == null ? EStatus.Fail : EStatus.Success;
if (Status == EStatus.Fail)
{

View File

@@ -28,6 +28,7 @@ namespace YooAsset
// 数据相关
private ESteps _steps = ESteps.None;
private bool _isPause = false;
private long _lastDownloadBytes = 0;
private int _lastDownloadCount = 0;
@@ -153,6 +154,9 @@ namespace YooAsset
// 注意:如果期间有下载失败的文件,暂停动态创建下载器
if (_downloadList.Count > 0 && _loadFailedList.Count == 0)
{
if (_isPause)
return;
if (_downloaders.Count < _downloadingMaxNumber)
{
int index = _downloadList.Count - 1;
@@ -195,6 +199,22 @@ namespace YooAsset
OperationSystem.StartOperaiton(this);
}
}
/// <summary>
/// 暂停下载
/// </summary>
public void PauseDownload()
{
_isPause = true;
}
/// <summary>
/// 恢复下载
/// </summary>
public void ResumeDownload()
{
_isPause = false;
}
}
public sealed class PackageDownloaderOperation : DownloaderOperation

View File

@@ -23,7 +23,7 @@ namespace YooAsset
public int ResourceVersion;
/// <summary>
/// 内置资源的标列表
/// 内置资源的标列表(首包资源)
/// </summary>
public string BuildinTags;

View File

@@ -1,7 +1,7 @@
{
"name": "com.tuyoogame.yooasset",
"displayName": "YooAsset",
"version": "1.0.9",
"version": "1.0.10",
"unity": "2019.4",
"description": "unity3d resources management system",
"author": {

View File

@@ -9,3 +9,4 @@
- Wales-丁 (709501148)
- L (401419353)
- 秀 (1025466218)
- martin (643087149)