public void ShouldRenderFloatingTextWhenDelete() { IFloatingTextRenderer floatingTextRenderer = Substitute.For <IFloatingTextRenderer>(); setting.FloatingTextRenderer = floatingTextRenderer; var gridFactory = new GridFactory(setting, groupFactory); grid = gridFactory.Create(); grid.NewGame(); Assert.IsTrue(grid.AddGroup(group)); Assert.IsTrue(group.Location.Equals(setting.BlockSpawnPoint)); grid.FixGroup(); Assert.IsTrue(grid.DropBlocks()); grid.SetState(GridStates.Dropped); Assert.IsNotNull(grid[3, 1]); Assert.IsNotNull(grid[3, 0]); grid.OnUpdate(); Assert.IsTrue(grid.CurrenteStateName == GridStates.Deleting); grid.OnUpdate(); Assert.IsNull(grid[3, 1]); Assert.IsNull(grid[3, 0]); Assert.IsTrue(grid.CurrenteStateName == GridStates.Deleted); floatingTextRenderer.Received().RenderText(Arg.Any <Vector2>(), Arg.Any <string>()); }
public ScratchpadPageTemplate() { this.Name = "Scratchpad"; this.Width = 750; this.Height = 600; // containers this.Grid = new XContainer() { Styles = new ObservableCollection <IStyle>(), Shapes = new ObservableCollection <IShape>() }; this.Table = new XContainer() { Styles = new ObservableCollection <IStyle>(), Shapes = new ObservableCollection <IShape>() }; this.Frame = new XContainer() { Styles = new ObservableCollection <IStyle>(), Shapes = new ObservableCollection <IShape>() }; // styles var gridStyle = new XStyle() { Name = "Grid", Fill = new XColor() { A = 0x00, R = 0x00, G = 0x00, B = 0x00 }, Stroke = new XColor() { A = 0xFF, R = 0xD3, G = 0xD3, B = 0xD3 }, Thickness = 1.0 }; this.Grid.Styles.Add(gridStyle); // grid var settings = new GridFactory.GridSettings() { StartX = 0.0, StartY = 0.0, Width = this.Width, Height = this.Height, SizeX = 30.0, SizeY = 30.0 }; GridFactory.Create(this.Grid.Shapes, gridStyle, settings); }
void CreateGrid() { if (GridFactory != null) { var grid = GridFactory.Create(); _grid = grid; currentControl = _grid; } }
public Simulation(SimulationConfiguration config, IPresenter presenter, ITimer timer) { _generationCount = 0; _config = config; _presenter = presenter; _timer = timer; var gridFactory = new GridFactory(); var grid = gridFactory.Create(config.GridType, config.Height, config.Width); var ruleSetFactory = new RuleSetFactory(); var ruleset = ruleSetFactory.Create(config.RuleSetType); _board = new Board(ruleset, grid); }
public void ShouldRenderFloatingTextWhenDelete() { IFloatingTextRenderer floatingTextRenderer = Substitute.For<IFloatingTextRenderer>(); setting.FloatingTextRenderer = floatingTextRenderer; var gridFactory = new GridFactory(setting, groupFactory); grid = gridFactory.Create(); grid.NewGame(); Assert.IsTrue(grid.AddGroup(group)); Assert.IsTrue(group.Location.Equals(setting.BlockSpawnPoint)); grid.FixGroup(); Assert.IsTrue(grid.DropBlocks()); grid.SetState(GridStates.Dropped); Assert.IsNotNull(grid[3, 1]); Assert.IsNotNull(grid[3, 0]); grid.OnUpdate(); Assert.IsTrue(grid.CurrenteStateName == GridStates.Deleting); grid.OnUpdate(); Assert.IsNull(grid[3, 1]); Assert.IsNull(grid[3, 0]); Assert.IsTrue(grid.CurrenteStateName == GridStates.Deleted); floatingTextRenderer.Received().RenderText(Arg.Any<Vector2>(), Arg.Any<string>()); }
public LogicPageTemplate() { this.Name = "Logic Page"; this.Width = 1260.0; this.Height = 891.0; // containers this.Grid = new XContainer() { Styles = new ObservableCollection <IStyle>(), Shapes = new ObservableCollection <IShape>() }; this.Table = new XContainer() { Styles = new ObservableCollection <IStyle>(), Shapes = new ObservableCollection <IShape>() }; this.Frame = new XContainer() { Styles = new ObservableCollection <IStyle>(), Shapes = new ObservableCollection <IShape>() }; // styles var gridStyle = new XStyle() { Name = "Grid", Fill = new XColor() { A = 0x00, R = 0x00, G = 0x00, B = 0x00 }, Stroke = new XColor() { A = 0xFF, R = 0xD3, G = 0xD3, B = 0xD3 }, Thickness = 1.0 }; this.Grid.Styles.Add(gridStyle); var tableStyle = new XStyle() { Name = "Table", Fill = new XColor() { A = 0x00, R = 0x00, G = 0x00, B = 0x00 }, Stroke = new XColor() { A = 0xFF, R = 0xD3, G = 0xD3, B = 0xD3 }, Thickness = 1.0 }; this.Table.Styles.Add(tableStyle); var frameStyle = new XStyle() { Name = "Frame", Fill = new XColor() { A = 0x00, R = 0x00, G = 0x00, B = 0x00 }, Stroke = new XColor() { A = 0xFF, R = 0xA9, G = 0xA9, B = 0xA9 }, Thickness = 1.0 }; this.Frame.Styles.Add(frameStyle); // grid var settings = new GridFactory.GridSettings() { StartX = 330.0, StartY = 30.0, Width = 600.0, Height = 750.0, SizeX = 30.0, SizeY = 30.0 }; GridFactory.Create(this.Grid.Shapes, gridStyle, settings); // table CreateTable(this.Table.Shapes, tableStyle); // frame CreateFrame(this.Frame.Shapes, frameStyle); }