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)); }