using AppGame.Systems;
using AppGame.Systems.CServer;
using Plugins.JNGame.System;
using Plugins.JNGame.Util;
using Service;
namespace AppGame
{
///
/// App 环境
///
public enum AppEnv
{
Client,
Server,
ServerClient,
SlaveServer,
SlaveServerClient,
}
public class App
{
public static AppEnv Env = AppEnv.ServerClient;
///
/// 业务服务器
///
public static readonly JNGSocket Business = new JNGSocket();
///
/// Tile服务器
///
public static readonly JNGServer Server = new JNGServer();
///
/// Tile客户端
///
public static readonly JNGClientGroup Client = new JNGClientGroup();
public static readonly JNGResService Resource = new JNGResService();
public static readonly JNGGame Game = new JNGGame();
public static readonly JAPI API = new(new JAPIConfig(){BaseURL = "http://127.0.0.1:8080"});
public static readonly GAPI GAPI = new GAPI();
public static readonly EventDispatcher Event = new();
public static int ClientID => Client.ClientID;
public static SystemBase[] AllSystem()
{
return new SystemBase[]
{
Business,
IsServer() || IsSlaveServer() ? Server : null,
Client,
Resource,
Game,
};
}
public static bool IsClient()
{
return Env is AppEnv.Client or AppEnv.ServerClient or AppEnv.SlaveServerClient;
}
public static bool IsServer()
{
return Env is AppEnv.Server or AppEnv.ServerClient;
}
public static bool IsSlaveServer()
{
return Env is AppEnv.SlaveServer or AppEnv.SlaveServerClient;
}
}
}