Пример #1
0
 public void Construct(Settings settings, [Inject(Id = injectId)] IMoveHandler moveHandler,
                       [Inject(Id = injectId)] ICollisionHandler collisionHandler)
 {
     this.settings         = settings;
     this.moveHandler      = moveHandler;
     this.collisionHandler = collisionHandler;
 }
Пример #2
0
 public GameHandler(IGameBuilder gameBuilder, IMoveHandler moveHandler, IBoardHandler boardHandler)
 {
     _gameBuilder = gameBuilder;
     _moveHandler = moveHandler;
     _boardHandler = boardHandler;
     Game = null;
 }
Пример #3
0
 public GameHandler(IGameBuilder gameBuilder, IMoveHandler moveHandler, IBoardHandler boardHandler)
 {
     _gameBuilder  = gameBuilder;
     _moveHandler  = moveHandler;
     _boardHandler = boardHandler;
     Game          = null;
 }
Пример #4
0
        public void AddMoveHandler(long id, IMoveHandler handler)
        {
            if (mMoveHandlerDict.ContainsKey(id))
            {
                return;
            }

            mMoveHandlerDict.Add(id, handler);
        }
Пример #5
0
        /// <summary>
        /// Gets the correct instance of the class implementing <see cref="ILabyrinthPlayField"/> interface.
        /// </summary>
        /// <returns>The correct instance of the class implementing <see cref="ILabyrinthPlayField"/> interface</returns>
        /// <param name="factory">A non null value of <see cref="IFactory"/></param>
        /// <param name="moveHandler">A non null value of <see cref="IMoveHandler"/></param>
        public ILabyrinthPlayField GetILabyrinthPlayFieldInstance(IFactory factory, IMoveHandler moveHandler)
        {
            if (factory == null || moveHandler == null)
            {
                throw new ArgumentNullException("GetLabyrinthInstance has a null argument");
            }

            return(new LabyrinthPlayField(factory, moveHandler));
        }
Пример #6
0
 public GameHub(IGameRepository gameRepository, IMoveValidator moveValidator, IMoveHandler moveHandler,
                CoordinateNotationParser coordinateNotationParser, FenParser fenParser, ILogger <GameHub> logger)
 {
     _gameRepository           = gameRepository;
     _moveValidator            = moveValidator;
     _moveHandler              = moveHandler;
     _coordinateNotationParser = coordinateNotationParser;
     _fenParser = fenParser;
     _logger    = logger;
 }
Пример #7
0
 public Explorer(
     IMaze maze,
     IMovementAnalyser movementAnalyser,
     IMoveHandler moveHandler)
 {
     this.maze             = maze.CheckIfNull(nameof(maze));
     this.movementAnalyser = movementAnalyser.CheckIfNull(nameof(movementAnalyser));
     this.moveHandler      = moveHandler.CheckIfNull(nameof(moveHandler));
     this.Facing           = Facing.East;
     this.recordedMoves    = new List <string>();
 }
Пример #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LabyrinthPlayField" /> class
        /// </summary>
        /// <param name="factory">The factory that is used to produce object in labyrinth</param>
        /// <param name="moveHandler">The move behavior of labyrinth</param>
        /// <param name="labyrinthSize">Labyrinth size</param>
        public LabyrinthPlayField(IFactory factory, IMoveHandler moveHandler, int labyrinthSize)
        {
            this.factory           = factory;
            this.MoveHandler       = moveHandler;
            this.LabyrinthSize     = labyrinthSize;
            this.labyrintStartRow  = this.LabyrinthSize / 2;
            this.labyrinthStartCol = this.LabyrinthSize / 2;

            this.Matrix = factory.GetICellMatrixInstance(this.LabyrinthSize);
            this.GenerateLabyrinth();
            this.CurrentCell = this.Matrix[this.labyrintStartRow, this.labyrinthStartCol];
        }
Пример #9
0
        public void Init()
        {
            string mazeFileName = "ExampleMazeSmall.txt";

            this.mazeLoader         = new MazeFileLoader(mazeFileName);
            this.mazeValidtor       = new MazeValidator();
            this.mazePositionFinder = new MazePositionFinder();
            this.mazeGridGenerator  = new MazeGridGenerator(mazeLoader, mazeValidtor, mazePositionFinder);
            this.maze             = new core.Maze(mazeGridGenerator);
            this.explorerPosition = new ExplorerPosition();
            this.movementAnalyser = new MovementAnalyser(this.explorerPosition, this.maze);
            this.moveHandler      = new MoveHandler(this.explorerPosition);
            this.explorer         = new Explorer(this.maze, this.movementAnalyser, this.moveHandler);
        }
Пример #10
0
 public PhaseFinalizeUseCase(
     IPhaseRegister phaseRegister,
     IDamageProvider damageProvider,
     ICurrentSkillModel skillModel,
     IMoveHandler moveHandler,
     ITurnCharacterProvider turnCharacter,
     ITargetProvider targetProvider)
 {
     _phaseRegister  = phaseRegister;
     _damageProvider = damageProvider;
     _skillModel     = skillModel;
     _moveHandler    = moveHandler;
     _turnCharacter  = turnCharacter;
     _targetProvider = targetProvider;
 }
