Ejemplo n.º 1
0
        // This switch statement for guesses has left the player
        //All 7 to 0 display each different images and calls the "GuessedWrongText" method.
        private void GuessFailed()
        {
            switch (GusLeft)
            {
            case 7:

                imgHngman.SetImageResource(Resource.Drawable.GuessFailed1);

                break;

            case 6:
                imgHngman.SetImageResource(Resource.Drawable.GuessFailed2);

                break;

            case 5:
                imgHngman.SetImageResource(Resource.Drawable.GuessFailed3);
                break;

            case 4:
                imgHngman.SetImageResource(Resource.Drawable.GuessFailed4);

                break;

            case 3:
                imgHngman.SetImageResource(Resource.Drawable.GuessFailed5);

                break;

            case 2:
                imgHngman.SetImageResource(Resource.Drawable.GuessFailed6);

                break;

            case 1:
                imgHngman.SetImageResource(Resource.Drawable.GuessFailed7);

                break;

            // Case 0 no guess left, player has lost the game.
            case 0:
                imgHngman.SetImageResource(Resource.Drawable.GuessFailed8);

                // For losing the game, the player incurs a 12 point penalty to their score. If it puts their score below 0, it will be set to 0
                score = score - 12;
                if (score < 0)
                {
                    score = 0;
                }
                System.Threading.Thread.Sleep(200);
                Toast.MakeText(this, " You LOSE. Your Score was " + score, ToastLength.Short).Show();
                var cc = new MyConnection();
                cc.UpdateScore(Id, PlyerName, score);
                System.Threading.Thread.Sleep(500);


                StartActivity(typeof(MainActivity));
                break;
            }
        }
Ejemplo n.º 2
0
        private void GameWon()
        {
            // default image
            Load_blank_Image();
            // Show text
            Toast.MakeText(this, "Correct Word Guessed", ToastLength.Short).
            Show();
            var cc = new MyConnection();

            cc.UpdateScore(Id, PlyerName, score);
            // And load a new random word from HandDic.text file
            LoadNewRandomWord();
        }