r2mods/ilspy_dump/ror2_csproj/RoR2.UI/MainUIArea.cs

28 lines
637 B
C#
Raw Normal View History

2024-10-04 07:26:37 +00:00
using UnityEngine;
namespace RoR2.UI;
[RequireComponent(typeof(RectTransform))]
[ExecuteInEditMode]
public class MainUIArea : MonoBehaviour
{
private RectTransform rectTransform;
private RectTransform parentRectTransform;
private void Awake()
{
rectTransform = GetComponent<RectTransform>();
parentRectTransform = rectTransform.parent.GetComponent<RectTransform>();
}
private void Update()
{
Rect rect = parentRectTransform.rect;
float num = rect.width * 0.05f;
float num2 = rect.height * 0.05f;
rectTransform.offsetMin = new Vector2(num, num2);
rectTransform.offsetMax = new Vector2(0f - num, 0f - num2);
}
}