ConstrainRect() статический публичный Метод

Constrain 'rect' to be within 'area' as much as possible, returning the Vector2 offset necessary for this to happen. This function is useful when trying to restrict one area (window) to always be within another (viewport).
static public ConstrainRect ( Vector2 minRect, Vector2 maxRect, Vector2 minArea, Vector2 maxArea ) : Vector2
minRect Vector2
maxRect Vector2
minArea Vector2
maxArea Vector2
Результат Vector2
Пример #1
0
    public virtual Vector3 CalculateConstrainOffset(Vector2 min, Vector2 max)
    {
        Vector4 finalClipRegion = this.finalClipRegion;
        float   num             = finalClipRegion.z * 0.5f;
        float   num2            = finalClipRegion.w * 0.5f;
        Vector2 zero            = Vector2.zero;

        zero.x = min.x;
        zero.y = min.y;
        Vector2 minRect = zero;

        zero.x = max.x;
        zero.y = max.y;
        Vector2 maxRect = zero;

        zero.x = finalClipRegion.x - num;
        zero.y = finalClipRegion.y - num2;
        Vector2 minArea = zero;

        zero.x = finalClipRegion.x + num;
        zero.y = finalClipRegion.y + num2;
        Vector2 maxArea = zero;

        if (this.clipping == UIDrawCall.Clipping.SoftClip)
        {
            minArea.x += this.clipSoftness.x;
            minArea.y += this.clipSoftness.y;
            maxArea.x -= this.clipSoftness.x;
            maxArea.y -= this.clipSoftness.y;
        }
        return(NGUIMath.ConstrainRect(minRect, maxRect, minArea, maxArea));
    }
Пример #2
0
    public Vector3 CalculateConstrainOffset(Vector2 min, Vector2 max)
    {
        Vector4 clipRange  = this.clipRange;
        float   num        = clipRange.z * 0.5f;
        Vector4 clipRange2 = this.clipRange;
        float   num2       = clipRange2.w * 0.5f;
        Vector2 minRect    = new Vector2(min.x, min.y);
        Vector2 maxRect    = new Vector2(max.x, max.y);
        Vector4 clipRange3 = this.clipRange;
        float   x          = clipRange3.x - num;
        Vector4 clipRange4 = this.clipRange;
        Vector2 minArea    = new Vector2(x, clipRange4.y - num2);
        Vector4 clipRange5 = this.clipRange;
        float   x2         = clipRange5.x + num;
        Vector4 clipRange6 = this.clipRange;
        Vector2 maxArea    = new Vector2(x2, clipRange6.y + num2);

        if (clipping == UIDrawCall.Clipping.SoftClip)
        {
            float   x3           = minArea.x;
            Vector2 clipSoftness = this.clipSoftness;
            minArea.x = x3 + clipSoftness.x;
            float   y             = minArea.y;
            Vector2 clipSoftness2 = this.clipSoftness;
            minArea.y = y + clipSoftness2.y;
            float   x4            = maxArea.x;
            Vector2 clipSoftness3 = this.clipSoftness;
            maxArea.x = x4 - clipSoftness3.x;
            float   y2            = maxArea.y;
            Vector2 clipSoftness4 = this.clipSoftness;
            maxArea.y = y2 - clipSoftness4.y;
        }
        return(NGUIMath.ConstrainRect(minRect, maxRect, minArea, maxArea));
    }
