mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-07 16:45:10 +00:00
59 lines
1.3 KiB
C#
59 lines
1.3 KiB
C#
using System.Collections.Generic;
|
|
using GameLogic;
|
|
using TEngine;
|
|
using UnityEngine;
|
|
|
|
public partial class GameApp
|
|
{
|
|
private List<ILogicSys> _listLogicMgr;
|
|
|
|
private void Init()
|
|
{
|
|
CodeTypes.Instance.Init(_hotfixAssembly.ToArray());
|
|
EventInterfaceHelper.Init();
|
|
_listLogicMgr = new List<ILogicSys>();
|
|
RegisterAllSystem();
|
|
InitSystemSetting();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 设置一些通用的系统属性。
|
|
/// </summary>
|
|
private void InitSystemSetting()
|
|
{
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 注册所有逻辑系统
|
|
/// </summary>
|
|
private void RegisterAllSystem()
|
|
{
|
|
//带生命周期的单例系统。
|
|
AddLogicSys(BehaviourSingleSystem.Instance);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 注册逻辑系统。
|
|
/// </summary>
|
|
/// <param name="logicSys">ILogicSys</param>
|
|
/// <returns></returns>
|
|
private bool AddLogicSys(ILogicSys logicSys)
|
|
{
|
|
if (_listLogicMgr.Contains(logicSys))
|
|
{
|
|
Log.Fatal("Repeat add logic system: {0}", logicSys.GetType().Name);
|
|
return false;
|
|
}
|
|
|
|
if (!logicSys.OnInit())
|
|
{
|
|
Log.Fatal("{0} Init failed", logicSys.GetType().Name);
|
|
return false;
|
|
}
|
|
|
|
_listLogicMgr.Add(logicSys);
|
|
|
|
return true;
|
|
}
|
|
} |