public void JoinTheGame(int roomId, int startingChip) { ActionCommMessage toSend = new ActionCommMessage(user.id, _sessionId, CommunicationMessage.ActionType.Join, startingChip, roomId); _eventHandler.SendNewEvent(toSend); }
public void StartTheGame(int roomId) { ActionCommMessage toSend = new ActionCommMessage(user.id, _sessionId, CommunicationMessage.ActionType.StartGame, -1, roomId); _eventHandler.SendNewEvent(toSend); }
public bool NotifyAction(ResponeCommMessage msg) { ActionCommMessage original = msg.OriginalMsg as ActionCommMessage; if (original != null) { switch (original.MoveType) { case CommunicationMessage.ActionType.Join: ReceivedJoin((JoinResponseCommMessage)msg); break; case CommunicationMessage.ActionType.Spectate: ReceivedSpectate((JoinResponseCommMessage)msg); break; case CommunicationMessage.ActionType.Leave: ReceivedLeave(msg); break; case CommunicationMessage.ActionType.SpectatorLeave: ReceivedSpectetorLeave(msg); break; default: GeneralCase(msg.GameData); break; } return(true); } return(false); }
public void SpectateRoom(int roomId) { ActionCommMessage toSend = new ActionCommMessage(user.id, _sessionId, CommunicationMessage.ActionType.Spectate, -1, roomId); _eventHandler.SendNewEvent(toSend); }
public bool startTheGame(int roomId) { ActionCommMessage toSend = new ActionCommMessage(_userId, TexasHoldemShared.CommMessages.CommunicationMessage.ActionType.StartGame, -1, roomId); _eventHandler.SendNewEvent(toSend); return(true); }
public void NotifyChosenMove(CommunicationMessage.ActionType move, int amount, int roomId) { if (move.Equals(CommunicationMessage.ActionType.Fold)) { ActionCommMessage response = new ActionCommMessage(user.id, _sessionId, move, amount, roomId); _eventHandler.SendNewEvent(response); } if ((move.Equals(CommunicationMessage.ActionType.Bet)) && (amount >= 0)) { ActionCommMessage response = new ActionCommMessage(user.id, _sessionId, move, amount, roomId); _eventHandler.SendNewEvent(response); } }
public void handleChosenAction(TexasHoldemShared.CommMessages.CommunicationMessage.ActionType Caction, int Camount, int roomId) { TexasHoldemShared.CommMessages.CommunicationMessage.ActionType ChosenOption = Caction; int amount = Camount; if (amount > -1) { ActionCommMessage response = new ActionCommMessage(_userId, ChosenOption, amount, roomId); string parsedResponse = XmlParser.SerializeMsg(response); _handler.addMsgToSend(parsedResponse); } else { Console.WriteLine("illegal"); } }
public ResponeCommMessage HandleEvent(ActionCommMessage msg) { if (_sessionIdHandler != null) { ResponeCommMessage response = null; IEnumerator <ActionResultInfo> iter; switch (msg.MoveType) { case CommunicationMessage.ActionType.Bet: case CommunicationMessage.ActionType.Fold: case CommunicationMessage.ActionType.HandCard: case CommunicationMessage.ActionType.Leave: case CommunicationMessage.ActionType.StartGame: case CommunicationMessage.ActionType.SpectatorLeave: iter = _gameService.DoAction(msg.UserId, msg.MoveType, msg.Amount, msg.RoomId); response = SendMessages(msg.UserId, iter, msg); break; case CommunicationMessage.ActionType.Join: iter = _gameService.DoAction(msg.UserId, msg.MoveType, msg.Amount, msg.RoomId); response = SendMessagesJoin(msg.UserId, iter, msg); break; case CommunicationMessage.ActionType.Spectate: iter = _gameService.AddSpectatorToRoom(msg.UserId, msg.RoomId); response = SendMessagesJoin(msg.UserId, iter, msg); break; } if (response != null) { return(response); } } return(new ResponeCommMessage(msg.UserId, msg.SessionId, false, msg)); }
public ResponeCommMessage HandleEvent(ActionCommMessage msg) { GotClientToServerMsg(msg); return(new ResponeCommMessage(msg.UserId, msg.SessionId, false, msg)); }
public void HandleEvent(ActionCommMessage msg) { Console.WriteLine("ActionCommMessage is client to server message"); }