using Gameplay.Manager; using Framework.BI; using UnityEngine; using PhxhSDK; namespace Gameplay.Game { public class Main : MonoBehaviour { public static PhxhSDK.Game Game { get { return _game; } } private static PhxhSDK.Game _game; private void Awake() { SDKManager.Instance.InitEarly(); string unityAdsGameID = null; #if UNITY_ANDROID unityAdsGameID = "5640254"; #elif UNITY_IPHONE unityAdsGameID = "5640255"; #endif AdSDKManager.Instance.ConfigureBeforeInit(unityAdsGameID); AdSDKManager.Instance.Init(); IAPManager.Instance.Init(); _InitReport(); DontDestroyOnLoad(gameObject); _game = new MyGame(); if (_game == null) { DebugUtil.LogError("Framework.Main: no game instance created"); } _game.Init(); } private void _InitReport() { } private void Start() { BIManager.Instance.TrackEventOnce(cfg.BI.EventFirst.fte_open); BIManager.Instance.TrackEvent(cfg.BI.Event.app_launch); Notification.Init(); _game.Start(); } private void Update() { _game.Update(Time.deltaTime); SDKManager.Instance.Update(); } private void OnApplicationPause(bool pauseStatus) { _game.OnApplicationPause(pauseStatus); } private void OnDestroy() { ADManager.Instance.Release(); _game.Release(); } } }