【m】yooasset更新
All checks were successful
Plugin Library CI / publish (00.BuildOriginality) (push) Successful in 3s
Plugin Library CI / publish (07.RKTools) (push) Successful in 2s
Plugin Library CI / publish (00.StaryEvo) (push) Successful in 4s
Plugin Library CI / publish (00.StaryEvoTools) (push) Successful in 10s
Plugin Library CI / publish (01.HybridCLR) (push) Successful in 5s
Plugin Library CI / publish (02.InformationSave) (push) Successful in 3s
Plugin Library CI / publish (03.YooAsset) (push) Successful in 1m25s
Plugin Library CI / publish (04.AudioCore) (push) Successful in 4s
Plugin Library CI / publish (05.TableTextConversion) (push) Successful in 4s
Plugin Library CI / publish (06.UIFarme) (push) Successful in 16s
Plugin Library CI / publish (08.UniTask) (push) Successful in 3s
Plugin Library CI / publish (09.CodeChecker) (push) Successful in 16s
Plugin Library CI / publish (10.StoryEditor) (push) Successful in 3s
Plugin Library CI / publish (10.XNode) (push) Successful in 4s
Plugin Library CI / publish (11.PointCloudTools) (push) Successful in 3s

This commit is contained in:
2026-04-13 22:36:57 +08:00
parent cb6a956ac2
commit a7902e8224
572 changed files with 1597 additions and 904 deletions

View File

@@ -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}");
}
}
}
}

View File

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

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bf6b81dffd4995e42a500ffc0025ec18
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,19 @@
using System.Collections.Generic;
#if YOO_MACRO_SUPPORT
namespace YooAsset.Editor
{
public class MacroDefine
{
/// <summary>
/// YooAsset版本宏定义
/// </summary>
public static readonly List<string> Macros = new List<string>()
{
"YOO_ASSET_2",
"YOO_ASSET_2_3",
"YOO_ASSET_2_3_OR_NEWER",
};
}
}
#endif

View File

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

View File

@@ -0,0 +1,106 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml;
using UnityEditor;
#if YOO_MACRO_SUPPORT
namespace YooAsset.Editor
{
[InitializeOnLoad]
public class MacroProcessor : AssetPostprocessor
{
static string OnGeneratedCSProject(string path, string content)
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(content);
if (IsCSProjectReferenced(xmlDoc.DocumentElement) == false)
return content;
if (ProcessDefineConstants(xmlDoc.DocumentElement) == false)
return content;
// 将修改后的XML结构重新输出为文本
using (var memoryStream = new MemoryStream())
{
var writerSettings = new XmlWriterSettings
{
Indent = true,
Encoding = new UTF8Encoding(false), //无BOM
OmitXmlDeclaration = false
};
using (var xmlWriter = XmlWriter.Create(memoryStream, writerSettings))
{
xmlDoc.Save(xmlWriter);
}
return Encoding.UTF8.GetString(memoryStream.ToArray());
}
}
/// <summary>
/// 处理宏定义
/// </summary>
private static bool ProcessDefineConstants(XmlElement element)
{
if (element == null)
return false;
bool processed = false;
foreach (XmlNode node in element.ChildNodes)
{
if (node.Name != "PropertyGroup")
continue;
foreach (XmlNode childNode in node.ChildNodes)
{
if (childNode.Name != "DefineConstants")
continue;
string[] defines = childNode.InnerText.Split(';');
HashSet<string> hashSets = new HashSet<string>(defines);
foreach (string yooMacro in MacroDefine.Macros)
{
string tmpMacro = yooMacro.Trim();
if (hashSets.Contains(tmpMacro) == false)
hashSets.Add(tmpMacro);
}
childNode.InnerText = string.Join(";", hashSets.ToArray());
processed = true;
}
}
return processed;
}
/// <summary>
/// 检测工程是否引用了YooAsset
/// </summary>
private static bool IsCSProjectReferenced(XmlElement element)
{
if (element == null)
return false;
foreach (XmlNode node in element.ChildNodes)
{
if (node.Name != "ItemGroup")
continue;
foreach (XmlNode childNode in node.ChildNodes)
{
if (childNode.Name != "Reference" && childNode.Name != "ProjectReference")
continue;
string include = childNode.Attributes["Include"].Value;
if (include.Contains("YooAsset"))
return true;
}
}
return false;
}
}
}
#endif

View File

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

View File

