/// <summary> /// 生成新的砖块,并重新设定坐标 /// </summary> private void NextBlockStart() { // 清除当前砖块 if (gameSurface.Children.Contains(Game.CurrentBlocks)) { gameSurface.Children.Remove(Game.CurrentBlocks); } // 将当前砖块散装装入背景 foreach (BlockControl blockControl in Game.CurrentBlocks.GetBlocksList()) { Point blockPoint = blockControl.TranslatePoint(new Point(0, 0), Game.CurrentBlocks.blockShowGrid); if (Game.currentY < 0) { continue; } Game.backGround[(int)(blockPoint.Y / 16) + Game.currentY, (int)(blockPoint.X / 16) + Game.currentX] = (int)(blockControl.BlocksShape); BlockControl newBlockControl = new BlockControl(blockControl.BlocksShape); newBlockControl.Margin = new Thickness(blockPoint.X + Game.currentX * 16, blockPoint.Y + Game.currentY * 16, 0, 0); newBlockControl.HorizontalAlignment = HorizontalAlignment.Left; newBlockControl.VerticalAlignment = VerticalAlignment.Top; gameSurface.Children.Add(newBlockControl); } Game.currentX = 5; Game.currentY = -4; Game.CurrentBlocks = Game.GetCurrentBlocks(); Game.NextBlocks = Game.GetNextBlocks(); }