public Action <GameObject, PointerEventData> RegisterOnClick(GameObject gameObject, Action action, string soundPath = null) { Button button = gameObject.GetComponent <Button>(); Action <GameObject, PointerEventData> result = (go, eventData) => { if (!soundPath.IsNullOrWhiteSpace()) { Client.instance.audioManager.PlayUISound(soundPath); } action(); }; UGUIEventListener.Get(button).onClick += result; SaveRegisteredUGUIEventListener(gameObject.GetComponent <UGUIEventListener>()); return(result); }
public void UnRegisterOnPointerDown(GameObject gameObject, Action <GameObject, BaseEventData> action) { UGUIEventListener.RemoveListener(gameObject, action, "onPointerDown"); }
public void UnRegisterOnDrag(GameObject gameObject, Action <GameObject, BaseEventData> action) { UGUIEventListener.RemoveListener(gameObject, action, "onDrag"); }
public void UnRegister(GameObject gameObject) { UGUIEventListener.RemoveAllListener(gameObject); }