mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
Init TEngine4.0.0
Init TEngine4.0.0
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
[Serializable]
|
||||
internal class DebugBundleInfo : IComparer<DebugBundleInfo>, IComparable<DebugBundleInfo>
|
||||
{
|
||||
/// <summary>
|
||||
/// 包裹名
|
||||
/// </summary>
|
||||
public string PackageName { set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// 资源包名称
|
||||
/// </summary>
|
||||
public string BundleName;
|
||||
|
||||
/// <summary>
|
||||
/// 引用计数
|
||||
/// </summary>
|
||||
public int RefCount;
|
||||
|
||||
/// <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);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8338e9d79d24e7e4e80aaacc8bc0fcde
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
[Serializable]
|
||||
internal class DebugPackageData
|
||||
{
|
||||
/// <summary>
|
||||
/// 包裹名称
|
||||
/// </summary>
|
||||
public string PackageName;
|
||||
|
||||
/// <summary>
|
||||
/// 调试数据列表
|
||||
/// </summary>
|
||||
public List<DebugProviderInfo> ProviderInfos = new List<DebugProviderInfo>(1000);
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 583d0c3e5520c6748b2aeacd209cf8b6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
[Serializable]
|
||||
internal class DebugProviderInfo : IComparer<DebugProviderInfo>, IComparable<DebugProviderInfo>
|
||||
{
|
||||
/// <summary>
|
||||
/// 包裹名
|
||||
/// </summary>
|
||||
public string PackageName { set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// 资源对象路径
|
||||
/// </summary>
|
||||
public string AssetPath;
|
||||
|
||||
/// <summary>
|
||||
/// 资源出生的场景
|
||||
/// </summary>
|
||||
public string SpawnScene;
|
||||
|
||||
/// <summary>
|
||||
/// 资源出生的时间
|
||||
/// </summary>
|
||||
public string SpawnTime;
|
||||
|
||||
/// <summary>
|
||||
/// 加载耗时(单位:毫秒)
|
||||
/// </summary>
|
||||
public long LoadingTime;
|
||||
|
||||
/// <summary>
|
||||
/// 引用计数
|
||||
/// </summary>
|
||||
public int RefCount;
|
||||
|
||||
/// <summary>
|
||||
/// 加载状态
|
||||
/// </summary>
|
||||
public string Status;
|
||||
|
||||
/// <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);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b3af795872a84c6429235be37acaf655
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
/// <summary>
|
||||
/// 资源系统调试信息
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
internal class DebugReport
|
||||
{
|
||||
/// <summary>
|
||||
/// 游戏帧
|
||||
/// </summary>
|
||||
public int FrameCount;
|
||||
|
||||
/// <summary>
|
||||
/// 调试的包裹数据列表
|
||||
/// </summary>
|
||||
public List<DebugPackageData> PackageDatas = new List<DebugPackageData>(10);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 序列化
|
||||
/// </summary>
|
||||
public static byte[] Serialize(DebugReport debugReport)
|
||||
{
|
||||
return Encoding.UTF8.GetBytes(JsonUtility.ToJson(debugReport));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 反序列化
|
||||
/// </summary>
|
||||
public static DebugReport Deserialize(byte[] data)
|
||||
{
|
||||
return JsonUtility.FromJson<DebugReport>(Encoding.UTF8.GetString(data));
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 04568a15f0fdb58438568dac56c588c5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
internal enum ERemoteCommand
|
||||
{
|
||||
/// <summary>
|
||||
/// 采样一次
|
||||
/// </summary>
|
||||
SampleOnce = 0,
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
internal class RemoteCommand
|
||||
{
|
||||
/// <summary>
|
||||
/// 命令类型
|
||||
/// </summary>
|
||||
public int CommandType;
|
||||
|
||||
/// <summary>
|
||||
/// 命令附加参数
|
||||
/// </summary>
|
||||
public string CommandParam;
|
||||
|
||||
|
||||
/// <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));
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e79402f4d610fb4408aa6f8a94b09cb9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,12 @@
|
||||
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");
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3fd4f5f47edbfd54ba92427daf9ea3a4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking.PlayerConnection;
|
||||
|
||||
namespace YooAsset
|
||||
{
|
||||
internal class RemoteDebuggerInRuntime : MonoBehaviour
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
/// <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);
|
||||
}
|
||||
}
|
||||
#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());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 91030c545c99c944a846f6a9a2a0756a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user