NLDClient-yudde/ProjectNLD/Assets/Code/Scripts/Gameplay/Game/Main.cs

47 lines
995 B
C#
Raw Normal View History

2023-12-15 19:25:08 +08:00
using System;
using System.Collections.Generic;
2023-08-22 19:08:45 +08:00
using UnityEngine;
2023-10-21 11:55:23 +08:00
namespace PhxhSDK
2023-08-22 19:08:45 +08:00
{
2023-10-19 15:00:19 +08:00
public class Main : SingletonMono<Main>
2023-08-22 19:08:45 +08:00
{
private static Game _game;
private void Awake()
{
2023-10-19 15:00:19 +08:00
SDKManager.GetSingleton().InitEarly();
2023-08-22 19:08:45 +08:00
DontDestroyOnLoad(gameObject);
_game = new MyGame();
if (_game == null)
{
2023-10-21 11:55:23 +08:00
DebugUtil.LogError("PhxhSDK.Main: no game instance created");
2023-08-22 19:08:45 +08:00
}
2023-10-19 15:00:19 +08:00
SDKManager.GetSingleton().Init();
2023-08-22 19:08:45 +08:00
_game.Init();
}
2023-12-15 19:29:25 +08:00
2023-12-15 19:25:08 +08:00
2023-08-22 19:08:45 +08:00
private void Start()
{
_game.Start();
}
private void Update()
{
_game.Update(Time.deltaTime);
}
private void OnApplicationPause(bool pauseStatus)
{
_game.OnApplicationPause(pauseStatus);
}
private void OnDestroy()
{
_game.Release();
2023-10-19 15:00:19 +08:00
SDKManager.Instance.Release();
2023-08-22 19:08:45 +08:00
}
}
2023-10-19 15:00:19 +08:00
}