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(); }
private void OnTriggerEnter(Collider other) { var player = other.gameObject.GetComponent <PlayerMove>(); if (player != null) { Enter?.Invoke(); } }
private void EKeyDown(object s, KeyEventArgs e) { if (e.Key == Key.Enter) { e.Handled = true; this.KeyDown -= EKeyDown; this.KeyUp += EKeyUP; Enter.Invoke(); } }
// 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; }
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); }; }
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; } }
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); }
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()); }
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); }; }
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; } } }
public virtual void OnEnter(PlayerEventArgs e) { AssertNotDisposed(); Enter?.Invoke(this, e); }
private void OnCollisionEnter(Collision other) { Enter?.Invoke(other); }
private void OnCollisionEnter(Collision collision) { Enter?.Invoke(collision); }
private void OnTriggerEnter(Collider other) { Enter?.Invoke(other); }
public void OnPointerEnter(PointerEventData eventData) { Enter?.Invoke(gameObject); }
internal void OnEnter() { Enter?.Invoke(); }
protected virtual void OnEnter(int a, int b) { Enter?.Invoke(a, b); }
public void OnEnterState(IState?previous) { Enter?.Invoke(previous); }
protected internal virtual void OnEnter(EventArgs e) { Enter?.Invoke(this, e); }
public void OnFocusEnter() { Debug.Log("Hololens Enter"); Enter?.Invoke(null); }
public void OnPointerEnter(PointerEventData eventData) { Enter?.Invoke(); }
/// <inheritdoc /> void IState.Enter() => Enter?.Invoke();
protected virtual void OnGotFocus(object sender, EventArgs e) { Activated?.Invoke(this, EventArgs.Empty); Enter?.Invoke(this, EventArgs.Empty); }
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); } } }
protected override void OnEnter(EventArgs e) { this.Invalidate(); Enter?.Invoke(); base.OnEnter(e); }
public void OnPointerEnter(PointerEventData eventData) => Enter?.Invoke(eventData);
private void gridView_Enter(object sender, EventArgs e) { Enter?.Invoke(this, e); }
//--------------------------------------------------------------------------- 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; } }