public NetServerRoomListController(int port) { var ctx = SharedNetContext.CreateContext("", 12345); this.Server = new BasicServer(); this.Server.InitializeServer(ctx, new LidgrenServerProvider()); this.service = ctx.Services.Get <NetRoomListControllerService>(); this.rooms = new Dictionary <Guid, NetServerRoomController>(); this.service.CreateRoomRequestChannel.Receive += OnCreateRoomRequest; this.service.GetRoomListRequestChannel.Receive += OnGetRoomListRequest; this.service.JoinRoomRequestChannel.Receive += OnJoinRoomRequest; this.service.SetUserIdChannel.Receive += OnUserIdSet; this.Server.StartServer(); }
public NetClientRoomListController(UserId user, string ipAddress, int port) { this.LocalUser = user; this.RoomList = new List <IRoomController>(); var ctx = SharedNetContext.CreateContext(ipAddress, port); this.Client = new BasicClient(); this.Client.InitializeClient(ctx, new LidgrenClientProvider()); this.service = ctx.Services.Get <NetRoomListControllerService>(); this.service.CreateRoomResponseChannel.Receive += OnCreateRoomResponse; this.service.GetRoomListResponseChannel.Receive += OnGetRoomListResponse; this.service.JoinRoomResponseChannel.Receive += OnJoinRoomResponse; this.service.SetUserStateChannel.Receive += OnSetUserState; this.Client.OnConnected += OnConnectedToServer; }