コード例 #1
0
    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>());
    }
コード例 #2
0
        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);
        }
コード例 #3
0
    void CreateGrid()
    {
        if (GridFactory != null)
        {
            var grid = GridFactory.Create();
            _grid = grid;

            currentControl = _grid;
        }
    }
コード例 #4
0
        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);
        }
コード例 #5
0
ファイル: GridTest.cs プロジェクト: Mojopon/ThreeSeven
    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>());
    }
コード例 #6
0
        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);
        }