@@ -0,0 +1,115 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml;
using UnityEditor;
using UnityEngine;
#if YOO_MACRO_SUPPORT
namespace YooAsset.Editor.Experiment
{
[InitializeOnLoad]
public class RspGenerator
{
// csc.rsp文件路径
private static string RspFilePath => Path.Combine(Application.dataPath, "csc.rsp");
static RspGenerator()
{
UpdateRspFile(MacroDefine.Macros, null);
}
/// <summary>
/// 更新csc.rsp文件
/// </summary>
private static void UpdateRspFile(List<string> addMacros, List<string> removeMacros)
{
var existingDefines = new HashSet<string>();
var otherLines = new List<string>();
// 1. 读取现有内容
ReadRspFile(existingDefines, otherLines);
// 2. 添加新宏
if (addMacros != null && addMacros.Count > 0)
{
addMacros.ForEach(x =>
{
if (existingDefines.Contains(x) == false)
existingDefines.Add(x);
});
}
// 3. 移除指定宏
if (removeMacros != null && removeMacros.Count > 0)
{
removeMacros.ForEach(x =>
{
existingDefines.Remove(x);
});
}
// 4. 重新生成内容
WriteRspFile(existingDefines, otherLines);
// 5. 刷新AssetDatabase
AssetDatabase.Refresh();
EditorUtility.RequestScriptReload();
}
/// <summary>
/// 读取csc.rsp文件,返回宏定义和其他行
/// </summary>
private static void ReadRspFile(HashSet<string> defines, List<string> others)
{
if (defines == null)
defines = new HashSet<string>();
if (others == null)
others = new List<string>();
if (File.Exists(RspFilePath) == false)
return;
foreach (string line in File.ReadAllLines(RspFilePath))
{
if (line.StartsWith("-define:"))
{
string[] parts = line.Split(new[] { ':' }, 2);
if (parts.Length == 2)
{
defines.Add(parts[1].Trim());
}
}
else
{
others.Add(line);
}
}
}
/// <summary>
/// 重新写入csc.rsp文件
/// </summary>
private static void WriteRspFile(HashSet<string> defines, List<string> others)
{
StringBuilder sb = new StringBuilder();
if (others != null && others.Count > 0)
{
others.ForEach(o => sb.AppendLine(o));
}
if (defines != null && defines.Count > 0)
{
foreach (string define in defines)
{
sb.AppendLine($"-define:{define}");
}
}
File.WriteAllText(RspFilePath, sb.ToString());
}
}
}
#endif

View File

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

View File

