Esempio n. 1
0
        public void PerformClipping()
        {
            Rect canvasRect = this.GetCanvasRect();

            UnityEngine.RectTransform.Axis axis = this.axis;
            if (axis == UnityEngine.RectTransform.Axis.Horizontal)
            {
                float width = canvasRect.width;
                canvasRect.xMin = Mathf.Max(canvasRect.xMin, canvasRect.xMin + (this.FromX * width));
                canvasRect.xMax = Mathf.Min(canvasRect.xMax, canvasRect.xMax - ((1f - this.ToX) * width));
            }
            else if (axis == UnityEngine.RectTransform.Axis.Vertical)
            {
                float height = canvasRect.height;
                canvasRect.yMin = Mathf.Max(canvasRect.yMin, canvasRect.yMin + (this.FromX * height));
                canvasRect.yMax = Mathf.Min(canvasRect.yMax, canvasRect.yMax - ((1f - this.ToX) * height));
            }
            CanvasRenderer component = base.GetComponent <CanvasRenderer>();

            if (component != null)
            {
                component.EnableRectClipping(canvasRect);
            }
            this.maskableCache.Clear();
            base.GetComponentsInChildren <MaskableGraphic>(this.maskableCache);
            foreach (MaskableGraphic graphic in this.maskableCache)
            {
                graphic.SetClipRect(canvasRect, true);
            }
        }
 public void SetClipRect(Rect clipRect, bool validRect)
 {
     if (validRect)
     {
         canvasRenderer.EnableRectClipping(clipRect);
     }
     else
     {
         canvasRenderer.DisableRectClipping();
     }
 }
Esempio n. 3
0
    public static int EnableRectClipping(IntPtr l)
    {
        int result;

        try
        {
            CanvasRenderer canvasRenderer = (CanvasRenderer)LuaObject.checkSelf(l);
            Rect           rect;
            LuaObject.checkValueType <Rect>(l, 2, out rect);
            canvasRenderer.EnableRectClipping(rect);
            LuaObject.pushValue(l, true);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
Esempio n. 4
0
        public void PerformClipping()
        {
            Rect  canvasRect = this.GetCanvasRect();
            float height     = canvasRect.height;

            canvasRect.yMin = Mathf.Max(canvasRect.yMin, canvasRect.yMin + (this.FromY * height));
            canvasRect.yMax = Mathf.Min(canvasRect.yMax, canvasRect.yMax - ((1f - this.ToY) * height));
            CanvasRenderer component = base.GetComponent <CanvasRenderer>();

            if (component != null)
            {
                component.EnableRectClipping(canvasRect);
            }
            this.maskableCache.Clear();
            base.GetComponentsInChildren <MaskableGraphic>(this.maskableCache);
            foreach (MaskableGraphic graphic in this.maskableCache)
            {
                graphic.SetClipRect(canvasRect, true);
            }
        }