2018-02-24 05:55:51 +08:00
|
|
|
namespace EventSystem.Framework.FunctionEvents
|
2018-02-23 03:43:18 +08:00
|
|
|
{
|
2018-12-30 18:00:05 +08:00
|
|
|
/// <summary>Used to handle mouse interactions with button clicks and scrolling the mouse wheel.</summary>
|
2018-02-24 05:55:51 +08:00
|
|
|
public class MouseButtonEvents
|
2018-02-23 03:43:18 +08:00
|
|
|
{
|
2018-12-30 18:00:05 +08:00
|
|
|
/// <summary>Function that runs when the user left clicks.</summary>
|
2018-02-23 03:43:18 +08:00
|
|
|
public functionEvent onLeftClick;
|
2018-12-30 18:00:05 +08:00
|
|
|
|
|
|
|
/// <summary>Function that runs when the user right clicks.</summary>
|
2018-02-23 03:43:18 +08:00
|
|
|
public functionEvent onRightClick;
|
2018-12-30 18:00:05 +08:00
|
|
|
|
|
|
|
/// <summary>Function that runs when the user scrolls the mouse wheel.</summary>
|
2018-02-23 03:43:18 +08:00
|
|
|
public functionEvent onMouseScroll;
|
|
|
|
|
2018-12-30 18:00:05 +08:00
|
|
|
/// <summary>A constructor used to set a single function to a mouse button.</summary>
|
2018-02-23 03:43:18 +08:00
|
|
|
/// <param name="clickFunction"></param>
|
|
|
|
/// <param name="leftClick">If true the function is set to the left click. If false the function is set to the right click.</param>
|
|
|
|
public MouseButtonEvents(functionEvent clickFunction, bool leftClick)
|
|
|
|
{
|
2018-12-30 18:00:05 +08:00
|
|
|
if (leftClick) this.onLeftClick = clickFunction;
|
2018-02-23 03:43:18 +08:00
|
|
|
else this.onRightClick = clickFunction;
|
|
|
|
}
|
|
|
|
|
2018-12-30 18:00:05 +08:00
|
|
|
/// <summary>A constructor used to map functions to mouse clicks.</summary>
|
2018-02-23 03:43:18 +08:00
|
|
|
/// <param name="OnLeftClick">A function to be ran when the mouse left clicks this position.</param>
|
|
|
|
/// <param name="OnRightClick">A function to be ran when the mouse right clicks this position.</param>
|
|
|
|
public MouseButtonEvents(functionEvent OnLeftClick, functionEvent OnRightClick)
|
|
|
|
{
|
|
|
|
this.onLeftClick = OnLeftClick;
|
|
|
|
this.onRightClick = OnRightClick;
|
|
|
|
}
|
|
|
|
|
2018-12-30 18:00:05 +08:00
|
|
|
/// <summary>A constructor used to map functions to mouse clicks and scrolling the mouse wheel.</summary>
|
2018-02-23 03:43:18 +08:00
|
|
|
/// <param name="OnLeftClick">A function to be ran when the mouse left clicks this position.</param>
|
|
|
|
/// <param name="OnRightClick">A function to be ran when the mouse right clicks this position.</param>
|
|
|
|
/// <param name="OnMouseScroll">A function to be ran when the user scrolls the mouse</param>
|
2018-12-30 18:00:05 +08:00
|
|
|
public MouseButtonEvents(functionEvent OnLeftClick, functionEvent OnRightClick, functionEvent OnMouseScroll)
|
2018-02-23 03:43:18 +08:00
|
|
|
{
|
|
|
|
this.onLeftClick = OnLeftClick;
|
|
|
|
this.onRightClick = OnRightClick;
|
|
|
|
this.onMouseScroll = OnMouseScroll;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|