示例#1
0
 /// <summary>
 /// 开始自定义游戏
 /// </summary>
 /// <param name="setting"></param>
 public void StartCustomGame(LayoutSetting setting)
 {
     SetGame(setting.RowSize, setting.ColumnSize, setting.MineSize);
     for (int row = 0; row < RowSize; row++)
     {
         for (int col = 0; col < ColumnSize; col++)
         {
             BlockCoordinate coordinate = new BlockCoordinate(row, col);
             this[coordinate].Coordinate = coordinate;
             int index = row * ColumnSize + col;
             if (setting.LayoutDataArray[index] == '1')
             {
                 this[coordinate].IsMineBlock = true;
             }
             else
             {
                 this[coordinate].IsMineBlock = false;
             }
         }
     }
     foreach (BlockCoordinate cCoordinate in GetAllCoordinates())
     {
         this[cCoordinate].NearMinesCount
             = GetNearCounts(cCoordinate, (BlockCoordinate nCoordinate) => this[nCoordinate].IsMineBlock);
     }
     OnPropertyChanged(nameof(Blocks));
     isGameStarted = true;
     FlagsCount    = 0;
 }
示例#2
0
        private void BorderGamePanelCover_Drop(object sender, DragEventArgs e)
        {
            string        filePath = ((string[])e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString();
            LayoutSetting setting  = GameLayoutLoader.ReadFromFile(filePath);

            GameWindow.StartCustomGame(() => { StartCustomGame(setting); });

            PlayOpacityTransform(GameWindow.BorderGamePanelCover,
                                 GameWindow.BorderGamePanelCover.Opacity, 0, 150);
            PlayBlurTransfrom(GameWindow.GamePlayAreaGrid, 15, 0, 150);
            GameWindow.BorderGamePanelCover.IsHitTestVisible = false;
        }