43 lines
931 B
C#
Raw Normal View History

2024-10-17 01:59:25 +08:00
using Cysharp.Threading.Tasks;
using JNGame.Runtime.System;
using JNGame.Runtime.Util;
2024-08-17 14:27:18 +08:00
2024-10-17 01:59:25 +08:00
namespace JNGame.Runtime
2024-08-17 14:27:18 +08:00
{
public class JNetGame : SingletonScene<JNetGame>
{
private SystemBase[] _systems;
public async UniTask Init(SystemBase[] systems)
{
_systems = systems;
foreach (var system in _systems)
{
if (system is not null)
{
await system.OnInit();
}
}
}
public void Close()
{
if (_systems is not null)
{
foreach (var system in _systems)
{
system?.OnClose();
}
}
}
private void OnApplicationQuit()
{
Close();
}
protected override void OnDispose()
{
Close();
}
}
}