예제 #1
0
        internal void OpenAllWithrRLClick()
        {
            if (this.TotalMines != GetFlagsCountAround())
            {
                return;
            }

            if (LeftTopBox != null)
            {
                if (LeftTopBox.Checked == false)
                {
                    if (LeftTopBox.HasMine && !LeftTopBox.HasFlag)
                    {
                        Game.YouLost(LeftTopBox);
                        return;
                    }
                    LeftTopBox.OpenAll();
                }
            }
            if (LeftBottomBox != null)
            {
                if (LeftBottomBox.Checked == false)
                {
                    if (LeftBottomBox.HasMine && !LeftBottomBox.HasFlag)
                    {
                        Game.YouLost(LeftBottomBox);
                        return;
                    }
                    LeftBottomBox.OpenAll();
                }
            }
            if (LeftBox != null)
            {
                if (LeftBox.Checked == false)
                {
                    if (LeftBox.HasMine && !LeftBox.HasFlag)
                    {
                        Game.YouLost(LeftBox);
                        return;
                    }
                    LeftBox.OpenAll();
                }
            }
            if (TopBox != null)
            {
                if (TopBox.Checked == false)
                {
                    if (TopBox.HasMine && !TopBox.HasFlag)
                    {
                        Game.YouLost(TopBox);
                        return;
                    }
                    TopBox.OpenAll();
                }
            }
            if (RightTopBox != null)
            {
                if (RightTopBox.Checked == false)
                {
                    if (RightTopBox.HasMine && !RightTopBox.HasFlag)
                    {
                        Game.YouLost(RightTopBox);
                        return;
                    }
                    RightTopBox.OpenAll();
                }
            }
            if (RightBottomBox != null)
            {
                if (RightBottomBox.Checked == false)
                {
                    if (RightBottomBox.HasMine && !RightBottomBox.HasFlag)
                    {
                        Game.YouLost(RightBottomBox);
                        return;
                    }
                    RightBottomBox.OpenAll();
                }
            }
            if (RightBox != null)
            {
                if (RightBox.Checked == false)
                {
                    if (RightBox.HasMine && !RightBox.HasFlag)
                    {
                        Game.YouLost(RightBox);
                        return;
                    }
                    RightBox.OpenAll();
                }
            }
            if (BottomBox != null)
            {
                if (BottomBox.Checked == false)
                {
                    if (BottomBox.HasMine && !BottomBox.HasFlag)
                    {
                        Game.YouLost(BottomBox);
                        return;
                    }
                    BottomBox.OpenAll();
                }
            }
        }
예제 #2
0
 public void OpenAll()
 {
     this.Open();
     this.Checked = true;
     if (this.TotalMines == 0)
     {
         if (LeftTopBox != null)
         {
             if (LeftTopBox.Checked == false)
             {
                 LeftTopBox.OpenAll();
             }
         }
         if (LeftBottomBox != null)
         {
             if (LeftBottomBox.Checked == false)
             {
                 LeftBottomBox.OpenAll();
             }
         }
         if (LeftBox != null)
         {
             if (LeftBox.Checked == false)
             {
                 LeftBox.OpenAll();
             }
         }
         if (TopBox != null)
         {
             if (TopBox.Checked == false)
             {
                 TopBox.OpenAll();
             }
         }
         if (RightTopBox != null)
         {
             if (RightTopBox.Checked == false)
             {
                 RightTopBox.OpenAll();
             }
         }
         if (RightBottomBox != null)
         {
             if (RightBottomBox.Checked == false)
             {
                 RightBottomBox.OpenAll();
             }
         }
         if (RightBox != null)
         {
             if (RightBox.Checked == false)
             {
                 RightBox.OpenAll();
             }
         }
         if (BottomBox != null)
         {
             if (BottomBox.Checked == false)
             {
                 BottomBox.OpenAll();
             }
         }
     }
 }