ITouchable testTouchable(UIObject touchableObj, Vector2 touchPosition)
    {
        foreach (Transform t in touchableObj.client.transform)
        {
            UIElement uie = t.GetComponent <UIElement>();
            if (uie != null)
            {
                UIObject o = t.GetComponent <UIElement>().UIObject;
                if (o != null)
                {
                    var touched = testTouchable(o, touchPosition);
                    if (touched != null)
                    {
                        return(touched);
                    }
                }
            }
        }

        ITouchable touchable = touchableObj as ITouchable;

        if (touchable != null)
        {
            if (touchable.hitTest(touchPosition))
            {
                return(touchable as ITouchable);
            }
        }

        return(null);
    }
Пример #2
0
    public ITouchable testTouchable(UIObject touchableObj, Vector2 touchPosition)
    {
        /*
         *      foreach( Transform t in touchableObj.client.transform )
         *      {
         *              UIElement uie = t.GetComponent<UIElement>();
         *              if( uie != null )
         *              {
         *                      UIObject o = t.GetComponent<UIElement>().UIObject;
         *                      if( o != null )
         *                      {
         *                              var touched = testTouchable( o, touchPosition );
         *                              if( touched != null )
         *                                      return touched;
         *                      }
         *              }
         *      }*/

        ITouchable touchable = touchableObj as ITouchable;

        if (touchable != null)
        {
            Debug.Log("test" + " (" + Time.time + ")");
            if (touchable.hitTest(touchPosition))
            {
                Debug.Log("hittest" + " (" + Time.time + ")");
                return(touchable as ITouchable);
            }
        }

        return(null);
    }