Пример #11
0
    public static int OnMove(IntPtr l)
    {
        int result;

        try
        {
            IMoveHandler  moveHandler = (IMoveHandler)LuaObject.checkSelf(l);
            AxisEventData eventData;
            LuaObject.checkType <AxisEventData>(l, 2, out eventData);
            moveHandler.OnMove(eventData);
            LuaObject.pushValue(l, true);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
Пример #12
0
 private static void Execute(IMoveHandler handler, BaseEventData eventData)
 {
     handler.OnMove(ValidateEventData <AxisEventData>(eventData));
 }
Пример #13
0
 public void Init()
 {
     this.explorerPosition = new Mock <IExplorerPosition>();
     this.moveHandler      = new MoveHandler(this.explorerPosition.Object);
 }
Пример #14
0
 public void AddHandler(IMoveHandler handler, bool invoke = false)
 {
     _aggregtor.AddHandler(handler, invoke);
 }
Пример #15
0
 public void AddHandler(IMoveHandler handler, bool invoke = false)
 {
 }
Пример #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LabyrinthPlayField" /> class
 /// </summary>
 /// <param name="factory">The factory that is used to produce object in labyrinth</param>
 /// <param name="moveHandler">The move behavior of labyrinth</param>
 public LabyrinthPlayField(IFactory factory, IMoveHandler moveHandler)
     : this(factory, moveHandler, DefaultSize)
 {
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="WebDavDispatcherClass1"/> class.
        /// </summary>
        /// <param name="class1Handlers">The WebDAV class 1 handlers</param>
        /// <param name="context">The WebDAV context</param>
        /// <param name="deadPropertyFactory">The factory to create dead properties</param>
        /// <param name="mimeTypeDetector">The mime type detector for the getmimetype property</param>
        /// <param name="options">The options for the WebDAV class 1 implementation</param>
        public WebDavDispatcherClass1(
            IEnumerable <IClass1Handler> class1Handlers,
            IWebDavContext context,
            IDeadPropertyFactory deadPropertyFactory,
            IMimeTypeDetector mimeTypeDetector,
            IOptions <WebDavDispatcherClass1Options> options)
        {
            _deadPropertyFactory = deadPropertyFactory;
            _mimeTypeDetector    = mimeTypeDetector;
            var httpMethods = new HashSet <string>();

            foreach (var class1Handler in class1Handlers)
            {
                var handlerFound = false;

                if (class1Handler is IOptionsHandler optionsHandler)
                {
                    _optionsHandler = optionsHandler;
                    handlerFound    = true;
                }

                if (class1Handler is IPropFindHandler propFindHandler)
                {
                    _propFindHandler = propFindHandler;
                    handlerFound     = true;
                }

                if (class1Handler is IGetHandler getHandler)
                {
                    _getHandler  = getHandler;
                    handlerFound = true;
                }

                if (class1Handler is IHeadHandler headHandler)
                {
                    _headHandler = headHandler;
                    handlerFound = true;
                }

                if (class1Handler is IPropPatchHandler propPatchHandler)
                {
                    _propPatchHandler = propPatchHandler;
                    handlerFound      = true;
                }

                if (class1Handler is IPutHandler putHandler)
                {
                    _putHandler  = putHandler;
                    handlerFound = true;
                }

                if (class1Handler is IMkColHandler mkColHandler)
                {
                    _mkColHandler = mkColHandler;
                    handlerFound  = true;
                }

                if (class1Handler is IDeleteHandler deleteHandler)
                {
                    _deleteHandler = deleteHandler;
                    handlerFound   = true;
                }

                if (class1Handler is ICopyHandler copyHandler)
                {
                    _copyHandler = copyHandler;
                    handlerFound = true;
                }

                if (class1Handler is IMoveHandler moveHandler)
                {
                    _moveHandler = moveHandler;
                    handlerFound = true;
                }

                if (!handlerFound)
                {
                    throw new NotSupportedException();
                }

                foreach (var httpMethod in class1Handler.HttpMethods)
                {
                    httpMethods.Add(httpMethod);
                }
            }

            HttpMethods   = httpMethods.ToList();
            WebDavContext = context;

            OptionsResponseHeaders = new Dictionary <string, IEnumerable <string> >()
            {
                ["Allow"] = HttpMethods,
            };

            DefaultResponseHeaders = new Dictionary <string, IEnumerable <string> >()
            {
                ["DAV"] = new[] { "1" },
            };

            _defaultCreationMap = new Lazy <IReadOnlyDictionary <XName, CreateDeadPropertyDelegate> >(() => CreateDeadPropertiesMap(options?.Value ?? new WebDavDispatcherClass1Options()));
        }
Пример #18
0
 public MoveHandlerTests()
 {
     _moveHandler = new MoveHandler();
     _coordinateNotationParser = new CoordinateNotationParser();
     _fenParser = new FenParser();
 }