Пример #1
0
        }//after client chose call notifyChosenMove

        public Tuple <TexasHoldemShared.CommMessages.CommunicationMessage.ActionType, int> notifyChosenMove(TexasHoldemShared.CommMessages.CommunicationMessage.ActionType[] options, TexasHoldemShared.CommMessages.CommunicationMessage.ActionType move, int amount, int roomId)
        {
            bool legalMove = false;

            foreach (TexasHoldemShared.CommMessages.CommunicationMessage.ActionType action in options)
            {
                if (action.Equals(move))
                {
                    legalMove = true;
                }
            }
            if (legalMove)
            {
                if (move.Equals(TexasHoldemShared.CommMessages.CommunicationMessage.ActionType.Fold))
                {
                    amount = -1;//amount isnt relevant

                    _eventHandler.handleChosenAction(move, amount, roomId);
                }
                else if ((move.Equals(TexasHoldemShared.CommMessages.CommunicationMessage.ActionType.Bet)) && (amount >= 0))
                {
                    Tuple <TexasHoldemShared.CommMessages.CommunicationMessage.ActionType, int> toRet = new Tuple <TexasHoldemShared.CommMessages.CommunicationMessage.ActionType, int>(move, amount);
                    return(toRet);
                }
            }

            //appropriate Log
            //notify the client for illegal input
            amount = -2;    //illegal answer for client
            Tuple <TexasHoldemShared.CommMessages.CommunicationMessage.ActionType, int> ret = new Tuple <TexasHoldemShared.CommMessages.CommunicationMessage.ActionType, int>(move, amount);

            return(ret);
        }