using PhxhSDK; using PhxhSDK.AOT; using System; using System.Reflection; using UnityEngine; namespace Gameplay { public class Main : SingletonMono
{ private const string GAME_TYPE_NAME = "MyGame, GamePlay"; private Game _game; public bool isInited { get; private set; } private void _InitGame() { SDKManager.GetSingleton().InitEarly(); 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(); } private async void _InitAsync() { isInited = false; #if USE_YOO await YooAssetHelper.Init(); #endif isInited = true; _InitGame(); } private void Start() { _InitAsync(); } private void Update() { if (!isInited) return; _game.Update(Time.deltaTime); SDKManager.Instance.Update(); } private void OnApplicationPause(bool pauseStatus) { if (!isInited) return; _game.OnApplicationPause(pauseStatus); } private void OnDestroy() { _game.Release(); SDKManager.Instance.Release(); } } }