Ejemplo n.º 1
0
        Dialog scoreDialog()
        {
            Dialog dialog = new Dialog(this);

            dialog.SetContentView(Resource.Layout.namePrompt);
            dialog.SetTitle("Enter Your Name");
            dialog.SetCancelable(true);

            TextView tvScore = (TextView)dialog.FindViewById(Resource.Id.score);

            tvScore.Text = String.Format("Your Score: {0}", score);
            EditText input = (EditText)dialog.FindViewById(Resource.Id.etName);
            Button   ok    = (Button)dialog.FindViewById(Resource.Id.ok);

            ok.Click += delegate {
                if (input.Text.Length > 0)
                {
                    var dbS = new ScoreCommands(this);
                    dbS.AddScore(score, DateTime.Now, input.Text);
                    Intent i = new Intent(this, typeof(EndActivity));
                    i.PutExtra("SCORE", score);
                    StartActivity(i);
                    Finish();
                    dialog.Cancel();
                }
                else
                {
                    Toast.MakeText(this, "Enter Name", ToastLength.Short).Show();
                }
            };

            return(dialog);
        }
Ejemplo n.º 2
0
        void MakeScoreDB()
        {
            var dbs = new ScoreCommands (this);
            string[] scr = Resources.GetStringArray (Resource.Array.scores);

            foreach (string s in scr) {
                string[] st = s.Split ('_');

                dbs.AddScore (Convert.ToInt32 (st[0]), DateTime.Now, st[1]);
            }
        }
Ejemplo n.º 3
0
        void MakeScoreDB()
        {
            var dbs = new ScoreCommands(this);

            string[] scr = Resources.GetStringArray(Resource.Array.scores);

            foreach (string s in scr)
            {
                string[] st = s.Split('_');

                dbs.AddScore(Convert.ToInt32(st[0]), DateTime.Now, st[1]);
            }
        }
Ejemplo n.º 4
0
        void DisplayHighscores()
        {
            TextView pName, pScore;

            List<Score> allScores = new List<Score> ();
            try {
                var dbS = new ScoreCommands (this);
                allScores = dbS.TopScores ();
            } catch (System.Exception sysExc) {
                Toast.MakeText (this, sysExc.Message, ToastLength.Long);
            }
            Score[] highScores = allScores.ToArray ();

            for (int i = 0; i<10; i++) {
                Score s = highScores[i];
                pName = FindViewById<TextView>(topNames[i]);
                pScore = FindViewById<TextView>(topScores[i]);

                pName.Text = s.PlayerName;
                pScore.Text = s.ScoreNumber.ToString ();
            }
        }
Ejemplo n.º 5
0
        void DisplayHighscores()
        {
            TextView pName, pScore;

            List <Score> allScores = new List <Score> ();

            try {
                var dbS = new ScoreCommands(this);
                allScores = dbS.TopScores();
            } catch (System.Exception sysExc) {
                Toast.MakeText(this, sysExc.Message, ToastLength.Long);
            }
            Score[] highScores = allScores.ToArray();

            for (int i = 0; i < 10; i++)
            {
                Score s = highScores[i];
                pName  = FindViewById <TextView>(topNames[i]);
                pScore = FindViewById <TextView>(topScores[i]);

                pName.Text  = s.PlayerName;
                pScore.Text = s.ScoreNumber.ToString();
            }
        }