mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
Compare commits
10 Commits
TEngine3.1
...
TEngine3.1
Author | SHA1 | Date | |
---|---|---|---|
![]() |
04a43a3f11 | ||
![]() |
54214cdd0b | ||
![]() |
fa870b6228 | ||
![]() |
8a49d3437b | ||
![]() |
f19b889deb | ||
![]() |
d55f6e29d9 | ||
![]() |
8e4af31f26 | ||
![]() |
58a4b3e043 | ||
![]() |
576bf3bb48 | ||
![]() |
d282b81546 |
@@ -1,6 +1,7 @@
|
||||
#if TENGINE_NET
|
||||
using System.Text;
|
||||
using TEngine.Core.Network;
|
||||
|
||||
#pragma warning disable CS8604
|
||||
#pragma warning disable CS8602
|
||||
#pragma warning disable CS8600
|
||||
@@ -49,6 +50,21 @@ public sealed class ProtoBufExporter
|
||||
Directory.CreateDirectory(Define.ProtoBufClientDirectory);
|
||||
}
|
||||
|
||||
if (!Directory.Exists($"{Define.ProtoBufDirectory}Outer"))
|
||||
{
|
||||
Directory.CreateDirectory($"{Define.ProtoBufDirectory}Outer");
|
||||
}
|
||||
|
||||
if (!Directory.Exists($"{Define.ProtoBufDirectory}Inner"))
|
||||
{
|
||||
Directory.CreateDirectory($"{Define.ProtoBufDirectory}Inner");
|
||||
}
|
||||
|
||||
if (!Directory.Exists($"{Define.ProtoBufDirectory}Bson"))
|
||||
{
|
||||
Directory.CreateDirectory($"{Define.ProtoBufDirectory}Bson");
|
||||
}
|
||||
|
||||
var tasks = new Task[2];
|
||||
tasks[0] = Task.Run(RouteType);
|
||||
tasks[1] = Task.Run(async () =>
|
||||
@@ -63,14 +79,9 @@ public sealed class ProtoBufExporter
|
||||
|
||||
private async Task Start(ProtoBufOpCodeType opCodeType)
|
||||
{
|
||||
var protoFile = "";
|
||||
List<string> files = new List<string>();
|
||||
var opCodeName = "";
|
||||
var parameter = "";
|
||||
var className = "";
|
||||
var isMsgHead = false;
|
||||
OpcodeInfo opcodeInfo = null;
|
||||
string responseTypeStr = null;
|
||||
string customRouteType = null;
|
||||
_opcodes.Clear();
|
||||
var file = new StringBuilder();
|
||||
var saveDirectory = new Dictionary<string, string>();
|
||||
@@ -86,9 +97,10 @@ public sealed class ProtoBufExporter
|
||||
_aRouteRequest = Opcode.OuterRouteRequest;
|
||||
_aRouteResponse = Opcode.OuterRouteResponse;
|
||||
opCodeName = "OuterOpcode";
|
||||
protoFile = $"{Define.ProtoBufDirectory}OuterMessage.proto";
|
||||
saveDirectory.Add(Define.ProtoBufServerDirectory, _serverTemplate);
|
||||
saveDirectory.Add(Define.ProtoBufClientDirectory, _clientTemplate);
|
||||
files.Add($"{Define.ProtoBufDirectory}OuterMessage.proto");
|
||||
files.AddRange(Directory.GetFiles($"{Define.ProtoBufDirectory}Outer").ToList());
|
||||
break;
|
||||
}
|
||||
case ProtoBufOpCodeType.Inner:
|
||||
@@ -101,8 +113,9 @@ public sealed class ProtoBufExporter
|
||||
_aRouteRequest = Opcode.InnerRouteRequest + 1000;
|
||||
_aRouteResponse = Opcode.InnerRouteResponse + 1000;
|
||||
opCodeName = "InnerOpcode";
|
||||
protoFile = $"{Define.ProtoBufDirectory}InnerMessage.proto";
|
||||
saveDirectory.Add(Define.ProtoBufServerDirectory, _serverTemplate);
|
||||
files.Add($"{Define.ProtoBufDirectory}InnerMessage.proto");
|
||||
files.AddRange(Directory.GetFiles($"{Define.ProtoBufDirectory}Inner").ToList());
|
||||
break;
|
||||
}
|
||||
case ProtoBufOpCodeType.InnerBson:
|
||||
@@ -115,13 +128,22 @@ public sealed class ProtoBufExporter
|
||||
_aRouteRequest = Opcode.InnerBsonRouteRequest + 1000;
|
||||
_aRouteResponse = Opcode.InnerBsonRouteResponse + 1000;
|
||||
opCodeName = "InnerBsonOpcode";
|
||||
protoFile = $"{Define.ProtoBufDirectory}InnerBsonMessage.proto";
|
||||
saveDirectory.Add(Define.ProtoBufServerDirectory, _serverTemplate);
|
||||
files.Add($"{Define.ProtoBufDirectory}InnerBsonMessage.proto");
|
||||
files.AddRange(Directory.GetFiles($"{Define.ProtoBufDirectory}Bson").ToList());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var protoFileText = await File.ReadAllTextAsync(protoFile);
|
||||
#region GenerateProtoFiles
|
||||
foreach (var filePath in files)
|
||||
{
|
||||
var parameter = "";
|
||||
var className = "";
|
||||
var isMsgHead = false;
|
||||
string responseTypeStr = null;
|
||||
string customRouteType = null;
|
||||
var protoFileText = await File.ReadAllTextAsync(filePath);
|
||||
|
||||
foreach (var line in protoFileText.Split('\n'))
|
||||
{
|
||||
@@ -302,7 +324,7 @@ public sealed class ProtoBufExporter
|
||||
}
|
||||
}
|
||||
|
||||
var csName = $"{Path.GetFileNameWithoutExtension(protoFile)}.cs";
|
||||
var csName = $"{Path.GetFileNameWithoutExtension(filePath)}.cs";
|
||||
|
||||
foreach (var (directory, template) in saveDirectory)
|
||||
{
|
||||
@@ -312,7 +334,11 @@ public sealed class ProtoBufExporter
|
||||
}
|
||||
|
||||
file.Clear();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region GenerateOpCode
|
||||
file.Clear();
|
||||
file.AppendLine("namespace TEngine");
|
||||
file.AppendLine("{");
|
||||
file.AppendLine($"\tpublic static partial class {opCodeName}");
|
||||
@@ -333,6 +359,8 @@ public sealed class ProtoBufExporter
|
||||
var csFile = Path.Combine(directory, $"{opCodeName}.cs");
|
||||
await File.WriteAllTextAsync(csFile, file.ToString());
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
private async Task RouteType()
|
||||
|
@@ -24,6 +24,7 @@ public partial class GameApp:Singleton<GameApp>
|
||||
Utility.Unity.AddDestroyListener(Instance.OnDestroy);
|
||||
Utility.Unity.AddOnDrawGizmosListener(Instance.OnDrawGizmos);
|
||||
Utility.Unity.AddOnApplicationPauseListener(Instance.OnApplicationPause);
|
||||
GameModule.Procedure.RestartProcedure(new GameLogic.OnEnterGameAppProcedure());
|
||||
Instance.StartGameLogic();
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,13 @@
|
||||
using TEngine;
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
public class OnEnterGameAppProcedure : ProcedureBase
|
||||
{
|
||||
protected override void OnEnter(IFsm<IProcedureManager> procedureOwner)
|
||||
{
|
||||
base.OnEnter(procedureOwner);
|
||||
Log.Debug("OnEnter GameApp Procedure");
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 415b43b274b541a0a2312417644452b0
|
||||
timeCreated: 1692956662
|
@@ -116,6 +116,7 @@ namespace GameMain
|
||||
|
||||
private void AllAssemblyLoadComplete()
|
||||
{
|
||||
ChangeState<ProcedureStartGame>(m_procedureOwner);
|
||||
#if UNITY_EDITOR
|
||||
m_MainLogicAssembly = AppDomain.CurrentDomain.GetAssemblies().
|
||||
First(assembly => $"{assembly.GetName().Name}.dll" == SettingsUtils.HybridCLRCustomGlobalSettings.LogicMainDllName);
|
||||
@@ -139,7 +140,6 @@ namespace GameMain
|
||||
}
|
||||
object[] objects = new object[] { new object[] { m_HotfixAssemblys } };
|
||||
entryMethod.Invoke(appType, objects);
|
||||
ChangeState<ProcedureStartGame>(m_procedureOwner);
|
||||
}
|
||||
|
||||
private Assembly GetMainLogicAssembly()
|
||||
|
@@ -31,7 +31,7 @@
|
||||
<Collector CollectPath="Assets/AssetRaw/Shaders" CollectGUID="2a4bceb84ed685447ace957f497eb810" CollectType="MainAssetCollector" AddressRule="AddressByFileName" PackRule="PackShaderVariants" FilterRule="CollectShaderVariants" UserData="" AssetTags="" />
|
||||
</Group>
|
||||
<Group GroupActiveRule="EnableGroup" GroupName="UI" GroupDesc="UI面板" AssetTags="UI">
|
||||
<Collector CollectPath="Assets/AssetRaw/UI" CollectGUID="27e87d83814156648b58f380b834e046" CollectType="MainAssetCollector" AddressRule="AddressByFileName" PackRule="PackDirectory" FilterRule="CollectAll" UserData="" AssetTags="" />
|
||||
<Collector CollectPath="Assets/AssetRaw/UI" CollectGUID="27e87d83814156648b58f380b834e046" CollectType="MainAssetCollector" AddressRule="AddressByFileName" PackRule="PackSeparately" FilterRule="CollectAll" UserData="" AssetTags="" />
|
||||
</Group>
|
||||
<Group GroupActiveRule="EnableGroup" GroupName="Fonts" GroupDesc="字体" AssetTags="Fonts">
|
||||
<Collector CollectPath="Assets/AssetRaw/Fonts" CollectGUID="2473375c9ee163a4b861278b38091455" CollectType="MainAssetCollector" AddressRule="AddressByFileName" PackRule="PackDirectory" FilterRule="CollectAll" UserData="" AssetTags="" />
|
||||
|
@@ -154,7 +154,7 @@ MonoBehaviour:
|
||||
CollectorGUID: 27e87d83814156648b58f380b834e046
|
||||
CollectorType: 0
|
||||
AddressRuleName: AddressByFileName
|
||||
PackRuleName: PackDirectory
|
||||
PackRuleName: PackSeparately
|
||||
FilterRuleName: CollectAll
|
||||
AssetTags:
|
||||
UserData:
|
||||
|
138
Assets/TEngine/Editor/Resource/YooAsset/PackageCompareWindow.cs
Normal file
138
Assets/TEngine/Editor/Resource/YooAsset/PackageCompareWindow.cs
Normal file
@@ -0,0 +1,138 @@
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace YooAsset.Editor
|
||||
{
|
||||
public class PackageCompareWindow : EditorWindow
|
||||
{
|
||||
static PackageCompareWindow _thisInstance;
|
||||
|
||||
[MenuItem("YooAsset/补丁包比对工具", false, 302)]
|
||||
static void ShowWindow()
|
||||
{
|
||||
if (_thisInstance == null)
|
||||
{
|
||||
_thisInstance = EditorWindow.GetWindow(typeof(PackageCompareWindow), false, "补丁包比对工具", true) as PackageCompareWindow;
|
||||
_thisInstance.minSize = new Vector2(800, 600);
|
||||
}
|
||||
_thisInstance.Show();
|
||||
}
|
||||
|
||||
private string _manifestPath1 = string.Empty;
|
||||
private string _manifestPath2 = string.Empty;
|
||||
private readonly List<PackageBundle> _changeList = new List<PackageBundle>();
|
||||
private readonly List<PackageBundle> _newList = new List<PackageBundle>();
|
||||
private Vector2 _scrollPos1;
|
||||
private Vector2 _scrollPos2;
|
||||
|
||||
private void OnGUI()
|
||||
{
|
||||
GUILayout.Space(10);
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button("选择补丁包1", GUILayout.MaxWidth(150)))
|
||||
{
|
||||
string resultPath = EditorUtility.OpenFilePanel("Find", "Assets/", "bytes");
|
||||
if (string.IsNullOrEmpty(resultPath))
|
||||
return;
|
||||
_manifestPath1 = resultPath;
|
||||
}
|
||||
EditorGUILayout.LabelField(_manifestPath1);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.Space(10);
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button("选择补丁包2", GUILayout.MaxWidth(150)))
|
||||
{
|
||||
string resultPath = EditorUtility.OpenFilePanel("Find", "Assets/", "bytes");
|
||||
if (string.IsNullOrEmpty(resultPath))
|
||||
return;
|
||||
_manifestPath2 = resultPath;
|
||||
}
|
||||
EditorGUILayout.LabelField(_manifestPath2);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
if (string.IsNullOrEmpty(_manifestPath1) == false && string.IsNullOrEmpty(_manifestPath2) == false)
|
||||
{
|
||||
if (GUILayout.Button("比对差异", GUILayout.MaxWidth(150)))
|
||||
{
|
||||
ComparePackage(_changeList, _newList);
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
using (new EditorGUI.DisabledScope(false))
|
||||
{
|
||||
int totalCount = _changeList.Count;
|
||||
EditorGUILayout.Foldout(true, $"差异列表 ( {totalCount} )");
|
||||
|
||||
EditorGUI.indentLevel = 1;
|
||||
_scrollPos1 = EditorGUILayout.BeginScrollView(_scrollPos1);
|
||||
{
|
||||
foreach (var bundle in _changeList)
|
||||
{
|
||||
EditorGUILayout.LabelField($"{bundle.BundleName} | {(bundle.FileSize / 1024)}K");
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndScrollView();
|
||||
EditorGUI.indentLevel = 0;
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
using (new EditorGUI.DisabledScope(false))
|
||||
{
|
||||
int totalCount = _newList.Count;
|
||||
EditorGUILayout.Foldout(true, $"新增列表 ( {totalCount} )");
|
||||
|
||||
EditorGUI.indentLevel = 1;
|
||||
_scrollPos2 = EditorGUILayout.BeginScrollView(_scrollPos2);
|
||||
{
|
||||
foreach (var bundle in _newList)
|
||||
{
|
||||
EditorGUILayout.LabelField($"{bundle.BundleName}");
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndScrollView();
|
||||
EditorGUI.indentLevel = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private void ComparePackage(List<PackageBundle> changeList, List<PackageBundle> newList)
|
||||
{
|
||||
changeList.Clear();
|
||||
newList.Clear();
|
||||
|
||||
// 加载补丁清单1
|
||||
byte[] bytesData1 = FileUtility.ReadAllBytes(_manifestPath1);
|
||||
PackageManifest manifest1 = ManifestTools.DeserializeFromBinary(bytesData1);
|
||||
|
||||
// 加载补丁清单1
|
||||
byte[] bytesData2 = FileUtility.ReadAllBytes(_manifestPath2);
|
||||
PackageManifest manifest2 = ManifestTools.DeserializeFromBinary(bytesData2);
|
||||
|
||||
// 拷贝文件列表
|
||||
foreach (var bundle2 in manifest2.BundleList)
|
||||
{
|
||||
if (manifest1.TryGetPackageBundle(bundle2.BundleName, out PackageBundle bundle1))
|
||||
{
|
||||
if (bundle2.FileHash != bundle1.FileHash)
|
||||
{
|
||||
changeList.Add(bundle2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
newList.Add(bundle2);
|
||||
}
|
||||
}
|
||||
|
||||
// 按字母重新排序
|
||||
changeList.Sort((x, y) => string.Compare(x.BundleName, y.BundleName));
|
||||
newList.Sort((x, y) => string.Compare(x.BundleName, y.BundleName));
|
||||
|
||||
Debug.Log("资源包差异比对完成!");
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 46962b0d15f63264bb45fe5be11f48cb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,89 @@
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace YooAsset.Editor
|
||||
{
|
||||
public class PackageImportWindow : EditorWindow
|
||||
{
|
||||
static PackageImportWindow _thisInstance;
|
||||
|
||||
[MenuItem("YooAsset/补丁包导入工具", false, 301)]
|
||||
static void ShowWindow()
|
||||
{
|
||||
if (_thisInstance == null)
|
||||
{
|
||||
_thisInstance = EditorWindow.GetWindow(typeof(PackageImportWindow), false, "补丁包导入工具", true) as PackageImportWindow;
|
||||
_thisInstance.minSize = new Vector2(800, 600);
|
||||
}
|
||||
_thisInstance.Show();
|
||||
}
|
||||
|
||||
private string _manifestPath = string.Empty;
|
||||
|
||||
private void OnGUI()
|
||||
{
|
||||
GUILayout.Space(10);
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button("选择补丁包", GUILayout.MaxWidth(150)))
|
||||
{
|
||||
string resultPath = EditorUtility.OpenFilePanel("Find", "Assets/", "bytes");
|
||||
if (string.IsNullOrEmpty(resultPath))
|
||||
return;
|
||||
_manifestPath = resultPath;
|
||||
}
|
||||
EditorGUILayout.LabelField(_manifestPath);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
if (string.IsNullOrEmpty(_manifestPath) == false)
|
||||
{
|
||||
if (GUILayout.Button("导入补丁包(全部文件)", GUILayout.MaxWidth(150)))
|
||||
{
|
||||
AssetBundleBuilderHelper.ClearStreamingAssetsFolder();
|
||||
CopyPackageFiles(_manifestPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CopyPackageFiles(string manifestFilePath)
|
||||
{
|
||||
string manifestFileName = Path.GetFileNameWithoutExtension(manifestFilePath);
|
||||
string outputDirectory = Path.GetDirectoryName(manifestFilePath);
|
||||
|
||||
// 加载补丁清单
|
||||
byte[] bytesData = FileUtility.ReadAllBytes(manifestFilePath);
|
||||
PackageManifest manifest = ManifestTools.DeserializeFromBinary(bytesData);
|
||||
|
||||
// 拷贝核心文件
|
||||
{
|
||||
string sourcePath = $"{outputDirectory}/{manifestFileName}.bytes";
|
||||
string destPath = $"{AssetBundleBuilderHelper.GetStreamingAssetsFolderPath()}/{manifestFileName}.bytes";
|
||||
EditorTools.CopyFile(sourcePath, destPath, true);
|
||||
}
|
||||
{
|
||||
string sourcePath = $"{outputDirectory}/{manifestFileName}.hash";
|
||||
string destPath = $"{AssetBundleBuilderHelper.GetStreamingAssetsFolderPath()}/{manifestFileName}.hash";
|
||||
EditorTools.CopyFile(sourcePath, destPath, true);
|
||||
}
|
||||
{
|
||||
string fileName = YooAssetSettingsData.GetPackageVersionFileName(manifest.PackageName);
|
||||
string sourcePath = $"{outputDirectory}/{fileName}";
|
||||
string destPath = $"{AssetBundleBuilderHelper.GetStreamingAssetsFolderPath()}/{fileName}";
|
||||
EditorTools.CopyFile(sourcePath, destPath, true);
|
||||
}
|
||||
|
||||
// 拷贝文件列表
|
||||
int fileCount = 0;
|
||||
foreach (var packageBundle in manifest.BundleList)
|
||||
{
|
||||
fileCount++;
|
||||
string sourcePath = $"{outputDirectory}/{packageBundle.FileName}";
|
||||
string destPath = $"{AssetBundleBuilderHelper.GetStreamingAssetsFolderPath()}/{packageBundle.FileName}";
|
||||
EditorTools.CopyFile(sourcePath, destPath, true);
|
||||
}
|
||||
|
||||
Debug.Log($"补丁包拷贝完成,一共拷贝了{fileCount}个资源文件");
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9054ed6f15278064aa817961e48878d5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -13,11 +13,9 @@ namespace TEngine
|
||||
private IProcedureManager m_ProcedureManager = null;
|
||||
private ProcedureBase m_EntranceProcedure = null;
|
||||
|
||||
[SerializeField]
|
||||
private string[] m_AvailableProcedureTypeNames = null;
|
||||
[SerializeField] private string[] m_AvailableProcedureTypeNames = null;
|
||||
|
||||
[SerializeField]
|
||||
private string m_EntranceProcedureTypeName = null;
|
||||
[SerializeField] private string m_EntranceProcedureTypeName = null;
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前流程。
|
||||
@@ -30,6 +28,7 @@ namespace TEngine
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return m_ProcedureManager.CurrentProcedure;
|
||||
}
|
||||
}
|
||||
@@ -45,6 +44,7 @@ namespace TEngine
|
||||
{
|
||||
return 0f;
|
||||
}
|
||||
|
||||
return m_ProcedureManager.CurrentProcedureTime;
|
||||
}
|
||||
}
|
||||
@@ -140,5 +140,31 @@ namespace TEngine
|
||||
{
|
||||
return m_ProcedureManager.GetProcedure(procedureType);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重启流程。
|
||||
/// <remarks>默认使用第一个流程作为启动流程。</remarks>
|
||||
/// </summary>
|
||||
/// <param name="procedures">新的的流程。</param>
|
||||
/// <returns>是否重启成功。</returns>
|
||||
/// <exception cref="GameFrameworkException">重启异常。</exception>
|
||||
public bool RestartProcedure(params ProcedureBase[] procedures)
|
||||
{
|
||||
if (procedures == null || procedures.Length <= 0)
|
||||
{
|
||||
throw new GameFrameworkException("RestartProcedure Failed procedures is invalid.");
|
||||
}
|
||||
|
||||
if (!GameModule.Fsm.DestroyFsm<IProcedureManager>())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
m_ProcedureManager = null;
|
||||
m_ProcedureManager = GameFrameworkModuleSystem.GetModule<IProcedureManager>();
|
||||
IFsmManager fsmManager = GameFrameworkModuleSystem.GetModule<IFsmManager>();
|
||||
m_ProcedureManager.Initialize(fsmManager, procedures);
|
||||
m_ProcedureManager.StartProcedure(procedures[0].GetType());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@@ -473,29 +473,6 @@ namespace TEngine
|
||||
handle.Completed += callback;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步加载资源。
|
||||
/// </summary>
|
||||
/// <param name="assetName">要加载资源的名称。</param>
|
||||
/// <param name="cancellationToken">取消操作Token。</param>
|
||||
/// <typeparam name="T">要加载资源的类型。</typeparam>
|
||||
/// <returns>异步资源实例。</returns>
|
||||
public async UniTask<T> LoadAssetAsync<T>(string assetName, CancellationToken cancellationToken) where T : UnityEngine.Object
|
||||
{
|
||||
return await m_ResourceManager.LoadAssetAsync<T>(assetName, cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步加载游戏物体。
|
||||
/// </summary>
|
||||
/// <param name="assetName">要加载的游戏物体名称。</param>
|
||||
/// <param name="cancellationToken">取消操作Token。</param>
|
||||
/// <returns>异步游戏物体实例。</returns>
|
||||
public async UniTask<GameObject> LoadGameObjectAsync(string assetName, CancellationToken cancellationToken)
|
||||
{
|
||||
return await m_ResourceManager.LoadAssetAsync<GameObject>(assetName, cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 同步加载资源并获取句柄。
|
||||
/// </summary>
|
||||
@@ -551,6 +528,7 @@ namespace TEngine
|
||||
Log.Fatal($"AssetsInfo is null");
|
||||
return null;
|
||||
}
|
||||
|
||||
return m_ResourceManager.LoadSubAssetsSync(assetInfo);
|
||||
}
|
||||
|
||||
@@ -562,7 +540,8 @@ namespace TEngine
|
||||
/// <param name="activateOnLoad">加载完毕时是否主动激活</param>
|
||||
/// <param name="priority">优先级</param>
|
||||
/// <returns>异步加载场景句柄。</returns>
|
||||
public SceneOperationHandle LoadSceneAsync(string location, LoadSceneMode sceneMode = LoadSceneMode.Single, bool activateOnLoad = true, int priority = 100)
|
||||
public SceneOperationHandle LoadSceneAsync(string location, LoadSceneMode sceneMode = LoadSceneMode.Single, bool activateOnLoad = true,
|
||||
int priority = 100)
|
||||
{
|
||||
return m_ResourceManager.LoadSceneAsync(location, sceneMode, activateOnLoad, priority);
|
||||
}
|
||||
@@ -575,9 +554,96 @@ namespace TEngine
|
||||
/// <param name="activateOnLoad">加载完毕时是否主动激活</param>
|
||||
/// <param name="priority">优先级</param>
|
||||
/// <returns>异步加载场景句柄。</returns>
|
||||
public SceneOperationHandle LoadSceneAsync(AssetInfo assetInfo, LoadSceneMode sceneMode = LoadSceneMode.Single, bool activateOnLoad = true, int priority = 100)
|
||||
public SceneOperationHandle LoadSceneAsync(AssetInfo assetInfo, LoadSceneMode sceneMode = LoadSceneMode.Single, bool activateOnLoad = true,
|
||||
int priority = 100)
|
||||
{
|
||||
return m_ResourceManager.LoadSceneAsync(assetInfo, sceneMode, activateOnLoad, priority);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步加载资源。
|
||||
/// </summary>
|
||||
/// <param name="assetName">要加载资源的名称。</param>
|
||||
/// <param name="cancellationToken">取消操作Token。</param>
|
||||
/// <typeparam name="T">要加载资源的类型。</typeparam>
|
||||
/// <returns>异步资源实例。</returns>
|
||||
public async UniTask<T> LoadAssetAsync<T>(string assetName, CancellationToken cancellationToken) where T : UnityEngine.Object
|
||||
{
|
||||
return await m_ResourceManager.LoadAssetAsync<T>(assetName, cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步加载游戏物体。
|
||||
/// </summary>
|
||||
/// <param name="assetName">要加载的游戏物体名称。</param>
|
||||
/// <param name="cancellationToken">取消操作Token。</param>
|
||||
/// <returns>异步游戏物体实例。</returns>
|
||||
public async UniTask<GameObject> LoadGameObjectAsync(string assetName, CancellationToken cancellationToken)
|
||||
{
|
||||
return await m_ResourceManager.LoadGameObjectAsync(assetName, cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步加载游戏物体。
|
||||
/// </summary>
|
||||
/// <param name="location">资源定位地址。</param>
|
||||
/// <param name="parent">父节点位置。</param>
|
||||
/// <param name="cancellationToken">取消操作Token。</param>
|
||||
/// <returns>异步游戏物体实例。</returns>
|
||||
public async UniTask<GameObject> LoadGameObjectAsync(string location, Transform parent, CancellationToken cancellationToken)
|
||||
{
|
||||
return await m_ResourceManager.LoadGameObjectAsync(location, parent, cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步加载原生文件。
|
||||
/// </summary>
|
||||
/// <param name="location">资源定位地址。</param>
|
||||
/// <param name="cancellationToken">取消操作Token。</param>
|
||||
/// <returns>原生文件资源实例。</returns>
|
||||
public async UniTask<RawFileOperationHandle> LoadRawAssetAsync(string location, CancellationToken cancellationToken)
|
||||
{
|
||||
return await m_ResourceManager.LoadRawAssetAsync(location, cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步加载子文件。
|
||||
/// </summary>
|
||||
/// <param name="location">资源定位地址。</param>
|
||||
/// <param name="assetName">资源名称。</param>
|
||||
/// <param name="cancellationToken">取消操作Token。</param>
|
||||
/// <typeparam name="T">资源实例类型。</typeparam>
|
||||
/// <returns>原生文件资源实例。</returns>
|
||||
public async UniTask<T> LoadSubAssetAsync<T>(string location, string assetName, CancellationToken cancellationToken) where T : UnityEngine.Object
|
||||
{
|
||||
return await m_ResourceManager.LoadSubAssetAsync<T>(location, assetName, cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步加载所有子文件。
|
||||
/// </summary>
|
||||
/// <param name="location">资源定位地址。</param>
|
||||
/// <param name="cancellationToken">取消操作Token。</param>
|
||||
/// <typeparam name="T">资源实例类型。</typeparam>
|
||||
/// <returns>原生文件资源实例。</returns>
|
||||
public async UniTask<T[]> LoadAllSubAssetAsync<T>(string location, CancellationToken cancellationToken) where T : UnityEngine.Object
|
||||
{
|
||||
return await m_ResourceManager.LoadAllSubAssetAsync<T>(location, cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步加载场景。
|
||||
/// </summary>
|
||||
/// <param name="location">场景的定位地址。</param>
|
||||
/// <param name="cancellationToken">取消操作Token。</param>
|
||||
/// <param name="sceneMode">场景加载模式。</param>
|
||||
/// <param name="activateOnLoad">加载完毕时是否主动激活。</param>
|
||||
/// <param name="priority">优先级。</param>
|
||||
/// <returns>场景资源实例。</returns>
|
||||
public async UniTask<Scene> LoadSceneAsyncByUniTask(string location, CancellationToken cancellationToken,
|
||||
LoadSceneMode sceneMode = LoadSceneMode.Single, bool activateOnLoad = true, int priority = 100)
|
||||
{
|
||||
return await m_ResourceManager.LoadSceneAsyncByUniTask(location, cancellationToken, sceneMode, activateOnLoad, priority);
|
||||
}
|
||||
}
|
||||
}
|
@@ -113,8 +113,6 @@ namespace TEngine
|
||||
BuglyManager.Instance.Init(Resources.Load<BuglyConfig>("BuglyConfig"));
|
||||
#endif
|
||||
|
||||
GameTime.StartFrame();
|
||||
|
||||
InitTextHelper();
|
||||
InitVersionHelper();
|
||||
InitLogHelper();
|
||||
@@ -141,7 +139,6 @@ namespace TEngine
|
||||
|
||||
private void Update()
|
||||
{
|
||||
GameTime.StartFrame();
|
||||
GameFrameworkModuleSystem.Update(Time.deltaTime, Time.unscaledDeltaTime);
|
||||
}
|
||||
|
||||
|
@@ -41,6 +41,16 @@
|
||||
"name": "com.unity.modules.particlesystem",
|
||||
"expression": "",
|
||||
"define": "UNITASK_PARTICLESYSTEM_SUPPORT"
|
||||
},
|
||||
{
|
||||
"name": "com.unity.textmeshpro",
|
||||
"expression": "",
|
||||
"define": "UNITASK_TEXTMESHPRO_SUPPORT"
|
||||
},
|
||||
{
|
||||
"name": "com.demigiant.dotween",
|
||||
"expression": "",
|
||||
"define": "UNITASK_DOTWEEN_SUPPORT"
|
||||
}
|
||||
],
|
||||
"noEngineReferences": false
|
||||
|
@@ -1,6 +1,6 @@
|
||||
// asmdef Version Defines, enabled when com.demigiant.dotween is imported.
|
||||
|
||||
#if UNITASK_DOTWEEN_SUPPORT
|
||||
#if true || UNITASK_DOTWEEN_SUPPORT
|
||||
|
||||
using Cysharp.Threading.Tasks.Internal;
|
||||
using DG.Tweening;
|
||||
|
37
Assets/TEngine/Runtime/Utility/NewtonsoftJsonHelper.cs
Normal file
37
Assets/TEngine/Runtime/Utility/NewtonsoftJsonHelper.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
namespace TEngine
|
||||
{
|
||||
public class NewtonsoftJsonHelper : Utility.Json.IJsonHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 将对象序列化为 JSON 字符串。
|
||||
/// </summary>
|
||||
/// <param name="obj">要序列化的对象。</param>
|
||||
/// <returns>序列化后的 JSON 字符串。</returns>
|
||||
public string ToJson(object obj)
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(obj);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将 JSON 字符串反序列化为对象。
|
||||
/// </summary>
|
||||
/// <typeparam name="T">对象类型。</typeparam>
|
||||
/// <param name="json">要反序列化的 JSON 字符串。</param>
|
||||
/// <returns>反序列化后的对象。</returns>
|
||||
public T ToObject<T>(string json)
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.DeserializeObject<T>(json);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将 JSON 字符串反序列化为对象。
|
||||
/// </summary>
|
||||
/// <param name="objectType">对象类型。</param>
|
||||
/// <param name="json">要反序列化的 JSON 字符串。</param>
|
||||
/// <returns>反序列化后的对象。</returns>
|
||||
public object ToObject(System.Type objectType, string json)
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.DeserializeObject(json, objectType);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 38484765ede44acc840c664a828ca6ff
|
||||
timeCreated: 1687360419
|
@@ -1,20 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package TEngine.Network.Message;
|
||||
import "google/protobuf/struct.proto";
|
||||
|
||||
|
||||
message AccountInfo
|
||||
{
|
||||
int64 UnitId = 1;
|
||||
int64 UserId = 2;
|
||||
int64 CharaId = 3;
|
||||
repeated int32 Ks = 4;
|
||||
repeated int64 Vs = 5;
|
||||
}
|
||||
|
||||
message ItemInfo
|
||||
{
|
||||
int32 ItemGId = 1;
|
||||
int32 ItemId = 2;
|
||||
int32 Count = 3;
|
||||
}
|
Reference in New Issue
Block a user