Пример #3
0
    /// <summary>
    /// Calculate the offset needed to be constrained within the panel's bounds.
    /// </summary>

    public Vector3 CalculateConstrainOffset(Vector2 min, Vector2 max)
    {
//		Vector4 clipRange=new Vector4();
//		clipRange.x=this.clipRange.x;
//		clipRange.y=this.clipRange.y;
//		clipRange.w=this.clipRange.w;
//		clipRange.z=this.clipRange.z;
//		if(isTop&&(max.y-min.y)<clipRange.w)
//		{
////			clipRange.w=max.y-min.y;
////			clipRange.y=this.clipRange.y+(this.clipRange.w-clipRange.w);
//			clipRange.y=-clipRange.w*0.05f;
//		}

        float offsetX = clipRange.z * 0.5f;
        float offsetY = clipRange.w * 0.5f;



        Vector2 minRect = new Vector2(min.x, min.y);
        Vector2 maxRect = new Vector2(max.x, max.y);
        Vector2 minArea = new Vector2(clipRange.x - offsetX, clipRange.y - offsetY);
        Vector2 maxArea = new Vector2(clipRange.x + offsetX, clipRange.y + offsetY);

        if (clipping == UIDrawCall.Clipping.SoftClip)
        {
            minArea.x += clipSoftness.x;
            minArea.y += clipSoftness.y;
            maxArea.x -= clipSoftness.x;
            maxArea.y -= clipSoftness.y;
        }

        Vector2 v2 = NGUIMath.ConstrainRect(minRect, maxRect, minArea, maxArea);

        if (isTop && (max.y - min.y) < clipRange.w)
        {
            float temY = -clipRange.w / 2;

            v2.y = -temY + clipRange.y;
//			Debug.Log("temY:"+temY+" v2.y:"+v2.y+"  clipRqnge.y:"+clipRange.y);
        }
//		Debug.Log("max:"+max+" min:"+min+" clipRange.z:"+clipRange.z+" clipRange.w"+clipRange.w);
        if (isLeft && (max.x - min.x) < clipRange.z)
        {
            float temX = -clipRange.z / 2;

            v2.x = temX + clipRange.x;
//			Debug.Log("temX:"+temX+" v2.x:"+v2.x+"  clipRqnge.z:"+clipRange.z);
        }
        //Debug.Log("vvv2:"+v2);
        return(v2);
    }
Пример #4
0
    Vector3 CalculateConstrainOffset()
    {
        Vector3 bottomLeft = Vector3.zero;
        Vector3 topRight   = new Vector3(Screen.width, Screen.height, 0.0f);

        bottomLeft = CameraManager.tk2DCamera.ScreenCamera.ScreenToWorldPoint(bottomLeft);
        topRight   = CameraManager.tk2DCamera.ScreenCamera.ScreenToWorldPoint(topRight);

        Vector2 minRect = new Vector2(this.rootForBounds.min.x, this.rootForBounds.min.y);
        Vector2 maxRect = new Vector2(this.rootForBounds.max.x, this.rootForBounds.max.y);

        return(NGUIMath.ConstrainRect(minRect, maxRect, bottomLeft, topRight));
    }
Пример #5
0
 private Vector3 CalculateConstrainOffset()
 {
     if ((this.rootForBounds != null) && (this.rootForBounds.childCount != 0))
     {
         Vector3 position = new Vector3(this.mCam.rect.xMin * Screen.width, this.mCam.rect.yMin * Screen.height, 0f);
         Vector3 vector2  = new Vector3(this.mCam.rect.xMax * Screen.width, this.mCam.rect.yMax * Screen.height, 0f);
         position = this.mCam.ScreenToWorldPoint(position);
         vector2  = this.mCam.ScreenToWorldPoint(vector2);
         Vector2 minRect = new Vector2(this.mBounds.min.x, this.mBounds.min.y);
         Vector2 maxRect = new Vector2(this.mBounds.max.x, this.mBounds.max.y);
         return((Vector3)NGUIMath.ConstrainRect(minRect, maxRect, position, vector2));
     }
     return(Vector3.zero);
 }
