summaryrefslogtreecommitdiff
path: root/Thronefall_v1.0/Decompile/SimpleUIScaler.cs
blob: 348433a0889b02b16e1ebce716a6eea1fd8e8ca2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using UnityEngine;

public class SimpleUIScaler : MonoBehaviour
{
	public bool offsetPositionWhenLarge;

	public Vector2 offset;

	private Vector2 ogPosition;

	private bool ogPositionBuffered;

	private RectTransform bufferedRT;

	private void OnEnable()
	{
		if (offsetPositionWhenLarge)
		{
			bufferedRT = GetComponent<RectTransform>();
			if (!ogPositionBuffered)
			{
				ogPosition = bufferedRT.anchoredPosition;
				ogPositionBuffered = true;
			}
		}
		if (SettingsManager.Instance.UseLargeInGameUI)
		{
			if (offsetPositionWhenLarge)
			{
				bufferedRT.anchoredPosition = ogPosition + offset;
			}
			base.transform.localScale = Vector3.one * 1.5f;
		}
		else
		{
			if (offsetPositionWhenLarge)
			{
				bufferedRT.anchoredPosition = ogPosition;
			}
			base.transform.localScale = Vector3.one;
		}
	}
}