Ejemplo n.º 1
0
        public MoveHeroSystem(GameContext game, InputContext input)
        {
            _game = game;

            _heroes = game.GetGroup(GameMatcher.AllOf(GameMatcher.Hero));
            _inputs = input.GetGroup(InputMatcher.AllOf(InputMatcher.Horizontal));
        }
Ejemplo n.º 2
0
 protected override ICollector <InputEntity> GetTrigger(IContext <InputEntity> context)
 {
     return(context.CreateCollector(InputMatcher.AllOf(
                                        InputMatcher.Command,
                                        InputMatcher.ToggleLightCommand
                                        )));
 }
Ejemplo n.º 3
0
 public MouseInput(Contexts contexts)
 {
     _input       = contexts.input;
     _leftClicks  = _input.GetGroup(InputMatcher.AnyOf(InputMatcher.MouseLeftDown, InputMatcher.MouseLeftReleased));
     _rightClicks = _input.GetGroup(InputMatcher.AnyOf(InputMatcher.MouseRightDown, InputMatcher.MouseRightReleased));
     _mouseHover  = _input.GetGroup(InputMatcher.MouseHover);
 }
Ejemplo n.º 4
0
 protected override ICollector <InputEntity> GetTrigger(IContext <InputEntity> context)
 {
     return(context.CreateCollector(InputMatcher.AnyOf(
                                        InputMatcher.AxisInput,
                                        InputMatcher.KeyInput
                                        )));
 }
 public UserInputProcessor(Contexts contexts)
 {
     _contexts         = contexts;
     _context          = contexts.input;
     _mouseEventsGroup = _context.GetGroup(InputMatcher.AllOf(InputMatcher.MouseEvent, InputMatcher.ScreenPoint));
     _keyEventsGroup   = _context.GetGroup(InputMatcher.AllOf(InputMatcher.KeyEvent));
     _mouseEventEntity = _context.GetGroup(InputMatcher.MouseEvent).GetSingleEntity();
 }
 public DragSelectionSystem(Contexts contexts) : base(contexts.input)
 {
     _contexts = contexts;
     _context  = contexts.input;
     _selectedEntitiesGroup  = contexts.game.GetGroup(GameMatcher.AllOf(GameMatcher.Selected));
     _keyEventGroup          = contexts.input.GetGroup(InputMatcher.AllOf(InputMatcher.KeyEvent, InputMatcher.KeyHeld));
     _dragSelectionDataGroup = contexts.input.GetGroup(InputMatcher.DragSelectionData);
 }
 public RemoveReactiveUIListenersSystem(Contexts contexts) : base(contexts.game)
 {
     this._contexts  = contexts;
     gameEntityGroup = this._contexts.game.GetGroup(GameMatcher.AnyOf(GameMatcher.ElixirListener
                                                                      , GameMatcher.TickListener));
     inputEntityGroup =
         this._contexts.input.GetGroup(InputMatcher.AllOf(InputMatcher.PauseListener));
 }
Ejemplo n.º 8
0
 public SystemMoveInput(Contexts contexts, IServiceContainer serviceContainer) :
     base(contexts, serviceContainer)
 {
     _inputGroup = contexts.input.GetGroup(InputMatcher.AllOf(
                                               InputMatcher.MoveDir,
                                               InputMatcher.ActorId,
                                               InputMatcher.Tick));
 }
Ejemplo n.º 9
0
        public MovePlayer(GameContext game, InputContext input)
        {
            this.game = game;

            players     = game.GetGroup(GameMatcher.AllOf(GameMatcher.Player));
            verticals   = input.GetGroup(InputMatcher.AllOf(InputMatcher.Vertical));
            horizontals = input.GetGroup(InputMatcher.AllOf(InputMatcher.Horizontal));
        }
 protected override ICollector <InputEntity> GetTrigger(IContext <InputEntity> context)
 {
     return(context.CreateCollector(
                InputMatcher.AllOf(
                    InputMatcher.ScreenPoint,
                    InputMatcher.MouseEvent
                    ).AnyOf(InputMatcher.LeftMouseButtonDown, InputMatcher.LeftMouseButtonHeld, InputMatcher.LeftMouseButtonUp)
                ));
 }
 public override BaseSystem DoInit(Contexts contexts, IServiceContainer serviceContainer)
 {
     base.DoInit(contexts, serviceContainer);
     _inputGroup = contexts.input.GetGroup(InputMatcher.AllOf(
                                               InputMatcher.InputInfo,
                                               InputMatcher.ActorId,
                                               InputMatcher.Tick));
     return(this);
 }