Пример #6
0
    /// <summary>
    /// Calculate the offset needed to be constrained within the panel's bounds.
    /// </summary>
    public override Vector3 CalculateConstrainOffset(Vector2 min, Vector2 max)
    {
        Vector4 cr;
        bool    b = false;

        if (um == UIScrollView.Movement.Horizontal && usw.bounds.size.x < finalClipRegion.z)
        {
            cr = new Vector4(finalClipRegion.x - (finalClipRegion.z / 2 - usw.bounds.size.x / 2) + tsartSpanX, finalClipRegion.y, usw.bounds.size.x, usw.bounds.size.y);
        }
        else if (um == UIScrollView.Movement.Vertical && usw.bounds.size.y < finalClipRegion.w)
        {
            cr = new Vector4(finalClipRegion.x, finalClipRegion.y + (finalClipRegion.w / 2 - usw.bounds.size.y / 2) - tsartSpanY, usw.bounds.size.x, usw.bounds.size.y);
        }
        else
        {
            cr = finalClipRegion;
            b  = true;
        }

        float offsetX = cr.z * 0.5f;
        float offsetY = cr.w * 0.5f;

        Vector2 minRect = new Vector2(min.x, min.y);
        Vector2 maxRect = new Vector2(max.x, max.y);
        Vector2 minArea = new Vector2(cr.x - offsetX, cr.y - offsetY);
        Vector2 maxArea = new Vector2(cr.x + offsetX, cr.y + offsetY);

        if (softBorderPadding && clipping == UIDrawCall.Clipping.SoftClip)
        {
            minArea.x += clipSoftness.x;
            minArea.y += clipSoftness.y;
            maxArea.x -= clipSoftness.x;
            maxArea.y -= clipSoftness.y;
        }
        Vector3 constraint = NGUIMath.ConstrainRect(minRect, maxRect, minArea, maxArea);

        if (b && constraint.sqrMagnitude > 0.1f)
        {
            if (constraint.y > 0)
            {
                constraint.y -= tsartSpanY;
            }
            else if (constraint.x < 0)
            {
                constraint.x += tsartSpanX;
            }
        }
        return(constraint);
    }
    private Vector3 CalculateConstrainOffset()
    {
        if (this.rootForBounds == null || this.rootForBounds.get_childCount() == 0)
        {
            return(Vector3.get_zero());
        }
        Vector3 vector  = new Vector3(this.mCam.get_rect().get_xMin() * (float)Screen.get_width(), this.mCam.get_rect().get_yMin() * (float)Screen.get_height(), 0f);
        Vector3 vector2 = new Vector3(this.mCam.get_rect().get_xMax() * (float)Screen.get_width(), this.mCam.get_rect().get_yMax() * (float)Screen.get_height(), 0f);

        vector  = this.mCam.ScreenToWorldPoint(vector);
        vector2 = this.mCam.ScreenToWorldPoint(vector2);
        Vector2 minRect = new Vector2(this.mBounds.get_min().x, this.mBounds.get_min().y);
        Vector2 maxRect = new Vector2(this.mBounds.get_max().x, this.mBounds.get_max().y);

        return(NGUIMath.ConstrainRect(minRect, maxRect, vector, vector2));
    }
Пример #8
0
    // Token: 0x06003089 RID: 12425 RVA: 0x000EE13C File Offset: 0x000EC53C
    private Vector3 CalculateConstrainOffset()
    {
        if (this.rootForBounds == null || this.rootForBounds.childCount == 0)
        {
            return(Vector3.zero);
        }
        Vector3 vector  = new Vector3(this.mCam.rect.xMin * (float)Screen.width, this.mCam.rect.yMin * (float)Screen.height, 0f);
        Vector3 vector2 = new Vector3(this.mCam.rect.xMax * (float)Screen.width, this.mCam.rect.yMax * (float)Screen.height, 0f);

        vector  = this.mCam.ScreenToWorldPoint(vector);
        vector2 = this.mCam.ScreenToWorldPoint(vector2);
        Vector2 minRect = new Vector2(this.mBounds.min.x, this.mBounds.min.y);
        Vector2 maxRect = new Vector2(this.mBounds.max.x, this.mBounds.max.y);

        return(NGUIMath.ConstrainRect(minRect, maxRect, vector, vector2));
    }
Пример #9
0
    /// <summary>
    /// Calculate the offset needed to be constrained within the panel's bounds.
    /// </summary>

    public Vector3 CalculateConstrainOffset(Vector2 min, Vector2 max)
    {
        float offsetX = clipRange.z * 0.5f;
        float offsetY = clipRange.w * 0.5f;

        Vector2 minRect = new Vector2(min.x, min.y);
        Vector2 maxRect = new Vector2(max.x, max.y);
        Vector2 minArea = new Vector2(clipRange.x - offsetX, clipRange.y - offsetY);
        Vector2 maxArea = new Vector2(clipRange.x + offsetX, clipRange.y + offsetY);

        minArea.x += clipSoftness.x;
        minArea.y += clipSoftness.y;
        maxArea.x -= clipSoftness.x;
        maxArea.y -= clipSoftness.y;

        return(NGUIMath.ConstrainRect(minRect, maxRect, minArea, maxArea));
    }
