Ejemplo n.º 1
0
        private void RegistEvent()
        {
            inputHandler.Click += data => { if (Enable)
                                            {
                                                Click?.Invoke(this, data);
                                            }
            };

            inputHandler.Enter += data => { if (Enable)
                                            {
                                                Enter?.Invoke(this, data);
                                            }
            };
            inputHandler.Exit += data => { if (Enable)
                                           {
                                               Exit?.Invoke(this, data);
                                           }
            };

            inputHandler.Down += data => { if (Enable)
                                           {
                                               Down?.Invoke(this, data);
                                           }
            };
            inputHandler.Up += data => { if (Enable)
                                         {
                                             Up?.Invoke(this, data);
                                         }
            };
        }
        public override async void OnStateEnter(Animator animator, AnimatorStateInfo animatorStateInfo, int layerIndex)
        {
            Enter?.Invoke();

            await Task.Delay((int)(animatorStateInfo.length * 1000));

            StopRunning?.Invoke();
        }
Ejemplo n.º 3
0
    private void OnTriggerEnter(Collider other)
    {
        var player = other.gameObject.GetComponent <PlayerMove>();

        if (player != null)
        {
            Enter?.Invoke();
        }
    }
Ejemplo n.º 4
0
 private void EKeyDown(object s, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         e.Handled     = true;
         this.KeyDown -= EKeyDown;
         this.KeyUp   += EKeyUP;
         Enter.Invoke();
     }
 }
Ejemplo n.º 5
0
        // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
//        override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
//        {
//        }

        // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
        override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        {
            if (animator.IsInTransition(layerIndex) || inState)
            {
                return;
            }

            Enter?.Invoke(animator, state);

            inState = true;
        }
Ejemplo n.º 6
0
 private void InitializeBackingControl(Control textBox)
 {
     Controls.Add(textBox);
     textBox.Dock         = DockStyle.Fill;
     textBox.Enter       += (sender, args) => { BackColor = SystemColors.Highlight; };
     textBox.Leave       += (sender, args) => { BackColor = SystemColors.WindowFrame; };
     textBox.TextChanged += (sender, args) => { TextChanged?.Invoke(sender, args); };
     textBox.KeyDown     += (sender, args) => { KeyDown?.Invoke(sender, args); };
     textBox.MouseClick  += (sender, args) => { MouseClick?.Invoke(sender, args); };
     textBox.Enter       += (sender, args) => { Enter?.Invoke(sender, args); };
     textBox.KeyUp       += (sender, args) => { KeyUp?.Invoke(sender, args); };
     textBox.Leave       += (sender, args) => { Leave?.Invoke(sender, args); };
     textBox.MouseMove   += (sender, args) => { MouseMove?.Invoke(sender, args); };
 }
Ejemplo n.º 7
0
    private void FixedUpdate()
    {
        var collidersHit = Physics2D.OverlapCircle(transform.position, Radius, layers);

        if (!collidersHit && isSomethingInside)
        {
            Exit?.Invoke(objectInside);
            isSomethingInside = false;
            objectInside      = null;
        }
        else if (collidersHit && !isSomethingInside)
        {
            objectInside = collidersHit.attachedRigidbody;
            Enter?.Invoke(objectInside);
            isSomethingInside = true;
        }
    }
Ejemplo n.º 8
0
    public void SetState(T state, bool initialState = false)
    {
        if (!_running)
        {
            _state = state;
            return;
        }

        if (!initialState)
        {
            Exit?.Invoke(_instance, null);
        }

        _state = state;

        Enter?.Invoke(_instance, null);

        StateChanged?.Invoke(_state, state);
    }
Ejemplo n.º 9
0
        private void OnTrainEnter()
        {
            if (_timeProvider.Now.Subtract(TimeSpan.FromSeconds(MinTimeAfterExit)) < _exitDateTime)
            {
                // It has not been long enough since the last exit.
                return;
            }

            CurrentState       = DetectorState.Entry;
            _entryDateTime     = _timeProvider.Now;
            _foundNothingCount = 0;

            if (_exitDateTime == null)
            {
                // We also set exit time if it's null
                _exitDateTime = _timeProvider.Now;
            }

            Enter?.Invoke(this, new EventArgs());
        }
