Esempio n. 1
0
        public dynamic GetCurrentGameData(bool detailed = false)
        {
            var currentPlay = m_Game.GetLastPlay();

            var lastTurnPlay       = m_Game.GetLastTurnPlay();
            var lastTurnPlayerName = m_Game.GetLastTurnPlayerName();

            var simpleHistory = lastTurnPlayerName + "=";

            if (lastTurnPlay != null && lastTurnPlay.Count > 0)
            {
                simpleHistory += BigTwoLogic.ToString(lastTurnPlay);
            }

            var data = new
            {
                play    = currentPlay != null && currentPlay.Count > 0 ? BigTwoLogic.ToString(currentPlay) : "",
                history = simpleHistory,
                last    = m_Game.GetLastPlayerName(),
                current = m_Game.GetCurrentTurnPlayerName(),
                state   = m_Game.GetGameState(),
                turns   = m_Game.GetCurrentTurns(),
                players = new List <string>(),
                scores  = new List <int>(),
                cards   = new List <string>(),
            };

            var gamePlayers = m_Game.GetPlayers();

            foreach (var gamePlayer in gamePlayers)
            {
                data.players.Add(gamePlayer.PlayerName);
                data.scores.Add(gamePlayer.GameScore);

                if (detailed)
                {
                    data.cards.Add(BigTwoLogic.EncodeCards(gamePlayer.CurrentHand.GetCards()));
                }
                else
                {
                    data.cards.Add(gamePlayer.CurrentHand.GetNumberOfCards().ToString());
                }
            }

            return(data);
        }
Esempio n. 2
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            var okay = m_Game.StartNewRound();

            UpdateGameDisplay();

            if (m_Game.GetGameState() == "PlayingCards")
            {
                btnStart.Enabled = false;
                if (okay)
                {
                    LogMsg("===== START =====");
                    LogMsg("Game Round - " + m_Game.GetShoeCode() + "-" + m_Game.GetRoundIndex());
                }
            }
        }