mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
Add GameEntry
Add GameEntry
This commit is contained in:
@@ -15,9 +15,9 @@ namespace TEngine
|
|||||||
{
|
{
|
||||||
if (null == sInstance)
|
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();
|
sInstance = new T();
|
||||||
TLogger.LogAssert(sInstance != null);
|
TLogger.LogAssert(sInstance != null);
|
||||||
|
23
Assets/TEngine/Runtime/Core/GameEntry.cs
Normal file
23
Assets/TEngine/Runtime/Core/GameEntry.cs
Normal 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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: eab97947b9db71a47b27c473727f40bb
|
guid: 92823e5f43d656747901c60b79aeb51c
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
@@ -3,24 +3,14 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace TEngine
|
namespace TEngine
|
||||||
{
|
{
|
||||||
/// <summary>
|
public class TEngineEntry : UnitySingleton<TEngineEntry>
|
||||||
/// 游戏入口,派生TEngine,实现进入游戏虚函数(override StartGame)
|
|
||||||
/// </summary>
|
|
||||||
public class TEngine : UnitySingleton<TEngine>
|
|
||||||
{
|
{
|
||||||
public override void Awake()
|
public System.Action OnStartGame;
|
||||||
|
protected override void OnLoad()
|
||||||
{
|
{
|
||||||
base.Awake();
|
|
||||||
|
|
||||||
TLogger.LogInfo($"DevicePerformanceLevel 设备性能评级:{DevicePerformanceUtil.GetDevicePerformanceLevel()}");
|
|
||||||
|
|
||||||
InitLibImp();
|
InitLibImp();
|
||||||
|
|
||||||
RegisterAllSystem();
|
RegisterAllSystem();
|
||||||
|
|
||||||
AfterAwake();
|
|
||||||
|
|
||||||
GameTime.StartFrame();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -167,16 +157,10 @@ namespace TEngine
|
|||||||
SingletonMgr.Release();
|
SingletonMgr.Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void AfterAwake()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void StartGame()
|
protected virtual void StartGame()
|
||||||
{
|
{
|
||||||
|
OnStartGame?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
11
Assets/TEngine/Runtime/Core/TEngineEntry.cs.meta
Normal file
11
Assets/TEngine/Runtime/Core/TEngineEntry.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 24d05fd49961e7848a44005a652f95c9
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Reference in New Issue
Block a user