Main mono拆分
parent
e3fa5980e8
commit
d0b2c8331f
|
|
@ -1,11 +1,15 @@
|
|||
using PhxhSDK;
|
||||
using PhxhSDK.AOT;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Gameplay
|
||||
{
|
||||
public class Main : SingletonMono<Main>
|
||||
{
|
||||
private const string GAME_TYPE_NAME = "MyGame, GamePlay";
|
||||
|
||||
private Game _game;
|
||||
|
||||
public bool isInited
|
||||
|
|
@ -14,16 +18,23 @@ namespace Gameplay
|
|||
private set;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void _InitGame()
|
||||
{
|
||||
SDKManager.GetSingleton().InitEarly();
|
||||
_game = new MyGame();
|
||||
|
||||
Type type = Type.GetType(GAME_TYPE_NAME);
|
||||
if (null == type)
|
||||
{
|
||||
Debug.LogError($"{GAME_TYPE_NAME} Type found");
|
||||
return;
|
||||
}
|
||||
|
||||
_game = Activator.CreateInstance(type) as Game;
|
||||
if (_game == null)
|
||||
{
|
||||
DebugUtil.LogError("PhxhSDK.Main: no game instance created");
|
||||
}
|
||||
|
||||
SDKManager.GetSingleton().Init();
|
||||
_game.Init();
|
||||
_game.Start();
|
||||
|
|
@ -46,14 +57,18 @@ namespace Gameplay
|
|||
|
||||
private void Update()
|
||||
{
|
||||
if (!isInited) return;
|
||||
if (!isInited)
|
||||
return;
|
||||
|
||||
_game.Update(Time.deltaTime);
|
||||
SDKManager.Instance.Update();
|
||||
}
|
||||
|
||||
private void OnApplicationPause(bool pauseStatus)
|
||||
{
|
||||
if (!isInited) return;
|
||||
if (!isInited)
|
||||
return;
|
||||
|
||||
_game.OnApplicationPause(pauseStatus);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue