Пример #1
0
    static bool IsVisible(ref DepthEntry de)
#endif
    {
        UIPanel panel = NGUITools.FindInParents <UIPanel>(de.hit.collider.gameObject);

        return(panel == null || panel.IsVisible(de.hit.point));
    }
Пример #2
0
	static bool IsVisible (ref DepthEntry de)
#endif
	{
		UIPanel panel = NGUITools.FindInParents<UIPanel>(de.go);

		while (panel != null)
		{
			if (!panel.IsVisible(de.hit.point)) return false;
			panel = panel.parentPanel;
		}
		return true;
	}
Пример #3
0
    private static bool IsVisible(ref DepthEntry de)
    {
        UIPanel uIPanel = NGUITools.FindInParents <UIPanel>(de.go);

        while (uIPanel != null)
        {
            if (!uIPanel.IsVisible(de.hit.point))
            {
                return(false);
            }
            uIPanel = uIPanel.parentPanel;
        }
        return(true);
    }
Пример #4
0
        private static bool IsShowing(ref DepthEntry de)
        #endif
        {
            var panel = NGUITools.FindInParents <UIPanel>(de.go);

            while (panel != null)
            {
                if (!panel.IsVisible(de.point))
                {
                    return(false);
                }
                panel = panel.parentPanel;
            }
            return(true);
        }
Пример #5
0
	static bool IsVisible (ref DepthEntry de)
#endif
	{
		UIPanel panel = NGUITools.FindInParents<UIPanel>(de.go);

		while (panel != null)
		{
			if (!panel.IsVisible(de.point)) return false;
			panel = panel.parentPanel;
		}
		return true;
	}
Пример #6
0
	/// <summary>
	/// Helper function to check if the specified hit is visible by the panel.
	/// </summary>

#if UNITY_FLASH
	static bool IsVisible (DepthEntry de)
Пример #7
0
	/// <summary>
	/// Helper function to check if the specified hit is visible by the panel.
	/// </summary>

	static bool IsVisible (ref DepthEntry de)
	{
		UIPanel panel = NGUITools.FindInParents<UIPanel>(de.hit.collider.gameObject);
		return (panel == null || panel.IsVisible(de.hit.point));
	}
Пример #8
0
    /// <summary>
    /// Helper function to check if the specified hit is visible by the panel.
    /// </summary>

#if UNITY_FLASH
    static bool IsVisible(DepthEntry de)
Пример #9
0
        public void ClickCenter()
        {
            var mHit  = new DepthEntry();
            var mHits = new BetterList <DepthEntry>();

            var cam = UIManager.Instance.UICamera.GetComponent <UICamera>();

            UIEventTrigger.current = null;

            // Convert to view space
            var currentCamera = cam.cachedCamera;

            // Cast a ray into the screen
            var p = Hollow.transform.position;

            p.z = currentCamera.nearClipPlane;
            var ray = new Ray(p, Vector3.forward);

            // Raycast into the screen
            var mask = currentCamera.cullingMask & cam.eventReceiverMask;
            var dist = (cam.rangeDistance > 0f)
                    ? cam.rangeDistance
                    : currentCamera.farClipPlane - currentCamera.nearClipPlane;

            var hits = Physics.RaycastAll(ray, dist, mask);

            if (hits.Length > 1)
            {
                for (var b = 0; b < hits.Length; ++b)
                {
                    var go = hits[b].collider.gameObject;

                    if (go == Hollow.gameObject)
                    {
                        continue;
                    }

                    var w = go.GetComponent <UIWidget>();

                    if (w != null)
                    {
                        if (!w.isVisible)
                        {
                            continue;
                        }
                        if (w.hitCheck != null && !w.hitCheck(hits[b].point))
                        {
                            continue;
                        }
                    }
                    else
                    {
                        var rect = NGUITools.FindInParents <UIRect>(go);
                        if (rect != null && rect.finalAlpha < 0.001f)
                        {
                            continue;
                        }
                    }

                    mHit.depth = NGUITools.CalculateRaycastDepth(go);

                    if (mHit.depth != int.MaxValue)
                    {
                        mHit.hit   = hits[b];
                        mHit.point = hits[b].point;
                        mHit.go    = hits[b].collider.gameObject;
                        mHits.Add(mHit);
                    }
                }

                mHits.Sort(delegate(DepthEntry r1, DepthEntry r2) { return(r2.depth.CompareTo(r1.depth)); });

                for (var b = 0; b < mHits.size; ++b)
                {
        #if UNITY_FLASH
                    if (IsShowing(mHits.buffer[b]))
        #else
                    if (IsShowing(ref mHits.buffer[b]))
        #endif
                    {
                        MessageNotify(mHits.buffer[b].go, "OnClick", null);
                        return;
                    }
                }
                mHits.Clear();
            }
            else if (hits.Length == 1)
            {
                var go = hits[0].collider.gameObject;

                if (go == Hollow.gameObject)
                {
                    return;
                }

                var w = go.GetComponent <UIWidget>();

                if (w != null)
                {
                    if (!w.isVisible)
                    {
                        return;
                    }
                    if (w.hitCheck != null && !w.hitCheck(hits[0].point))
                    {
                        return;
                    }
                }
                else
                {
                    var rect = NGUITools.FindInParents <UIRect>(go);
                    if (rect != null && rect.finalAlpha < 0.001f)
                    {
                        return;
                    }
                }

                if (IsShowing(hits[0].point, hits[0].collider.gameObject))
                {
                    MessageNotify(hits[0].collider.gameObject, "OnClick", null);
                }
            }
        }
Пример #10
0
 static bool IsShowing(DepthEntry de)