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,57 @@
|
||||
using System.Collections.Generic;
|
||||
using TEngine;
|
||||
using UnityEngine;
|
||||
|
||||
public partial class GameApp
|
||||
{
|
||||
private List<ILogicSys> _listLogicMgr;
|
||||
|
||||
private void Init()
|
||||
{
|
||||
_listLogicMgr = new List<ILogicSys>();
|
||||
RegisterAllSystem();
|
||||
InitSystemSetting();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置一些通用的系统属性。
|
||||
/// </summary>
|
||||
private void InitSystemSetting()
|
||||
{
|
||||
Application.targetFrameRate = 120;
|
||||
Log.Warning("Set UnityEngine.Application.targetFrameRate = 120");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 注册所有逻辑系统
|
||||
/// </summary>
|
||||
private void RegisterAllSystem()
|
||||
{
|
||||
//带生命周期的单例系统。
|
||||
AddLogicSys(BehaviourSingleSystem.Instance);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 注册逻辑系统。
|
||||
/// </summary>
|
||||
/// <param name="logicSys">ILogicSys</param>
|
||||
/// <returns></returns>
|
||||
protected 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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user