コード例 #1
0
        private void GuessButton_TouchUpInside(object sender, EventArgs e)
        {
            // Disable the button so they cant guess again
            ScoreView.DisableButton();

            // Block the user from selecting a new player until the game starts back over
            foreach (var playerView in PlayerViews)
            {
                playerView.DisableImageViewButton();
            }

            // Check if they got it right?!
            bool didGuessCorrectly = Game.CheckGuess();


            if (didGuessCorrectly)
            {
                ScoreView.MessageLabel.Text = "Winnnnar!";
            }
            else
            {
                ScoreView.MessageLabel.Text = "You are a Loser, try harder.";
            }

            ScoreView.ScoreLabel.Text = string.Format("Score {0} of 10", Game.Score);

            // ----------------------------------------------
            var players = Game.GetOrderOfPlayers();

            foreach (var item in players)
            {
                var roundedPoints = Math.Round((double)item.CurrentPlayer.fppg, 2);
                item.FppgLabel.Text = string.Format("FPPG: {0}", roundedPoints);
            }

            UpdateConstraintPlacement(players);

            if (Game.Score == 10)
            {
                // Game over, you won, start new game?
                Console.WriteLine("You Won game over");

                this.PresentViewController(new VictoryViewController(), true, null);
            }
            else
            {
                StartNewMatch();
            }
        }