private IController _controller; // 游戏控制器 #endregion public TetrisGame(int id, IEnumerable <SquareArray> styles, IEngine engine, ITetrisFactory factory, int w, int h, int gameSpeed) { Width = w; Height = h; GameSpeed = gameSpeed; engine.TickEvent += UpdateDispatch; engine.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) { this.Fps = (sender as IEngine).Fps; }; _underLying = new SquareArray(h, w); _factory = factory; _factory.Game = this; if (_factory is CacheFactory) // 如果是CacheFactory,初始化 { (_factory as CacheFactory).Init(); } InitTickAPI(); Id = id; _tick = 0; _state = 0; }
public static void SetupFactory(TestContext test) { _game = (new Tetrisor()).NewGame(); _factory = _game.Factory; }