1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- using System;
- using UnityEngine;
- [AddComponentMenu("NGUI/Interaction/Forward Events (Legacy)")]
- public class UIForwardEvents : MonoBehaviour
- {
- private void OnHover(bool isOver)
- {
- if (this.onHover && this.target != null)
- {
- this.target.SendMessage("OnHover", isOver, SendMessageOptions.DontRequireReceiver);
- }
- }
- private void OnPress(bool pressed)
- {
- if (this.onPress && this.target != null)
- {
- this.target.SendMessage("OnPress", pressed, SendMessageOptions.DontRequireReceiver);
- }
- }
- private void OnClick()
- {
- if (this.onClick && this.target != null)
- {
- this.target.SendMessage("OnClick", SendMessageOptions.DontRequireReceiver);
- }
- }
- private void OnDoubleClick()
- {
- if (this.onDoubleClick && this.target != null)
- {
- this.target.SendMessage("OnDoubleClick", SendMessageOptions.DontRequireReceiver);
- }
- }
- private void OnSelect(bool selected)
- {
- if (this.onSelect && this.target != null)
- {
- this.target.SendMessage("OnSelect", selected, SendMessageOptions.DontRequireReceiver);
- }
- }
- private void OnDrag(Vector2 delta)
- {
- if (this.onDrag && this.target != null)
- {
- this.target.SendMessage("OnDrag", delta, SendMessageOptions.DontRequireReceiver);
- }
- }
- private void OnDrop(GameObject go)
- {
- if (this.onDrop && this.target != null)
- {
- this.target.SendMessage("OnDrop", go, SendMessageOptions.DontRequireReceiver);
- }
- }
- private void OnSubmit()
- {
- if (this.onSubmit && this.target != null)
- {
- this.target.SendMessage("OnSubmit", SendMessageOptions.DontRequireReceiver);
- }
- }
- private void OnScroll(float delta)
- {
- if (this.onScroll && this.target != null)
- {
- this.target.SendMessage("OnScroll", delta, SendMessageOptions.DontRequireReceiver);
- }
- }
- public GameObject target;
- public bool onHover;
- public bool onPress;
- public bool onClick;
- public bool onDoubleClick;
- public bool onSelect;
- public bool onDrag;
- public bool onDrop;
- public bool onSubmit;
- public bool onScroll;
- }
|