/// <summary> /// Removes a mouse/touchpad pointer listener. /// </summary> /// <param name="del">Delegate to be removed.</param> public void RemoveRayPtrListener(PointerInfoDelegate del) { rayListeners -= del; }
/// <summary> /// Registers a delegate to be called with all ray /// pointer input. Use this when you want to "listen" /// to all ray input. /// </summary> /// <param name="del">Delegate to be called.</param> public void AddRayPtrListener(PointerInfoDelegate del) { rayListeners += del; }
/// <summary> /// Removes a mouse/touchpad pointer listener. /// </summary> /// <param name="del">Delegate to be removed.</param> public void RemoveMouseTouchPtrListener(PointerInfoDelegate del) { mouseTouchListeners -= del; }
/// <summary> /// Removes a delegate previously added with SetNonUIHitDelegate() /// or AddNonUIHitDelegate(). /// </summary> /// <param name="del"></param> public void RemoveNonUIHitDelegate(PointerInfoDelegate del) { informNonUIHit -= del; }
/// <summary> /// Registers a delegate to be called with all mouse /// and touchpad pointer input. Use this when you /// want to "listen" to all mouse or touchpad input. /// </summary> /// <param name="del">Delegate to be called.</param> public void AddMouseTouchPtrListener(PointerInfoDelegate del) { mouseTouchListeners += del; }
/// <summary> /// Sets the delegate to be called when a raycast is /// performed on an input event which hits a non-UI /// object. Use this when your game uses raycasts for /// non-UI game purposes but you don't want to waste /// performance with a redundant set of raycasts. /// NOTE: This will replace any previously registered /// delegates. /// </summary> /// <param name="del">Delegate to be called.</param> public void SetNonUIHitDelegate(PointerInfoDelegate del) { informNonUIHit = del; }
/// <summary> /// Adds a delegate to be called when a raycast is /// performed on an input event which hits a non-UI /// object. Use this when your game uses raycasts for /// non-UI game purposes but you don't want to waste /// performance with a redundant set of raycasts. /// </summary> /// <param name="del">Delegate to be called.</param> public void AddNonUIHitDelegate(PointerInfoDelegate del) { informNonUIHit += del; }
/// <summary> /// Removes a mouse/touchpad pointer listener. /// </summary> /// <param name="del">Delegate to be removed.</param> public void RemoveMouseTouchPtrListener(PointerInfoDelegate del) { RemovePtrListener(mouseTouchListeners, del); }
/// <summary> /// Removes a mouse/touchpad pointer listener. /// </summary> /// <param name="del">Delegate to be removed.</param> public void RemoveRayPtrListener(PointerInfoDelegate del) { RemovePtrListener(rayListeners, del); }
// Helper method that removes a pointer listener from a list: protected void RemovePtrListener(EZLinkedList<EZLinkedListNode<PointerInfoDelegate>> list, PointerInfoDelegate del) { for (EZLinkedListIterator<EZLinkedListNode<PointerInfoDelegate>> i = list.Begin(); !i.Done; i.Next()) { if (i.Current.val == del) { // Save it: EZLinkedListNode<PointerInfoDelegate> node = i.Current; // Remove it from the active list: list.Remove(i.Current); // Add it to our free pool: listenerPool.Add(node); // We're done. i.End(); break; } } }
/// <summary> /// Registers a delegate to be called with all ray /// pointer input. Use this when you want to "listen" /// to all ray input. /// </summary> /// <param name="del">Delegate to be called.</param> public void AddRayPtrListener(PointerInfoDelegate del) { rayListeners.Add(GetPtrListenNode(del)); }
/// <summary> /// Registers a delegate to be called with all mouse /// and touchpad pointer input. Use this when you /// want to "listen" to all mouse or touchpad input. /// </summary> /// <param name="del">Delegate to be called.</param> public void AddMouseTouchPtrListener(PointerInfoDelegate del) { mouseTouchListeners.Add(GetPtrListenNode(del)); }
protected EZLinkedListNode<PointerInfoDelegate> GetPtrListenNode(PointerInfoDelegate del) { EZLinkedListNode<PointerInfoDelegate> delNode; if (listenerPool.Count > 0) { delNode = listenerPool.Head; listenerPool.Remove(delNode); delNode.val = del; } else delNode = new EZLinkedListNode<PointerInfoDelegate>(del); return delNode; }
/// <summary> /// Registers a delegate to be called when a raycast is /// performed on an input event which hits a non-UI /// object. Use this when your game uses raycasts for /// non-UI game purposes but you don't want to waste /// performance with a redundant set of raycasts. /// </summary> /// <param name="del">Delegate to be called.</param> /// <returns>The previous delegate. It is recommended to save /// this value and call it in your own delegate to preserve /// the delegate chain.</returns> public PointerInfoDelegate SetNonUIHitDelegate(PointerInfoDelegate del) { PointerInfoDelegate oldDel = informNonUIHit; informNonUIHit = del; return oldDel; }