private void ZorlukButonControl_Click(object sender, EventArgs e)
        {
            Button levelbtn = sender as Button;

            zorluk = (ZorlukSeviyesi)Convert.ToInt32(levelbtn.Tag);

            if (!string.IsNullOrWhiteSpace(rchTxtName.Text))
            {
                switch (zorluk)
                {
                case ZorlukSeviyesi.Kolay:
                    //yapılacaklar
                    break;

                case ZorlukSeviyesi.Orta:
                    break;

                case ZorlukSeviyesi.Zor:
                    break;

                    //Dinamik olarak tanımlanacak Buton tipinde iki boyutlu dizi tanımladık.
                }
                if (seviyeKontrol)
                {
                    bombholder  = new BombHolder(zorluk);
                    MayinTarlam = new frmMineField(zorluk);
                    MayinTarlam.Show();
                    this.ShowInTaskbar = false;
                    this.Hide();
                }
            }
            else
            {
                //toolTip1.SetToolTip(rchTxtName, "Bu alanı boş geçemezsin Dude!");
            }
        }
Beispiel #2
0
        private void frmMineField_Load(object sender, EventArgs e)
        {
            //C:\Users\kamil\source\repos\ProjeOdevi_K.YasinABLAY\minefield\images\weapons.png

            mineInserter inserter = new mineInserter();

            int k = 0;

            lblfrmName.Text  = this.Text;
            lblUserName.Text = (Application.OpenForms["frmBaslarken"].Controls["rchTxtName"] as RichTextBox).Text;

            frmMineField frmMineField = new frmMineField(zorluk);
            //Button[] bombalar = new Button[mtrsX];
            Random rnd = new Random();

            for (int i = 0; i < mtrsX * mtrsY; i++)
            {
                btnBomba = new Button();
                if (frmMineField.mayinPaneli.Height > Y + 54)
                {
                    btnBomba.Size     = new Size(51, 51);
                    btnBomba.Location = new Point(X, Y);
                    btnBomba.Name     = i.ToString() + ". buton";
                    // btnBomba.Text = i.ToString() + ". buton";
                    toolTip1.SetToolTip(btnBomba, btnBomba.Name + "  " + (btnBomba.Location.X,
                                                                          btnBomba.Location.Y));
                    btnBomba.MouseUp += WhichClicked_MouseUp;
                    btnBomba.Tag      = "-1";
                }
                else
                {
                    break;
                }
                if (mayinPaneli.Width > btnBomba.Location.X + 54)
                {
                    mayinPaneli.Controls.Add(btnBomba);
                    X += 54;
                }
                else
                {
                    mayinPaneli.Controls.Add(btnBomba);
                    X = 3;
                    if (mayinPaneli.Height > btnBomba.Location.Y + 65)
                    {
                        Y += 54;
                    }
                    else
                    {
                        break;
                    }
                }
            }
            MineProperties.numberOfbombs = MineIncrease.MineIncreaseLevel(zorluk);
            MineProperties.locations     = new int[MineProperties.numberOfbombs];
            int[] MineCarrier = inserter.MineInserter();
            foreach (var item in mayinPaneli.Controls)
            {
                if (item is Button)
                {
                    var b        = (item as Button).Name.Substring(0, 1);
                    var itemName = (item as Button).Name;
                    for (int i = 0; i < MineCarrier.Length; i++)
                    {
                        bool Even = int.TryParse(itemName.Substring(0, 2), out finish);
                        bool Odd  = false;
                        if (!Even)
                        {
                            Odd = int.TryParse(itemName.Substring(0, 1), out finish);
                        }
                        if (Odd || Even)
                        {
                            if (finish.ToString() == MineCarrier[i].ToString())
                            {
                                (item as Button).Tag = Image.FromFile(PathAdjuster() + "images\\weapons.png");
                                if ((Application.OpenForms["frmBaslarken"].Controls["chboxSee"] as CheckBox).Checked)
                                {
                                    (item as Button).Text = MineCarrier[i].ToString();
                                }

                                break;
                            }
                        }
                    }
                    k++;
                }
            }
            skor = mayinPaneli.Controls.Count;
            ScoreReduction(true);

            //string toDisplay = string.Join(Environment.NewLine, MineCarrier);
            //MessageBox.Show(toDisplay);
        }
Beispiel #3
0
        // frmMineField mayinTarlam = new frmMineField(zorluk);

        public static void minePut(frmMineField mineField)
        {
        }