private void Setup() { qManager = new QueueManager(SiteServerIndex, new QueueManagerOptions(new[] { new QueueWatcher("SiteServer", null), new QueueWatcher(SiteServerIndex, null), }, new[] { "ChatServer", "GameServer", "SiteServer", "GatewayServer", "Gateway*" })); qManager.AddChannel("Area.Site.Login", (user, data) => OnUserLogin(user, (SiteLoginRequest)data)); qManager.AddChannel("Area.Site.CreateUser", (user, data) => OnUserCreate(user, (SiteCreateUserRequest)data)); qManager.AddChannel("Area.Site.GetGameTypes", (user, data) => OnGetGameTypes(user)); qManager.AddChannel("Area.Site.GetRooms", (user, data) => OnGetRooms(user, (GetRoomsRequest)data)); qManager.AddChannel("Area.Site.GetRoomInfo", (user, data) => OnGetRoomInfo(user, (GetRoomInfoRequest)data)); qManager.AddChannel("Area.Site.CreateRoom", (user, data) => OnCreateRoom(user, (CreateRoomRequest)data)); qManager.AddChannel("Area.Site.LeaveRoom", (user, data) => OnLeaveRoom(user, (LeaveRoomRequest)data)); qManager.AddChannel("Area.Site.JoinRoom", (user, data) => OnJoinRoom(user, (RoomJoinRequest)data)); qManager.AddChannel("Area.Site.StartGame", (user, data) => OnStartGame(user, (StartGameRequest)data)); qManager.AddChannel("Area.Site.UserDisconnect", (user, data) => OnUserDisconnect(user, (UserDisconnectModel)data)); qManager.AddChannel("Area.Site.GetGamesByUser", (user, data) => OnGetGamesByUser(user, (GetGamesByUserRequest)data)); qManager.AddChannel("Area.Site.DoesGameNameExist", (user, data) => OnDoesGameNameExist(user, (DoesGameExistRequest)data)); qManager.AddChannel("Area.Site.DeveloperCreateGame", (user, data) => OnDeveloperCreateGame(user, (DeveloperCreateGameRequest)data)); qManager.AddChannel("Area.Site.DeveloperUpdateGame", (user, data) => OnDeveloperUpdateGame(user, (DeveloperUpdateGameRequest)data)); }
private void Setup() { qManager = new QueueManager(GameServerIndex, new QueueManagerOptions(new[] { new QueueWatcher("GameServer", null), new QueueWatcher(GameServerIndex, null), }, new[] { "GameServer", "GatewayServer", "Gateway*" })); qManager.AddChannel("Area.Game.Create", (user, data) => OnGameCreate((GameCreateRequestModel)data)); qManager.AddChannel("Area.Game.AnswerQuestion", (user, data) => OnUserAnswerQuestion(user, (GameAnswerQuestionModel)data)); qManager.AddChannel("Area.Game.UserDisconnect", (user, data) => OnUserDisconnect(user, (UserDisconnectModel)data)); qManager.AddChannel("Area.Game.LeaveGameRoom", (user, data) => OnUserLeave(user, (UserLeaveModel)data)); }
private void Setup() { qManager = new QueueManager(ChatServerIndex, new QueueManagerOptions(new[] { new QueueWatcher("ChatServer", null), new QueueWatcher(ChatServerIndex, null), }, new[] { "ChatServer", "GatewayServer", "Gateway*" })); qManager.AddChannel("Area.Chat.CreateChatRoom", (user, data) => OnCreateChatChannel(user, (CreateChatRoomRequest) data)); qManager.AddChannel("Area.Chat.JoinChatRoom", (user, data) => OnJoinChatChannel(user, (JoinChatRoomRequest) data)); qManager.AddChannel("Area.Chat.SendMessage", (user, data) => OnSendMessage(user, (SendChatMessageModel) data)); qManager.AddChannel("Area.Chat.UserDisconnect", (user, data) => OnUserDisconnect(user, (UserDisconnectModel) data)); qManager.AddChannel("Area.Chat.LeaveChatRoom", (user, data) => OnLeaveChatRoom(user)); }
public GameServer() { fs = Global.Require<FS>("fs"); childProcess = Global.Require<ChildProcess>("child_process"); dataManager = new DataManager(); gameServerIndex = "GameServer" + Guid.NewGuid(); cachedGames = new JsDictionary<string, GameObject>(); Global.Require<NodeModule>("fibers"); rooms = new List<GameRoom>(); gameData = new GameData(); Global.Process.On("exit", () => Console.Log("exi")); /*qManager.AddChannel("Area.Game.Create", (arg1, arg2) => { GameRoom room; rooms.Add(room = new GameRoom()); });*/ qManager = new QueueManager(gameServerIndex, new QueueManagerOptions(new[] { new QueueWatcher("GameServer", null), new QueueWatcher(gameServerIndex, null), }, new[] { "GameServer", "GatewayServer", "Gateway*" })); qManager.AddChannel<SomeModel>("SomeNamespaceOrEnum??", (user, data) => { EmitAll(room, "Area.Game.UpdateState", new Compressor().CompressText(Json.Stringify(room.Game.CardGame.CleanUp()))); var user = getPlayerByUsername(room, answ.User.UserName); qManager.SendMessage(user, user.Gateway, "Area.Game.AskQuestion", gameAnswer.CleanUp()); }); }
private void Setup() { qManager = new QueueManager(DebugGameServerIndex, new QueueManagerOptions(new[] { new QueueWatcher("DebugServer", null), new QueueWatcher(DebugGameServerIndex, null), }, new[] { "DebugServer", "GatewayServer", "Gateway*" })); qManager.AddChannel("Area.Debug.Create", (user, data) => OnGameCreate(user, (CreateDebugGameRequest)data)); qManager.AddChannel("Area.Debug.DebugResponse", (user, data) => OnHandleDebugResponse(user, (DebugResponse)data)); qManager.AddChannel("Area.Debug.Destroy", (user, data) => OnGameDestroy(user, (DestroyDebugGameRequest)data)); qManager.AddChannel("Area.Debug.AnswerQuestion", (user, data) => OnUserAnswerQuestion(user, (DebugGameAnswerQuestionModel)data)); qManager.AddChannel("Area.Debug.UserDisconnect", (user, data) => OnUserDisconnect(user, (UserDisconnectModel)data)); qManager.AddChannel("Area.Debug.LeaveGameRoom", (user, data) => OnUserLeave(user, (UserLeaveModel)data)); }