Exemplo n.º 1
0
 private void CalculateButtonType()
 {
     for (int i = 0; i < m_btnCount; i++)
     {
         if (ButtonInformation[i].ButtonType != 0)
         {
             int tag = CalculateButtonTag(i);
             if (tag != 0)
             {
                 ButtonClass buttonClass = new ButtonClass(1, i);
                 buttonClass.SurroundMineNums = tag;
                 ButtonInformation[i]         = buttonClass;
             }
         }
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 生成随机雷
        /// </summary>
        private void ProduceRandomMine()
        {
            int mineNums = 0;

            switch (m_btnCount)
            {
            case 81:
                mineNums = 10;
                this.label_MineNums.Text = "010";
                break;

            case 225:
                mineNums = 40;
                this.label_MineNums.Text = "040";
                break;

            case 400:
                mineNums = 140;
                this.label_MineNums.Text = "140";
                break;
            }
            for (int i = 0; i < mineNums; i++)
            {
                Random random = new Random();
                int    k      = random.Next(0, m_btnCount);
                if (ButtonInformation[k].ButtonType == 0)
                {
                    i--;
                }
                else
                {
                    ButtonInformation[k] = new ButtonClass(0, k);
                    MineList.Add(k);
                }
            }
        }