mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-07 16:45:10 +00:00
@@ -36,7 +36,10 @@ namespace GameBase
|
|||||||
|
|
||||||
protected virtual void OnDestroy()
|
protected virtual void OnDestroy()
|
||||||
{
|
{
|
||||||
Release();
|
if (this == _instance)
|
||||||
|
{
|
||||||
|
Release();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -60,7 +63,7 @@ namespace GameBase
|
|||||||
if (_instance != null)
|
if (_instance != null)
|
||||||
{
|
{
|
||||||
SingletonSystem.Release(_instance.gameObject);
|
SingletonSystem.Release(_instance.gameObject);
|
||||||
_instance = null;
|
_instance = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,7 +99,7 @@ namespace GameBase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_instance == null)
|
if (_instance == null)
|
||||||
{
|
{
|
||||||
Log.Error($"Can't create SingletonBehaviour<{typeof(T)}>");
|
Log.Error($"Can't create SingletonBehaviour<{typeof(T)}>");
|
||||||
}
|
}
|
||||||
|
@@ -3,10 +3,10 @@ using GameLogic;
|
|||||||
using TEngine;
|
using TEngine;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public partial class GameApp
|
public partial class GameApp : Singleton<GameApp>
|
||||||
{
|
{
|
||||||
private List<ILogicSys> _listLogicMgr;
|
private List<ILogicSys> _listLogicMgr;
|
||||||
|
|
||||||
public override void Active()
|
public override void Active()
|
||||||
{
|
{
|
||||||
CodeTypes.Instance.Init(_hotfixAssembly.ToArray());
|
CodeTypes.Instance.Init(_hotfixAssembly.ToArray());
|
||||||
@@ -15,13 +15,13 @@ public partial class GameApp
|
|||||||
RegisterAllSystem();
|
RegisterAllSystem();
|
||||||
InitSystemSetting();
|
InitSystemSetting();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设置一些通用的系统属性。
|
/// 设置一些通用的系统属性。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitSystemSetting()
|
private void InitSystemSetting()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -32,7 +32,7 @@ public partial class GameApp
|
|||||||
//带生命周期的单例系统。
|
//带生命周期的单例系统。
|
||||||
AddLogicSys(BehaviourSingleSystem.Instance);
|
AddLogicSys(BehaviourSingleSystem.Instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 注册逻辑系统。
|
/// 注册逻辑系统。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@@ -9,6 +9,7 @@ using UnityEngine;
|
|||||||
using TEngine;
|
using TEngine;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using YooAsset;
|
using YooAsset;
|
||||||
|
using Cysharp.Threading.Tasks;
|
||||||
|
|
||||||
namespace GameMain
|
namespace GameMain
|
||||||
{
|
{
|
||||||
@@ -38,6 +39,12 @@ namespace GameMain
|
|||||||
base.OnEnter(procedureOwner);
|
base.OnEnter(procedureOwner);
|
||||||
Log.Debug("HyBridCLR ProcedureLoadAssembly OnEnter");
|
Log.Debug("HyBridCLR ProcedureLoadAssembly OnEnter");
|
||||||
m_procedureOwner = procedureOwner;
|
m_procedureOwner = procedureOwner;
|
||||||
|
|
||||||
|
LoadAssembly().Forget();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async UniTaskVoid LoadAssembly()
|
||||||
|
{
|
||||||
m_LoadAssemblyComplete = false;
|
m_LoadAssemblyComplete = false;
|
||||||
m_HotfixAssemblys = new List<Assembly>();
|
m_HotfixAssemblys = new List<Assembly>();
|
||||||
|
|
||||||
@@ -55,7 +62,7 @@ namespace GameMain
|
|||||||
{
|
{
|
||||||
m_LoadMetadataAssemblyComplete = true;
|
m_LoadMetadataAssemblyComplete = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SettingsUtils.HybridCLRCustomGlobalSettings.Enable || GameModule.Resource.PlayMode == EPlayMode.EditorSimulateMode)
|
if (!SettingsUtils.HybridCLRCustomGlobalSettings.Enable || GameModule.Resource.PlayMode == EPlayMode.EditorSimulateMode)
|
||||||
{
|
{
|
||||||
m_MainLogicAssembly = GetMainLogicAssembly();
|
m_MainLogicAssembly = GetMainLogicAssembly();
|
||||||
@@ -75,10 +82,11 @@ namespace GameMain
|
|||||||
SettingsUtils.HybridCLRCustomGlobalSettings.AssemblyTextAssetPath,
|
SettingsUtils.HybridCLRCustomGlobalSettings.AssemblyTextAssetPath,
|
||||||
$"{hotUpdateDllName}{SettingsUtils.HybridCLRCustomGlobalSettings.AssemblyTextAssetExtension}"));
|
$"{hotUpdateDllName}{SettingsUtils.HybridCLRCustomGlobalSettings.AssemblyTextAssetExtension}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.Debug($"LoadAsset: [ {assetLocation} ]");
|
Log.Debug($"LoadAsset: [ {assetLocation} ]");
|
||||||
m_LoadAssetCount++;
|
m_LoadAssetCount++;
|
||||||
GameModule.Resource.LoadAsset<TextAsset>(assetLocation,LoadAssetSuccess);
|
var result = await GameModule.Resource.LoadAssetAsync<TextAsset>(assetLocation);
|
||||||
|
LoadAssetSuccess(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_LoadAssemblyWait = true;
|
m_LoadAssemblyWait = true;
|
||||||
@@ -94,7 +102,7 @@ namespace GameMain
|
|||||||
m_LoadAssemblyComplete = true;
|
m_LoadAssemblyComplete = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnUpdate(IFsm<IProcedureManager> procedureOwner, float elapseSeconds, float realElapseSeconds)
|
protected override void OnUpdate(IFsm<IProcedureManager> procedureOwner, float elapseSeconds, float realElapseSeconds)
|
||||||
{
|
{
|
||||||
base.OnUpdate(procedureOwner, elapseSeconds, realElapseSeconds);
|
base.OnUpdate(procedureOwner, elapseSeconds, realElapseSeconds);
|
||||||
@@ -108,7 +116,7 @@ namespace GameMain
|
|||||||
}
|
}
|
||||||
AllAssemblyLoadComplete();
|
AllAssemblyLoadComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AllAssemblyLoadComplete()
|
private void AllAssemblyLoadComplete()
|
||||||
{
|
{
|
||||||
ChangeState<ProcedureStartGame>(m_procedureOwner);
|
ChangeState<ProcedureStartGame>(m_procedureOwner);
|
||||||
@@ -231,11 +239,11 @@ namespace GameMain
|
|||||||
SettingsUtils.HybridCLRCustomGlobalSettings.AssemblyTextAssetPath,
|
SettingsUtils.HybridCLRCustomGlobalSettings.AssemblyTextAssetPath,
|
||||||
$"{aotDllName}{SettingsUtils.HybridCLRCustomGlobalSettings.AssemblyTextAssetExtension}"));
|
$"{aotDllName}{SettingsUtils.HybridCLRCustomGlobalSettings.AssemblyTextAssetExtension}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Log.Debug($"LoadMetadataAsset: [ {assetLocation} ]");
|
Log.Debug($"LoadMetadataAsset: [ {assetLocation} ]");
|
||||||
m_LoadMetadataAssetCount++;
|
m_LoadMetadataAssetCount++;
|
||||||
GameModule.Resource.LoadAsset<TextAsset>(assetLocation,LoadMetadataAssetSuccess);
|
GameModule.Resource.LoadAsset<TextAsset>(assetLocation, LoadMetadataAssetSuccess);
|
||||||
}
|
}
|
||||||
m_LoadMetadataAssemblyWait = true;
|
m_LoadMetadataAssemblyWait = true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user