Ejemplo n.º 10
0
 private void InitializeBackingControl(Control textBox)
 {
     textBox.AllowDrop    = true;
     textBox.DragEnter   += SETextBox_DragEnter;
     textBox.DragDrop    += SETextBox_DragDrop;
     textBox.GotFocus    += (sender, args) => { _gotFocusTicks = DateTime.UtcNow.Ticks; };
     textBox.MouseDown   += SETextBox_MouseDown;
     textBox.MouseUp     += SETextBox_MouseUp;
     textBox.TextChanged += TextChangedHighlight;
     Controls.Add(textBox);
     textBox.Dock         = DockStyle.Fill;
     textBox.Enter       += (sender, args) => { BackColor = SystemColors.Highlight; };
     textBox.Leave       += (sender, args) => { BackColor = SystemColors.WindowFrame; };
     textBox.TextChanged += (sender, args) => { TextChanged?.Invoke(sender, args); };
     textBox.KeyDown     += (sender, args) => { KeyDown?.Invoke(sender, args); };
     textBox.MouseClick  += (sender, args) => { MouseClick?.Invoke(sender, args); };
     textBox.Enter       += (sender, args) => { Enter?.Invoke(sender, args); };
     textBox.KeyUp       += (sender, args) => { KeyUp?.Invoke(sender, args); };
     textBox.Leave       += (sender, args) => { Leave?.Invoke(sender, args); };
     textBox.MouseMove   += (sender, args) => { MouseMove?.Invoke(sender, args); };
 }
Ejemplo n.º 11
0
 public override void LateUpdate()
 {
     if (enabled)
     {
         if (containsMouse)
         {
             if (!hovering)
             {
                 Enter?.Invoke(this);
                 hovering = true;
             }
             else
             {
                 Stay?.Invoke(this);
             }
         }
         else if (hovering)
         {
             Exit?.Invoke(this);
             hovering = false;
         }
     }
 }
Ejemplo n.º 12
0
 public virtual void OnEnter(PlayerEventArgs e)
 {
     AssertNotDisposed();
     Enter?.Invoke(this, e);
 }
 private void OnCollisionEnter(Collision other)
 {
     Enter?.Invoke(other);
 }
Ejemplo n.º 14
0
 private void OnCollisionEnter(Collision collision)
 {
     Enter?.Invoke(collision);
 }
Ejemplo n.º 15
0
 private void OnTriggerEnter(Collider other)
 {
     Enter?.Invoke(other);
 }
Ejemplo n.º 16
0
 public void OnPointerEnter(PointerEventData eventData)
 {
     Enter?.Invoke(gameObject);
 }
Ejemplo n.º 17
0
 internal void OnEnter()
 {
     Enter?.Invoke();
 }
Ejemplo n.º 18
0
 protected virtual void OnEnter(int a, int b)
 {
     Enter?.Invoke(a, b);
 }
Ejemplo n.º 19
0
 public void OnEnterState(IState?previous)
 {
     Enter?.Invoke(previous);
 }
Ejemplo n.º 20
0
 protected internal virtual void OnEnter(EventArgs e)
 {
     Enter?.Invoke(this, e);
 }
Ejemplo n.º 21
0
 public void OnFocusEnter()
 {
     Debug.Log("Hololens Enter");
     Enter?.Invoke(null);
 }
 public void OnPointerEnter(PointerEventData eventData)
 {
     Enter?.Invoke();
 }
Ejemplo n.º 23
0
 /// <inheritdoc />
 void IState.Enter() =>
 Enter?.Invoke();
Ejemplo n.º 24
0
 protected virtual void OnGotFocus(object sender, EventArgs e)
 {
     Activated?.Invoke(this, EventArgs.Empty);
     Enter?.Invoke(this, EventArgs.Empty);
 }
