mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
TEngine全面更新,升级YooAsset2.1.1、UniTask、UIWindow、I2Localization
TEngine全面更新,升级YooAsset2.1.1、UniTask、UIWindow、I2Localization
This commit is contained in:
@@ -4,36 +4,36 @@ using System.Collections.Generic;
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
[Serializable]
|
||||
internal class DebugBundleInfo : IComparer<DebugBundleInfo>, IComparable<DebugBundleInfo>
|
||||
{
|
||||
/// <summary>
|
||||
/// 包裹名
|
||||
/// </summary>
|
||||
public string PackageName { set; get; }
|
||||
[Serializable]
|
||||
internal class DebugBundleInfo : IComparer<DebugBundleInfo>, IComparable<DebugBundleInfo>
|
||||
{
|
||||
/// <summary>
|
||||
/// 包裹名
|
||||
/// </summary>
|
||||
public string PackageName { set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// 资源包名称
|
||||
/// </summary>
|
||||
public string BundleName;
|
||||
/// <summary>
|
||||
/// 资源包名称
|
||||
/// </summary>
|
||||
public string BundleName;
|
||||
|
||||
/// <summary>
|
||||
/// 引用计数
|
||||
/// </summary>
|
||||
public int RefCount;
|
||||
/// <summary>
|
||||
/// 引用计数
|
||||
/// </summary>
|
||||
public int RefCount;
|
||||
|
||||
/// <summary>
|
||||
/// 加载状态
|
||||
/// </summary>
|
||||
public string Status;
|
||||
/// <summary>
|
||||
/// 加载状态
|
||||
/// </summary>
|
||||
public string Status;
|
||||
|
||||
public int CompareTo(DebugBundleInfo other)
|
||||
{
|
||||
return Compare(this, other);
|
||||
}
|
||||
public int Compare(DebugBundleInfo a, DebugBundleInfo b)
|
||||
{
|
||||
return string.CompareOrdinal(a.BundleName, b.BundleName);
|
||||
}
|
||||
}
|
||||
public int CompareTo(DebugBundleInfo other)
|
||||
{
|
||||
return Compare(this, other);
|
||||
}
|
||||
public int Compare(DebugBundleInfo a, DebugBundleInfo b)
|
||||
{
|
||||
return string.CompareOrdinal(a.BundleName, b.BundleName);
|
||||
}
|
||||
}
|
||||
}
|
@@ -5,17 +5,17 @@ using System.Collections.Generic;
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
[Serializable]
|
||||
internal class DebugPackageData
|
||||
{
|
||||
/// <summary>
|
||||
/// 包裹名称
|
||||
/// </summary>
|
||||
public string PackageName;
|
||||
[Serializable]
|
||||
internal class DebugPackageData
|
||||
{
|
||||
/// <summary>
|
||||
/// 包裹名称
|
||||
/// </summary>
|
||||
public string PackageName;
|
||||
|
||||
/// <summary>
|
||||
/// 调试数据列表
|
||||
/// </summary>
|
||||
public List<DebugProviderInfo> ProviderInfos = new List<DebugProviderInfo>(1000);
|
||||
}
|
||||
/// <summary>
|
||||
/// 调试数据列表
|
||||
/// </summary>
|
||||
public List<DebugProviderInfo> ProviderInfos = new List<DebugProviderInfo>(1000);
|
||||
}
|
||||
}
|
@@ -4,56 +4,56 @@ using System.Collections.Generic;
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
[Serializable]
|
||||
internal class DebugProviderInfo : IComparer<DebugProviderInfo>, IComparable<DebugProviderInfo>
|
||||
{
|
||||
/// <summary>
|
||||
/// 包裹名
|
||||
/// </summary>
|
||||
public string PackageName { set; get; }
|
||||
[Serializable]
|
||||
internal class DebugProviderInfo : IComparer<DebugProviderInfo>, IComparable<DebugProviderInfo>
|
||||
{
|
||||
/// <summary>
|
||||
/// 包裹名
|
||||
/// </summary>
|
||||
public string PackageName { set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// 资源对象路径
|
||||
/// </summary>
|
||||
public string AssetPath;
|
||||
/// <summary>
|
||||
/// 资源对象路径
|
||||
/// </summary>
|
||||
public string AssetPath;
|
||||
|
||||
/// <summary>
|
||||
/// 资源出生的场景
|
||||
/// </summary>
|
||||
public string SpawnScene;
|
||||
/// <summary>
|
||||
/// 资源出生的场景
|
||||
/// </summary>
|
||||
public string SpawnScene;
|
||||
|
||||
/// <summary>
|
||||
/// 资源出生的时间
|
||||
/// </summary>
|
||||
public string SpawnTime;
|
||||
/// <summary>
|
||||
/// 资源出生的时间
|
||||
/// </summary>
|
||||
public string SpawnTime;
|
||||
|
||||
/// <summary>
|
||||
/// 加载耗时(单位:毫秒)
|
||||
/// </summary>
|
||||
public long LoadingTime;
|
||||
/// <summary>
|
||||
/// 加载耗时(单位:毫秒)
|
||||
/// </summary>
|
||||
public long LoadingTime;
|
||||
|
||||
/// <summary>
|
||||
/// 引用计数
|
||||
/// </summary>
|
||||
public int RefCount;
|
||||
/// <summary>
|
||||
/// 引用计数
|
||||
/// </summary>
|
||||
public int RefCount;
|
||||
|
||||
/// <summary>
|
||||
/// 加载状态
|
||||
/// </summary>
|
||||
public string Status;
|
||||
/// <summary>
|
||||
/// 加载状态
|
||||
/// </summary>
|
||||
public string Status;
|
||||
|
||||
/// <summary>
|
||||
/// 依赖的资源包列表
|
||||
/// </summary>
|
||||
public List<DebugBundleInfo> DependBundleInfos;
|
||||
/// <summary>
|
||||
/// 依赖的资源包列表
|
||||
/// </summary>
|
||||
public List<DebugBundleInfo> DependBundleInfos;
|
||||
|
||||
public int CompareTo(DebugProviderInfo other)
|
||||
{
|
||||
return Compare(this, other);
|
||||
}
|
||||
public int Compare(DebugProviderInfo a, DebugProviderInfo b)
|
||||
{
|
||||
return string.CompareOrdinal(a.AssetPath, b.AssetPath);
|
||||
}
|
||||
}
|
||||
public int CompareTo(DebugProviderInfo other)
|
||||
{
|
||||
return Compare(this, other);
|
||||
}
|
||||
public int Compare(DebugProviderInfo a, DebugProviderInfo b)
|
||||
{
|
||||
return string.CompareOrdinal(a.AssetPath, b.AssetPath);
|
||||
}
|
||||
}
|
||||
}
|
@@ -6,34 +6,34 @@ using UnityEngine;
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
/// <summary>
|
||||
/// 资源系统调试信息
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
internal class DebugReport
|
||||
{
|
||||
/// <summary>
|
||||
/// 游戏帧
|
||||
/// </summary>
|
||||
public int FrameCount;
|
||||
/// <summary>
|
||||
/// 资源系统调试信息
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
internal class DebugReport
|
||||
{
|
||||
/// <summary>
|
||||
/// 游戏帧
|
||||
/// </summary>
|
||||
public int FrameCount;
|
||||
|
||||
/// <summary>
|
||||
/// 调试的包裹数据列表
|
||||
/// </summary>
|
||||
public List<DebugPackageData> PackageDatas = new List<DebugPackageData>(10);
|
||||
|
||||
/// <summary>
|
||||
/// 调试的包裹数据列表
|
||||
/// </summary>
|
||||
public List<DebugPackageData> PackageDatas = new List<DebugPackageData>(10);
|
||||
|
||||
/// <summary>
|
||||
/// 序列化
|
||||
/// </summary>
|
||||
public static byte[] Serialize(DebugReport debugReport)
|
||||
|
||||
/// <summary>
|
||||
/// 序列化
|
||||
/// </summary>
|
||||
public static byte[] Serialize(DebugReport debugReport)
|
||||
{
|
||||
return Encoding.UTF8.GetBytes(JsonUtility.ToJson(debugReport));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 反序列化
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// 反序列化
|
||||
/// </summary>
|
||||
public static DebugReport Deserialize(byte[] data)
|
||||
{
|
||||
return JsonUtility.FromJson<DebugReport>(Encoding.UTF8.GetString(data));
|
||||
|
@@ -4,42 +4,42 @@ using UnityEngine;
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
internal enum ERemoteCommand
|
||||
{
|
||||
/// <summary>
|
||||
/// 采样一次
|
||||
/// </summary>
|
||||
SampleOnce = 0,
|
||||
}
|
||||
internal enum ERemoteCommand
|
||||
{
|
||||
/// <summary>
|
||||
/// 采样一次
|
||||
/// </summary>
|
||||
SampleOnce = 0,
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
internal class RemoteCommand
|
||||
{
|
||||
/// <summary>
|
||||
/// 命令类型
|
||||
/// </summary>
|
||||
public int CommandType;
|
||||
[Serializable]
|
||||
internal class RemoteCommand
|
||||
{
|
||||
/// <summary>
|
||||
/// 命令类型
|
||||
/// </summary>
|
||||
public int CommandType;
|
||||
|
||||
/// <summary>
|
||||
/// 命令附加参数
|
||||
/// </summary>
|
||||
public string CommandParam;
|
||||
/// <summary>
|
||||
/// 命令附加参数
|
||||
/// </summary>
|
||||
public string CommandParam;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 序列化
|
||||
/// </summary>
|
||||
public static byte[] Serialize(RemoteCommand command)
|
||||
{
|
||||
return Encoding.UTF8.GetBytes(JsonUtility.ToJson(command));
|
||||
}
|
||||
/// <summary>
|
||||
/// 序列化
|
||||
/// </summary>
|
||||
public static byte[] Serialize(RemoteCommand command)
|
||||
{
|
||||
return Encoding.UTF8.GetBytes(JsonUtility.ToJson(command));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 反序列化
|
||||
/// </summary>
|
||||
public static RemoteCommand Deserialize(byte[] data)
|
||||
{
|
||||
return JsonUtility.FromJson<RemoteCommand>(Encoding.UTF8.GetString(data));
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 反序列化
|
||||
/// </summary>
|
||||
public static RemoteCommand Deserialize(byte[] data)
|
||||
{
|
||||
return JsonUtility.FromJson<RemoteCommand>(Encoding.UTF8.GetString(data));
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,12 +1,11 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
internal class RemoteDebuggerDefine
|
||||
{
|
||||
public static readonly Guid kMsgSendPlayerToEditor = new Guid("e34a5702dd353724aa315fb8011f08c3");
|
||||
public static readonly Guid kMsgSendEditorToPlayer = new Guid("4d1926c9df5b052469a1c63448b7609a");
|
||||
}
|
||||
internal class RemoteDebuggerDefine
|
||||
{
|
||||
public static readonly Guid kMsgSendPlayerToEditor = new Guid("e34a5702dd353724aa315fb8011f08c3");
|
||||
public static readonly Guid kMsgSendEditorToPlayer = new Guid("4d1926c9df5b052469a1c63448b7609a");
|
||||
}
|
||||
}
|
@@ -5,49 +5,49 @@ using UnityEngine.Networking.PlayerConnection;
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
internal class RemoteDebuggerInRuntime : MonoBehaviour
|
||||
{
|
||||
internal class RemoteDebuggerInRuntime : MonoBehaviour
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
/// <summary>
|
||||
/// 编辑器下获取报告的回调
|
||||
/// </summary>
|
||||
public static Action<int, DebugReport> EditorHandleDebugReportCallback;
|
||||
/// <summary>
|
||||
/// 编辑器下获取报告的回调
|
||||
/// </summary>
|
||||
public static Action<int, DebugReport> EditorHandleDebugReportCallback;
|
||||
|
||||
/// <summary>
|
||||
/// 编辑器下请求报告数据
|
||||
/// </summary>
|
||||
public static void EditorRequestDebugReport()
|
||||
{
|
||||
if(UnityEditor.EditorApplication.isPlaying)
|
||||
{
|
||||
var report = YooAssets.GetDebugReport();
|
||||
EditorHandleDebugReportCallback?.Invoke(0, report);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 编辑器下请求报告数据
|
||||
/// </summary>
|
||||
public static void EditorRequestDebugReport()
|
||||
{
|
||||
if (UnityEditor.EditorApplication.isPlaying)
|
||||
{
|
||||
var report = YooAssets.GetDebugReport();
|
||||
EditorHandleDebugReportCallback?.Invoke(0, report);
|
||||
}
|
||||
}
|
||||
#else
|
||||
private void OnEnable()
|
||||
{
|
||||
PlayerConnection.instance.Register(RemoteDebuggerDefine.kMsgSendEditorToPlayer, OnHandleEditorMessage);
|
||||
}
|
||||
private void OnDisable()
|
||||
{
|
||||
PlayerConnection.instance.Unregister(RemoteDebuggerDefine.kMsgSendEditorToPlayer, OnHandleEditorMessage);
|
||||
}
|
||||
private void OnHandleEditorMessage(MessageEventArgs args)
|
||||
{
|
||||
var command = RemoteCommand.Deserialize(args.data);
|
||||
YooLogger.Log($"On handle remote command : {command.CommandType} Param : {command.CommandParam}");
|
||||
if (command.CommandType == (int)ERemoteCommand.SampleOnce)
|
||||
{
|
||||
var debugReport = YooAssets.GetDebugReport();
|
||||
var data = DebugReport.Serialize(debugReport);
|
||||
PlayerConnection.instance.Send(RemoteDebuggerDefine.kMsgSendPlayerToEditor, data);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotImplementedException(command.CommandType.ToString());
|
||||
}
|
||||
}
|
||||
private void OnEnable()
|
||||
{
|
||||
PlayerConnection.instance.Register(RemoteDebuggerDefine.kMsgSendEditorToPlayer, OnHandleEditorMessage);
|
||||
}
|
||||
private void OnDisable()
|
||||
{
|
||||
PlayerConnection.instance.Unregister(RemoteDebuggerDefine.kMsgSendEditorToPlayer, OnHandleEditorMessage);
|
||||
}
|
||||
private void OnHandleEditorMessage(MessageEventArgs args)
|
||||
{
|
||||
var command = RemoteCommand.Deserialize(args.data);
|
||||
YooLogger.Log($"On handle remote command : {command.CommandType} Param : {command.CommandParam}");
|
||||
if (command.CommandType == (int)ERemoteCommand.SampleOnce)
|
||||
{
|
||||
var debugReport = YooAssets.GetDebugReport();
|
||||
var data = DebugReport.Serialize(debugReport);
|
||||
PlayerConnection.instance.Send(RemoteDebuggerDefine.kMsgSendPlayerToEditor, data);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotImplementedException(command.CommandType.ToString());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user