void HandleMouseButtonUp(MouseButtonUpEvent args) { if (pickedNode != null) { StaticSprite2D staticSprite = pickedNode.GetComponent <StaticSprite2D>(); staticSprite.Color = (new Color(1.0f, 1.0f, 1.0f, 1.0f)); // Restore picked sprite color pickedNode.RemoveComponent <ConstraintMouse2D>(); pickedNode = null; } UnsubscribeFromEvent <MouseMoveEvent>(); UnsubscribeFromEvent <MouseButtonUpEvent>(); }
public EventManager.EventResult handleInput(Event e) { switch (e.name) { case "input.keyboard.key.up": { KeyUpEvent ke = e as KeyUpEvent; handleKeyboardUp(ke.key); break; } case "input.keyboard.key.down": { KeyDownEvent ke = e as KeyDownEvent; handleKeyboardDown(ke.key); break; } case "input.mouse.wheel": { MouseWheelEvent me = e as MouseWheelEvent; handleMouseWheel(me.delta); break; } case "input.mouse.button.up": { MouseButtonUpEvent me = e as MouseButtonUpEvent; handleMouseButtonUp(me.button); break; } case "input.mouse.button.down": { MouseButtonDownEvent me = e as MouseButtonDownEvent; handleMouseButtonDown(me.button); break; } case "input.mouse.move": { MouseMoveEvent me = e as MouseMoveEvent; handleMouseMove(me.xDelta, -me.yDelta); break; } } return(EventManager.EventResult.HANDLED); }
protected virtual void OnDragEndEvent() { MouseButtonUpEvent?.Invoke(); }
void HandleMouseButtonUp(MouseButtonUpEvent args) { if (pickedNode != null) { StaticSprite2D staticSprite = pickedNode.GetComponent<StaticSprite2D>(); staticSprite.Color = (new Color(1.0f, 1.0f, 1.0f, 1.0f)); // Restore picked sprite color pickedNode.RemoveComponent<ConstraintMouse2D>(); pickedNode = null; } UnsubscribeFromEvent<MouseMoveEvent>(); UnsubscribeFromEvent<MouseButtonUpEvent>(); }