public Box GetNewBasicBox(GameFrame gf = null) { Random rand = new Random(seed); seed = rand.Next(); int id = rand.Next(7)+1; return GetBoxFromId(id, gf); }
public static Box GetBoxFromId(int id,GameFrame gf = null) { Box box=null; switch (id) { case 1: box = new Z_Box(gf); break; case 2: box = new S_Box(gf); break; case 3: box = new T_Box(gf); break; case 4: box = new I_Box(gf); break; case 5: box = new O_Box(gf); break; case 6: box = new L_Box(gf); break; case 7: box = new J_Box(gf); break; } if (box == null) box = new I_Box(gf); return box; }
public J_Box(GameFrame gf) : base(gf) { this.shape = BoxShape.J; entity = new List<Square>{ new Square(new Position(0,0), shape), new Square(new Position(0,-1), shape), new Square(new Position(-1,0), shape), new Square(new Position(-2,0), shape) }; }
public MainWindow() { InitializeComponent(); game = new MyGameFrame(gameGrid,19,11); scoreBoard = new ScoringBoard(Scoring_Board); preview = new PreviewWindow(game, PreviewImage); game.RowsCleanEvent += scoreBoard.GetScore; game.GameOverEvent += scoreBoard.WhenGameOver; }
public PreviewWindow(GameFrame gf,Image img) { gFrame = gf; this.img = img; string path = System.Environment.CurrentDirectory + "/images/" + "emptyPreview.png"; if (File.Exists(path)) { img.Source = new BitmapImage(new Uri(path, UriKind.Absolute)); } else { img.Source = null; } gFrame.RenewReadyBox += GetNewReadyBox; }
public Singleplaywindow() { InitializeComponent(); // 在此点之下插入创建对象所需的代码。 game = new MyGameFrame(gameGrid,19,11); scoreBoard = new ScoringBoard(Scoring_Board); preview = new PreviewWindow(game, PreviewImage); game.RowsCleanEvent += scoreBoard.GetScore; game.RowsCleanEvent += Play; game.GameOverEvent += scoreBoard.WhenGameOver; //game.GameOverEvent += writeScoreRating; }
public BoxShadow(GameFrame gf) { //entity = new List<Square>(); gFrame = gf; reflect += gf.ActiveBoxPositionChanged; }
public O_Box(GameFrame gf) : base(gf) { this.shape = BoxShape.O; entity = new List<Square>{ new Square(new Position(0,0), shape), new Square(new Position(0,1), shape), new Square(new Position(-1,0), shape), new Square(new Position(-1,1), shape), }; }
public L_Box(GameFrame gf) : base(gf) { state = 0; this.shape = BoxShape.L; entity = new List<Square>{ new Square(new Position(0,0), shape), new Square(new Position(0,1), shape), new Square(new Position(-1,0), shape), new Square(new Position(-2,0), shape), }; }
protected Timer timer2; //快速下落后销毁方块 #endregion Fields #region Constructors public Box(GameFrame gf) { this.gFrame = gf; isActive = false; center = new Position(2, gFrame.Column / 2); }