Ejemplo n.º 25
0
        public override void Update()
        {
            if (Mouse.ButtonPressed(MouseButtons.Left))
            {
                var isFocused = IsMouseOver();
                if (isFocused != IsFocused)
                {
                    IsFocused = isFocused;
                    FocusChanged?.Invoke(this, new FocusChangedEventArgs(IsFocused));
                }

                if (IsFocused && Font.HitTest(Mouse.Position - Position, Text, ActualWidth, out int i))
                {
                    _cursorPos = i;
                }
            }

            if (!IsFocused)
            {
                return;
            }

            //Toggle cursor every half second
            _cursorTick += GameTime.UnscaledDeltaTime;
            if (_cursorTick >= .5f)
            {
                _showCursor = !_showCursor;
                _cursorTick = 0;
            }

            //Cursor navigation
            //Always show cursor when navigating
            if (_cursorPos > 0 && Keyboard.KeyPressed(Keys.Left))
            {
                _cursorPos--;
                _cursorTick = 0;
                _showCursor = true;
                HandleInputEvent(Keys.Left);
            }
            else if (_cursorPos < _text.Length && Keyboard.KeyPressed(Keys.Right))
            {
                _cursorPos++;
                _cursorTick = 0;
                _showCursor = true;
                HandleInputEvent(Keys.Right);
            }

            if (Keyboard.KeyPressed(Keys.Enter))
            {
                Enter?.Invoke(this, new EventArgs());
                HandleInputEvent(Keys.Enter);
            }

            //Text deletion
            if (Keyboard.KeyPressed(Keys.Backspace) && _cursorPos > 0)
            {
                _text = _text.Remove(_cursorPos - 1, 1);
                _cursorPos--;
                HandleInputEvent(Keys.Backspace);
            }
            if (Keyboard.KeyPressed(Keys.Delete) && _cursorPos < _text.Length)
            {
                _text = _text.Remove(_cursorPos, 1);
                HandleInputEvent(Keys.Delete);
            }

            //Text input
            var keys = Enum.GetValues(typeof(Keys));

            for (int i = 0; i < keys.Length; i++)
            {
                var k = (Keys)keys.GetValue(i);
                if (Keyboard.KeyPressed(k))
                {
                    var text = Keyboard.ToUnicode(k);
                    if (text != "\b")
                    {
                        _text       = _text.Insert(_cursorPos, text);
                        _cursorPos += text.Length;
                    }
                    HandleInputEvent(k);
                }
            }
        }
Ejemplo n.º 26
0
 protected override void OnEnter(EventArgs e)
 {
     this.Invalidate();
     Enter?.Invoke();
     base.OnEnter(e);
 }
Ejemplo n.º 27
0
 public void OnPointerEnter(PointerEventData eventData) => Enter?.Invoke(eventData);
Ejemplo n.º 28
0
 private void gridView_Enter(object sender, EventArgs e)
 {
     Enter?.Invoke(this, e);
 }
Ejemplo n.º 29
0
        //---------------------------------------------------------------------------

        private void OnEnter(IEntity source, IEntity target)
        {
            Enter?.Invoke(source, target);
        }
        /// <summary>Atualiza o componente.</summary>
        /// <param name="gameTime">Fornece acesso aos valores de tempo do jogo.</param>
        protected override void _Update(GameTime gameTime)
        {
            dclickTime += gameTime.ElapsedGameTime.Milliseconds;

            if (dclickTime > DoubleClickDelay)
            {
                dclickTime = 0;
                clicks     = 0;
            }

            Rectangle bounds = Actor.Bounds;
            Screen    screen = Screen;

            old   = state;
            state = Mouse.GetState();

            //Se o ponteiro do mouse consta como dentro dos limites
            if (mouseOn)
            {
                //mas verificando novamente ele consta fora
                if (!bounds.Contains(state.Position))
                {
                    Leave?.Invoke(Actor, state);
                }
            }

            //se o ponteiro do mouse está dentro dos limites da entidade.
            if (bounds.Contains(state.Position))
            {
                //se o ponteiro do mouse se encontrava fora
                if (!mouseOn)
                {
                    Enter?.Invoke(Actor, state);
                }

                mouseOn = true;
                On?.Invoke(Actor, state);

                //se um botão foi pressionado enquanto o controle está dentro
                if (state.LeftButton == ButtonState.Pressed ||
                    state.RightButton == ButtonState.Pressed ||
                    state.MiddleButton == ButtonState.Pressed)
                {
                    //old = state;
                    Down?.Invoke(Actor, state);
                }

                //se um botão foi liberado
                if (old.LeftButton == ButtonState.Pressed && state.LeftButton == ButtonState.Released ||
                    old.RightButton == ButtonState.Pressed && state.RightButton == ButtonState.Released ||
                    old.MiddleButton == ButtonState.Pressed && state.MiddleButton == ButtonState.Released)
                {
                    Up?.Invoke(Actor, state);
                }

                //Verifica se houve clique duplo
                if (old.LeftButton == ButtonState.Released && state.LeftButton == ButtonState.Pressed)
                {
                    clicks++;
                    dclickTime = 0;

                    if (clicks >= 2 && dclickTime < DoubleClickDelay)
                    {
                        DoubleClick?.Invoke(Actor, state);
                        clicks     = 0;
                        dclickTime = 0;
                    }
                }
            }
            else
            {
                mouseOn = false;
                //old = state;
            }
        }