mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
1.增加重启流程Procedure接口。2.增加进入热更域后的流程Procedure。
1.增加重启流程Procedure接口。2.增加进入热更域后的流程Procedure。
This commit is contained in:
@@ -24,6 +24,7 @@ public partial class GameApp:Singleton<GameApp>
|
|||||||
Utility.Unity.AddDestroyListener(Instance.OnDestroy);
|
Utility.Unity.AddDestroyListener(Instance.OnDestroy);
|
||||||
Utility.Unity.AddOnDrawGizmosListener(Instance.OnDrawGizmos);
|
Utility.Unity.AddOnDrawGizmosListener(Instance.OnDrawGizmos);
|
||||||
Utility.Unity.AddOnApplicationPauseListener(Instance.OnApplicationPause);
|
Utility.Unity.AddOnApplicationPauseListener(Instance.OnApplicationPause);
|
||||||
|
GameModule.Procedure.RestartProcedure(new GameLogic.OnEnterGameAppProcedure());
|
||||||
Instance.StartGameLogic();
|
Instance.StartGameLogic();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,7 +34,7 @@ public partial class GameApp:Singleton<GameApp>
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void StartGameLogic()
|
private void StartGameLogic()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@@ -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()
|
private void AllAssemblyLoadComplete()
|
||||||
{
|
{
|
||||||
|
ChangeState<ProcedureStartGame>(m_procedureOwner);
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
m_MainLogicAssembly = AppDomain.CurrentDomain.GetAssemblies().
|
m_MainLogicAssembly = AppDomain.CurrentDomain.GetAssemblies().
|
||||||
First(assembly => $"{assembly.GetName().Name}.dll" == SettingsUtils.HybridCLRCustomGlobalSettings.LogicMainDllName);
|
First(assembly => $"{assembly.GetName().Name}.dll" == SettingsUtils.HybridCLRCustomGlobalSettings.LogicMainDllName);
|
||||||
@@ -139,7 +140,6 @@ namespace GameMain
|
|||||||
}
|
}
|
||||||
object[] objects = new object[] { new object[] { m_HotfixAssemblys } };
|
object[] objects = new object[] { new object[] { m_HotfixAssemblys } };
|
||||||
entryMethod.Invoke(appType, objects);
|
entryMethod.Invoke(appType, objects);
|
||||||
ChangeState<ProcedureStartGame>(m_procedureOwner);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Assembly GetMainLogicAssembly()
|
private Assembly GetMainLogicAssembly()
|
||||||
|
@@ -13,11 +13,9 @@ namespace TEngine
|
|||||||
private IProcedureManager m_ProcedureManager = null;
|
private IProcedureManager m_ProcedureManager = null;
|
||||||
private ProcedureBase m_EntranceProcedure = null;
|
private ProcedureBase m_EntranceProcedure = null;
|
||||||
|
|
||||||
[SerializeField]
|
[SerializeField] private string[] m_AvailableProcedureTypeNames = null;
|
||||||
private string[] m_AvailableProcedureTypeNames = null;
|
|
||||||
|
|
||||||
[SerializeField]
|
[SerializeField] private string m_EntranceProcedureTypeName = null;
|
||||||
private string m_EntranceProcedureTypeName = null;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取当前流程。
|
/// 获取当前流程。
|
||||||
@@ -30,6 +28,7 @@ namespace TEngine
|
|||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_ProcedureManager.CurrentProcedure;
|
return m_ProcedureManager.CurrentProcedure;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -45,6 +44,7 @@ namespace TEngine
|
|||||||
{
|
{
|
||||||
return 0f;
|
return 0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_ProcedureManager.CurrentProcedureTime;
|
return m_ProcedureManager.CurrentProcedureTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -140,5 +140,31 @@ namespace TEngine
|
|||||||
{
|
{
|
||||||
return m_ProcedureManager.GetProcedure(procedureType);
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user