mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-23 17:20:12 +00:00
feat #671
This commit is contained in:
@@ -118,6 +118,34 @@ namespace YooAsset
|
|||||||
Debug.Log($"Succeed to save catalog file : {binaryFilePath}");
|
Debug.Log($"Succeed to save catalog file : {binaryFilePath}");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生成空的包裹内置自由目录文件
|
||||||
|
/// </summary>
|
||||||
|
public static bool CreateEmptyCatalogFile(string packageName, string packageVersion, string outputPath)
|
||||||
|
{
|
||||||
|
// 创建内置清单实例
|
||||||
|
var buildinFileCatalog = new DefaultBuildinFileCatalog();
|
||||||
|
buildinFileCatalog.FileVersion = CatalogDefine.FileVersion;
|
||||||
|
buildinFileCatalog.PackageName = packageName;
|
||||||
|
buildinFileCatalog.PackageVersion = packageVersion;
|
||||||
|
|
||||||
|
// 创建输出文件
|
||||||
|
string jsonFilePath = $"{outputPath}/{DefaultBuildinFileSystemDefine.BuildinCatalogJsonFileName}";
|
||||||
|
if (File.Exists(jsonFilePath))
|
||||||
|
File.Delete(jsonFilePath);
|
||||||
|
SerializeToJson(jsonFilePath, buildinFileCatalog);
|
||||||
|
|
||||||
|
// 创建输出文件
|
||||||
|
string binaryFilePath = $"{outputPath}/{DefaultBuildinFileSystemDefine.BuildinCatalogBinaryFileName}";
|
||||||
|
if (File.Exists(binaryFilePath))
|
||||||
|
File.Delete(binaryFilePath);
|
||||||
|
SerializeToBinary(binaryFilePath, buildinFileCatalog);
|
||||||
|
|
||||||
|
UnityEditor.AssetDatabase.Refresh();
|
||||||
|
Debug.Log($"Succeed to save catalog file : {binaryFilePath}");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
using System.IO;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEditor;
|
||||||
|
|
||||||
|
namespace YooAsset.Editor
|
||||||
|
{
|
||||||
|
public class CreateEmptyCatalogWindow : EditorWindow
|
||||||
|
{
|
||||||
|
static CreateEmptyCatalogWindow _thisInstance;
|
||||||
|
|
||||||
|
[MenuItem("Tools/空清单生成工具(Catalog)", false, 102)]
|
||||||
|
static void ShowWindow()
|
||||||
|
{
|
||||||
|
if (_thisInstance == null)
|
||||||
|
{
|
||||||
|
_thisInstance = EditorWindow.GetWindow(typeof(CreateEmptyCatalogWindow), false, "空清单生成工具", true) as CreateEmptyCatalogWindow;
|
||||||
|
_thisInstance.minSize = new Vector2(800, 600);
|
||||||
|
}
|
||||||
|
_thisInstance.Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _packageName = string.Empty;
|
||||||
|
|
||||||
|
private void OnGUI()
|
||||||
|
{
|
||||||
|
GUILayout.Space(10);
|
||||||
|
EditorGUILayout.BeginHorizontal();
|
||||||
|
_packageName = EditorGUILayout.TextField("Package Name", _packageName);
|
||||||
|
EditorGUILayout.EndHorizontal();
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(_packageName) == false)
|
||||||
|
{
|
||||||
|
if (GUILayout.Button("生成空的Catalog文件", GUILayout.MaxWidth(150)))
|
||||||
|
{
|
||||||
|
string outputPath = EditorTools.OpenFolderPanel("输出目录", "Assets/");
|
||||||
|
if (string.IsNullOrEmpty(outputPath) == false)
|
||||||
|
{
|
||||||
|
CreateEmptyCatalogFile(outputPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CreateEmptyCatalogFile(string outputPath)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
bool result = CatalogTools.CreateEmptyCatalogFile(_packageName, string.Empty, outputPath);
|
||||||
|
if (result == false)
|
||||||
|
{
|
||||||
|
Debug.LogError($"Create package {_packageName} catalog file failed ! See the detail error in console !");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (System.Exception ex)
|
||||||
|
{
|
||||||
|
Debug.LogError($"Create package {_packageName} catalog file failed ! {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 211aadfc630b2ec419d5efce05e8aabe
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -10,7 +10,7 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
static PackageComparatorWindow _thisInstance;
|
static PackageComparatorWindow _thisInstance;
|
||||||
|
|
||||||
[MenuItem("Tools/补丁包比对工具", false, 102)]
|
[MenuItem("Tools/补丁包比对工具", false, 103)]
|
||||||
static void ShowWindow()
|
static void ShowWindow()
|
||||||
{
|
{
|
||||||
if (_thisInstance == null)
|
if (_thisInstance == null)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ namespace YooAsset.Editor
|
|||||||
{
|
{
|
||||||
static PackageImporterWindow _thisInstance;
|
static PackageImporterWindow _thisInstance;
|
||||||
|
|
||||||
[MenuItem("Tools/补丁包导入工具", false, 101)]
|
[MenuItem("Tools/补丁包导入工具", false, 104)]
|
||||||
static void ShowWindow()
|
static void ShowWindow()
|
||||||
{
|
{
|
||||||
if (_thisInstance == null)
|
if (_thisInstance == null)
|
||||||
|
|||||||
Reference in New Issue
Block a user