private void ProcessLine(TetrisGame sender, TetrisGame.ClearBarEventArgs e) // 将消除的行加入另一边 { if (sender.IsDuelGame) { var line = e.Squares.Clone() as Square[]; for (int i = 0; i < e.Squares.Length; i++) { Debug.Assert(line != null, "line != null"); if (line[i].NewSquare) { line[i] = null; } if (line[i] is ItemSquare) { line[i] = new Square(1); } } sender.DuelGame.PushLine(line); } }
private void ProcessItemSquare(TetrisGame game, TetrisGame.ClearBarEventArgs e) // ClearBar时检查是否有道具Square被消除 { foreach (var s in e.Squares) { if (s is ItemSquare) { Debug.Assert(game.Factory is TetrisItemFactory); var si = s as ItemSquare; var f = game.Factory as TetrisItemFactory; switch (si.ItemId) { case 0: f.PushGun(); break; case 1: f.PushInverseGun(); break; case 2: f.PushTon(); break; case 3: Debug.Assert(game.IsDuelGame); Console.WriteLine("Inversed Control"); game.DuelGame.Controller.InverseControl(); game.Later(10 * game.RoundTicks, () => { game.DuelGame.Controller.InverseControl(); Console.WriteLine("Inversed Back"); }); break; } } } }