2024-02-09 22:15:05 +00:00
|
|
|
|
using GameServer.Controllers.Event;
|
|
|
|
|
using GameServer.Controllers.Factory;
|
|
|
|
|
using GameServer.Controllers.Manager;
|
|
|
|
|
using GameServer.Extensions;
|
2024-02-09 09:20:14 +00:00
|
|
|
|
using GameServer.Models;
|
2024-02-07 21:41:39 +00:00
|
|
|
|
using GameServer.Network;
|
2024-02-09 09:44:42 +00:00
|
|
|
|
using GameServer.Network.Kcp;
|
2024-02-09 22:15:05 +00:00
|
|
|
|
using GameServer.Network.Messages;
|
2024-02-07 21:41:39 +00:00
|
|
|
|
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();
|
|
|
|
|
|
2024-02-09 22:15:05 +00:00
|
|
|
|
builder.Services.AddControllers()
|
2024-02-09 09:44:42 +00:00
|
|
|
|
.AddSingleton<KcpGateway>().AddScoped<PlayerSession>()
|
2024-02-09 22:15:05 +00:00
|
|
|
|
.AddScoped<MessageManager>().AddSingleton<EventHandlerFactory>()
|
2024-02-07 21:41:39 +00:00
|
|
|
|
.AddScoped<RpcManager>().AddScoped<IRpcEndPoint, RpcSessionEndPoint>()
|
|
|
|
|
.AddSingleton<SessionManager>()
|
2024-02-09 22:15:05 +00:00
|
|
|
|
.AddScoped<EventSystem>().AddScoped<ModelManager>().AddScoped<ControllerManager>()
|
2024-02-07 21:41:39 +00:00
|
|
|
|
.AddHostedService<WWGameServer>();
|
|
|
|
|
|
|
|
|
|
await builder.Build().RunAsync();
|
|
|
|
|
}
|
|
|
|
|
}
|