Exemple #1
0
 private void Vremenska_MouseUp(object sender, MouseEventArgs e)
 {
     mouseDown = false;
     Cursor    = Cursors.Default;
     Obleki.Pogodok(character.Width, character.Height, this.Width, this.Height);
     if (Obleki.ProveriDaliPobedil())
     {
         Pomoshna pomoshna = new Pomoshna();
         pomoshna.smiley    = Resources.smiley;
         pomoshna.text1     = "Браво !!!";
         pomoshna.text2     = "Ја завршивте играта";
         pomoshna.text3     = "Дали сакате нова игра?";
         pomoshna.buttonYes = "Да";
         pomoshna.buttonNo  = "Не";
         if (pomoshna.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             DialogResult = DialogResult.OK;
             this.Close();
         }
         else
         {
             DialogResult = DialogResult.Cancel;
             this.Close();
         }
     }
 }
Exemple #2
0
        // Set the time elapsed label in the form and update the progress bar
        private void timer1_Tick(object sender, EventArgs e)
        {
            timeElapsed++;
            int min = timeElapsed / 60;
            int sec = timeElapsed % 60;

            lblTimer.Text    = String.Format("{0:00}:{1:00}", min, sec);
            pbPogodeni.Value = Convert.ToInt32(tbPogodeniLeft.Text) + Convert.ToInt32(tbPogodeniRight.Text);
            //If all items in correct lists stop the timer and start a new game with Pomoshna form
            if (pbPogodeni.Value == pbPogodeni.Maximum)
            {
                timer1.Stop();
                pomoshna           = new Pomoshna();
                pomoshna.smiley    = Resources.smiley;
                pomoshna.text1     = "Браво !!!";
                pomoshna.text2     = string.Format("Ја завршивте играта за {0:00} минути и {1:00} секунди", min, sec);
                pomoshna.text3     = "Дали сакате нова игра?";
                pomoshna.buttonYes = "Да";
                pomoshna.buttonNo  = "Не";
                if (pomoshna.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    newGame();
                }
                else
                {
                    this.Close();
                }
            }
        }
Exemple #3
0
 //Move selected items from source list to destination list
 private void moveListItems(ListBox source, ListBox destination)
 {
     //Check if an item is selected
     if (source.SelectedIndex != -1)
     {
         //Move all selected items, multiple selection enabled
         foreach (var item in source.SelectedItems)
         {
             destination.Items.Add(item);
             Stavka s = item as Stavka;
             //Check if the category of the items do not corresponds to the category of the listBox we want to place it
             if ((s.Category == "Овошје" && destination == lbRight) || (s.Category == "Зеленчук" && destination == lbLeft))
             {
                 pomoshna           = new Pomoshna();
                 pomoshna.smiley    = s.image;
                 pomoshna.text2     = s.description;
                 pomoshna.buttonYes = "Во ред";
                 pomoshna.Show();
             }
         }
         //Remove the selected items from the source list, while there are selected items
         //Must do this, because they will remain in the source list too
         while (source.SelectedItems.Count > 0)
         {
             source.Items.Remove(source.SelectedItems[0]);
         }
     }
 }
