Files
Dec2017-Script-Dump/UnityEngine/Rect.cs
T
2026-06-04 11:42:34 +02:00

455 lines
11 KiB
C#

using System;
using UnityEngine.Scripting;
namespace UnityEngine
{
// Token: 0x0200045F RID: 1119
[UsedByNativeCode]
public struct Rect
{
// Token: 0x060038E6 RID: 14566 RVA: 0x00062248 File Offset: 0x00060448
public Rect(float x, float y, float width, float height)
{
this.m_XMin = x;
this.m_YMin = y;
this.m_Width = width;
this.m_Height = height;
}
// Token: 0x060038E7 RID: 14567 RVA: 0x00062268 File Offset: 0x00060468
public Rect(Vector2 position, Vector2 size)
{
this.m_XMin = position.x;
this.m_YMin = position.y;
this.m_Width = size.x;
this.m_Height = size.y;
}
// Token: 0x060038E8 RID: 14568 RVA: 0x000622A0 File Offset: 0x000604A0
public Rect(Rect source)
{
this.m_XMin = source.m_XMin;
this.m_YMin = source.m_YMin;
this.m_Width = source.m_Width;
this.m_Height = source.m_Height;
}
// Token: 0x17000D0D RID: 3341
// (get) Token: 0x060038E9 RID: 14569 RVA: 0x000622D8 File Offset: 0x000604D8
public static Rect zero
{
get
{
return new Rect(0f, 0f, 0f, 0f);
}
}
// Token: 0x060038EA RID: 14570 RVA: 0x00062308 File Offset: 0x00060508
public static Rect MinMaxRect(float xmin, float ymin, float xmax, float ymax)
{
return new Rect(xmin, ymin, xmax - xmin, ymax - ymin);
}
// Token: 0x060038EB RID: 14571 RVA: 0x0006232C File Offset: 0x0006052C
public void Set(float x, float y, float width, float height)
{
this.m_XMin = x;
this.m_YMin = y;
this.m_Width = width;
this.m_Height = height;
}
// Token: 0x17000D0E RID: 3342
// (get) Token: 0x060038EC RID: 14572 RVA: 0x0006234C File Offset: 0x0006054C
// (set) Token: 0x060038ED RID: 14573 RVA: 0x00062368 File Offset: 0x00060568
public float x
{
get
{
return this.m_XMin;
}
set
{
this.m_XMin = value;
}
}
// Token: 0x17000D0F RID: 3343
// (get) Token: 0x060038EE RID: 14574 RVA: 0x00062374 File Offset: 0x00060574
// (set) Token: 0x060038EF RID: 14575 RVA: 0x00062390 File Offset: 0x00060590
public float y
{
get
{
return this.m_YMin;
}
set
{
this.m_YMin = value;
}
}
// Token: 0x17000D10 RID: 3344
// (get) Token: 0x060038F0 RID: 14576 RVA: 0x0006239C File Offset: 0x0006059C
// (set) Token: 0x060038F1 RID: 14577 RVA: 0x000623C4 File Offset: 0x000605C4
public Vector2 position
{
get
{
return new Vector2(this.m_XMin, this.m_YMin);
}
set
{
this.m_XMin = value.x;
this.m_YMin = value.y;
}
}
// Token: 0x17000D11 RID: 3345
// (get) Token: 0x060038F2 RID: 14578 RVA: 0x000623E4 File Offset: 0x000605E4
// (set) Token: 0x060038F3 RID: 14579 RVA: 0x00062424 File Offset: 0x00060624
public Vector2 center
{
get
{
return new Vector2(this.x + this.m_Width / 2f, this.y + this.m_Height / 2f);
}
set
{
this.m_XMin = value.x - this.m_Width / 2f;
this.m_YMin = value.y - this.m_Height / 2f;
}
}
// Token: 0x17000D12 RID: 3346
// (get) Token: 0x060038F4 RID: 14580 RVA: 0x0006245C File Offset: 0x0006065C
// (set) Token: 0x060038F5 RID: 14581 RVA: 0x00062484 File Offset: 0x00060684
public Vector2 min
{
get
{
return new Vector2(this.xMin, this.yMin);
}
set
{
this.xMin = value.x;
this.yMin = value.y;
}
}
// Token: 0x17000D13 RID: 3347
// (get) Token: 0x060038F6 RID: 14582 RVA: 0x000624A4 File Offset: 0x000606A4
// (set) Token: 0x060038F7 RID: 14583 RVA: 0x000624CC File Offset: 0x000606CC
public Vector2 max
{
get
{
return new Vector2(this.xMax, this.yMax);
}
set
{
this.xMax = value.x;
this.yMax = value.y;
}
}
// Token: 0x17000D14 RID: 3348
// (get) Token: 0x060038F8 RID: 14584 RVA: 0x000624EC File Offset: 0x000606EC
// (set) Token: 0x060038F9 RID: 14585 RVA: 0x00062508 File Offset: 0x00060708
public float width
{
get
{
return this.m_Width;
}
set
{
this.m_Width = value;
}
}
// Token: 0x17000D15 RID: 3349
// (get) Token: 0x060038FA RID: 14586 RVA: 0x00062514 File Offset: 0x00060714
// (set) Token: 0x060038FB RID: 14587 RVA: 0x00062530 File Offset: 0x00060730
public float height
{
get
{
return this.m_Height;
}
set
{
this.m_Height = value;
}
}
// Token: 0x17000D16 RID: 3350
// (get) Token: 0x060038FC RID: 14588 RVA: 0x0006253C File Offset: 0x0006073C
// (set) Token: 0x060038FD RID: 14589 RVA: 0x00062564 File Offset: 0x00060764
public Vector2 size
{
get
{
return new Vector2(this.m_Width, this.m_Height);
}
set
{
this.m_Width = value.x;
this.m_Height = value.y;
}
}
// Token: 0x17000D17 RID: 3351
// (get) Token: 0x060038FE RID: 14590 RVA: 0x00062584 File Offset: 0x00060784
// (set) Token: 0x060038FF RID: 14591 RVA: 0x000625A0 File Offset: 0x000607A0
public float xMin
{
get
{
return this.m_XMin;
}
set
{
float xMax = this.xMax;
this.m_XMin = value;
this.m_Width = xMax - this.m_XMin;
}
}
// Token: 0x17000D18 RID: 3352
// (get) Token: 0x06003900 RID: 14592 RVA: 0x000625CC File Offset: 0x000607CC
// (set) Token: 0x06003901 RID: 14593 RVA: 0x000625E8 File Offset: 0x000607E8
public float yMin
{
get
{
return this.m_YMin;
}
set
{
float yMax = this.yMax;
this.m_YMin = value;
this.m_Height = yMax - this.m_YMin;
}
}
// Token: 0x17000D19 RID: 3353
// (get) Token: 0x06003902 RID: 14594 RVA: 0x00062614 File Offset: 0x00060814
// (set) Token: 0x06003903 RID: 14595 RVA: 0x00062638 File Offset: 0x00060838
public float xMax
{
get
{
return this.m_Width + this.m_XMin;
}
set
{
this.m_Width = value - this.m_XMin;
}
}
// Token: 0x17000D1A RID: 3354
// (get) Token: 0x06003904 RID: 14596 RVA: 0x0006264C File Offset: 0x0006084C
// (set) Token: 0x06003905 RID: 14597 RVA: 0x00062670 File Offset: 0x00060870
public float yMax
{
get
{
return this.m_Height + this.m_YMin;
}
set
{
this.m_Height = value - this.m_YMin;
}
}
// Token: 0x06003906 RID: 14598 RVA: 0x00062684 File Offset: 0x00060884
public bool Contains(Vector2 point)
{
return point.x >= this.xMin && point.x < this.xMax && point.y >= this.yMin && point.y < this.yMax;
}
// Token: 0x06003907 RID: 14599 RVA: 0x000626E4 File Offset: 0x000608E4
public bool Contains(Vector3 point)
{
return point.x >= this.xMin && point.x < this.xMax && point.y >= this.yMin && point.y < this.yMax;
}
// Token: 0x06003908 RID: 14600 RVA: 0x00062744 File Offset: 0x00060944
public bool Contains(Vector3 point, bool allowInverse)
{
bool flag;
if (!allowInverse)
{
flag = this.Contains(point);
}
else
{
bool flag2 = false;
if ((this.width < 0f && point.x <= this.xMin && point.x > this.xMax) || (this.width >= 0f && point.x >= this.xMin && point.x < this.xMax))
{
flag2 = true;
}
flag = flag2 && ((this.height < 0f && point.y <= this.yMin && point.y > this.yMax) || (this.height >= 0f && point.y >= this.yMin && point.y < this.yMax));
}
return flag;
}
// Token: 0x06003909 RID: 14601 RVA: 0x00062850 File Offset: 0x00060A50
private static Rect OrderMinMax(Rect rect)
{
if (rect.xMin > rect.xMax)
{
float xMin = rect.xMin;
rect.xMin = rect.xMax;
rect.xMax = xMin;
}
if (rect.yMin > rect.yMax)
{
float yMin = rect.yMin;
rect.yMin = rect.yMax;
rect.yMax = yMin;
}
return rect;
}
// Token: 0x0600390A RID: 14602 RVA: 0x000628CC File Offset: 0x00060ACC
public bool Overlaps(Rect other)
{
return other.xMax > this.xMin && other.xMin < this.xMax && other.yMax > this.yMin && other.yMin < this.yMax;
}
// Token: 0x0600390B RID: 14603 RVA: 0x0006292C File Offset: 0x00060B2C
public bool Overlaps(Rect other, bool allowInverse)
{
Rect rect = this;
if (allowInverse)
{
rect = Rect.OrderMinMax(rect);
other = Rect.OrderMinMax(other);
}
return rect.Overlaps(other);
}
// Token: 0x0600390C RID: 14604 RVA: 0x00062968 File Offset: 0x00060B68
public static Vector2 NormalizedToPoint(Rect rectangle, Vector2 normalizedRectCoordinates)
{
return new Vector2(Mathf.Lerp(rectangle.x, rectangle.xMax, normalizedRectCoordinates.x), Mathf.Lerp(rectangle.y, rectangle.yMax, normalizedRectCoordinates.y));
}
// Token: 0x0600390D RID: 14605 RVA: 0x000629B8 File Offset: 0x00060BB8
public static Vector2 PointToNormalized(Rect rectangle, Vector2 point)
{
return new Vector2(Mathf.InverseLerp(rectangle.x, rectangle.xMax, point.x), Mathf.InverseLerp(rectangle.y, rectangle.yMax, point.y));
}
// Token: 0x0600390E RID: 14606 RVA: 0x00062A08 File Offset: 0x00060C08
public static bool operator !=(Rect lhs, Rect rhs)
{
return !(lhs == rhs);
}
// Token: 0x0600390F RID: 14607 RVA: 0x00062A28 File Offset: 0x00060C28
public static bool operator ==(Rect lhs, Rect rhs)
{
return lhs.x == rhs.x && lhs.y == rhs.y && lhs.width == rhs.width && lhs.height == rhs.height;
}
// Token: 0x06003910 RID: 14608 RVA: 0x00062A8C File Offset: 0x00060C8C
public override int GetHashCode()
{
return this.x.GetHashCode() ^ (this.width.GetHashCode() << 2) ^ (this.y.GetHashCode() >> 2) ^ (this.height.GetHashCode() >> 1);
}
// Token: 0x06003911 RID: 14609 RVA: 0x00062AFC File Offset: 0x00060CFC
public override bool Equals(object other)
{
bool flag;
if (!(other is Rect))
{
flag = false;
}
else
{
Rect rect = (Rect)other;
flag = this.x.Equals(rect.x) && this.y.Equals(rect.y) && this.width.Equals(rect.width) && this.height.Equals(rect.height);
}
return flag;
}
// Token: 0x06003912 RID: 14610 RVA: 0x00062B94 File Offset: 0x00060D94
public override string ToString()
{
return UnityString.Format("(x:{0:F2}, y:{1:F2}, width:{2:F2}, height:{3:F2})", new object[] { this.x, this.y, this.width, this.height });
}
// Token: 0x06003913 RID: 14611 RVA: 0x00062BF4 File Offset: 0x00060DF4
public string ToString(string format)
{
return UnityString.Format("(x:{0}, y:{1}, width:{2}, height:{3})", new object[]
{
this.x.ToString(format),
this.y.ToString(format),
this.width.ToString(format),
this.height.ToString(format)
});
}
// Token: 0x17000D1B RID: 3355
// (get) Token: 0x06003914 RID: 14612 RVA: 0x00062C64 File Offset: 0x00060E64
[Obsolete("use xMin")]
public float left
{
get
{
return this.m_XMin;
}
}
// Token: 0x17000D1C RID: 3356
// (get) Token: 0x06003915 RID: 14613 RVA: 0x00062C80 File Offset: 0x00060E80
[Obsolete("use xMax")]
public float right
{
get
{
return this.m_XMin + this.m_Width;
}
}
// Token: 0x17000D1D RID: 3357
// (get) Token: 0x06003916 RID: 14614 RVA: 0x00062CA4 File Offset: 0x00060EA4
[Obsolete("use yMin")]
public float top
{
get
{
return this.m_YMin;
}
}
// Token: 0x17000D1E RID: 3358
// (get) Token: 0x06003917 RID: 14615 RVA: 0x00062CC0 File Offset: 0x00060EC0
[Obsolete("use yMax")]
public float bottom
{
get
{
return this.m_YMin + this.m_Height;
}
}
// Token: 0x0400113E RID: 4414
private float m_XMin;
// Token: 0x0400113F RID: 4415
private float m_YMin;
// Token: 0x04001140 RID: 4416
private float m_Width;
// Token: 0x04001141 RID: 4417
private float m_Height;
}
}