private ControlAssigner CreateController(IBlueprintBuilder builder,
                                                 ITableHighlighter tableHighlighter)
        {
            var controllerFactory = new ControllerFactory();
            var controller        = controllerFactory.CreateController(builder, tableHighlighter);
            var controlAssigner   = new ControlAssigner(controller);

            return(controlAssigner);
        }
        public void CheckIfLeftClickActionIsAssignedByControllerToPipeLink()
        {
            var mockController = new Mock <IController>();
            var mockPipeLink   = new Mock <IWorldObject>();

            mockPipeLink.SetupSet(pipeLink => pipeLink.LeftClickAction = It.IsAny <PipeLinkSelect>()).Verifiable();

            var edge = new CoordinatePair(new Coordinate(2, 2), new Coordinate(1, 2));
            var blueprintBuilderControlAssigner = new ControlAssigner(mockController.Object);

            blueprintBuilderControlAssigner.AssignPipeLinkControl(mockPipeLink.Object, edge);

            mockPipeLink.VerifySet(pipeLink => pipeLink.LeftClickAction = It.IsAny <PipeLinkSelect>());
        }
        public void CheckIfLeftClickActionIsAsssignedByControllerToBlock()
        {
            var mockController = new Mock <IController>();
            var mockBlock      = new Mock <IWorldObject>();

            mockBlock.SetupSet(block => block.LeftClickAction = It.IsAny <BlockSelect>()).Verifiable();

            var position = new Coordinate(4, 2);
            var blueprintBuilderControlAssigner = new ControlAssigner(mockController.Object);

            blueprintBuilderControlAssigner.AssignBlockControl(mockBlock.Object, position);

            mockBlock.VerifySet(block => block.LeftClickAction = It.IsAny <BlockSelect>());
        }
        public void CheckIfLeftClickActionIsAssignedByControllerToTile()
        {
            var mockController = new Mock <IController>();
            var mockTile       = new Mock <IWorldObject>();

            mockTile.SetupSet(tile => tile.LeftClickAction = It.IsAny <TileSelect>()).Verifiable();

            var position = new Coordinate(2, 3);
            var blueprintBuilderControlAssigner = new ControlAssigner(mockController.Object);

            blueprintBuilderControlAssigner.AssignTileControl(mockTile.Object, position);

            mockTile.VerifySet(tile => tile.LeftClickAction = It.IsAny <TileSelect>());
        }
        public void CheckIfClickActionsAreAssignedByControllerToShipComponent()
        {
            var mockController    = new Mock <IController>();
            var mockShipComponent = new Mock <IWorldObject>();

            mockShipComponent.SetupSet(component => component.LeftClickAction  = It.IsAny <ShipComponentSelect>()).Verifiable();
            mockShipComponent.SetupSet(component => component.RightClickAction = It.IsAny <ShipComponentCancel>()).Verifiable();

            var position = new Coordinate(1, 3);
            var blueprintBuilderControlAssigner = new ControlAssigner(mockController.Object);

            blueprintBuilderControlAssigner.AssignShipComponentControl(mockShipComponent.Object, position);

            mockShipComponent.VerifySet(component => component.LeftClickAction  = It.IsAny <ShipComponentSelect>());
            mockShipComponent.VerifySet(component => component.RightClickAction = It.IsAny <ShipComponentCancel>());
        }
예제 #6
0
        private ViewModel CreateViewModel(
            IBlueprintBuilder builder,
            ObjectTable objectTable,
            ControlAssigner controlAssigner,
            IFactory <IActivateableWorldObject>[] shipComponentsFactories)
        {
            var viewModel = new ViewModel(
                builder,
                objectTable,
                new ActivateableWorldObjectFactory(blockFactory),
                new ViewDetailsFactory <IActivateableWorldObject, IShipComponent>(componentDetails, shipComponentsFactories),
                new ActivateableWorldObjectFactory(pipeLinkFactory),
                new CurveWorldObjectFactory(pipeFactory),
                controlAssigner);

            return(viewModel);
        }
예제 #7
0
 private void AssignTileControls(IBlueprintBuilder builder, IActivateableWorldObject[,] tiles, ControlAssigner controlAssigner)
 {
     foreach (var coordinate in tiles.GetCoordinates())
     {
         controlAssigner.AssignTileControl(tiles.Get(coordinate), coordinate);
     }
 }