AxibugEmuOnline/AxibugEmuOnline.Client/Assets/Script/AppAxibugEmuOnline.cs

69 lines
2.0 KiB
C#
Raw Normal View History

2024-06-28 18:08:25 +08:00
using AxibugEmuOnline.Client.Manager;
using AxibugEmuOnline.Client.Network;
2024-08-13 18:35:20 +08:00
using System.Collections;
2024-06-28 18:08:25 +08:00
using UnityEngine;
namespace AxibugEmuOnline.Client.ClientCore
{
public class AppAxibugEmuOnline
{
public static string TokenStr;
public static long RID = -1;
public static string IP;
public static int Port;
public static LogManager log;
public static NetworkHelper networkHelper;
public static AppLogin login;
public static AppChat chat;
public static UserDataManager user;
2024-07-03 14:43:11 +08:00
public static AppNetGame netgame;
public static AppEmu emu;
2024-08-13 18:35:20 +08:00
public static RomLib romLib;
public static HttpAPI httpAPI;
private static CoroutineRunner coRunner;
[RuntimeInitializeOnLoadMethod]
static void Init()
2024-06-28 18:08:25 +08:00
{
log = new LogManager();
LogManager.OnLog += OnNoSugarNetLog;
networkHelper = new NetworkHelper();
login = new AppLogin();
chat = new AppChat();
user = new UserDataManager();
2024-07-03 14:43:11 +08:00
emu = new AppEmu();
netgame = new AppNetGame();
2024-08-14 13:09:22 +08:00
romLib = new RomLib();
httpAPI = new HttpAPI();
2024-08-13 18:35:20 +08:00
var go = new GameObject("[AppAxibugEmuOnline]");
GameObject.DontDestroyOnLoad(go);
coRunner = go.AddComponent<CoroutineRunner>();
}
public static Coroutine StartCoroutine(IEnumerator itor)
{
return coRunner.StartCoroutine(itor);
}
public static void StopCoroutine(Coroutine cor)
{
coRunner.StopCoroutine(cor);
2024-06-28 18:08:25 +08:00
}
public static bool Connect(string IP, int port)
{
return networkHelper.Init(IP, port);
}
public static void Close()
{
AppAxibugEmuOnline.log.Info("停止");
}
static void OnNoSugarNetLog(int LogLevel, string msg)
{
2024-08-13 18:35:20 +08:00
Debug.Log("[AxibugEmuOnline]:" + msg);
2024-06-28 18:08:25 +08:00
}
}
}