Пример #1
0
        public void Start(byte gameBtnRowNum, byte gameBtnColNum, byte gameBtnMineNum)
        {
            // Array'lerde hafıza temizlenip yeniden oluşturuluyor.
            if (this.gameArrMap != null || this.gameBtnList != null)
            {
                Clear();
            }
            this.gameBtnColNum   = gameBtnColNum;
            this.gameBtnRowNum   = gameBtnRowNum;
            this.gameBtnMineNum  = gameBtnMineNum;
            this.gameBtnEmptyNum = gameBtnRowNum * gameBtnColNum - gameBtnMineNum;
            this.gameArrMap      = new GameArrayMap(this.gameBtnRowNum, this.gameBtnColNum, this.gameBtnMineNum);
            this.gameBtnList     = new GameButton[this.gameBtnRowNum, this.gameBtnColNum];

            //Butonlar gameBtnList dizisine ve Form Panele ekleniyor.
            for (byte row = 0; row < this.gameBtnRowNum; row++)
            {
                for (byte col = 0; col < this.gameBtnColNum; col++)
                {
                    this.gameBtnList[row, col] = GameBtnClonePrototype(ref row, ref col);
                    panelMap.Controls.Add(this.gameBtnList[row, col]);
                }
            }
            //
            // X = WIDTH    = Satır
            // Y = HEIGHT   = Sütun
            //
            //Panel yeniden boyutlandırılıyor.
            panelMap.Height = (_.gameBtnColNum * btnSize.Height + _.gameBtnColNum * btnLeftRightMargin) - btnLeftRightMargin;
            panelMap.Width  = (_.gameBtnRowNum * btnSize.Width + _.gameBtnRowNum * btnTopBottomMargin) - btnTopBottomMargin;
        }
Пример #2
0
 public void Clear()
 {
     panelMap.Hide();
     if (thread != null)
     {
         thread.Abort();
     }
     gameArrMap  = null;
     gameBtnList = null;
     panelMap.Controls.Clear();
     score           = 0;
     lose            = false;
     gameBtnEmptyNum = 0;
     GC.Collect();
 }