/// <summary> /// 固定当前形状在屏幕上 /// </summary> public static void FixShape() { timer.Stop(); //停止下落 for (int i = 0; i < 4; i++) { //点亮对应的背景方块 Globals.BackBlocks[Globals.DynamicBlocksArray[i].GLocation.Y , Globals.DynamicBlocksArray[i].GLocation.X].BackColor = Globals.ColorOfFixedBlock; //将对应的网格值设置为1,表示此网格已经被占据 Globals.GirdArray[Globals.DynamicBlocksArray[i].GLocation.Y, Globals.DynamicBlocksArray[i].GLocation.X] = 1; } int temp = Globals.BasePoint.Y; MoveAndRotate.MakeNewShape(); //扫描当前形状所在的四行,但最多达到第22行 DelLines(temp, temp + 3 > 22 ? 22 : temp + 3); if (IsGameOver()) { Game.Over(); } timer.Start(); }
/// <summary> /// 开始新游戏 /// </summary> public static void StartNewGame() { MoveAndRotate.AutoDown(false); if (State != GameStates.Stoped && MessageBox.Show("\n 确实要重新开始游戏吗? \n ", "重新开始", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != DialogResult.Yes) { if (State != GameStates.Paused) { MoveAndRotate.AutoDown(true); } return; } Ini(); CanOp = true; State = GameStates.Playing; MoveAndRotate.MakeNewShape(); MoveAndRotate.AutoDown(true); ClassMain.formMain.labelInfo.Text = "Playing...."; if (Globals.IsPlayBackMusic) { Sound.PlayMusic(Globals.PathOfBackMusic, true); } }
/// <summary> /// 开始游戏,但不还原数据(要还原数据并开始新游戏,请使用StartNewGame()) /// </summary> public static void Start() { Globals.BasePoint = new GirdPoint(0, 0); CanOp = true; State = GameStates.Playing; MoveAndRotate.MakeNewShape(); MoveAndRotate.AutoDown(true); ClassMain.formMain.labelInfo.Text = "Playing...."; if (Globals.IsPlayBackMusic) { Sound.PlayMusic(Globals.PathOfBackMusic, true); } }