WutheringWaves/GameServer/Program.cs
2024-02-08 00:41:39 +03:00

28 lines
966 B
C#

using GameServer.Extensions;
using GameServer.Handlers;
using GameServer.Handlers.Factory;
using GameServer.Network;
using GameServer.Network.Rpc;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
namespace GameServer;
internal static class Program
{
private static async Task Main(string[] args)
{
HostApplicationBuilder builder = Host.CreateApplicationBuilder(args);
builder.Logging.AddConsole();
builder.Services.AddHandlers()
.AddSingleton<KcpGateway>().AddScoped<KcpSession>()
.AddScoped<MessageManager>().AddSingleton<MessageHandlerFactory>()
.AddScoped<RpcManager>().AddScoped<IRpcEndPoint, RpcSessionEndPoint>()
.AddSingleton<SessionManager>()
.AddHostedService<WWGameServer>();
await builder.Build().RunAsync();
}
}