示例#1
0
        public void gameFail()
        {
            RunOnUiThread(() => obrazekSmile.SetImageResource(Resource.Drawable.angry));

            if (OptionsHodnoty.Vibrace)
            {
                mvibrator = (Vibrator)this.GetSystemService(Context.VibratorService);
                mvibrator.Vibrate(50);
            }

            Vysledek vysledek = new Vysledek(score, DateTime.Now.ToString());

            SeznamVysledku.seznam.Add(vysledek);
            SeznamVysledku.WriteToBinaryFile();
            gameFailed = true;
        }
示例#2
0
        protected override void OnResume()
        {
            base.OnResume();

            scoreText.Text = null;
            SeznamVysledku.ReadFromBinaryFile();
            if (SeznamVysledku.seznam != null)
            {
                foreach (Vysledek x in SeznamVysledku.seznam.OrderByDescending(p => p.Score))
                {
                    scoreText.Text += "\n" + x.Score + "     " + x.Cas;
                }
            }

            SaveOtions.ReadFromFile();
        }
示例#3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Create your application here
            SetContentView(Resource.Layout.Options);

            CheckBox     checkVibrace = FindViewById <CheckBox> (Resource.Id.checkBoxVibrace);
            ToggleButton toggle       = FindViewById <ToggleButton> (Resource.Id.toggleButton);

            SaveOtions.ReadFromFile();

            if (OptionsHodnoty.Vibrace)
            {
                checkVibrace.Checked = true;
            }
            else
            {
                checkVibrace.Checked = false;
            }

            checkVibrace.CheckedChange += delegate {
                if (checkVibrace.Checked)
                {
                    OptionsHodnoty.Vibrace = true;
                    SaveOtions.WriteToFile();
                }
                else
                {
                    OptionsHodnoty.Vibrace = false;
                    SaveOtions.WriteToFile();
                }
            };

            if (OptionsHodnoty.TouchMode)
            {
                toggle.Checked = true;
            }
            else
            {
                toggle.Checked = false;
            }

            toggle.CheckedChange += delegate {
                if (toggle.Checked)
                {
                    OptionsHodnoty.TouchMode = true;
                    SaveOtions.WriteToFile();
                }
                else
                {
                    OptionsHodnoty.TouchMode = false;
                    SaveOtions.WriteToFile();
                }
            };

            Button resetScore = FindViewById <Button> (Resource.Id.buttonResetScore);

            resetScore.LongClick += delegate {
                SeznamVysledku.ResetVysledku();
            };

            Button zpet = FindViewById <Button> (Resource.Id.buttonZpet);

            zpet.Click += delegate {
                Finish();
            };
        }