Beispiel #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);

            RequestedOrientation = Android.Content.PM.ScreenOrientation.Landscape;

            btn_down = FindViewById <ImageView>(Resource.Id.down);
            btn_up   = FindViewById <ImageView>(Resource.Id.up);

            image  = FindViewById <ImageViewScroll.ImageViewScroll>(Resource.Id.image);
            image2 = FindViewById <ImageViewScroll.ImageViewScroll>(Resource.Id.image2);
            image3 = FindViewById <ImageViewScroll.ImageViewScroll>(Resource.Id.image3);

            txt_score = FindViewById <TextView>(Resource.Id.txt_score);

            image.SetEventEnd(this);
            image2.SetEventEnd(this);
            image3.SetEventEnd(this);

            btn_up.Click += delegate
            {
                if (Common.SCORE >= 50)
                {
                    btn_up.Visibility   = Android.Views.ViewStates.Gone;
                    btn_down.Visibility = Android.Views.ViewStates.Visible;

                    image.SetValueRandom(new Random(DateTime.Now.Millisecond).Next(6),
                                         new Random(DateTime.Now.Millisecond).Next(5, 16));
                    image2.SetValueRandom(new Random(DateTime.Now.Millisecond).Next(6),
                                          new Random(DateTime.Now.Millisecond).Next(5, 16));
                    image3.SetValueRandom(new Random(DateTime.Now.Millisecond).Next(6),
                                          new Random(DateTime.Now.Millisecond).Next(5, 16));

                    Common.SCORE  -= 50;
                    txt_score.Text = Common.SCORE.ToString();
                }

                else
                {
                    Toast.MakeText(this, "Vous n'avez pas assez d'argent", ToastLength.Short).Show();
                }
            };
        }
Beispiel #2
0
 public MyListener(ImageViewScroll imageViewScroll, int image, int rotate_count)
 {
     this.imageViewScroll = imageViewScroll;
     this.image           = image;
     this.rotate_count    = rotate_count;
 }