Пример #10
0
    private Vector3 CalculateConstrainOffset()
    {
        if (rootForBounds == null || rootForBounds.childCount == 0)
        {
            return(Vector3.zero);
        }

        var position = new Vector3(mCam.rect.xMin * Screen.width, mCam.rect.yMin * Screen.height, 0f);
        var vector2  = new Vector3(mCam.rect.xMax * Screen.width, mCam.rect.yMax * Screen.height, 0f);

        position = mCam.ScreenToWorldPoint(position);
        vector2  = mCam.ScreenToWorldPoint(vector2);
        var minRect = new Vector2(mBounds.min.x, mBounds.min.y);
        var maxRect = new Vector2(mBounds.max.x, mBounds.max.y);

        return(NGUIMath.ConstrainRect(minRect, maxRect, position, vector2));
    }
    /// <summary>
    /// Calculate the offset needed to be constrained within the panel's bounds.
    /// </summary>

    Vector3 CalculateConstrainOffset()
    {
        if (rootForBounds == null || rootForBounds.childCount == 0)
        {
            return(Vector3.zero);
        }

        Vector3 bottomLeft = new Vector3(mCam.rect.xMin * Screen.width, mCam.rect.yMin * Screen.height, 0f);
        Vector3 topRight   = new Vector3(mCam.rect.xMax * Screen.width, mCam.rect.yMax * Screen.height, 0f);

        bottomLeft = mCam.ScreenToWorldPoint(bottomLeft);
        topRight   = mCam.ScreenToWorldPoint(topRight);

        Vector2 minRect = new Vector2(mBounds.min.x, mBounds.min.y);
        Vector2 maxRect = new Vector2(mBounds.max.x, mBounds.max.y);

        return(NGUIMath.ConstrainRect(minRect, maxRect, bottomLeft, topRight));
    }
Пример #12
0
    public Vector3 CalculateConstrainOffset(Vector2 min, Vector2 max)
    {
        float   num     = this.clipRange.z * 0.5f;
        float   num2    = this.clipRange.w * 0.5f;
        Vector2 minRect = new Vector2(min.x, min.y);
        Vector2 maxRect = new Vector2(max.x, max.y);
        Vector2 minArea = new Vector2(this.clipRange.x - num, this.clipRange.y - num2);
        Vector2 maxArea = new Vector2(this.clipRange.x + num, this.clipRange.y + num2);

        if (this.clipping == UIDrawCall.Clipping.SoftClip)
        {
            minArea.x += this.clipSoftness.x;
            minArea.y += this.clipSoftness.y;
            maxArea.x -= this.clipSoftness.x;
            maxArea.y -= this.clipSoftness.y;
        }
        return((Vector3)NGUIMath.ConstrainRect(minRect, maxRect, minArea, maxArea));
    }
Пример #13
0
    /// <summary>
    /// Calculate the offset needed to be constrained within the panel's bounds.
    /// </summary>

    public Vector3 CalculateConstrainOffsetByBounds(Vector2 min, Vector2 max, Vector4 bounds)
    {
        float offsetX = bounds.z * 0.5f;
        float offsetY = bounds.w * 0.5f;

        Vector2 minRect = new Vector2(min.x, min.y);
        Vector2 maxRect = new Vector2(max.x, max.y);
        Vector2 minArea = new Vector2(bounds.x - offsetX, bounds.y - offsetY);
        Vector2 maxArea = new Vector2(bounds.x + offsetX, bounds.y + offsetY);

        if (clipping == UIDrawCall.Clipping.SoftClip)
        {
            minArea.x += clipSoftness.x;
            minArea.y += clipSoftness.y;
            maxArea.x -= clipSoftness.x;
            maxArea.y -= clipSoftness.y;
        }
        return(NGUIMath.ConstrainRect(minRect, maxRect, minArea, maxArea));
    }
Пример #14
0
    public virtual Vector3 CalculateConstrainOffset(Vector2 min, Vector2 max)
    {
        Vector4 finalClipRegion = this.finalClipRegion;
        Single  num             = finalClipRegion.z * 0.5f;
        Single  num2            = finalClipRegion.w * 0.5f;
        Vector2 minRect         = new Vector2(min.x, min.y);
        Vector2 maxRect         = new Vector2(max.x, max.y);
        Vector2 minArea         = new Vector2(finalClipRegion.x - num, finalClipRegion.y - num2);
        Vector2 maxArea         = new Vector2(finalClipRegion.x + num, finalClipRegion.y + num2);

        if (this.softBorderPadding && this.clipping == UIDrawCall.Clipping.SoftClip)
        {
            minArea.x += this.mClipSoftness.x;
            minArea.y += this.mClipSoftness.y;
            maxArea.x -= this.mClipSoftness.x;
            maxArea.y -= this.mClipSoftness.y;
        }
        return(NGUIMath.ConstrainRect(minRect, maxRect, minArea, maxArea));
    }