@@ -10,7 +10,7 @@ namespace YooAsset.Editor
{
static PackageComparatorWindow _thisInstance;
[MenuItem("Tools/补丁包比对工具", false, 102)]
[MenuItem("Tools/补丁包比对工具", false, 103)]
static void ShowWindow()
{
if (_thisInstance == null)

View File

@@ -8,7 +8,7 @@ namespace YooAsset.Editor
{
static PackageImporterWindow _thisInstance;
[MenuItem("Tools/补丁包导入工具", false, 101)]
[MenuItem("Tools/补丁包导入工具", false, 104)]
static void ShowWindow()
{
if (_thisInstance == null)

View File

@@ -106,6 +106,9 @@ public static class ShaderVariantCollector
if (_steps == ESteps.CollectSleeping)
{
if (ShaderUtil.anythingCompiling)
return;
if (_elapsedTime.ElapsedMilliseconds > SleepMilliseconds)
{
DestroyAllSpheres();

View File

@@ -16,8 +16,9 @@ internal class APFSDownloadFileOperation : FSDownloadFileOperation
private readonly AlipayFileSystem _fileSystem;
private readonly DownloadFileOptions _options;
private UnityWebCacheRequestOperation _webCacheRequestOp;
private int _requestCount = 0;
private float _tryAgainTimer;
private float _tryAgainTimer = 0;
private int _failedTryAgain;
private ESteps _steps = ESteps.None;
@@ -25,6 +26,7 @@ internal class APFSDownloadFileOperation : FSDownloadFileOperation
{
_fileSystem = fileSystem;
_options = options;
_failedTryAgain = options.FailedTryAgain;
}
internal override void InternalStart()
{

View File

@@ -20,7 +20,7 @@ namespace YooAsset
private UnityAlipayAssetBundleRequestOperation _unityAssetBundleRequestOp;
private int _requestCount = 0;
private float _tryAgainTimer;
private float _tryAgainTimer = 0;
private int _failedTryAgain;
private ESteps _steps = ESteps.None;
@@ -29,6 +29,7 @@ namespace YooAsset
{
_bundle = bundle;
_options = options;
_failedTryAgain = options.FailedTryAgain;
}
internal override void InternalStart()
{

View File

@@ -16,8 +16,9 @@ internal class TPFSDownloadFileOperation : FSDownloadFileOperation
private readonly TaptapFileSystem _fileSystem;
private readonly DownloadFileOptions _options;
private UnityWebCacheRequestOperation _webCacheRequestOp;
private int _requestCount = 0;
private float _tryAgainTimer;
private float _tryAgainTimer = 0;
private int _failedTryAgain;
private ESteps _steps = ESteps.None;
@@ -25,6 +26,7 @@ internal class TPFSDownloadFileOperation : FSDownloadFileOperation
{
_fileSystem = fileSystem;
_options = options;
_failedTryAgain = options.FailedTryAgain;
}
internal override void InternalStart()
{

View File

@@ -19,7 +19,7 @@ namespace YooAsset
private UnityTaptapAssetBundleRequestOperation _unityAssetBundleRequestOp;
private int _requestCount = 0;
private float _tryAgainTimer;
private float _tryAgainTimer = 0;
private int _failedTryAgain;
private ESteps _steps = ESteps.None;
@@ -28,6 +28,7 @@ namespace YooAsset
{
_bundle = bundle;
_options = options;
_failedTryAgain = options.FailedTryAgain;
}
internal override void InternalStart()
{

View File

@@ -8,10 +8,20 @@ using TapTapMiniGame;
public static class TaptapFileSystemCreater
{
public static FileSystemParameters CreateFileSystemParameters(string packageRoot)
public static FileSystemParameters CreateFileSystemParameters(string packageRoot, IRemoteServices remoteServices)
{
string fileSystemClass = $"{nameof(TaptapFileSystem)},YooAsset.MiniGame";
var fileSystemParams = new FileSystemParameters(fileSystemClass, packageRoot);
fileSystemParams.AddParameter(FileSystemParametersDefine.REMOTE_SERVICES, remoteServices);
return fileSystemParams;
}
public static FileSystemParameters CreateFileSystemParameters(string packageRoot, IRemoteServices remoteServices, IWebDecryptionServices decryptionServices)
{
string fileSystemClass = $"{nameof(TaptapFileSystem)},YooAsset.MiniGame";
var fileSystemParams = new FileSystemParameters(fileSystemClass, packageRoot);
fileSystemParams.AddParameter(FileSystemParametersDefine.REMOTE_SERVICES, remoteServices);
fileSystemParams.AddParameter(FileSystemParametersDefine.DECRYPTION_SERVICES, decryptionServices);
return fileSystemParams;
}
}

View File

@@ -16,8 +16,9 @@ internal class TTFSDownloadFileOperation : FSDownloadFileOperation
private readonly TiktokFileSystem _fileSystem;
private readonly DownloadFileOptions _options;
private UnityWebCacheRequestOperation _webCacheRequestOp;
private int _requestCount = 0;
private float _tryAgainTimer;
private float _tryAgainTimer = 0;
private int _failedTryAgain;
private ESteps _steps = ESteps.None;
@@ -25,6 +26,7 @@ internal class TTFSDownloadFileOperation : FSDownloadFileOperation
{
_fileSystem = fileSystem;
_options = options;
_failedTryAgain = options.FailedTryAgain;
}
internal override void InternalStart()
{

View File

@@ -19,7 +19,7 @@ namespace YooAsset
private UnityTiktokAssetBundleRequestOperation _unityAssetBundleRequestOp;
private int _requestCount = 0;
private float _tryAgainTimer;
private float _tryAgainTimer = 0;
private int _failedTryAgain;
private ESteps _steps = ESteps.None;
@@ -28,6 +28,7 @@ namespace YooAsset
{
_bundle = bundle;
_options = options;
_failedTryAgain = options.FailedTryAgain;
}
internal override void InternalStart()
{

View File

@@ -16,8 +16,9 @@ internal class WXFSDownloadFileOperation : FSDownloadFileOperation
private readonly WechatFileSystem _fileSystem;
private readonly DownloadFileOptions _options;
private UnityWebCacheRequestOperation _webCacheRequestOp;
private int _requestCount = 0;
private float _tryAgainTimer;
private float _tryAgainTimer = 0;
private int _failedTryAgain;
private ESteps _steps = ESteps.None;
@@ -25,6 +26,7 @@ internal class WXFSDownloadFileOperation : FSDownloadFileOperation
{
_fileSystem = fileSystem;
_options = options;
_failedTryAgain = options.FailedTryAgain;
}
internal override void InternalStart()
{

View File

@@ -19,7 +19,7 @@ namespace YooAsset
private UnityWechatAssetBundleRequestOperation _unityAssetBundleRequestOp;
private int _requestCount = 0;
private float _tryAgainTimer;
private float _tryAgainTimer = 0;
private int _failedTryAgain;
private ESteps _steps = ESteps.None;
@@ -28,6 +28,7 @@ namespace YooAsset
{
_bundle = bundle;
_options = options;
_failedTryAgain = options.FailedTryAgain;
}
internal override void InternalStart()
{

View File

@@ -6,7 +6,6 @@
"GUID:5efd170ecd8084500bed5692932fe14e",
"GUID:bb21d6197862c4c3e863390dec9859a7",
"GUID:870f26a2ffa82429195df0861505c5d5",
"GUID:870f26a2ffa82429195df0861505c5d5",
"GUID:6921e41464907054da1a045ea64ca16f"
],
"includePlatforms": [],

View File

@@ -94,19 +94,19 @@ namespace Cysharp.Threading.Tasks
switch (handle)
{
case AssetHandle asset_handle:
asset_handle.Completed += result.continuationAction;
asset_handle.Completed += result._continuationAction;
break;
case SceneHandle scene_handle:
scene_handle.Completed += result.continuationAction;
scene_handle.Completed += result._continuationAction;
break;
case SubAssetsHandle sub_asset_handle:
sub_asset_handle.Completed += result.continuationAction;
sub_asset_handle.Completed += result._continuationAction;
break;
case RawFileHandle raw_file_handle:
raw_file_handle.Completed += result.continuationAction;
raw_file_handle.Completed += result._continuationAction;
break;
case AllAssetsHandle all_assets_handle:
all_assets_handle.Completed += result.continuationAction;
all_assets_handle.Completed += result._continuationAction;
break;
}
#endif