Пример #1
0
        private void Form_Game_FormClosing(object sender, FormClosingEventArgs e)
        {
            DataSet_AccountsTableAdapters.QueriesTableAdapter queriesTableAdapter = new DataSet_AccountsTableAdapters.QueriesTableAdapter();

            int scorActual = (int)queriesTableAdapter.GetScore(Id_User);

            queriesTableAdapter.UpdateScore(scorActual + Score, Id_User);
            queriesTableAdapter.Update_NrGaini(scorActual + Score, Id_User);

            int numarSageti = (int)queriesTableAdapter.Get_NrSageti(Id_User);

            queriesTableAdapter.Update_NrSageti(numarSageti + (3 - nrSageti), Id_User);

            int ScoreMaxim = (int)queriesTableAdapter.Get_ScoreMax(Id_User);

            if (Score > ScoreMaxim)
            {
                queriesTableAdapter.Update_ScoreMax(Score, Id_User);
            }

            form_Start.Show();

            timer_Arrow.Stop();
            timer_Chicken.Stop();
            timer_Disappear.Stop();

            //actualizeaza scor
        }
Пример #2
0
        public Form_Register(Form form)
        {
            InitializeComponent();

            formLogin = form;

            QueriesTableAdapter = new DataSet_AccountsTableAdapters.QueriesTableAdapter();
        }
Пример #3
0
        public Form_Lobby(Form form, int Id_User)
        {
            InitializeComponent();;

            this.Id_User = Id_User;

            form_Login = form;

            queriesTableAdapter = new DataSet_AccountsTableAdapters.QueriesTableAdapter();

            Punctaj  = (int)queriesTableAdapter.GetScore(Id_User);
            UserName = queriesTableAdapter.GetUserName(Id_User);

            label_Salut.Text = "Bine ai revenit " + UserName + "!";

            label_Salut.Location = new Point((Width - label_Salut.Width) / 2, label_Salut.Location.Y);
        }
Пример #4
0
        void HitChicken(Class_Arrow arrow)
        {
            if (arrow.nivel == 1)
            {
                for (int i = 0; i < chickens.Count; i++)
                {
                    if (chickens[i].location <= 4)
                    {
                        if (arrow.X >= chickens[i].X && arrow.X <= chickens[i].X + chickens[i].Width)
                        {
                            if (arrow.Y >= chickens[i].Y && arrow.Y <= chickens[i].Y + chickens[i].Height)
                            {
                                if (!chickens[i].Baby)
                                {
                                    Score++;
                                    label_Punctaj.Text = Score.ToString();

                                    frec[chickens[i].location] = 0;
                                    chickens.RemoveAt(i);

                                    timer_Arrow.Stop();
                                    Trage = false;
                                    nrGaini--;

                                    if (Sound)
                                    {
                                        soundPlayer_Chicken_Hurt.Play();
                                    }
                                }
                                else
                                {
                                    if (Sound)
                                    {
                                        soundPlayer_Chicken_Hurt.Play();
                                    }

                                    DataSet_AccountsTableAdapters.QueriesTableAdapter queriesTableAdapter = new DataSet_AccountsTableAdapters.QueriesTableAdapter();

                                    int nrPui = (int)queriesTableAdapter.Get_NrPui(Id_User);
                                    queriesTableAdapter.Update_NrPui(nrPui + 1, Id_User);


                                    timer_Arrow.Stop();
                                    timer_Chicken.Stop();

                                    Hide();

                                    Form_GameOver form_GameOver = new Form_GameOver(Score);

                                    form_GameOver.ShowDialog();

                                    Close();
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                for (int i = 0; i < chickens.Count; i++)
                {
                    if (chickens[i].location >= 5)
                    {
                        if (arrow.X >= chickens[i].X && arrow.X <= chickens[i].X + chickens[i].Width)
                        {
                            if (arrow.Y >= chickens[i].Y && arrow.Y <= chickens[i].Y + chickens[i].Height)
                            {
                                if (!chickens[i].Baby)
                                {
                                    Score++;
                                    label_Punctaj.Text = Score.ToString();

                                    frec[chickens[i].location] = 0;
                                    chickens.RemoveAt(i);

                                    timer_Arrow.Stop();
                                    Trage = false;

                                    nrGaini--;

                                    if (Sound)
                                    {
                                        soundPlayer_Chicken_Hurt.Play();
                                    }
                                }
                                else
                                {
                                    if (Sound)
                                    {
                                        soundPlayer_Chicken_Hurt.Play();
                                    }

                                    DataSet_AccountsTableAdapters.QueriesTableAdapter queriesTableAdapter = new DataSet_AccountsTableAdapters.QueriesTableAdapter();

                                    int nrPui = (int)queriesTableAdapter.Get_NrPui(Id_User);
                                    queriesTableAdapter.Update_NrPui(nrPui + 1, Id_User);

                                    timer_Arrow.Stop();
                                    timer_Chicken.Stop();

                                    Hide();

                                    Form_GameOver form_GameOver = new Form_GameOver(Score);

                                    form_GameOver.ShowDialog();

                                    Close();
                                }
                            }
                        }
                    }
                }
            }
        }