Ejemplo n.º 1
0
        void OnMessage(object sender, MessageEventArgs e)
        {
            var simpleAction = GrabAction(e.Message.Body);

            switch (simpleAction)
            {
            case "OPEN_TABLE":
                OpenTableMessage openTable = JsonConvert.DeserializeObject <OpenTableMessage>(e.Message.Body);
                messageHandler.OpenTable(openTable);
                break;

            case "TABLE_STATE":
                TableStateMessage stateMessage = JsonConvert.DeserializeObject <TableStateMessage>(e.Message.Body);
                messageHandler.TableState(stateMessage);
                break;

            case "ELIMINATED":
                EliminatedMessage eliminated = JsonConvert.DeserializeObject <EliminatedMessage>(e.Message.Body);
                messageHandler.Eliminated(eliminated);
                break;

            case "CLOSE_TABLE":
                Console.WriteLine(e.Message.Body);
                break;

            case "BEGIN_GAME":
                BeginGame beginGame = JsonConvert.DeserializeObject <BeginGame>(e.Message.Body);
                messageHandler.BeginGame(beginGame);
                break;

            case "DEAL_COMMUNITY_CARDS":
                DealCommunityCards dealCommunityCards = JsonConvert.DeserializeObject <DealCommunityCards>(e.Message.Body);
                messageHandler.DealCommunityCards(dealCommunityCards);
                break;

            case "SET_ACTIVE_PLAYER":
                SetActivePlayer setActivePlayer = JsonConvert.DeserializeObject <SetActivePlayer>(e.Message.Body);
                messageHandler.SetActivePlayer(setActivePlayer);
                break;

            case "SET_PLAYER_ACTION":
                SetPlayerAction setPlayerAction = JsonConvert.DeserializeObject <SetPlayerAction>(e.Message.Body);
                messageHandler.SetPlayerAction(setPlayerAction);
                break;

            case "SET_PLAYERS":
                SetPlayers setPlayers = JsonConvert.DeserializeObject <SetPlayers>(e.Message.Body);
                messageHandler.SetPlayers(setPlayers);
                break;

            case "CHAT":
                Console.WriteLine(GrabBody(e.Message.Body));
                break;

            default:
                break;
            } //switch
        }     //OnMessage
Ejemplo n.º 2
0
        }//BeginGame

        public void SetPlayers(SetPlayers message)
        {
            GetBot(message.tableId)?.SetPlayers(message.message.players);
        }