Add GameEntry

Add GameEntry
This commit is contained in:
ALEXTANG
2022-08-08 19:34:48 +08:00
parent 0ca119be70
commit ef5ffb1599
5 changed files with 41 additions and 23 deletions

View File

@@ -15,9 +15,9 @@ namespace TEngine
{
if (null == sInstance)
{
if (!TEngine.Instance.ContainLogicSys(BehaviourSingleSystem.Instance))
if (!TEngineEntry.Instance.ContainLogicSys(BehaviourSingleSystem.Instance))
{
TEngine.Instance.AddLogicSys(BehaviourSingleSystem.Instance);
TEngineEntry.Instance.AddLogicSys(BehaviourSingleSystem.Instance);
}
sInstance = new T();
TLogger.LogAssert(sInstance != null);

View File

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TEngine;
using UnityEngine;
namespace Assets.TEngine.Runtime.Core
{
public class GameEntry:MonoBehaviour
{
void Start()
{
TEngineEntry.Instance.OnStartGame += OnStartGame;
}
void OnStartGame()
{
TLogger.LogError("OnStartGame");
}
}
}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: eab97947b9db71a47b27c473727f40bb
guid: 92823e5f43d656747901c60b79aeb51c
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -3,24 +3,14 @@ using UnityEngine;
namespace TEngine
{
/// <summary>
/// 游戏入口派生TEngine实现进入游戏虚函数(override StartGame)
/// </summary>
public class TEngine : UnitySingleton<TEngine>
public class TEngineEntry : UnitySingleton<TEngineEntry>
{
public override void Awake()
public System.Action OnStartGame;
protected override void OnLoad()
{
base.Awake();
TLogger.LogInfo($"DevicePerformanceLevel 设备性能评级:{DevicePerformanceUtil.GetDevicePerformanceLevel()}");
InitLibImp();
RegisterAllSystem();
AfterAwake();
GameTime.StartFrame();
}
/// <summary>
@@ -167,16 +157,10 @@ namespace TEngine
SingletonMgr.Release();
}
protected virtual void AfterAwake()
{
}
protected virtual void StartGame()
{
OnStartGame?.Invoke();
}
#endregion
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 24d05fd49961e7848a44005a652f95c9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: