51 lines
1.2 KiB
C#
Raw Permalink Normal View History

2024-10-16 20:41:40 +08:00
using System;
2024-10-17 20:36:24 +08:00
using DG.Tweening;
using HotScripts.GameLauncher;
2024-10-16 20:41:40 +08:00
using HotScripts.GameScripts.FGui;
using HotScripts.GameScripts.FGui.Scripts;
2024-10-17 20:36:24 +08:00
using HotScripts.GameScripts.FGui.Scripts.Hall;
2024-10-17 01:59:25 +08:00
using JNGame.Runtime;
2024-10-16 20:41:40 +08:00
using SHFrame;
using UnityEngine;
using EventArgs = SHFrame.EventArgs;
namespace HotScripts.GameScripts
{
public class HotGameMain : MonoBehaviour
{
private async void Awake()
{
AddListener();
//初始化系统
await JNetGame.Instance.Init(App.AllSystem());
2024-10-17 20:36:24 +08:00
//初始化成功
App.EventLauncher.DispatchEvent(HotLauncherEvent.InitSuccess);
2024-10-16 20:41:40 +08:00
}
private void OnDestroy()
{
RemoveListener();
}
private void AddListener()
{
2024-10-17 20:36:24 +08:00
App.EventLauncher.AddListener(HotLauncherEvent.GoGameMain,OnGoGameMain);
2024-10-16 20:41:40 +08:00
}
private void RemoveListener()
{
2024-10-17 20:36:24 +08:00
App.EventLauncher.RemoveListener(HotLauncherEvent.GoGameMain,OnGoGameMain);
2024-10-16 20:41:40 +08:00
}
private async void OnGoGameMain(EventArgs eventargs)
{
Log.Debug($"进入游戏");
2024-10-17 20:36:24 +08:00
await App.UI.Open<HallUI>(UIID.Hall);
2024-10-16 20:41:40 +08:00
}
}
}