Ejemplo n.º 12
0
 protected override ICollector <InputEntity> GetTrigger(IContext <InputEntity> context)
 {
     return(context.CreateCollector(
                InputMatcher.AllOf(
                    InputMatcher.MouseUp,
                    InputMatcher.LeftMouse
                    )
                ));
 }
Ejemplo n.º 13
0
        public BuildCommands(Contexts contexts) : base(contexts.input)
        {
            _game    = contexts.game;
            _grid    = UnityEngine.GameObject.FindObjectOfType <HexGridBehaviour>();
            _presets = new Presets(_game, _grid);

            _UICommands = contexts.input.GetGroup(InputMatcher.AnyOf(InputMatcher.UIBuildBarracks, InputMatcher.UIBuildTower));
            _selectedBarracksBuilders = _game.GetGroup(GameMatcher.AllOf(GameMatcher.Selected, GameMatcher.CanBuildBarracks));
            _selectedTowerBuilders    = _game.GetGroup(GameMatcher.AllOf(GameMatcher.Selected, GameMatcher.CanBuildBarracks));
        }
Ejemplo n.º 14
0
        public ExecuteNavigationInput(Contexts contexts, ServiceContainer serviceContainer)
        {
            _gameContext      = contexts.game;
            _gameStateContext = contexts.gameState;

            _navigationInput = contexts.input.GetGroup(InputMatcher.AllOf(
                                                           InputMatcher.Coordinate,
                                                           InputMatcher.Selection,
                                                           InputMatcher.ActorId,
                                                           InputMatcher.Tick));
        }
        public ExecuteNavigationInput(Contexts contexts, Services services)
        {
            _services          = services;
            _navigationService = services.Get <INavigationService>();
            _gameContext       = contexts.game;
            _gameStateContext  = contexts.gameState;

            _navigationInput = contexts.input.GetGroup(InputMatcher.AllOf(
                                                           InputMatcher.Coordinate,
                                                           InputMatcher.Selection,
                                                           InputMatcher.ActorId,
                                                           InputMatcher.Tick));
        }
Ejemplo n.º 16
0
        public ExecuteSpawnInput(Contexts contexts, ServiceContainer serviceContainer)
        {
            _viewService      = serviceContainer.Get <IViewService>();
            _gameContext      = contexts.game;
            _gameStateContext = contexts.gameState;
            _actorContext     = contexts.actor;

            _spawnInputs = contexts.input.GetGroup(
                InputMatcher.AllOf(
                    InputMatcher.EntityConfigId,
                    InputMatcher.ActorId,
                    InputMatcher.Coordinate,
                    InputMatcher.Tick));
        }
 public void Execute()
 {
     foreach (var input in _inputContext.GetEntities(
                  InputMatcher.AllOf(
                      InputMatcher.Tick,
                      InputMatcher.Coordinate,
                      InputMatcher.Selection,
                      InputMatcher.ActorId))
              .Where(entity => entity.tick.value < _gameStateContext.tick.value))
     {
         var ents = _gameContext.GetEntities(GameMatcher.LocalId)
                    .Where(entity => entity.actorId.value == input.actorId.value).Select(entity => entity.id.value);
         var missing = input.selection.entityIds.Where(u => !ents.Contains(u)).ToList();
         if (missing.Any())
         {
             _services.Get <ILogService>().Warn(missing.Count + " missing for actor: " + input.actorId.value);
         }
     }
 }
