private static bool IsMouseAction(MouseTrigger a, MouseButtonEventArgs e, int clickCount) { if (clickCount != TriggerClickCount(a)) { return(false); } if (a == MouseTrigger.LeftClick && e.ChangedButton == MouseButton.Left) { return(true); } if (a == MouseTrigger.MiddleClick && e.ChangedButton == MouseButton.Middle) { return(true); } if (a == MouseTrigger.RightClick && e.ChangedButton == MouseButton.Right) { return(true); } else { return(false); } }
public override void Init() { stateHandle.Init(); stateHandle.AsyncState(_state); mTrigger = GetComponent <MouseTrigger>(); mTrigger.onEnter += Ontrigger; mTrigger.onExit += Ontrigger; mTrigger.onDown += Ontrigger; mTrigger.onUp += Ontrigger; SetGlobalLock(false); SetPrivateLock(false); }
/// <summary> /// Returns the amount of clicks represented by specified mouse trigger. /// </summary> private int TriggerClickCount(MouseTrigger a) { if (a == MouseTrigger.None) { return(0); } else if (a == MouseTrigger.LeftClick || a == MouseTrigger.MiddleClick || a == MouseTrigger.RightClick) { return(1); } else { return(2); } }
private static bool IsMouseAction(MouseTrigger a, MouseButton button, int clickCount) { if (clickCount != TriggerClickCount(a)) { return(false); } if (a == MouseTrigger.LeftClick && button == MouseButton.Left) { return(true); } if (a == MouseTrigger.MiddleClick && button == MouseButton.Middle) { return(true); } if (a == MouseTrigger.RightClick && button == MouseButton.Right) { return(true); } return(false); }
public bool IsIn(MouseTrigger t) { return x >= t.position.x && y >= t.position.y && x <= t.position.x + t.size.x && y <= t.position.y + t.size.y; }