Exemplo n.º 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            SetContentView(Resource.Layout.activity_main);
            FindViewById <ImageView>(Resource.Id.imageView1).SetImageResource(Resource.Drawable.Logo_Decale);
            FindViewById <ImageView>(Resource.Id.imageView1).LayoutParameters.Width = FindViewById <LinearLayout>(Resource.Id.linearLayout1).Width / 2;

            #region Initialisation des boutons
            FindViewById <Button>(Resource.Id.Bouton_Jouer).Click       += this.Jouer;
            FindViewById <Button>(Resource.Id.Bouton_Inscription).Click += this.Inscription;
            FindViewById <Button>(Resource.Id.Bouton_Info).Click        += this.Info;
            FindViewById <Button>(Resource.Id.Bouton_Parametre).Click   += this.Parametre;
            FindViewById <Button>(Resource.Id.Bouton_Score).Click       += this.Score;
            FindViewById <Button>(Resource.Id.Bouton_Quitter).Click     += this.Quitter;
            #endregion

            //Création de la Db
            //DB_Manager.Delete_DB();
            DB_Manager.Start_DB();

            if (Variables.Play_With_Bluetooth == true)
            {
                Bluetooth_Manager.Start_Bluetooth();
            }
        }
Exemplo n.º 2
0
        private void Niveau_Spinner(object sender, AdapterView.ItemSelectedEventArgs e)
        {
            DB_Manager.Create_Categorie_List(Spinner_Niveau.SelectedItem.ToString());
            var adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleSpinnerItem, Variables.List_Categorie);

            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            Spinner_Categorie.Adapter = adapter;
        }
Exemplo n.º 3
0
 void Inscription(object sender, System.EventArgs e)
 {
     if (prenom.Text.Length > 0 && nom.Text.Length > 0 && age.Text.Length > 0)
     {
         if (DB_Manager.Check_User_Exist(prenom.Text, nom.Text, Convert.ToInt32(Math.Floor(Convert.ToDecimal(age.Text)))) == false)
         {
             DB_Manager.Create_User(prenom.Text, nom.Text, Convert.ToInt32(Math.Floor(Convert.ToDecimal(age.Text))));
             this.Finish();
         }
         else
         {
             Toast.MakeText(this, "L'utilisateur existe déja", ToastLength.Long);
         }
     }
     else
     {
         Toast.MakeText(this, "Veillez remplir tout les zone", ToastLength.Long);
     }
 }
Exemplo n.º 4
0
        void Suivant(object sender, EventArgs e)
        {
            string[] split = Spinner_Joueur.SelectedItem.ToString().Split(" ");
            Variables.NbJoueur = int.Parse(split[0]);

            //Envoyer la variable pour le mode
            if (Radio_Normal.Checked == false && int.Parse(split[0]) == 1)
            {
                Log.Info("Option", "Jusqu'a la mort");
                Variables.Mode_Jeu = "Mort";
                DB_Manager.Create_Question_List(Spinner_Niveau.SelectedItem.ToString(), "Aléatoire");
            }
            else
            {
                Log.Info("Option", "Normal");
                Variables.Mode_Jeu = "Normal";
                DB_Manager.Create_Question_List(Spinner_Niveau.SelectedItem.ToString(), Spinner_Categorie.SelectedItem.ToString());
            }

            StartActivity(new Intent(this, typeof(Inscription)));
        }
Exemplo n.º 5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Recap_Game);
            // Create your application here
            FindViewById <Button>(Resource.Id.button_Menu).Click    += this.Menu;
            FindViewById <Button>(Resource.Id.button_Rejouer).Click += this.Rejouer;

            foreach (var player in Variables.List_Joueur)
            {
                DB_Manager.Update_User(player.Numero, player.Prenom, player.Nom, player.Age, player.Reussi, player.Echec, player.Max_Mort);
            }

            Affichage      = FindViewById <TextView>(Resource.Id.textView1);
            Affichage.Text = "";

            if (Variables.Mode_Jeu == "Mort")
            {
                Affichage.Text = Variables.List_Joueur[0].Prenom + " " + Variables.List_Joueur[0].Nom + "\nNombre de bonne réponse : " + Variables.List_Joueur[0].Max_Mort;
            }
            else
            {
                int i = 1;
                foreach (var player in Variables.List_Joueur)
                {
                    Affichage.Text += "J" + i + " - " + player.Prenom + " " + player.Nom + "\n";
                    Affichage.Text += "Nombre réussi = " + player.Reussi + "\n";
                    Affichage.Text += "Nombre échoué = " + player.Echec + "\n";
                    i++;
                }
                Affichage.Text += "\n";
                Affichage.Text += "Résumé des questions\n";
                Affichage.Text += "\n";
                foreach (var item in Variables.Recap_Game)
                {
                    Affichage.Text += item + "\n";
                }
            }
        }