This commit is contained in:
niko
2026-06-04 11:42:34 +02:00
parent f39ba70a9f
commit e720b98cd1
7488 changed files with 2493818 additions and 0 deletions
+239
View File
@@ -0,0 +1,239 @@
using System;
using System.Runtime.CompilerServices;
using UnityEngine.Scripting;
namespace UnityEngine
{
// Token: 0x02000249 RID: 585
public sealed class RectTransformUtility
{
// Token: 0x060027E6 RID: 10214 RVA: 0x0002DE70 File Offset: 0x0002C070
private RectTransformUtility()
{
}
// Token: 0x060027E7 RID: 10215 RVA: 0x0002DE7C File Offset: 0x0002C07C
public static bool RectangleContainsScreenPoint(RectTransform rect, Vector2 screenPoint)
{
return RectTransformUtility.RectangleContainsScreenPoint(rect, screenPoint, null);
}
// Token: 0x060027E8 RID: 10216 RVA: 0x0002DE9C File Offset: 0x0002C09C
public static bool ScreenPointToWorldPointInRectangle(RectTransform rect, Vector2 screenPoint, Camera cam, out Vector3 worldPoint)
{
worldPoint = Vector2.zero;
Ray ray = RectTransformUtility.ScreenPointToRay(cam, screenPoint);
Plane plane = new Plane(rect.rotation * Vector3.back, rect.position);
float num;
bool flag;
if (!plane.Raycast(ray, out num))
{
flag = false;
}
else
{
worldPoint = ray.GetPoint(num);
flag = true;
}
return flag;
}
// Token: 0x060027E9 RID: 10217 RVA: 0x0002DF0C File Offset: 0x0002C10C
public static bool ScreenPointToLocalPointInRectangle(RectTransform rect, Vector2 screenPoint, Camera cam, out Vector2 localPoint)
{
localPoint = Vector2.zero;
Vector3 vector;
bool flag;
if (RectTransformUtility.ScreenPointToWorldPointInRectangle(rect, screenPoint, cam, out vector))
{
localPoint = rect.InverseTransformPoint(vector);
flag = true;
}
else
{
flag = false;
}
return flag;
}
// Token: 0x060027EA RID: 10218 RVA: 0x0002DF58 File Offset: 0x0002C158
public static Ray ScreenPointToRay(Camera cam, Vector2 screenPos)
{
Ray ray;
if (cam != null)
{
ray = cam.ScreenPointToRay(screenPos);
}
else
{
Vector3 vector = screenPos;
vector.z -= 100f;
ray = new Ray(vector, Vector3.forward);
}
return ray;
}
// Token: 0x060027EB RID: 10219 RVA: 0x0002DFB0 File Offset: 0x0002C1B0
public static Vector2 WorldToScreenPoint(Camera cam, Vector3 worldPoint)
{
Vector2 vector;
if (cam == null)
{
vector = new Vector2(worldPoint.x, worldPoint.y);
}
else
{
vector = cam.WorldToScreenPoint(worldPoint);
}
return vector;
}
// Token: 0x060027EC RID: 10220 RVA: 0x0002DFF8 File Offset: 0x0002C1F8
public static Bounds CalculateRelativeRectTransformBounds(Transform root, Transform child)
{
RectTransform[] componentsInChildren = child.GetComponentsInChildren<RectTransform>(false);
Bounds bounds2;
if (componentsInChildren.Length > 0)
{
Vector3 vector = new Vector3(float.MaxValue, float.MaxValue, float.MaxValue);
Vector3 vector2 = new Vector3(float.MinValue, float.MinValue, float.MinValue);
Matrix4x4 worldToLocalMatrix = root.worldToLocalMatrix;
int i = 0;
int num = componentsInChildren.Length;
while (i < num)
{
componentsInChildren[i].GetWorldCorners(RectTransformUtility.s_Corners);
for (int j = 0; j < 4; j++)
{
Vector3 vector3 = worldToLocalMatrix.MultiplyPoint3x4(RectTransformUtility.s_Corners[j]);
vector = Vector3.Min(vector3, vector);
vector2 = Vector3.Max(vector3, vector2);
}
i++;
}
Bounds bounds = new Bounds(vector, Vector3.zero);
bounds.Encapsulate(vector2);
bounds2 = bounds;
}
else
{
bounds2 = new Bounds(Vector3.zero, Vector3.zero);
}
return bounds2;
}
// Token: 0x060027ED RID: 10221 RVA: 0x0002E0F4 File Offset: 0x0002C2F4
public static Bounds CalculateRelativeRectTransformBounds(Transform trans)
{
return RectTransformUtility.CalculateRelativeRectTransformBounds(trans, trans);
}
// Token: 0x060027EE RID: 10222 RVA: 0x0002E110 File Offset: 0x0002C310
public static void FlipLayoutOnAxis(RectTransform rect, int axis, bool keepPositioning, bool recursive)
{
if (!(rect == null))
{
if (recursive)
{
for (int i = 0; i < rect.childCount; i++)
{
RectTransform rectTransform = rect.GetChild(i) as RectTransform;
if (rectTransform != null)
{
RectTransformUtility.FlipLayoutOnAxis(rectTransform, axis, false, true);
}
}
}
Vector2 pivot = rect.pivot;
pivot[axis] = 1f - pivot[axis];
rect.pivot = pivot;
if (!keepPositioning)
{
Vector2 anchoredPosition = rect.anchoredPosition;
anchoredPosition[axis] = -anchoredPosition[axis];
rect.anchoredPosition = anchoredPosition;
Vector2 anchorMin = rect.anchorMin;
Vector2 anchorMax = rect.anchorMax;
float num = anchorMin[axis];
anchorMin[axis] = 1f - anchorMax[axis];
anchorMax[axis] = 1f - num;
rect.anchorMin = anchorMin;
rect.anchorMax = anchorMax;
}
}
}
// Token: 0x060027EF RID: 10223 RVA: 0x0002E210 File Offset: 0x0002C410
public static void FlipLayoutAxes(RectTransform rect, bool keepPositioning, bool recursive)
{
if (!(rect == null))
{
if (recursive)
{
for (int i = 0; i < rect.childCount; i++)
{
RectTransform rectTransform = rect.GetChild(i) as RectTransform;
if (rectTransform != null)
{
RectTransformUtility.FlipLayoutAxes(rectTransform, false, true);
}
}
}
rect.pivot = RectTransformUtility.GetTransposed(rect.pivot);
rect.sizeDelta = RectTransformUtility.GetTransposed(rect.sizeDelta);
if (!keepPositioning)
{
rect.anchoredPosition = RectTransformUtility.GetTransposed(rect.anchoredPosition);
rect.anchorMin = RectTransformUtility.GetTransposed(rect.anchorMin);
rect.anchorMax = RectTransformUtility.GetTransposed(rect.anchorMax);
}
}
}
// Token: 0x060027F0 RID: 10224 RVA: 0x0002E2D4 File Offset: 0x0002C4D4
private static Vector2 GetTransposed(Vector2 input)
{
return new Vector2(input.y, input.x);
}
// Token: 0x060027F1 RID: 10225 RVA: 0x0002E2FC File Offset: 0x0002C4FC
public static bool RectangleContainsScreenPoint(RectTransform rect, Vector2 screenPoint, Camera cam)
{
return RectTransformUtility.INTERNAL_CALL_RectangleContainsScreenPoint(rect, ref screenPoint, cam);
}
// Token: 0x060027F2 RID: 10226
[GeneratedByOldBindingsGenerator]
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern bool INTERNAL_CALL_RectangleContainsScreenPoint(RectTransform rect, ref Vector2 screenPoint, Camera cam);
// Token: 0x060027F3 RID: 10227 RVA: 0x0002E31C File Offset: 0x0002C51C
public static Vector2 PixelAdjustPoint(Vector2 point, Transform elementTransform, Canvas canvas)
{
Vector2 vector;
RectTransformUtility.INTERNAL_CALL_PixelAdjustPoint(ref point, elementTransform, canvas, out vector);
return vector;
}
// Token: 0x060027F4 RID: 10228
[GeneratedByOldBindingsGenerator]
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void INTERNAL_CALL_PixelAdjustPoint(ref Vector2 point, Transform elementTransform, Canvas canvas, out Vector2 value);
// Token: 0x060027F5 RID: 10229 RVA: 0x0002E340 File Offset: 0x0002C540
public static Rect PixelAdjustRect(RectTransform rectTransform, Canvas canvas)
{
Rect rect;
RectTransformUtility.INTERNAL_CALL_PixelAdjustRect(rectTransform, canvas, out rect);
return rect;
}
// Token: 0x060027F6 RID: 10230
[GeneratedByOldBindingsGenerator]
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void INTERNAL_CALL_PixelAdjustRect(RectTransform rectTransform, Canvas canvas, out Rect value);
// Token: 0x040006EB RID: 1771
private static Vector3[] s_Corners = new Vector3[4];
}
}