예제 #1
0
        public static DragHandler Get(GameObject go)
        {
            DragHandler result = go.GetComponent <DragHandler>();

            if (result == null)
            {
                result = go.AddComponent <DragHandler>();
            }
            return(result);
        }
예제 #2
0
        private void Start()
        {
            if (handler == null)
            {
                handler = transform.GetChild(1) as RectTransform;
            }
            if (bound == null)
            {
                bound = transform.GetChild(0) as RectTransform;
            }

            onValueChange = new CorssValueSetterEvent();
            fix           = RelativeFix.Get(handler);
            DragHandler.Get(handler.gameObject).OnDragAction.AddListener(OnDrag);
            DragHandler.Get(handler.gameObject).OnDropAction.AddListener(OnDrop);
            ClickHandler.Get(bound.gameObject).OnClickAction.AddListener(OnClick);
            value = Vector2.zero;
        }
예제 #3
0
 void Start()
 {
     DragHandler.Get(gameObject).OnDragAction.AddListener(OnDrag);
     DragHandler.Get(gameObject).OnDropAction.AddListener(OnDrop);
 }