-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathGameServerModule.cs
33 lines (29 loc) · 1.1 KB
/
GameServerModule.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using NetScape.Abstractions.Interfaces.IO;
using NetScape.Abstractions.Interfaces.IO.EventLoop;
using NetScape.Abstractions.IO;
using NetScape.Modules.Server.IO;
using NetScape.Modules.Server.IO.EventLoop;
using Autofac;
using NetScape.Abstractions.Model.Game;
using NetScape.Abstractions.Interfaces.Messages;
namespace NetScape.Modules.Server
{
public sealed class GameServerModule : Module
{
private readonly IGameServerParameters _gameServerParams;
public GameServerModule(string bindAddr, ushort port)
{
_gameServerParams =
new GameServerParameters { BindAddress = bindAddr, Port = port };
}
protected override void Load(ContainerBuilder builder)
{
builder.RegisterType<GameServer>().As<IGameServer>();
builder.RegisterType<ServerChannelInitializer>();
builder.RegisterType<GameServerEventLoopGroupFactory>()
.As<IEventLoopGroupFactory>();
builder.RegisterInstance(_gameServerParams).As<IGameServerParameters>();
base.Load(builder);
}
}
}