mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-06-26 11:24:46 +00:00
71 lines
2.0 KiB
C#
71 lines
2.0 KiB
C#
using AppGame.Systems;
|
|
using AppGame.Systems.CServer;
|
|
using JNGame.Runtime.System;
|
|
using JNGame.Runtime.Util;
|
|
using JNGame.Util;
|
|
using Service;
|
|
|
|
namespace AppGame
|
|
{
|
|
/// <summary>
|
|
/// App 环境
|
|
/// </summary>
|
|
public enum AppEnv
|
|
{
|
|
Client,
|
|
Server,
|
|
ServerClient,
|
|
SlaveServer,
|
|
SlaveServerClient,
|
|
}
|
|
public class App
|
|
{
|
|
|
|
public static AppEnv Env = AppEnv.ServerClient;
|
|
/// <summary>
|
|
/// 业务服务器
|
|
/// </summary>
|
|
public static readonly JNGSocket Business = new JNGSocket();
|
|
/// <summary>
|
|
/// Tile服务器
|
|
/// </summary>
|
|
public static readonly JNGServer Server = new JNGServer();
|
|
/// <summary>
|
|
/// Tile客户端
|
|
/// </summary>
|
|
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;
|
|
}
|
|
|
|
}
|
|
} |