Esempio n. 1
0
        public gameEngineReturnMessage StartGame(string accessToken)
        {
            boolResponse returnMsg = new boolResponse();
            var          g         = FindAdministratorsGame(accessToken);

            returnMsg.okay = (g != null);
            if (g != null)
            {
                g.Start();
            }
            return(returnMsg);
        }
Esempio n. 2
0
        public gameEngineReturnMessage ReRoll(string accessToken, string facesToReRoll)
        {
            boolResponse returnMsg      = new boolResponse();
            game         associatedGame = FindGameByPlayer(accessToken);

            if (associatedGame == null)
            {
                returnMsg.okay = false;
                return(returnMsg);
            }
            returnMsg.okay = associatedGame.ReRoll(accessToken, facesToReRoll);
            return(returnMsg);
        }
Esempio n. 3
0
        public gameEngineReturnMessage SetPlayersRunningOrder(string accessToken, List <string> playersNames)
        {
            boolResponse returnMsg = new boolResponse();

            returnMsg.okay = false;
            var g = FindAdministratorsGame(accessToken);

            if (g == null)
            {
                return(returnMsg);
            }
            returnMsg.okay = g.SetRunningOrder(playersNames);
            return(returnMsg);
        }
Esempio n. 4
0
        public gameEngineReturnMessage AcceptHand(string accessToken)
        {
            boolResponse returnMsg      = new boolResponse();
            game         associatedGame = FindGameByPlayer(accessToken);

            if (associatedGame == null)
            {
                returnMsg.okay = false;
                return(returnMsg);
            }

            bool acceptedOk = associatedGame.AcceptHand(accessToken);

            returnMsg.okay = acceptedOk;
            return(returnMsg);
        }
Esempio n. 5
0
        public gameEngineReturnMessage CloseForNewJoiners(string accessToken)
        {
            boolResponse returnMsg = new boolResponse();

            returnMsg.okay = false;

            var g = FindGameByPlayer(accessToken);

            if (g == null)
            {
                return(returnMsg);
            }
            if (!g.hasAdministrator(accessToken))
            {
                return(returnMsg);
            }
            g.CloseToNewJoiners();
            returnMsg.okay = true;
            return(returnMsg);
        }
Esempio n. 6
0
        public gameEngineReturnMessage DeclareHand(string accessToken, pokerDiceHand hand)
        {
            game         associatedGame = FindGameByPlayer(accessToken);
            boolResponse returnMsg      = new boolResponse();

            if (associatedGame == null)
            {
                returnMsg.okay = false;
                return(returnMsg);
            }

            bool declareAccepted = associatedGame.DeclareHand(accessToken, hand);

            if (declareAccepted)
            {
                returnMsg.okay = true;
            }
            else
            {
                returnMsg.okay = false;
            }

            return(returnMsg);
        }