Пример #15
0
    /// <summary>
    /// Calculate the offset needed to be constrained within the panel's bounds.
    /// </summary>

    public virtual Vector3 CalculateConstrainOffset(Vector2 min, Vector2 max)
    {
        float offsetX = clipRange.z * 0.5f;
        float offsetY = clipRange.w * 0.5f;

        Vector2 minRect = new Vector2(min.x, min.y);
        Vector2 maxRect = new Vector2(max.x, max.y);
        Vector2 minArea = new Vector2(clipRange.x - offsetX, clipRange.y - offsetY);
        Vector2 maxArea = new Vector2(clipRange.x + offsetX, clipRange.y + offsetY);

        if (clipping == UIDrawCall.Clipping.SoftClip)
        {
            minArea.x += clipSoftness.x;
            minArea.y += clipSoftness.y;
            maxArea.x -= clipSoftness.x;
            maxArea.y -= clipSoftness.y;
        }
        return(NGUIMath.ConstrainRect(minRect, maxRect, minArea, maxArea));
    }
Пример #16
0
    public Vector3 CalculateConstrainOffset(Vector2 min, Vector2 max)
    {
        var num     = clipRange.z * 0.5f;
        var num2    = clipRange.w * 0.5f;
        var minRect = new Vector2(min.x, min.y);
        var maxRect = new Vector2(max.x, max.y);
        var minArea = new Vector2(clipRange.x - num, clipRange.y - num2);
        var maxArea = new Vector2(clipRange.x + num, clipRange.y + num2);

        if (clipping == UIDrawCall.Clipping.SoftClip)
        {
            minArea.x += clipSoftness.x;
            minArea.y += clipSoftness.y;
            maxArea.x -= clipSoftness.x;
            maxArea.y -= clipSoftness.y;
        }

        return(NGUIMath.ConstrainRect(minRect, maxRect, minArea, maxArea));
    }