Exemple #4
0
 private void Ulica_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Up)
     {
         person.ChangeDirection(Covece.DIRECTION.UP);
         person.Move();
     }
     if (e.KeyCode == Keys.Down)
     {
         person.ChangeDirection(Covece.DIRECTION.DOWN);
         person.Move();
     }
     if (e.KeyCode == Keys.Left)
     {
         person.ChangeDirection(Covece.DIRECTION.LEFT);
         person.Move();
     }
     if (e.KeyCode == Keys.Down)
     {
         person.ChangeDirection(Covece.DIRECTION.DOWN);
         person.Move();
     }
     if (e.KeyCode == Keys.Right)
     {
         person.ChangeDirection(Covece.DIRECTION.RIGHT);
         person.Move();
     }
     if (person.Y == 20)
     {
         if (lightColor)
         {
             Pomoshna pomoshna = new Pomoshna();
             pomoshna.text1     = "Браво!!!!!";
             pomoshna.text2     = "Успешно поминавте од другата страна на коловозот.";
             pomoshna.text3     = "Дали сакате да се обидете повторно?";
             pomoshna.buttonYes = "Да";
             pomoshna.buttonNo  = "Не";
             pomoshna.smiley    = Resources.smiley;
             if (pomoshna.ShowDialog() == DialogResult.OK)
             {
                 newGame();
             }
             else
             {
                 Close();
             }
         }
         Invalidate();
     }
 }
        //Checks if the location of person is in on the Zebra and the light is red
        public void NaZebraICrvenoSvetlo()
        {
            //the end point
            int pocetokulica = Resources.sidewalk_Up.Height - 20;
            int krajulica    = pocetokulica + Resources.street.Height;

            if (!lightColor && Y > pocetokulica && Y < krajulica)
            {
                pomoshna           = new Pomoshna();
                pomoshna.text1     = "На добар пат си да ја поминеш улицата";
                pomoshna.text2     = "Тргна на зелено, но ти се уклучи црвено ";
                pomoshna.text3     = "Обиди се повторно";
                pomoshna.buttonYes = "Во ред";
                pomoshna.buttonNo  = null;
                pomoshna.smiley    = Resources.smiley;
                pomoshna.Show();
                Y = 300;
            }
        }
 public void Move()
 {
     if (direction == DIRECTION.UP)
     {
         person = Resources.Person1_Up;
         if ((Y - 10) > 0)
         {
             Y -= 10;
         }
         //If the person goes UP and he is not in between the Zebra
         if (!CheckLocation())
         {
             pomoshna           = new Pomoshna();
             pomoshna.text1     = "Упс";
             pomoshna.text2     = "Улицата се поминува само на пешачки премин";
             pomoshna.text3     = "Обиди се повторно ";
             pomoshna.buttonYes = "Да";
             pomoshna.buttonNo  = null;
             pomoshna.smiley    = sad_smiley;
             pomoshna.Show();
             Y += 10;
         }
         else
         {
             //If the person goes UP and he is in between the Zebra but the trafic light is red
             if (!lightColor && X > formHeight / 2)
             {
                 Y                  = 300;
                 pomoshna           = new Pomoshna();
                 pomoshna.text2     = "Улицата се поминува на зелено";
                 pomoshna.buttonYes = "Во ред";
                 pomoshna.buttonNo  = null;
                 pomoshna.smiley    = sad_smiley;
                 pomoshna.Show();
             }
         }
     }
     if (direction == DIRECTION.LEFT)
     {
         person = Resources.Person1_Left;
         if ((X - 10) > 0)
         {
             X -= 10;
         }
         if (Y < 300)
         {
             //the person is on the Zebra and wants to go  Left
             if (!CheckLocation())
             {
                 pomoshna           = new Pomoshna();
                 pomoshna.text1     = "Не Не";
                 pomoshna.text2     = "Движи се по пешачкиот премир, не оди лево и десно";
                 pomoshna.text3     = "Обиди се повторно ";
                 pomoshna.buttonYes = "Да";
                 pomoshna.buttonNo  = null;
                 pomoshna.smiley    = sad_smiley;
                 pomoshna.Show();
                 X += 10;
             }
         }
     }
     if (direction == DIRECTION.RIGHT)
     {
         person = Resources.Person1_Right;
         if ((X + 10) < formWidth - person.Width)
         {
             X += 10;
         }
         if (Y < 300)
         {
             //the person is on the Zebra and wants to go Right
             if (!CheckLocation())
             {
                 pomoshna           = new Pomoshna();
                 pomoshna.text1     = "Не Не";
                 pomoshna.text2     = "Движи се по пешачкиот премир, не оди лево и десно";
                 pomoshna.text3     = "Обиди се повторно ";
                 pomoshna.buttonYes = "Да";
                 pomoshna.buttonNo  = null;
                 pomoshna.smiley    = sad_smiley;
                 pomoshna.Show();
                 X -= 10;
             }
         }
     }
 }