Ejemplo n.º 18
0
        public void Execute()
        {
            foreach (var input in _inputContext.GetEntities(
                         InputMatcher.AllOf(
                             InputMatcher.Tick,
                             InputMatcher.Coordinate,
                             InputMatcher.Selection,
                             InputMatcher.ActorId))
                     .Where(entity => entity.tick.value < _gameStateContext.tick.value))
            {
                var targetActorId = input.hasTargetActorId ? input.targetActorId.value : input.actorId.value;

                var ents = _gameContext.GetEntities(GameMatcher.LocalId)
                           .Where(entity => entity.actorId.value == targetActorId).Select(entity => entity.id.value);
                var missing = input.selection.entityIds.Where(u => !ents.Contains(u)).ToList();
                if (missing.Any())
                {
                    Log.Warn(this, missing.Count + " missing for actor: " + targetActorId + " (command from " + input.actorId.value + ")");
                }
            }
        }
 protected override ICollector <InputEntity> GetTrigger(IContext <InputEntity> context)
 {
     return(new Collector <InputEntity>(
                new[]
     {
         context.GetGroup(InputMatcher
                          .AllOf(
                              InputMatcher.KeyEvent,
                              InputMatcher.KeyHeld
                              )
                          ),
         context.GetGroup(InputMatcher.AnyOf(
                              InputMatcher.MouseScrollDown,
                              InputMatcher.MouseScrollUp
                              ))
     },
                new[]
     {
         GroupEvent.AddedOrRemoved,
         GroupEvent.AddedOrRemoved
     }
                ));
 }
Ejemplo n.º 20
0
 protected override void SetTriggers()
 {
     Trigger(InputMatcher.AllOf(InputMatcher.EventId).Added());
 }
Ejemplo n.º 21
0
 protected override void SetTriggers()
 {
     Trigger(InputMatcher.AllOf(InputMatcher.ChannelSwitchEvent).Added());
 }
Ejemplo n.º 22
0
 protected override ICollector <InputEntity> GetTrigger(IContext <InputEntity> context)
 {
     return(context.CreateCollector(InputMatcher.AnyOf(InputMatcher.ShowUiCommand, InputMatcher.HideUiCommand)));
 }
Ejemplo n.º 23
0
 protected override void SetTriggers()
 {
     Trigger(Contexts.input.CreateCollector(InputMatcher.AllOf(InputMatcher.FlagTrash, InputMatcher.FlagTrashValidated).Added()));
     Trigger(Contexts.state.CreateCollector(StateMatcher.AllOf(StateMatcher.FlagTrash, StateMatcher.FlagTrashValidated).Added()));
 }
 protected override ICollector <InputEntity> GetTrigger(IContext <InputEntity> context)
 {
     //return collector
     return(context.CreateCollector(InputMatcher.AllOf(InputMatcher.InputTouchData)));
 }
 protected override ICollector <InputEntity> GetTrigger(IContext <InputEntity> context)
 {
     return(context.CreateCollector(InputMatcher.AllOf(InputMatcher.ClickDown, InputMatcher.HoldingClick)));
 }
Ejemplo n.º 26
0
 protected override ICollector <InputEntity> GetTrigger(IContext <InputEntity> context)
 {
     return(context.CreateCollector(InputMatcher.AllOf(InputMatcher.TouchType)));
 }
Ejemplo n.º 27
0
 protected override ICollector <InputEntity> GetTrigger(IContext <InputEntity> context)
 {
     // triggers:
     // PointerOverUi.AddedOrRemoved
     return(context.CreateCollector(InputMatcher.AnyOf(InputMatcher.PointerOverUi.AddedOrRemoved().matcher)));
 }
Ejemplo n.º 28
0
 protected override ICollector <InputEntity> GetTrigger(IContext <InputEntity> context)
 {
     return(context.CreateCollector(InputMatcher.AnyOf(InputMatcher.MouseClickDown, InputMatcher.MouseClickStay)));
 }
 protected override ICollector <InputEntity> GetTrigger(IContext <InputEntity> context)
 => context.CreateCollector(InputMatcher.AllOf(InputMatcher.Input, InputMatcher.MouseUp));
 protected override Collector <InputEntity> GetTrigger(IContext <InputEntity> context)
 {
     return(context.CreateCollector(InputMatcher.AllOf(InputMatcher.RightMouse, InputMatcher.MouseDown)));
 }