Пример #17
0
 static public int ConstrainRect_s(IntPtr l)
 {
     try {
         UnityEngine.Vector2 a1;
         checkType(l, 1, out a1);
         UnityEngine.Vector2 a2;
         checkType(l, 2, out a2);
         UnityEngine.Vector2 a3;
         checkType(l, 3, out a3);
         UnityEngine.Vector2 a4;
         checkType(l, 4, out a4);
         var ret = NGUIMath.ConstrainRect(a1, a2, a3, a4);
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Пример #18
0
    private Vector3 CalculateConstrainOffset()
    {
        if (this.rootForBounds == null || this.rootForBounds.childCount == 0)
        {
            return(Vector3.zero);
        }
        Vector3 vector  = new Vector3(this.mCam.rect.xMin * (float)ResolutionConstrain.Instance.width, this.mCam.rect.yMin * (float)ResolutionConstrain.Instance.height, 0f);
        Vector3 vector2 = new Vector3(this.mCam.rect.xMax * (float)ResolutionConstrain.Instance.width, this.mCam.rect.yMax * (float)ResolutionConstrain.Instance.height, 0f);

        vector  = this.mCam.ScreenToWorldPoint(vector);
        vector2 = this.mCam.ScreenToWorldPoint(vector2);
        Vector2 zero = Vector2.zero;

        zero.x = this.mBounds.min.x;
        zero.y = this.mBounds.min.y;
        Vector2 zero2 = Vector2.zero;

        zero2.x = this.mBounds.max.x;
        zero2.y = this.mBounds.max.y;
        return(NGUIMath.ConstrainRect(zero, zero2, vector, vector2));
    }
Пример #19
0
	/// <summary>
	/// Calculate the offset needed to be constrained within the panel's bounds.
	/// </summary>

	public virtual Vector3 CalculateConstrainOffset (Vector2 min, Vector2 max)
	{
		Vector4 cr = finalClipRegion;

		float offsetX = cr.z * 0.5f;
		float offsetY = cr.w * 0.5f;

		Vector2 minRect = new Vector2(min.x, min.y);
		Vector2 maxRect = new Vector2(max.x, max.y);
		Vector2 minArea = new Vector2(cr.x - offsetX, cr.y - offsetY);
		Vector2 maxArea = new Vector2(cr.x + offsetX, cr.y + offsetY);

		if (softBorderPadding && clipping == UIDrawCall.Clipping.SoftClip)
		{
			minArea.x += mClipSoftness.x;
			minArea.y += mClipSoftness.y;
			maxArea.x -= mClipSoftness.x;
			maxArea.y -= mClipSoftness.y;
		}
		return NGUIMath.ConstrainRect(minRect, maxRect, minArea, maxArea);
	}
Пример #20
0
    public Vector3 CalculateConstrainOffset(Vector2 min, Vector2 max)
    {
        float   single   = this.clipRange.z * 0.5f;
        float   single1  = this.clipRange.w * 0.5f;
        Vector2 vector2  = new Vector2(min.x, min.y);
        Vector2 vector21 = new Vector2(max.x, max.y);
        Vector4 vector4  = this.clipRange;
        Vector4 vector41 = this.clipRange;
        Vector2 vector22 = new Vector2(vector4.x - single, vector41.y - single1);
        Vector4 vector42 = this.clipRange;
        Vector4 vector43 = this.clipRange;
        Vector2 vector23 = new Vector2(vector42.x + single, vector43.y + single1);

        if (this.clipping == UIDrawCall.Clipping.SoftClip)
        {
            vector22.x = vector22.x + this.clipSoftness.x;
            vector22.y = vector22.y + this.clipSoftness.y;
            vector23.x = vector23.x - this.clipSoftness.x;
            vector23.y = vector23.y - this.clipSoftness.y;
        }
        return(NGUIMath.ConstrainRect(vector2, vector21, vector22, vector23));
    }
Пример #21
0
    private Vector3 CalculateConstrainOffset()
    {
        if (rootForBounds == null || rootForBounds.childCount == 0)
        {
            return(Vector3.zero);
        }
        Vector3 position  = new Vector3(mCam.rect.xMin * (float)Screen.width, mCam.rect.yMin * (float)Screen.height, 0f);
        Vector3 position2 = new Vector3(mCam.rect.xMax * (float)Screen.width, mCam.rect.yMax * (float)Screen.height, 0f);

        position  = mCam.ScreenToWorldPoint(position);
        position2 = mCam.ScreenToWorldPoint(position2);
        Vector3 min     = mBounds.min;
        float   x       = min.x;
        Vector3 min2    = mBounds.min;
        Vector2 minRect = new Vector2(x, min2.y);
        Vector3 max     = mBounds.max;
        float   x2      = max.x;
        Vector3 max2    = mBounds.max;
        Vector2 maxRect = new Vector2(x2, max2.y);

        return(NGUIMath.ConstrainRect(minRect, maxRect, position, position2));
    }
Пример #22
0
 static public int ConstrainRect_s(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.Vector2 a1;
         checkType(l, 1, out a1);
         UnityEngine.Vector2 a2;
         checkType(l, 2, out a2);
         UnityEngine.Vector2 a3;
         checkType(l, 3, out a3);
         UnityEngine.Vector2 a4;
         checkType(l, 4, out a4);
         var ret = NGUIMath.ConstrainRect(a1, a2, a3, a4);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
Пример #23
0
    private Vector3 CalculateConstrainOffset()
    {
        if (this.rootForBounds == null || this.rootForBounds.childCount == 0)
        {
            return(Vector3.zero);
        }
        Rect    rect       = this.mCam.rect;
        float   single     = rect.xMin * (float)Screen.width;
        Rect    rect1      = this.mCam.rect;
        Vector3 vector3    = new Vector3(single, rect1.yMin * (float)Screen.height, 0f);
        Rect    rect2      = this.mCam.rect;
        float   single1    = rect2.xMax * (float)Screen.width;
        Rect    rect3      = this.mCam.rect;
        Vector3 worldPoint = new Vector3(single1, rect3.yMax * (float)Screen.height, 0f);

        vector3    = this.mCam.ScreenToWorldPoint(vector3);
        worldPoint = this.mCam.ScreenToWorldPoint(worldPoint);
        Vector3 vector31 = this.mBounds.min;
        Vector2 vector2  = new Vector2(vector31.x, this.mBounds.min.y);
        Vector3 vector32 = this.mBounds.max;
        Vector2 vector21 = new Vector2(vector32.x, this.mBounds.max.y);

        return(NGUIMath.ConstrainRect(vector2, vector21, vector3, worldPoint));
    }
    private Vector3 CalculateConstrainOffset()
    {
        //IL_0021: Unknown result type (might be due to invalid IL or missing references)
        //IL_002f: Unknown result type (might be due to invalid IL or missing references)
        //IL_0034: Unknown result type (might be due to invalid IL or missing references)
        //IL_004a: Unknown result type (might be due to invalid IL or missing references)
        //IL_004f: Unknown result type (might be due to invalid IL or missing references)
        //IL_0071: Unknown result type (might be due to invalid IL or missing references)
        //IL_0076: Unknown result type (might be due to invalid IL or missing references)
        //IL_008c: Unknown result type (might be due to invalid IL or missing references)
        //IL_0091: Unknown result type (might be due to invalid IL or missing references)
        //IL_00b1: Unknown result type (might be due to invalid IL or missing references)
        //IL_00b2: Unknown result type (might be due to invalid IL or missing references)
        //IL_00b7: Unknown result type (might be due to invalid IL or missing references)
        //IL_00be: Unknown result type (might be due to invalid IL or missing references)
        //IL_00bf: Unknown result type (might be due to invalid IL or missing references)
        //IL_00c4: Unknown result type (might be due to invalid IL or missing references)
        //IL_00cd: Unknown result type (might be due to invalid IL or missing references)
        //IL_00d2: Unknown result type (might be due to invalid IL or missing references)
        //IL_00e1: Unknown result type (might be due to invalid IL or missing references)
        //IL_00e6: Unknown result type (might be due to invalid IL or missing references)
        //IL_00fc: Unknown result type (might be due to invalid IL or missing references)
        //IL_0101: Unknown result type (might be due to invalid IL or missing references)
        //IL_0110: Unknown result type (might be due to invalid IL or missing references)
        //IL_0115: Unknown result type (might be due to invalid IL or missing references)
        //IL_0123: Unknown result type (might be due to invalid IL or missing references)
        //IL_0124: Unknown result type (might be due to invalid IL or missing references)
        //IL_0125: Unknown result type (might be due to invalid IL or missing references)
        //IL_0126: Unknown result type (might be due to invalid IL or missing references)
        //IL_012b: Unknown result type (might be due to invalid IL or missing references)
        //IL_012c: Unknown result type (might be due to invalid IL or missing references)
        //IL_0131: Unknown result type (might be due to invalid IL or missing references)
        //IL_0136: Unknown result type (might be due to invalid IL or missing references)
        if (rootForBounds == null || rootForBounds.get_childCount() == 0)
        {
            return(Vector3.get_zero());
        }
        Rect    rect  = mCam.get_rect();
        float   num   = rect.get_xMin() * (float)Screen.get_width();
        Rect    rect2 = mCam.get_rect();
        Vector3 val   = default(Vector3);

        val._002Ector(num, rect2.get_yMin() * (float)Screen.get_height(), 0f);
        Rect    rect3 = mCam.get_rect();
        float   num2  = rect3.get_xMax() * (float)Screen.get_width();
        Rect    rect4 = mCam.get_rect();
        Vector3 val2  = default(Vector3);

        val2._002Ector(num2, rect4.get_yMax() * (float)Screen.get_height(), 0f);
        val  = mCam.ScreenToWorldPoint(val);
        val2 = mCam.ScreenToWorldPoint(val2);
        Vector3 min     = mBounds.get_min();
        float   x       = min.x;
        Vector3 min2    = mBounds.get_min();
        Vector2 minRect = default(Vector2);

        minRect._002Ector(x, min2.y);
        Vector3 max     = mBounds.get_max();
        float   x2      = max.x;
        Vector3 max2    = mBounds.get_max();
        Vector2 maxRect = default(Vector2);

        maxRect._002Ector(x2, max2.y);
        return(Vector2.op_Implicit(NGUIMath.ConstrainRect(minRect, maxRect, Vector2.op_Implicit(val), Vector2.op_Implicit(val2))));
    }
Пример #25
0
 public unsafe static long $Invoke11(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(NGUIMath.ConstrainRect(*(*(IntPtr *)args), *(*(IntPtr *)(args + 1)), *(*(IntPtr *)(args + 2)), *(*(IntPtr *)(args + 3)))));
 }