Decompiled source of BankingApp v1.0.0

BankingApp_Il2cpp.dll

Decompiled 6 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BankingApp;
using BankingApp.Features;
using BankingApp.Utils;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppScheduleOne;
using Il2CppScheduleOne.DevUtilities;
using Il2CppScheduleOne.Money;
using Il2CppScheduleOne.PlayerScripts;
using Il2CppScheduleOne.UI;
using Il2CppScheduleOne.UI.Phone;
using Il2CppSystem;
using MelonLoader;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Core), "BankingApp", "1.0.0", "HazDS", null)]
[assembly: MelonGame("TVGS", "Schedule I")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("BankingApp_Il2cpp")]
[assembly: AssemblyConfiguration("Il2cpp")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BankingApp_Il2cpp")]
[assembly: AssemblyTitle("BankingApp_Il2cpp")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BankingApp
{
	public class Core : MelonMod
	{
		[CompilerGenerated]
		private sealed class <InitializeBankingApp>d__12 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Core <>4__this;

			private Exception <ex>5__1;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <InitializeBankingApp>d__12(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<ex>5__1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(2f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					try
					{
						if (!PlayerSingleton<AppsCanvas>.InstanceExists)
						{
							DebugLog.Error("AppsCanvas not found, cannot initialize banking app");
							return false;
						}
						<>4__this._bankingAppManager = new BankingAppManager();
						<>4__this._bankingAppManager.Initialize();
						DebugLog.Msg("Banking app initialized successfully");
					}
					catch (Exception ex)
					{
						<ex>5__1 = ex;
						DebugLog.Error("Failed to initialize banking app: " + <ex>5__1.Message);
						DebugLog.Error("Stack trace: " + <ex>5__1.StackTrace);
					}
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private bool _initialized;

		private BankingAppManager _bankingAppManager;

		public static Core Instance { get; private set; }

		public static bool DebugLogsEnabled { get; private set; } = true;


		public override void OnInitializeMelon()
		{
			Instance = this;
			MelonLogger.Msg("BankingApp v1.0.0 loaded!");
		}

		public override void OnSceneWasLoaded(int buildIndex, string sceneName)
		{
			if (sceneName == "Menu")
			{
				_initialized = false;
				_bankingAppManager = null;
			}
			else if (sceneName == "Main" && !_initialized)
			{
				_initialized = true;
				MelonCoroutines.Start(InitializeBankingApp());
			}
		}

		[IteratorStateMachine(typeof(<InitializeBankingApp>d__12))]
		private IEnumerator InitializeBankingApp()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <InitializeBankingApp>d__12(0)
			{
				<>4__this = this
			};
		}

		public override void OnUpdate()
		{
			_bankingAppManager?.Update();
		}
	}
}
namespace BankingApp.Utils
{
	public static class Constants
	{
		public static class Game
		{
			public const string GAME_STUDIO = "TVGS";

			public const string GAME_NAME = "Schedule I";
		}

		public static class UI
		{
			public const float WEEKLY_DEPOSIT_LIMIT = 10000f;

			public static readonly int[] AMOUNTS = new int[6] { 20, 50, 100, 500, 1000, 5000 };
		}

		public static class Colors
		{
			public const string MONEY_GREEN = "#54E717";

			public const string ONLINE_BLUE = "#4CBFFF";

			public const string ERROR_RED = "#FF4B4B";
		}

		public const string MOD_NAME = "BankingApp";

		public const string MOD_VERSION = "1.0.0";

		public const string MOD_AUTHOR = "HazDS";
	}
	public static class DebugLog
	{
		public static void Msg(string message)
		{
			if (Core.DebugLogsEnabled)
			{
				MelonLogger.Msg(message);
			}
		}

		public static void Warning(string message)
		{
			MelonLogger.Warning(message);
		}

		public static void Error(string message)
		{
			MelonLogger.Error(message);
		}
	}
}
namespace BankingApp.Features
{
	public class BankingAppManager
	{
		private GameObject _appContainer;

		private Button _appIconButton;

		private BankingAppUI _bankingUI;

		private bool _isOpen;

		public bool IsOpen => _isOpen;

		public void Initialize()
		{
			CreateAppIcon();
			CreateAppUI();
			RegisterEventHandlers();
			DebugLog.Msg("BankingAppManager initialized");
		}

		private void CreateAppIcon()
		{
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			HomeScreen instance = PlayerSingleton<HomeScreen>.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				DebugLog.Error("HomeScreen not found");
				return;
			}
			RectTransform val = null;
			GameObject val2 = null;
			val = instance.appIconContainer;
			val2 = instance.appIconPrefab;
			if ((Object)(object)val == (Object)null)
			{
				DebugLog.Error("appIconContainer is null");
				return;
			}
			if ((Object)(object)val2 == (Object)null)
			{
				DebugLog.Error("appIconPrefab is null");
				return;
			}
			GameObject val3 = Object.Instantiate<GameObject>(val2, ((Component)val).transform);
			((Object)val3).name = "BankingAppIcon";
			Transform obj = val3.transform.Find("Label");
			Text val4 = ((obj != null) ? ((Component)obj).GetComponent<Text>() : null);
			if ((Object)(object)val4 != (Object)null)
			{
				val4.text = "Banking";
			}
			Transform obj2 = val3.transform.Find("Mask/Image");
			Image val5 = ((obj2 != null) ? ((Component)obj2).GetComponent<Image>() : null);
			if ((Object)(object)val5 != (Object)null)
			{
				Sprite val6 = LoadEmbeddedSprite("BankingApp.Assets.appicon_banking.png");
				if ((Object)(object)val6 != (Object)null)
				{
					val5.sprite = val6;
					((Graphic)val5).color = Color.white;
				}
				else
				{
					((Graphic)val5).color = Color32.op_Implicit(new Color32((byte)84, (byte)231, (byte)23, byte.MaxValue));
				}
			}
			Transform val7 = val3.transform.Find("Notifications");
			if ((Object)(object)val7 != (Object)null)
			{
				((Component)val7).gameObject.SetActive(false);
			}
			_appIconButton = val3.GetComponent<Button>();
			if ((Object)(object)_appIconButton != (Object)null)
			{
				((UnityEventBase)_appIconButton.onClick).RemoveAllListeners();
				((UnityEvent)_appIconButton.onClick).AddListener(UnityAction.op_Implicit((Action)OnAppIconClicked));
			}
			DebugLog.Msg("Banking app icon created");
		}

		private void CreateAppUI()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			AppsCanvas instance = PlayerSingleton<AppsCanvas>.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				DebugLog.Error("AppsCanvas not found");
				return;
			}
			_appContainer = new GameObject("BankingApp");
			_appContainer.transform.SetParent(((Component)instance.canvas).transform, false);
			RectTransform val = _appContainer.AddComponent<RectTransform>();
			val.anchorMin = Vector2.zero;
			val.anchorMax = Vector2.one;
			val.offsetMin = Vector2.zero;
			val.offsetMax = Vector2.zero;
			_bankingUI = new BankingAppUI(_appContainer.transform);
			_bankingUI.OnCloseRequested += Close;
			_appContainer.SetActive(false);
			DebugLog.Msg("Banking app UI created");
		}

		private void RegisterEventHandlers()
		{
			Phone instance = PlayerSingleton<Phone>.Instance;
			if ((Object)(object)instance != (Object)null)
			{
				instance.closeApps += Action.op_Implicit((Action)CloseAction);
			}
		}

		private void CloseAction()
		{
			Close();
		}

		private void OnAppIconClicked()
		{
			if (_isOpen)
			{
				Close();
			}
			else
			{
				Open();
			}
		}

		public void Open()
		{
			if (!_isOpen)
			{
				if ((Object)(object)Phone.ActiveApp != (Object)null)
				{
					DebugLog.Warning("Another app is already open");
					return;
				}
				_isOpen = true;
				_appContainer.SetActive(true);
				Phone.ActiveApp = _appContainer;
				PlayerSingleton<HomeScreen>.Instance.SetIsOpen(false);
				PlayerSingleton<AppsCanvas>.Instance.SetIsOpen(true);
				PlayerSingleton<Phone>.Instance.SetIsHorizontal(true);
				PlayerSingleton<Phone>.Instance.SetLookOffsetMultiplier(0.6f);
				_bankingUI.Show();
				DebugLog.Msg("Banking app opened");
			}
		}

		public void Close()
		{
			if (_isOpen)
			{
				_isOpen = false;
				_appContainer.SetActive(false);
				if ((Object)(object)Phone.ActiveApp == (Object)(object)_appContainer)
				{
					Phone.ActiveApp = null;
				}
				PlayerSingleton<HomeScreen>.Instance.SetIsOpen(true);
				PlayerSingleton<Phone>.Instance.SetIsHorizontal(false);
				PlayerSingleton<Phone>.Instance.SetLookOffsetMultiplier(1f);
				Singleton<CursorManager>.Instance.SetCursorAppearance((ECursorType)0);
				_bankingUI.Hide();
				DebugLog.Msg("Banking app closed");
			}
		}

		private void OnExitAction(ExitAction exit)
		{
			if (!exit.Used && _isOpen && PlayerSingleton<Phone>.InstanceExists && PlayerSingleton<Phone>.Instance.IsOpen)
			{
				if (_bankingUI.HandleBack())
				{
					exit.Used = true;
					return;
				}
				exit.Used = true;
				Close();
			}
		}

		public void Update()
		{
			if (!_isOpen)
			{
				return;
			}
			_bankingUI?.Update();
			if (PlayerSingleton<Phone>.InstanceExists && PlayerSingleton<Phone>.Instance.IsOpen)
			{
				if (IsHoveringHomeButton() && GameInput.GetButtonDown((ButtonCode)0))
				{
					Close();
				}
				else if (Input.GetKeyDown((KeyCode)27) && !_bankingUI.HandleBack())
				{
					Close();
				}
			}
		}

		private bool IsHoveringHomeButton()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			GameplayMenu instance = Singleton<GameplayMenu>.Instance;
			Camera val = ((instance != null) ? instance.OverlayCamera : null);
			if ((Object)(object)val == (Object)null)
			{
				return false;
			}
			Ray val2 = val.ScreenPointToRay(Input.mousePosition);
			int num = 1 << LayerMask.NameToLayer("Overlay");
			RaycastHit val3 = default(RaycastHit);
			if (Physics.Raycast(val2, ref val3, 2f, num))
			{
				return ((Object)((Component)((RaycastHit)(ref val3)).collider).gameObject).name == "Button";
			}
			return false;
		}

		private static Sprite LoadEmbeddedSprite(string resourceName)
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Assembly executingAssembly = Assembly.GetExecutingAssembly();
				using Stream stream = executingAssembly.GetManifestResourceStream(resourceName);
				if (stream == null)
				{
					DebugLog.Warning("Could not find embedded resource: " + resourceName);
					return null;
				}
				byte[] array = new byte[stream.Length];
				stream.Read(array, 0, array.Length);
				Texture2D val = new Texture2D(2, 2);
				ImageConversion.LoadImage(val, Il2CppStructArray<byte>.op_Implicit(array));
				return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
			}
			catch (Exception ex)
			{
				DebugLog.Error("Failed to load embedded sprite: " + ex.Message);
				return null;
			}
		}
	}
	public class BankingAppUI
	{
		[CompilerGenerated]
		private sealed class <ProcessTransaction>d__74 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public float amount;

			public bool depositing;

			public BankingAppUI <>4__this;

			private MoneyManager <moneyManager>5__1;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <ProcessTransaction>d__74(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<moneyManager>5__1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>4__this.SetActiveScreen(<>4__this._processingScreen);
					<>2__current = (object)new WaitForSeconds(1f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<moneyManager>5__1 = NetworkSingleton<MoneyManager>.Instance;
					if ((Object)(object)<moneyManager>5__1 == (Object)null)
					{
						<>4__this.SetActiveScreen(<>4__this._menuScreen);
						return false;
					}
					if (depositing)
					{
						if (<moneyManager>5__1.cashBalance >= amount)
						{
							<moneyManager>5__1.ChangeCashBalance(0f - amount, true, false);
							<moneyManager>5__1.CreateOnlineTransaction("Mobile Deposit", amount, 1f, string.Empty);
							ATM.WeeklyDepositSum += amount;
							<>4__this._successSubtitle.text = "You have deposited " + MoneyManager.FormatAmount(amount, false, false);
							<>4__this.SetActiveScreen(<>4__this._successScreen);
						}
						else
						{
							<>4__this.SetActiveScreen(<>4__this._menuScreen);
						}
					}
					else if (GetOnlineBalance(<moneyManager>5__1) >= amount)
					{
						<moneyManager>5__1.ChangeCashBalance(amount, true, false);
						<moneyManager>5__1.CreateOnlineTransaction("Mobile Withdrawal", 0f - amount, 1f, string.Empty);
						<>4__this._successSubtitle.text = "You have withdrawn " + MoneyManager.FormatAmount(amount, false, false);
						<>4__this.SetActiveScreen(<>4__this._successScreen);
					}
					else
					{
						<>4__this.SetActiveScreen(<>4__this._menuScreen);
					}
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private readonly Transform _root;

		private GameObject _background;

		private GameObject _menuScreen;

		private GameObject _amountScreen;

		private GameObject _processingScreen;

		private GameObject _successScreen;

		private GameObject _activeScreen;

		private Text _titleText;

		private Text _headerDepositLimitText;

		private Text _headerOnlineBalanceText;

		private Text _headerCashText;

		private Text _amountHeaderDepositLimitText;

		private Text _amountHeaderOnlineBalanceText;

		private Text _amountHeaderCashText;

		private Text _amountSelectorTitle;

		private Text _selectedAmountText;

		private Text _confirmButtonText;

		private Text _successSubtitle;

		private Button _depositButton;

		private Button _withdrawButton;

		private Button _confirmButton;

		private Button _cancelButton;

		private Button _doneButton;

		private Button _returnButton;

		private Button[] _amountButtons;

		private Button[] _incrementButtons;

		private Text _processingDotsText;

		private float _dotAnimationTimer;

		private int _dotCount;

		private bool _isDepositing = true;

		private float _selectedAmount = 20f;

		private static readonly Color32 BackgroundTop = new Color32((byte)59, (byte)127, (byte)212, byte.MaxValue);

		private static readonly Color32 BackgroundBottom = new Color32((byte)30, (byte)58, (byte)95, byte.MaxValue);

		private static readonly Color32 HeaderBgColor = new Color32((byte)40, (byte)80, (byte)140, byte.MaxValue);

		private static readonly Color32 ButtonColor = new Color32((byte)35, (byte)65, (byte)110, byte.MaxValue);

		private static readonly Color32 ButtonHoverColor = new Color32((byte)50, (byte)90, (byte)145, byte.MaxValue);

		private static readonly Color32 ButtonSelectedColor = new Color32((byte)60, (byte)140, (byte)200, byte.MaxValue);

		private static readonly Color32 CyanColor = new Color32((byte)76, (byte)191, byte.MaxValue, byte.MaxValue);

		private static readonly Color32 GreenColor = new Color32((byte)84, (byte)231, (byte)23, byte.MaxValue);

		private static readonly Color32 OrangeColor = new Color32(byte.MaxValue, (byte)140, (byte)50, byte.MaxValue);

		private static readonly Color32 ConfirmGreen = new Color32((byte)50, (byte)200, (byte)80, byte.MaxValue);

		private static readonly int[] PresetAmounts = new int[6] { 20, 50, 100, 500, 1000, 5000 };

		private static readonly int[] IncrementValues = new int[6] { -100, -10, -1, 1, 10, 100 };

		public event Action OnCloseRequested;

		public BankingAppUI(Transform root)
		{
			_root = root;
			BuildUI();
		}

		private void BuildUI()
		{
			CreateBackground();
			CreateMenuScreen();
			CreateAmountScreen();
			CreateProcessingScreen();
			CreateSuccessScreen();
			SetActiveScreen(_menuScreen);
		}

		private void CreateBackground()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			_background = new GameObject("Background");
			_background.transform.SetParent(_root, false);
			RectTransform val = _background.AddComponent<RectTransform>();
			val.anchorMin = Vector2.zero;
			val.anchorMax = Vector2.one;
			val.offsetMin = Vector2.zero;
			val.offsetMax = Vector2.zero;
			Image val2 = _background.AddComponent<Image>();
			((Graphic)val2).color = Color32.op_Implicit(BackgroundTop);
		}

		private void CreateMenuScreen()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_033a: Unknown result type (might be due to invalid IL or missing references)
			//IL_038e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
			_menuScreen = CreatePanel(_root, "MenuScreen", Color.clear);
			SetFullRect(_menuScreen.GetComponent<RectTransform>(), 0f, 0f, 1f, 1f);
			GameObject val = CreatePanel(_menuScreen.transform, "Header", Color32.op_Implicit(HeaderBgColor));
			SetFullRect(val.GetComponent<RectTransform>(), 0f, 0.88f, 1f, 1f);
			_titleText = CreateText(val.transform, "Title", "ATM", 24, (TextAnchor)3);
			_titleText.fontStyle = (FontStyle)1;
			SetFullRect(((Component)_titleText).GetComponent<RectTransform>(), 0.03f, 0f, 0.15f, 1f);
			Text val2 = CreateText(val.transform, "DepositLimitLabel", "Weekly Deposit Limit", 12, (TextAnchor)7);
			SetFullRect(((Component)val2).GetComponent<RectTransform>(), 0.15f, 0.52f, 0.4f, 1f);
			_headerDepositLimitText = CreateText(val.transform, "DepositLimitValue", "$0 / $10,000", 16, (TextAnchor)1);
			_headerDepositLimitText.fontStyle = (FontStyle)1;
			SetFullRect(((Component)_headerDepositLimitText).GetComponent<RectTransform>(), 0.15f, 0f, 0.4f, 0.52f);
			Text val3 = CreateText(val.transform, "OnlineLabel", "Online Balance", 12, (TextAnchor)7);
			SetFullRect(((Component)val3).GetComponent<RectTransform>(), 0.42f, 0.52f, 0.68f, 1f);
			_headerOnlineBalanceText = CreateText(val.transform, "OnlineValue", "$0", 18, (TextAnchor)1);
			((Graphic)_headerOnlineBalanceText).color = Color32.op_Implicit(CyanColor);
			_headerOnlineBalanceText.fontStyle = (FontStyle)1;
			SetFullRect(((Component)_headerOnlineBalanceText).GetComponent<RectTransform>(), 0.42f, 0f, 0.68f, 0.52f);
			Text val4 = CreateText(val.transform, "CashLabel", "Cash", 12, (TextAnchor)7);
			SetFullRect(((Component)val4).GetComponent<RectTransform>(), 0.7f, 0.52f, 0.97f, 1f);
			_headerCashText = CreateText(val.transform, "CashValue", "$0", 18, (TextAnchor)1);
			((Graphic)_headerCashText).color = Color32.op_Implicit(GreenColor);
			_headerCashText.fontStyle = (FontStyle)1;
			SetFullRect(((Component)_headerCashText).GetComponent<RectTransform>(), 0.7f, 0f, 0.97f, 0.52f);
			GameObject val5 = CreatePanel(_menuScreen.transform, "ContentArea", Color.clear);
			SetFullRect(val5.GetComponent<RectTransform>(), 0.05f, 0.15f, 0.95f, 0.8f);
			Text val6 = CreateText(val5.transform, "Welcome", "Select Transaction Type", 24, (TextAnchor)4);
			SetFullRect(((Component)val6).GetComponent<RectTransform>(), 0f, 0.75f, 1f, 0.95f);
			_depositButton = CreateStyledButton(val5.transform, "DepositButton", "DEPOSIT", CyanColor, OnDepositPressed);
			SetFullRect(((Component)_depositButton).GetComponent<RectTransform>(), 0.1f, 0.45f, 0.9f, 0.7f);
			_withdrawButton = CreateStyledButton(val5.transform, "WithdrawButton", "WITHDRAW", CyanColor, OnWithdrawPressed);
			SetFullRect(((Component)_withdrawButton).GetComponent<RectTransform>(), 0.1f, 0.15f, 0.9f, 0.4f);
			Button val7 = CreateStyledButton(_menuScreen.transform, "CloseButton", "CLOSE", OrangeColor, delegate
			{
				this.OnCloseRequested?.Invoke();
			});
			SetFullRect(((Component)val7).GetComponent<RectTransform>(), 0.3f, 0.03f, 0.7f, 0.12f);
		}

		private void CreateAmountScreen()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_037a: Unknown result type (might be due to invalid IL or missing references)
			_amountScreen = CreatePanel(_root, "AmountScreen", Color.clear);
			SetFullRect(_amountScreen.GetComponent<RectTransform>(), 0f, 0f, 1f, 1f);
			GameObject val = CreatePanel(_amountScreen.transform, "Header", Color32.op_Implicit(HeaderBgColor));
			SetFullRect(val.GetComponent<RectTransform>(), 0f, 0.88f, 1f, 1f);
			Text val2 = CreateText(val.transform, "ATM", "ATM", 24, (TextAnchor)3);
			val2.fontStyle = (FontStyle)1;
			SetFullRect(((Component)val2).GetComponent<RectTransform>(), 0.03f, 0f, 0.15f, 1f);
			Text val3 = CreateText(val.transform, "DepositLimitLabel", "Weekly Deposit Limit", 12, (TextAnchor)7);
			SetFullRect(((Component)val3).GetComponent<RectTransform>(), 0.15f, 0.52f, 0.4f, 1f);
			_amountHeaderDepositLimitText = CreateText(val.transform, "DepositLimitValue", "$0 / $10,000", 16, (TextAnchor)1);
			_amountHeaderDepositLimitText.fontStyle = (FontStyle)1;
			SetFullRect(((Component)_amountHeaderDepositLimitText).GetComponent<RectTransform>(), 0.15f, 0f, 0.4f, 0.52f);
			Text val4 = CreateText(val.transform, "OnlineLabel", "Online Balance", 12, (TextAnchor)7);
			SetFullRect(((Component)val4).GetComponent<RectTransform>(), 0.42f, 0.52f, 0.68f, 1f);
			_amountHeaderOnlineBalanceText = CreateText(val.transform, "OnlineValue", "$0", 18, (TextAnchor)1);
			((Graphic)_amountHeaderOnlineBalanceText).color = Color32.op_Implicit(CyanColor);
			_amountHeaderOnlineBalanceText.fontStyle = (FontStyle)1;
			SetFullRect(((Component)_amountHeaderOnlineBalanceText).GetComponent<RectTransform>(), 0.42f, 0f, 0.68f, 0.52f);
			Text val5 = CreateText(val.transform, "CashLabel", "Cash", 12, (TextAnchor)7);
			SetFullRect(((Component)val5).GetComponent<RectTransform>(), 0.7f, 0.52f, 0.97f, 1f);
			_amountHeaderCashText = CreateText(val.transform, "CashValue", "$0", 18, (TextAnchor)1);
			((Graphic)_amountHeaderCashText).color = Color32.op_Implicit(GreenColor);
			_amountHeaderCashText.fontStyle = (FontStyle)1;
			SetFullRect(((Component)_amountHeaderCashText).GetComponent<RectTransform>(), 0.7f, 0f, 0.97f, 0.52f);
			_amountSelectorTitle = CreateText(_amountScreen.transform, "Title", "Select amount to deposit", 20, (TextAnchor)4);
			SetFullRect(((Component)_amountSelectorTitle).GetComponent<RectTransform>(), 0f, 0.78f, 1f, 0.87f);
			CreateIncrementButtons(_amountScreen.transform);
			CreatePresetAmountButtons(_amountScreen.transform);
			_cancelButton = CreateStyledButton(_amountScreen.transform, "CancelButton", "CANCEL", OrangeColor, OnCancelPressed);
			SetFullRect(((Component)_cancelButton).GetComponent<RectTransform>(), 0.05f, 0.02f, 0.45f, 0.12f);
			_confirmButton = CreateStyledButton(_amountScreen.transform, "ConfirmButton", "DEPOSIT $20", ConfirmGreen, OnConfirmPressed);
			SetFullRect(((Component)_confirmButton).GetComponent<RectTransform>(), 0.55f, 0.02f, 0.95f, 0.12f);
			_confirmButtonText = ((Component)_confirmButton).GetComponentInChildren<Text>();
			_amountScreen.SetActive(false);
		}

		private void CreateIncrementButtons(Transform parent)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreatePanel(parent, "IncrementContainer", Color.clear);
			SetFullRect(val.GetComponent<RectTransform>(), 0.02f, 0.68f, 0.98f, 0.79f);
			_incrementButtons = (Button[])(object)new Button[6];
			float num = 0.125f;
			float num2 = 0.02f;
			float num3 = 7f * num + 6f * num2;
			float num4 = (1f - num3) / 2f;
			string[] array = new string[7] { "-100", "-10", "-1", "", "+1", "+10", "+100" };
			for (int i = 0; i < 7; i++)
			{
				float num5 = num4 + (float)i * (num + num2);
				float xMax = num5 + num;
				if (i == 3)
				{
					GameObject val2 = CreatePanel(val.transform, "AmountDisplay", Color32.op_Implicit(ButtonColor));
					SetFullRect(val2.GetComponent<RectTransform>(), num5, 0f, xMax, 1f);
					Outline val3 = val2.AddComponent<Outline>();
					((Shadow)val3).effectColor = Color.white;
					((Shadow)val3).effectDistance = new Vector2(2f, 2f);
					_selectedAmountText = CreateText(val2.transform, "Amount", "$20", 20, (TextAnchor)4);
					_selectedAmountText.fontStyle = (FontStyle)1;
					SetFullRect(((Component)_selectedAmountText).GetComponent<RectTransform>(), 0f, 0f, 1f, 1f);
				}
				else
				{
					int num6 = ((i < 3) ? i : (i - 1));
					int value = IncrementValues[num6];
					Button val4 = CreateStyledButton(val.transform, $"Inc_{value}", array[i], CyanColor, delegate
					{
						AdjustAmount(value);
					});
					SetFullRect(((Component)val4).GetComponent<RectTransform>(), num5, 0f, xMax, 1f);
					_incrementButtons[num6] = val4;
				}
			}
		}

		private void CreatePresetAmountButtons(Transform parent)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreatePanel(parent, "ButtonGrid", Color.clear);
			SetFullRect(val.GetComponent<RectTransform>(), 0.05f, 0.14f, 0.95f, 0.66f);
			_amountButtons = (Button[])(object)new Button[7];
			float num = 0f;
			float num2 = 0.52f;
			float num3 = 0.46f;
			float num4 = 0.22f;
			float num5 = 0.04f;
			for (int i = 0; i < 3; i++)
			{
				float num6 = 1f - (float)i * (num4 + num5);
				float yMin = num6 - num4;
				int num7 = PresetAmounts[i];
				int index = i;
				Button val2 = CreateAmountButton(val.transform, $"Amount_{num7}", MoneyManager.FormatAmount((float)num7, false, false), delegate
				{
					SelectPresetAmount(index);
				});
				SetFullRect(((Component)val2).GetComponent<RectTransform>(), num, yMin, num + num3, num6);
				_amountButtons[i] = val2;
			}
			for (int j = 0; j < 3; j++)
			{
				float num8 = 1f - (float)j * (num4 + num5);
				float yMin2 = num8 - num4;
				int index2 = j + 3;
				Button val3;
				if (j == 2)
				{
					val3 = CreateAmountButton(val.transform, "Amount_MAX", "MAX", delegate
					{
						SelectPresetAmount(6);
					});
					_amountButtons[6] = val3;
				}
				else
				{
					int num9 = PresetAmounts[index2];
					val3 = CreateAmountButton(val.transform, $"Amount_{num9}", MoneyManager.FormatAmount((float)num9, false, false), delegate
					{
						SelectPresetAmount(index2);
					});
					_amountButtons[index2] = val3;
				}
				SetFullRect(((Component)val3).GetComponent<RectTransform>(), num2, yMin2, num2 + num3, num8);
			}
		}

		private Button CreateAmountButton(Transform parent, string name, string label, Action onClick)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreatePanel(parent, name, Color32.op_Implicit(CyanColor));
			Button val2 = val.AddComponent<Button>();
			Outline val3 = val.AddComponent<Outline>();
			((Shadow)val3).effectColor = Color32.op_Implicit(new Color32((byte)100, (byte)150, (byte)200, byte.MaxValue));
			((Shadow)val3).effectDistance = new Vector2(2f, 2f);
			ColorBlock colors = ((Selectable)val2).colors;
			((ColorBlock)(ref colors)).normalColor = Color32.op_Implicit(CyanColor);
			((ColorBlock)(ref colors)).highlightedColor = Color32.op_Implicit(new Color32((byte)100, (byte)210, byte.MaxValue, byte.MaxValue));
			((ColorBlock)(ref colors)).pressedColor = Color32.op_Implicit(new Color32((byte)60, (byte)160, (byte)220, byte.MaxValue));
			((ColorBlock)(ref colors)).selectedColor = Color32.op_Implicit(new Color32((byte)60, (byte)160, (byte)220, byte.MaxValue));
			((Selectable)val2).colors = colors;
			Text val4 = CreateText(val.transform, "Text", label, 22, (TextAnchor)4);
			val4.fontStyle = (FontStyle)1;
			SetFullRect(((Component)val4).GetComponent<RectTransform>(), 0f, 0f, 1f, 1f);
			((UnityEvent)val2.onClick).AddListener(UnityAction.op_Implicit(onClick));
			return val2;
		}

		private void CreateProcessingScreen()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			_processingScreen = CreatePanel(_root, "ProcessingScreen", Color.clear);
			SetFullRect(_processingScreen.GetComponent<RectTransform>(), 0f, 0f, 1f, 1f);
			Text val = CreateText(_processingScreen.transform, "Title", "Processing", 32, (TextAnchor)4);
			val.fontStyle = (FontStyle)1;
			SetFullRect(((Component)val).GetComponent<RectTransform>(), 0f, 0.5f, 1f, 0.6f);
			_processingDotsText = CreateText(_processingScreen.transform, "Dots", ".", 32, (TextAnchor)4);
			_processingDotsText.fontStyle = (FontStyle)1;
			SetFullRect(((Component)_processingDotsText).GetComponent<RectTransform>(), 0f, 0.4f, 1f, 0.5f);
			_processingScreen.SetActive(false);
		}

		private void CreateSuccessScreen()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			_successScreen = CreatePanel(_root, "SuccessScreen", Color.clear);
			SetFullRect(_successScreen.GetComponent<RectTransform>(), 0f, 0f, 1f, 1f);
			Text val = CreateText(_successScreen.transform, "Title", "Transaction Complete", 32, (TextAnchor)4);
			((Graphic)val).color = Color32.op_Implicit(GreenColor);
			val.fontStyle = (FontStyle)1;
			SetFullRect(((Component)val).GetComponent<RectTransform>(), 0f, 0.6f, 1f, 0.75f);
			_successSubtitle = CreateText(_successScreen.transform, "Subtitle", "", 24, (TextAnchor)4);
			SetFullRect(((Component)_successSubtitle).GetComponent<RectTransform>(), 0.1f, 0.45f, 0.9f, 0.58f);
			_doneButton = CreateStyledButton(_successScreen.transform, "DoneButton", "DONE", ConfirmGreen, delegate
			{
				this.OnCloseRequested?.Invoke();
			});
			SetFullRect(((Component)_doneButton).GetComponent<RectTransform>(), 0.15f, 0.25f, 0.85f, 0.38f);
			_returnButton = CreateStyledButton(_successScreen.transform, "ReturnButton", "RETURN TO MENU", ButtonColor, OnReturnToMenu);
			SetFullRect(((Component)_returnButton).GetComponent<RectTransform>(), 0.15f, 0.1f, 0.85f, 0.23f);
			_successScreen.SetActive(false);
		}

		private GameObject CreatePanel(Transform parent, string name, Color color)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			RectTransform val2 = val.AddComponent<RectTransform>();
			Image val3 = val.AddComponent<Image>();
			((Graphic)val3).color = color;
			return val;
		}

		private Text CreateText(Transform parent, string name, string content, int fontSize, TextAnchor alignment)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			RectTransform val2 = val.AddComponent<RectTransform>();
			Text val3 = val.AddComponent<Text>();
			val3.text = content;
			val3.fontSize = fontSize;
			val3.alignment = alignment;
			((Graphic)val3).color = Color.white;
			val3.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
			return val3;
		}

		private Button CreateStyledButton(Transform parent, string name, string label, Color32 bgColor, Action onClick)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreatePanel(parent, name, Color32.op_Implicit(bgColor));
			Button val2 = val.AddComponent<Button>();
			ColorBlock colors = ((Selectable)val2).colors;
			((ColorBlock)(ref colors)).normalColor = Color32.op_Implicit(bgColor);
			((ColorBlock)(ref colors)).highlightedColor = Color32.op_Implicit(new Color32((byte)Mathf.Min(255, bgColor.r + 30), (byte)Mathf.Min(255, bgColor.g + 30), (byte)Mathf.Min(255, bgColor.b + 30), byte.MaxValue));
			((ColorBlock)(ref colors)).pressedColor = Color32.op_Implicit(new Color32((byte)Mathf.Max(0, bgColor.r - 20), (byte)Mathf.Max(0, bgColor.g - 20), (byte)Mathf.Max(0, bgColor.b - 20), byte.MaxValue));
			((Selectable)val2).colors = colors;
			Text val3 = CreateText(val.transform, "Text", label, 20, (TextAnchor)4);
			val3.fontStyle = (FontStyle)1;
			SetFullRect(((Component)val3).GetComponent<RectTransform>(), 0f, 0f, 1f, 1f);
			((UnityEvent)val2.onClick).AddListener(UnityAction.op_Implicit(onClick));
			return val2;
		}

		private void SetFullRect(RectTransform rect, float xMin, float yMin, float xMax, float yMax)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			rect.anchorMin = new Vector2(xMin, yMin);
			rect.anchorMax = new Vector2(xMax, yMax);
			rect.offsetMin = Vector2.zero;
			rect.offsetMax = Vector2.zero;
		}

		private void SetActiveScreen(GameObject screen)
		{
			_menuScreen.SetActive(false);
			_amountScreen.SetActive(false);
			_processingScreen.SetActive(false);
			_successScreen.SetActive(false);
			_activeScreen = screen;
			_activeScreen.SetActive(true);
		}

		public void Show()
		{
			SetActiveScreen(_menuScreen);
			UpdateBalanceDisplay();
		}

		public void Hide()
		{
			SetActiveScreen(_menuScreen);
		}

		public bool HandleBack()
		{
			if ((Object)(object)_activeScreen == (Object)(object)_amountScreen)
			{
				SetActiveScreen(_menuScreen);
				return true;
			}
			return false;
		}

		public void Update()
		{
			UpdateBalanceDisplay();
			if ((Object)(object)_activeScreen == (Object)(object)_processingScreen && (Object)(object)_processingDotsText != (Object)null)
			{
				_dotAnimationTimer += Time.deltaTime;
				if (_dotAnimationTimer >= 0.4f)
				{
					_dotAnimationTimer = 0f;
					_dotCount = (_dotCount + 1) % 4;
					_processingDotsText.text = new string('.', (_dotCount == 0) ? 1 : _dotCount);
				}
			}
			if ((Object)(object)_activeScreen == (Object)(object)_amountScreen)
			{
				UpdateAmountScreen();
			}
		}

		private void UpdateBalanceDisplay()
		{
			MoneyManager instance = NetworkSingleton<MoneyManager>.Instance;
			if (!((Object)(object)instance == (Object)null))
			{
				float weeklyDepositSum = ATM.WeeklyDepositSum;
				string text = MoneyManager.FormatAmount(weeklyDepositSum, false, false) + " / " + MoneyManager.FormatAmount(10000f, false, false);
				string text2 = MoneyManager.FormatAmount(GetOnlineBalance(instance), false, false);
				string text3 = MoneyManager.FormatAmount(instance.cashBalance, false, false);
				if ((Object)(object)_headerDepositLimitText != (Object)null)
				{
					_headerDepositLimitText.text = text;
				}
				if ((Object)(object)_headerOnlineBalanceText != (Object)null)
				{
					_headerOnlineBalanceText.text = text2;
				}
				if ((Object)(object)_headerCashText != (Object)null)
				{
					_headerCashText.text = text3;
				}
				if ((Object)(object)_amountHeaderDepositLimitText != (Object)null)
				{
					_amountHeaderDepositLimitText.text = text;
				}
				if ((Object)(object)_amountHeaderOnlineBalanceText != (Object)null)
				{
					_amountHeaderOnlineBalanceText.text = text2;
				}
				if ((Object)(object)_amountHeaderCashText != (Object)null)
				{
					_amountHeaderCashText.text = text3;
				}
				if (weeklyDepositSum >= 10000f && (Object)(object)_depositButton != (Object)null)
				{
					((Selectable)_depositButton).interactable = false;
				}
				else if ((Object)(object)_depositButton != (Object)null)
				{
					((Selectable)_depositButton).interactable = true;
				}
			}
		}

		private void UpdateAmountScreen()
		{
			MoneyManager instance = NetworkSingleton<MoneyManager>.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return;
			}
			float num = (_isDepositing ? Mathf.Min(instance.cashBalance, 10000f - ATM.WeeklyDepositSum) : GetOnlineBalance(instance));
			for (int i = 0; i < _incrementButtons.Length; i++)
			{
				if (!((Object)(object)_incrementButtons[i] == (Object)null))
				{
					float num2 = _selectedAmount + (float)IncrementValues[i];
					((Selectable)_incrementButtons[i]).interactable = num2 >= 1f && num2 <= num;
				}
			}
			for (int j = 0; j < 6; j++)
			{
				if (!((Object)(object)_amountButtons[j] == (Object)null))
				{
					bool interactable = num >= (float)PresetAmounts[j];
					((Selectable)_amountButtons[j]).interactable = interactable;
				}
			}
			if ((Object)(object)_amountButtons[6] != (Object)null)
			{
				((Component)_amountButtons[6]).GetComponentInChildren<Text>().text = "MAX (" + MoneyManager.FormatAmount(num, false, false) + ")";
				((Selectable)_amountButtons[6]).interactable = num > 0f;
			}
			string text = (_isDepositing ? "DEPOSIT" : "WITHDRAW");
			_confirmButtonText.text = text + " " + MoneyManager.FormatAmount(_selectedAmount, false, false);
			((Selectable)_confirmButton).interactable = _selectedAmount > 0f && _selectedAmount <= num;
			_selectedAmountText.text = MoneyManager.FormatAmount(_selectedAmount, false, false);
		}

		private void AdjustAmount(int delta)
		{
			MoneyManager instance = NetworkSingleton<MoneyManager>.Instance;
			if (!((Object)(object)instance == (Object)null))
			{
				float num = (_isDepositing ? Mathf.Min(instance.cashBalance, 10000f - ATM.WeeklyDepositSum) : GetOnlineBalance(instance));
				_selectedAmount = Mathf.Clamp(_selectedAmount + (float)delta, 1f, num);
				_selectedAmountText.text = MoneyManager.FormatAmount(_selectedAmount, false, false);
			}
		}

		private void SelectPresetAmount(int index)
		{
			MoneyManager instance = NetworkSingleton<MoneyManager>.Instance;
			if (!((Object)(object)instance == (Object)null))
			{
				float num = (_isDepositing ? Mathf.Min(instance.cashBalance, 10000f - ATM.WeeklyDepositSum) : GetOnlineBalance(instance));
				if (index == 6)
				{
					_selectedAmount = num;
				}
				else if (index < PresetAmounts.Length)
				{
					_selectedAmount = Mathf.Min((float)PresetAmounts[index], num);
				}
				_selectedAmountText.text = MoneyManager.FormatAmount(_selectedAmount, false, false);
			}
		}

		private void OnDepositPressed()
		{
			_isDepositing = true;
			_amountSelectorTitle.text = "Select amount to deposit";
			_selectedAmount = 20f;
			SetActiveScreen(_amountScreen);
		}

		private void OnWithdrawPressed()
		{
			_isDepositing = false;
			_amountSelectorTitle.text = "Select amount to withdraw";
			_selectedAmount = 20f;
			SetActiveScreen(_amountScreen);
		}

		private void OnConfirmPressed()
		{
			if (!(_selectedAmount <= 0f))
			{
				MelonCoroutines.Start(ProcessTransaction(_selectedAmount, _isDepositing));
			}
		}

		private void OnCancelPressed()
		{
			SetActiveScreen(_menuScreen);
		}

		private void OnReturnToMenu()
		{
			SetActiveScreen(_menuScreen);
		}

		[IteratorStateMachine(typeof(<ProcessTransaction>d__74))]
		private IEnumerator ProcessTransaction(float amount, bool depositing)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ProcessTransaction>d__74(0)
			{
				<>4__this = this,
				amount = amount,
				depositing = depositing
			};
		}

		private static float GetOnlineBalance(MoneyManager moneyManager)
		{
			return moneyManager.onlineBalance;
		}
	}
}

BankingApp_Mono.dll

Decompiled 6 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BankingApp;
using BankingApp.Features;
using BankingApp.Utils;
using MelonLoader;
using Microsoft.CodeAnalysis;
using ScheduleOne;
using ScheduleOne.DevUtilities;
using ScheduleOne.Money;
using ScheduleOne.PlayerScripts;
using ScheduleOne.UI;
using ScheduleOne.UI.Phone;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Core), "BankingApp", "1.0.0", "HazDS", null)]
[assembly: MelonGame("TVGS", "Schedule I")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("BankingApp_Mono")]
[assembly: AssemblyConfiguration("Mono")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BankingApp_Mono")]
[assembly: AssemblyTitle("BankingApp_Mono")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BankingApp
{
	public class Core : MelonMod
	{
		[CompilerGenerated]
		private sealed class <InitializeBankingApp>d__12 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Core <>4__this;

			private Exception <ex>5__1;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <InitializeBankingApp>d__12(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<ex>5__1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(2f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					try
					{
						if (!PlayerSingleton<AppsCanvas>.InstanceExists)
						{
							DebugLog.Error("AppsCanvas not found, cannot initialize banking app");
							return false;
						}
						<>4__this._bankingAppManager = new BankingAppManager();
						<>4__this._bankingAppManager.Initialize();
						DebugLog.Msg("Banking app initialized successfully");
					}
					catch (Exception ex)
					{
						<ex>5__1 = ex;
						DebugLog.Error("Failed to initialize banking app: " + <ex>5__1.Message);
						DebugLog.Error("Stack trace: " + <ex>5__1.StackTrace);
					}
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private bool _initialized;

		private BankingAppManager _bankingAppManager;

		public static Core Instance { get; private set; }

		public static bool DebugLogsEnabled { get; private set; } = true;


		public override void OnInitializeMelon()
		{
			Instance = this;
			MelonLogger.Msg("BankingApp v1.0.0 loaded!");
		}

		public override void OnSceneWasLoaded(int buildIndex, string sceneName)
		{
			if (sceneName == "Menu")
			{
				_initialized = false;
				_bankingAppManager = null;
			}
			else if (sceneName == "Main" && !_initialized)
			{
				_initialized = true;
				MelonCoroutines.Start(InitializeBankingApp());
			}
		}

		[IteratorStateMachine(typeof(<InitializeBankingApp>d__12))]
		private IEnumerator InitializeBankingApp()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <InitializeBankingApp>d__12(0)
			{
				<>4__this = this
			};
		}

		public override void OnUpdate()
		{
			_bankingAppManager?.Update();
		}
	}
}
namespace BankingApp.Utils
{
	public static class Constants
	{
		public static class Game
		{
			public const string GAME_STUDIO = "TVGS";

			public const string GAME_NAME = "Schedule I";
		}

		public static class UI
		{
			public const float WEEKLY_DEPOSIT_LIMIT = 10000f;

			public static readonly int[] AMOUNTS = new int[6] { 20, 50, 100, 500, 1000, 5000 };
		}

		public static class Colors
		{
			public const string MONEY_GREEN = "#54E717";

			public const string ONLINE_BLUE = "#4CBFFF";

			public const string ERROR_RED = "#FF4B4B";
		}

		public const string MOD_NAME = "BankingApp";

		public const string MOD_VERSION = "1.0.0";

		public const string MOD_AUTHOR = "HazDS";
	}
	public static class DebugLog
	{
		public static void Msg(string message)
		{
			if (Core.DebugLogsEnabled)
			{
				MelonLogger.Msg(message);
			}
		}

		public static void Warning(string message)
		{
			MelonLogger.Warning(message);
		}

		public static void Error(string message)
		{
			MelonLogger.Error(message);
		}
	}
}
namespace BankingApp.Features
{
	public class BankingAppManager
	{
		private GameObject _appContainer;

		private Button _appIconButton;

		private BankingAppUI _bankingUI;

		private bool _isOpen;

		public bool IsOpen => _isOpen;

		public void Initialize()
		{
			CreateAppIcon();
			CreateAppUI();
			RegisterEventHandlers();
			DebugLog.Msg("BankingAppManager initialized");
		}

		private void CreateAppIcon()
		{
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Expected O, but got Unknown
			HomeScreen instance = PlayerSingleton<HomeScreen>.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				DebugLog.Error("HomeScreen not found");
				return;
			}
			RectTransform val = null;
			GameObject val2 = null;
			FieldInfo field = typeof(HomeScreen).GetField("appIconContainer", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (field == null)
			{
				DebugLog.Error("Could not find appIconContainer field");
				return;
			}
			object? value = field.GetValue(instance);
			val = (RectTransform)((value is RectTransform) ? value : null);
			FieldInfo field2 = typeof(HomeScreen).GetField("appIconPrefab", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (field2 == null)
			{
				DebugLog.Error("Could not find appIconPrefab field");
				return;
			}
			object? value2 = field2.GetValue(instance);
			val2 = (GameObject)((value2 is GameObject) ? value2 : null);
			if ((Object)(object)val == (Object)null)
			{
				DebugLog.Error("appIconContainer is null");
				return;
			}
			if ((Object)(object)val2 == (Object)null)
			{
				DebugLog.Error("appIconPrefab is null");
				return;
			}
			GameObject val3 = Object.Instantiate<GameObject>(val2, ((Component)val).transform);
			((Object)val3).name = "BankingAppIcon";
			Transform obj = val3.transform.Find("Label");
			Text val4 = ((obj != null) ? ((Component)obj).GetComponent<Text>() : null);
			if ((Object)(object)val4 != (Object)null)
			{
				val4.text = "Banking";
			}
			Transform obj2 = val3.transform.Find("Mask/Image");
			Image val5 = ((obj2 != null) ? ((Component)obj2).GetComponent<Image>() : null);
			if ((Object)(object)val5 != (Object)null)
			{
				Sprite val6 = LoadEmbeddedSprite("BankingApp.Assets.appicon_banking.png");
				if ((Object)(object)val6 != (Object)null)
				{
					val5.sprite = val6;
					((Graphic)val5).color = Color.white;
				}
				else
				{
					((Graphic)val5).color = Color32.op_Implicit(new Color32((byte)84, (byte)231, (byte)23, byte.MaxValue));
				}
			}
			Transform val7 = val3.transform.Find("Notifications");
			if ((Object)(object)val7 != (Object)null)
			{
				((Component)val7).gameObject.SetActive(false);
			}
			_appIconButton = val3.GetComponent<Button>();
			if ((Object)(object)_appIconButton != (Object)null)
			{
				((UnityEventBase)_appIconButton.onClick).RemoveAllListeners();
				((UnityEvent)_appIconButton.onClick).AddListener(new UnityAction(OnAppIconClicked));
			}
			DebugLog.Msg("Banking app icon created");
		}

		private void CreateAppUI()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			AppsCanvas instance = PlayerSingleton<AppsCanvas>.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				DebugLog.Error("AppsCanvas not found");
				return;
			}
			_appContainer = new GameObject("BankingApp");
			_appContainer.transform.SetParent(((Component)instance.canvas).transform, false);
			RectTransform val = _appContainer.AddComponent<RectTransform>();
			val.anchorMin = Vector2.zero;
			val.anchorMax = Vector2.one;
			val.offsetMin = Vector2.zero;
			val.offsetMax = Vector2.zero;
			_bankingUI = new BankingAppUI(_appContainer.transform);
			_bankingUI.OnCloseRequested += Close;
			_appContainer.SetActive(false);
			DebugLog.Msg("Banking app UI created");
		}

		private void RegisterEventHandlers()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			GameInput.RegisterExitListener(new ExitDelegate(OnExitAction), 1);
			Phone instance = PlayerSingleton<Phone>.Instance;
			if ((Object)(object)instance != (Object)null)
			{
				instance.closeApps = (Action)Delegate.Combine(instance.closeApps, new Action(Close));
			}
		}

		private void OnAppIconClicked()
		{
			if (_isOpen)
			{
				Close();
			}
			else
			{
				Open();
			}
		}

		public void Open()
		{
			if (!_isOpen)
			{
				if ((Object)(object)Phone.ActiveApp != (Object)null)
				{
					DebugLog.Warning("Another app is already open");
					return;
				}
				_isOpen = true;
				_appContainer.SetActive(true);
				Phone.ActiveApp = _appContainer;
				PlayerSingleton<HomeScreen>.Instance.SetIsOpen(false);
				PlayerSingleton<AppsCanvas>.Instance.SetIsOpen(true);
				PlayerSingleton<Phone>.Instance.SetIsHorizontal(true);
				PlayerSingleton<Phone>.Instance.SetLookOffsetMultiplier(0.6f);
				_bankingUI.Show();
				DebugLog.Msg("Banking app opened");
			}
		}

		public void Close()
		{
			if (_isOpen)
			{
				_isOpen = false;
				_appContainer.SetActive(false);
				if ((Object)(object)Phone.ActiveApp == (Object)(object)_appContainer)
				{
					Phone.ActiveApp = null;
				}
				PlayerSingleton<HomeScreen>.Instance.SetIsOpen(true);
				PlayerSingleton<Phone>.Instance.SetIsHorizontal(false);
				PlayerSingleton<Phone>.Instance.SetLookOffsetMultiplier(1f);
				Singleton<CursorManager>.Instance.SetCursorAppearance((ECursorType)0);
				_bankingUI.Hide();
				DebugLog.Msg("Banking app closed");
			}
		}

		private void OnExitAction(ExitAction exit)
		{
			if (!exit.Used && _isOpen && PlayerSingleton<Phone>.InstanceExists && PlayerSingleton<Phone>.Instance.IsOpen)
			{
				if (_bankingUI.HandleBack())
				{
					exit.Used = true;
					return;
				}
				exit.Used = true;
				Close();
			}
		}

		public void Update()
		{
			if (_isOpen)
			{
				_bankingUI?.Update();
				if (PlayerSingleton<Phone>.InstanceExists && PlayerSingleton<Phone>.Instance.IsOpen && IsHoveringHomeButton() && GameInput.GetButtonDown((ButtonCode)0))
				{
					Close();
				}
			}
		}

		private bool IsHoveringHomeButton()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			Camera val = Singleton<GameplayMenu>.Instance?.OverlayCamera;
			if ((Object)(object)val == (Object)null)
			{
				return false;
			}
			Ray val2 = val.ScreenPointToRay(Input.mousePosition);
			int num = 1 << LayerMask.NameToLayer("Overlay");
			RaycastHit val3 = default(RaycastHit);
			if (Physics.Raycast(val2, ref val3, 2f, num))
			{
				return ((Object)((Component)((RaycastHit)(ref val3)).collider).gameObject).name == "Button";
			}
			return false;
		}

		private static Sprite LoadEmbeddedSprite(string resourceName)
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Assembly executingAssembly = Assembly.GetExecutingAssembly();
				using Stream stream = executingAssembly.GetManifestResourceStream(resourceName);
				if (stream == null)
				{
					DebugLog.Warning("Could not find embedded resource: " + resourceName);
					return null;
				}
				byte[] array = new byte[stream.Length];
				stream.Read(array, 0, array.Length);
				Texture2D val = new Texture2D(2, 2);
				ImageConversion.LoadImage(val, array);
				return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
			}
			catch (Exception ex)
			{
				DebugLog.Error("Failed to load embedded sprite: " + ex.Message);
				return null;
			}
		}
	}
	public class BankingAppUI
	{
		[CompilerGenerated]
		private sealed class <ProcessTransaction>d__74 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public float amount;

			public bool depositing;

			public BankingAppUI <>4__this;

			private MoneyManager <moneyManager>5__1;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <ProcessTransaction>d__74(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<moneyManager>5__1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>4__this.SetActiveScreen(<>4__this._processingScreen);
					<>2__current = (object)new WaitForSeconds(1f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<moneyManager>5__1 = NetworkSingleton<MoneyManager>.Instance;
					if ((Object)(object)<moneyManager>5__1 == (Object)null)
					{
						<>4__this.SetActiveScreen(<>4__this._menuScreen);
						return false;
					}
					if (depositing)
					{
						if (<moneyManager>5__1.cashBalance >= amount)
						{
							<moneyManager>5__1.ChangeCashBalance(0f - amount, true, false);
							<moneyManager>5__1.CreateOnlineTransaction("Mobile Deposit", amount, 1f, string.Empty);
							ATM.WeeklyDepositSum += amount;
							<>4__this._successSubtitle.text = "You have deposited " + MoneyManager.FormatAmount(amount, false, false);
							<>4__this.SetActiveScreen(<>4__this._successScreen);
						}
						else
						{
							<>4__this.SetActiveScreen(<>4__this._menuScreen);
						}
					}
					else if (GetOnlineBalance(<moneyManager>5__1) >= amount)
					{
						<moneyManager>5__1.ChangeCashBalance(amount, true, false);
						<moneyManager>5__1.CreateOnlineTransaction("Mobile Withdrawal", 0f - amount, 1f, string.Empty);
						<>4__this._successSubtitle.text = "You have withdrawn " + MoneyManager.FormatAmount(amount, false, false);
						<>4__this.SetActiveScreen(<>4__this._successScreen);
					}
					else
					{
						<>4__this.SetActiveScreen(<>4__this._menuScreen);
					}
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private readonly Transform _root;

		private GameObject _background;

		private GameObject _menuScreen;

		private GameObject _amountScreen;

		private GameObject _processingScreen;

		private GameObject _successScreen;

		private GameObject _activeScreen;

		private Text _titleText;

		private Text _headerDepositLimitText;

		private Text _headerOnlineBalanceText;

		private Text _headerCashText;

		private Text _amountHeaderDepositLimitText;

		private Text _amountHeaderOnlineBalanceText;

		private Text _amountHeaderCashText;

		private Text _amountSelectorTitle;

		private Text _selectedAmountText;

		private Text _confirmButtonText;

		private Text _successSubtitle;

		private Button _depositButton;

		private Button _withdrawButton;

		private Button _confirmButton;

		private Button _cancelButton;

		private Button _doneButton;

		private Button _returnButton;

		private Button[] _amountButtons;

		private Button[] _incrementButtons;

		private Text _processingDotsText;

		private float _dotAnimationTimer;

		private int _dotCount;

		private bool _isDepositing = true;

		private float _selectedAmount = 20f;

		private static readonly Color32 BackgroundTop = new Color32((byte)59, (byte)127, (byte)212, byte.MaxValue);

		private static readonly Color32 BackgroundBottom = new Color32((byte)30, (byte)58, (byte)95, byte.MaxValue);

		private static readonly Color32 HeaderBgColor = new Color32((byte)40, (byte)80, (byte)140, byte.MaxValue);

		private static readonly Color32 ButtonColor = new Color32((byte)35, (byte)65, (byte)110, byte.MaxValue);

		private static readonly Color32 ButtonHoverColor = new Color32((byte)50, (byte)90, (byte)145, byte.MaxValue);

		private static readonly Color32 ButtonSelectedColor = new Color32((byte)60, (byte)140, (byte)200, byte.MaxValue);

		private static readonly Color32 CyanColor = new Color32((byte)76, (byte)191, byte.MaxValue, byte.MaxValue);

		private static readonly Color32 GreenColor = new Color32((byte)84, (byte)231, (byte)23, byte.MaxValue);

		private static readonly Color32 OrangeColor = new Color32(byte.MaxValue, (byte)140, (byte)50, byte.MaxValue);

		private static readonly Color32 ConfirmGreen = new Color32((byte)50, (byte)200, (byte)80, byte.MaxValue);

		private static readonly int[] PresetAmounts = new int[6] { 20, 50, 100, 500, 1000, 5000 };

		private static readonly int[] IncrementValues = new int[6] { -100, -10, -1, 1, 10, 100 };

		public event Action OnCloseRequested;

		public BankingAppUI(Transform root)
		{
			_root = root;
			BuildUI();
		}

		private void BuildUI()
		{
			CreateBackground();
			CreateMenuScreen();
			CreateAmountScreen();
			CreateProcessingScreen();
			CreateSuccessScreen();
			SetActiveScreen(_menuScreen);
		}

		private void CreateBackground()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			_background = new GameObject("Background");
			_background.transform.SetParent(_root, false);
			RectTransform val = _background.AddComponent<RectTransform>();
			val.anchorMin = Vector2.zero;
			val.anchorMax = Vector2.one;
			val.offsetMin = Vector2.zero;
			val.offsetMax = Vector2.zero;
			Image val2 = _background.AddComponent<Image>();
			((Graphic)val2).color = Color32.op_Implicit(BackgroundTop);
		}

		private void CreateMenuScreen()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_033a: Unknown result type (might be due to invalid IL or missing references)
			//IL_038e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
			_menuScreen = CreatePanel(_root, "MenuScreen", Color.clear);
			SetFullRect(_menuScreen.GetComponent<RectTransform>(), 0f, 0f, 1f, 1f);
			GameObject val = CreatePanel(_menuScreen.transform, "Header", Color32.op_Implicit(HeaderBgColor));
			SetFullRect(val.GetComponent<RectTransform>(), 0f, 0.88f, 1f, 1f);
			_titleText = CreateText(val.transform, "Title", "ATM", 24, (TextAnchor)3);
			_titleText.fontStyle = (FontStyle)1;
			SetFullRect(((Component)_titleText).GetComponent<RectTransform>(), 0.03f, 0f, 0.15f, 1f);
			Text val2 = CreateText(val.transform, "DepositLimitLabel", "Weekly Deposit Limit", 12, (TextAnchor)7);
			SetFullRect(((Component)val2).GetComponent<RectTransform>(), 0.15f, 0.52f, 0.4f, 1f);
			_headerDepositLimitText = CreateText(val.transform, "DepositLimitValue", "$0 / $10,000", 16, (TextAnchor)1);
			_headerDepositLimitText.fontStyle = (FontStyle)1;
			SetFullRect(((Component)_headerDepositLimitText).GetComponent<RectTransform>(), 0.15f, 0f, 0.4f, 0.52f);
			Text val3 = CreateText(val.transform, "OnlineLabel", "Online Balance", 12, (TextAnchor)7);
			SetFullRect(((Component)val3).GetComponent<RectTransform>(), 0.42f, 0.52f, 0.68f, 1f);
			_headerOnlineBalanceText = CreateText(val.transform, "OnlineValue", "$0", 18, (TextAnchor)1);
			((Graphic)_headerOnlineBalanceText).color = Color32.op_Implicit(CyanColor);
			_headerOnlineBalanceText.fontStyle = (FontStyle)1;
			SetFullRect(((Component)_headerOnlineBalanceText).GetComponent<RectTransform>(), 0.42f, 0f, 0.68f, 0.52f);
			Text val4 = CreateText(val.transform, "CashLabel", "Cash", 12, (TextAnchor)7);
			SetFullRect(((Component)val4).GetComponent<RectTransform>(), 0.7f, 0.52f, 0.97f, 1f);
			_headerCashText = CreateText(val.transform, "CashValue", "$0", 18, (TextAnchor)1);
			((Graphic)_headerCashText).color = Color32.op_Implicit(GreenColor);
			_headerCashText.fontStyle = (FontStyle)1;
			SetFullRect(((Component)_headerCashText).GetComponent<RectTransform>(), 0.7f, 0f, 0.97f, 0.52f);
			GameObject val5 = CreatePanel(_menuScreen.transform, "ContentArea", Color.clear);
			SetFullRect(val5.GetComponent<RectTransform>(), 0.05f, 0.15f, 0.95f, 0.8f);
			Text val6 = CreateText(val5.transform, "Welcome", "Select Transaction Type", 24, (TextAnchor)4);
			SetFullRect(((Component)val6).GetComponent<RectTransform>(), 0f, 0.75f, 1f, 0.95f);
			_depositButton = CreateStyledButton(val5.transform, "DepositButton", "DEPOSIT", CyanColor, OnDepositPressed);
			SetFullRect(((Component)_depositButton).GetComponent<RectTransform>(), 0.1f, 0.45f, 0.9f, 0.7f);
			_withdrawButton = CreateStyledButton(val5.transform, "WithdrawButton", "WITHDRAW", CyanColor, OnWithdrawPressed);
			SetFullRect(((Component)_withdrawButton).GetComponent<RectTransform>(), 0.1f, 0.15f, 0.9f, 0.4f);
			Button val7 = CreateStyledButton(_menuScreen.transform, "CloseButton", "CLOSE", OrangeColor, delegate
			{
				this.OnCloseRequested?.Invoke();
			});
			SetFullRect(((Component)val7).GetComponent<RectTransform>(), 0.3f, 0.03f, 0.7f, 0.12f);
		}

		private void CreateAmountScreen()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_037a: Unknown result type (might be due to invalid IL or missing references)
			_amountScreen = CreatePanel(_root, "AmountScreen", Color.clear);
			SetFullRect(_amountScreen.GetComponent<RectTransform>(), 0f, 0f, 1f, 1f);
			GameObject val = CreatePanel(_amountScreen.transform, "Header", Color32.op_Implicit(HeaderBgColor));
			SetFullRect(val.GetComponent<RectTransform>(), 0f, 0.88f, 1f, 1f);
			Text val2 = CreateText(val.transform, "ATM", "ATM", 24, (TextAnchor)3);
			val2.fontStyle = (FontStyle)1;
			SetFullRect(((Component)val2).GetComponent<RectTransform>(), 0.03f, 0f, 0.15f, 1f);
			Text val3 = CreateText(val.transform, "DepositLimitLabel", "Weekly Deposit Limit", 12, (TextAnchor)7);
			SetFullRect(((Component)val3).GetComponent<RectTransform>(), 0.15f, 0.52f, 0.4f, 1f);
			_amountHeaderDepositLimitText = CreateText(val.transform, "DepositLimitValue", "$0 / $10,000", 16, (TextAnchor)1);
			_amountHeaderDepositLimitText.fontStyle = (FontStyle)1;
			SetFullRect(((Component)_amountHeaderDepositLimitText).GetComponent<RectTransform>(), 0.15f, 0f, 0.4f, 0.52f);
			Text val4 = CreateText(val.transform, "OnlineLabel", "Online Balance", 12, (TextAnchor)7);
			SetFullRect(((Component)val4).GetComponent<RectTransform>(), 0.42f, 0.52f, 0.68f, 1f);
			_amountHeaderOnlineBalanceText = CreateText(val.transform, "OnlineValue", "$0", 18, (TextAnchor)1);
			((Graphic)_amountHeaderOnlineBalanceText).color = Color32.op_Implicit(CyanColor);
			_amountHeaderOnlineBalanceText.fontStyle = (FontStyle)1;
			SetFullRect(((Component)_amountHeaderOnlineBalanceText).GetComponent<RectTransform>(), 0.42f, 0f, 0.68f, 0.52f);
			Text val5 = CreateText(val.transform, "CashLabel", "Cash", 12, (TextAnchor)7);
			SetFullRect(((Component)val5).GetComponent<RectTransform>(), 0.7f, 0.52f, 0.97f, 1f);
			_amountHeaderCashText = CreateText(val.transform, "CashValue", "$0", 18, (TextAnchor)1);
			((Graphic)_amountHeaderCashText).color = Color32.op_Implicit(GreenColor);
			_amountHeaderCashText.fontStyle = (FontStyle)1;
			SetFullRect(((Component)_amountHeaderCashText).GetComponent<RectTransform>(), 0.7f, 0f, 0.97f, 0.52f);
			_amountSelectorTitle = CreateText(_amountScreen.transform, "Title", "Select amount to deposit", 20, (TextAnchor)4);
			SetFullRect(((Component)_amountSelectorTitle).GetComponent<RectTransform>(), 0f, 0.78f, 1f, 0.87f);
			CreateIncrementButtons(_amountScreen.transform);
			CreatePresetAmountButtons(_amountScreen.transform);
			_cancelButton = CreateStyledButton(_amountScreen.transform, "CancelButton", "CANCEL", OrangeColor, OnCancelPressed);
			SetFullRect(((Component)_cancelButton).GetComponent<RectTransform>(), 0.05f, 0.02f, 0.45f, 0.12f);
			_confirmButton = CreateStyledButton(_amountScreen.transform, "ConfirmButton", "DEPOSIT $20", ConfirmGreen, OnConfirmPressed);
			SetFullRect(((Component)_confirmButton).GetComponent<RectTransform>(), 0.55f, 0.02f, 0.95f, 0.12f);
			_confirmButtonText = ((Component)_confirmButton).GetComponentInChildren<Text>();
			_amountScreen.SetActive(false);
		}

		private void CreateIncrementButtons(Transform parent)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreatePanel(parent, "IncrementContainer", Color.clear);
			SetFullRect(val.GetComponent<RectTransform>(), 0.02f, 0.68f, 0.98f, 0.79f);
			_incrementButtons = (Button[])(object)new Button[6];
			float num = 0.125f;
			float num2 = 0.02f;
			float num3 = 7f * num + 6f * num2;
			float num4 = (1f - num3) / 2f;
			string[] array = new string[7] { "-100", "-10", "-1", "", "+1", "+10", "+100" };
			for (int i = 0; i < 7; i++)
			{
				float num5 = num4 + (float)i * (num + num2);
				float xMax = num5 + num;
				if (i == 3)
				{
					GameObject val2 = CreatePanel(val.transform, "AmountDisplay", Color32.op_Implicit(ButtonColor));
					SetFullRect(val2.GetComponent<RectTransform>(), num5, 0f, xMax, 1f);
					Outline val3 = val2.AddComponent<Outline>();
					((Shadow)val3).effectColor = Color.white;
					((Shadow)val3).effectDistance = new Vector2(2f, 2f);
					_selectedAmountText = CreateText(val2.transform, "Amount", "$20", 20, (TextAnchor)4);
					_selectedAmountText.fontStyle = (FontStyle)1;
					SetFullRect(((Component)_selectedAmountText).GetComponent<RectTransform>(), 0f, 0f, 1f, 1f);
				}
				else
				{
					int num6 = ((i < 3) ? i : (i - 1));
					int value = IncrementValues[num6];
					Button val4 = CreateStyledButton(val.transform, $"Inc_{value}", array[i], CyanColor, delegate
					{
						AdjustAmount(value);
					});
					SetFullRect(((Component)val4).GetComponent<RectTransform>(), num5, 0f, xMax, 1f);
					_incrementButtons[num6] = val4;
				}
			}
		}

		private void CreatePresetAmountButtons(Transform parent)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreatePanel(parent, "ButtonGrid", Color.clear);
			SetFullRect(val.GetComponent<RectTransform>(), 0.05f, 0.14f, 0.95f, 0.66f);
			_amountButtons = (Button[])(object)new Button[7];
			float num = 0f;
			float num2 = 0.52f;
			float num3 = 0.46f;
			float num4 = 0.22f;
			float num5 = 0.04f;
			for (int i = 0; i < 3; i++)
			{
				float num6 = 1f - (float)i * (num4 + num5);
				float yMin = num6 - num4;
				int num7 = PresetAmounts[i];
				int index = i;
				Button val2 = CreateAmountButton(val.transform, $"Amount_{num7}", MoneyManager.FormatAmount((float)num7, false, false), delegate
				{
					SelectPresetAmount(index);
				});
				SetFullRect(((Component)val2).GetComponent<RectTransform>(), num, yMin, num + num3, num6);
				_amountButtons[i] = val2;
			}
			for (int j = 0; j < 3; j++)
			{
				float num8 = 1f - (float)j * (num4 + num5);
				float yMin2 = num8 - num4;
				int index2 = j + 3;
				Button val3;
				if (j == 2)
				{
					val3 = CreateAmountButton(val.transform, "Amount_MAX", "MAX", delegate
					{
						SelectPresetAmount(6);
					});
					_amountButtons[6] = val3;
				}
				else
				{
					int num9 = PresetAmounts[index2];
					val3 = CreateAmountButton(val.transform, $"Amount_{num9}", MoneyManager.FormatAmount((float)num9, false, false), delegate
					{
						SelectPresetAmount(index2);
					});
					_amountButtons[index2] = val3;
				}
				SetFullRect(((Component)val3).GetComponent<RectTransform>(), num2, yMin2, num2 + num3, num8);
			}
		}

		private Button CreateAmountButton(Transform parent, string name, string label, Action onClick)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Expected O, but got Unknown
			GameObject val = CreatePanel(parent, name, Color32.op_Implicit(CyanColor));
			Button val2 = val.AddComponent<Button>();
			Outline val3 = val.AddComponent<Outline>();
			((Shadow)val3).effectColor = Color32.op_Implicit(new Color32((byte)100, (byte)150, (byte)200, byte.MaxValue));
			((Shadow)val3).effectDistance = new Vector2(2f, 2f);
			ColorBlock colors = ((Selectable)val2).colors;
			((ColorBlock)(ref colors)).normalColor = Color32.op_Implicit(CyanColor);
			((ColorBlock)(ref colors)).highlightedColor = Color32.op_Implicit(new Color32((byte)100, (byte)210, byte.MaxValue, byte.MaxValue));
			((ColorBlock)(ref colors)).pressedColor = Color32.op_Implicit(new Color32((byte)60, (byte)160, (byte)220, byte.MaxValue));
			((ColorBlock)(ref colors)).selectedColor = Color32.op_Implicit(new Color32((byte)60, (byte)160, (byte)220, byte.MaxValue));
			((Selectable)val2).colors = colors;
			Text val4 = CreateText(val.transform, "Text", label, 22, (TextAnchor)4);
			val4.fontStyle = (FontStyle)1;
			SetFullRect(((Component)val4).GetComponent<RectTransform>(), 0f, 0f, 1f, 1f);
			((UnityEvent)val2.onClick).AddListener(new UnityAction(onClick.Invoke));
			return val2;
		}

		private void CreateProcessingScreen()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			_processingScreen = CreatePanel(_root, "ProcessingScreen", Color.clear);
			SetFullRect(_processingScreen.GetComponent<RectTransform>(), 0f, 0f, 1f, 1f);
			Text val = CreateText(_processingScreen.transform, "Title", "Processing", 32, (TextAnchor)4);
			val.fontStyle = (FontStyle)1;
			SetFullRect(((Component)val).GetComponent<RectTransform>(), 0f, 0.5f, 1f, 0.6f);
			_processingDotsText = CreateText(_processingScreen.transform, "Dots", ".", 32, (TextAnchor)4);
			_processingDotsText.fontStyle = (FontStyle)1;
			SetFullRect(((Component)_processingDotsText).GetComponent<RectTransform>(), 0f, 0.4f, 1f, 0.5f);
			_processingScreen.SetActive(false);
		}

		private void CreateSuccessScreen()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			_successScreen = CreatePanel(_root, "SuccessScreen", Color.clear);
			SetFullRect(_successScreen.GetComponent<RectTransform>(), 0f, 0f, 1f, 1f);
			Text val = CreateText(_successScreen.transform, "Title", "Transaction Complete", 32, (TextAnchor)4);
			((Graphic)val).color = Color32.op_Implicit(GreenColor);
			val.fontStyle = (FontStyle)1;
			SetFullRect(((Component)val).GetComponent<RectTransform>(), 0f, 0.6f, 1f, 0.75f);
			_successSubtitle = CreateText(_successScreen.transform, "Subtitle", "", 24, (TextAnchor)4);
			SetFullRect(((Component)_successSubtitle).GetComponent<RectTransform>(), 0.1f, 0.45f, 0.9f, 0.58f);
			_doneButton = CreateStyledButton(_successScreen.transform, "DoneButton", "DONE", ConfirmGreen, delegate
			{
				this.OnCloseRequested?.Invoke();
			});
			SetFullRect(((Component)_doneButton).GetComponent<RectTransform>(), 0.15f, 0.25f, 0.85f, 0.38f);
			_returnButton = CreateStyledButton(_successScreen.transform, "ReturnButton", "RETURN TO MENU", ButtonColor, OnReturnToMenu);
			SetFullRect(((Component)_returnButton).GetComponent<RectTransform>(), 0.15f, 0.1f, 0.85f, 0.23f);
			_successScreen.SetActive(false);
		}

		private GameObject CreatePanel(Transform parent, string name, Color color)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			RectTransform val2 = val.AddComponent<RectTransform>();
			Image val3 = val.AddComponent<Image>();
			((Graphic)val3).color = color;
			return val;
		}

		private Text CreateText(Transform parent, string name, string content, int fontSize, TextAnchor alignment)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			RectTransform val2 = val.AddComponent<RectTransform>();
			Text val3 = val.AddComponent<Text>();
			val3.text = content;
			val3.fontSize = fontSize;
			val3.alignment = alignment;
			((Graphic)val3).color = Color.white;
			val3.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
			return val3;
		}

		private Button CreateStyledButton(Transform parent, string name, string label, Color32 bgColor, Action onClick)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Expected O, but got Unknown
			GameObject val = CreatePanel(parent, name, Color32.op_Implicit(bgColor));
			Button val2 = val.AddComponent<Button>();
			ColorBlock colors = ((Selectable)val2).colors;
			((ColorBlock)(ref colors)).normalColor = Color32.op_Implicit(bgColor);
			((ColorBlock)(ref colors)).highlightedColor = Color32.op_Implicit(new Color32((byte)Mathf.Min(255, bgColor.r + 30), (byte)Mathf.Min(255, bgColor.g + 30), (byte)Mathf.Min(255, bgColor.b + 30), byte.MaxValue));
			((ColorBlock)(ref colors)).pressedColor = Color32.op_Implicit(new Color32((byte)Mathf.Max(0, bgColor.r - 20), (byte)Mathf.Max(0, bgColor.g - 20), (byte)Mathf.Max(0, bgColor.b - 20), byte.MaxValue));
			((Selectable)val2).colors = colors;
			Text val3 = CreateText(val.transform, "Text", label, 20, (TextAnchor)4);
			val3.fontStyle = (FontStyle)1;
			SetFullRect(((Component)val3).GetComponent<RectTransform>(), 0f, 0f, 1f, 1f);
			((UnityEvent)val2.onClick).AddListener(new UnityAction(onClick.Invoke));
			return val2;
		}

		private void SetFullRect(RectTransform rect, float xMin, float yMin, float xMax, float yMax)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			rect.anchorMin = new Vector2(xMin, yMin);
			rect.anchorMax = new Vector2(xMax, yMax);
			rect.offsetMin = Vector2.zero;
			rect.offsetMax = Vector2.zero;
		}

		private void SetActiveScreen(GameObject screen)
		{
			_menuScreen.SetActive(false);
			_amountScreen.SetActive(false);
			_processingScreen.SetActive(false);
			_successScreen.SetActive(false);
			_activeScreen = screen;
			_activeScreen.SetActive(true);
		}

		public void Show()
		{
			SetActiveScreen(_menuScreen);
			UpdateBalanceDisplay();
		}

		public void Hide()
		{
			SetActiveScreen(_menuScreen);
		}

		public bool HandleBack()
		{
			if ((Object)(object)_activeScreen == (Object)(object)_amountScreen)
			{
				SetActiveScreen(_menuScreen);
				return true;
			}
			return false;
		}

		public void Update()
		{
			UpdateBalanceDisplay();
			if ((Object)(object)_activeScreen == (Object)(object)_processingScreen && (Object)(object)_processingDotsText != (Object)null)
			{
				_dotAnimationTimer += Time.deltaTime;
				if (_dotAnimationTimer >= 0.4f)
				{
					_dotAnimationTimer = 0f;
					_dotCount = (_dotCount + 1) % 4;
					_processingDotsText.text = new string('.', (_dotCount == 0) ? 1 : _dotCount);
				}
			}
			if ((Object)(object)_activeScreen == (Object)(object)_amountScreen)
			{
				UpdateAmountScreen();
			}
		}

		private void UpdateBalanceDisplay()
		{
			MoneyManager instance = NetworkSingleton<MoneyManager>.Instance;
			if (!((Object)(object)instance == (Object)null))
			{
				float weeklyDepositSum = ATM.WeeklyDepositSum;
				string text = MoneyManager.FormatAmount(weeklyDepositSum, false, false) + " / " + MoneyManager.FormatAmount(10000f, false, false);
				string text2 = MoneyManager.FormatAmount(GetOnlineBalance(instance), false, false);
				string text3 = MoneyManager.FormatAmount(instance.cashBalance, false, false);
				if ((Object)(object)_headerDepositLimitText != (Object)null)
				{
					_headerDepositLimitText.text = text;
				}
				if ((Object)(object)_headerOnlineBalanceText != (Object)null)
				{
					_headerOnlineBalanceText.text = text2;
				}
				if ((Object)(object)_headerCashText != (Object)null)
				{
					_headerCashText.text = text3;
				}
				if ((Object)(object)_amountHeaderDepositLimitText != (Object)null)
				{
					_amountHeaderDepositLimitText.text = text;
				}
				if ((Object)(object)_amountHeaderOnlineBalanceText != (Object)null)
				{
					_amountHeaderOnlineBalanceText.text = text2;
				}
				if ((Object)(object)_amountHeaderCashText != (Object)null)
				{
					_amountHeaderCashText.text = text3;
				}
				if (weeklyDepositSum >= 10000f && (Object)(object)_depositButton != (Object)null)
				{
					((Selectable)_depositButton).interactable = false;
				}
				else if ((Object)(object)_depositButton != (Object)null)
				{
					((Selectable)_depositButton).interactable = true;
				}
			}
		}

		private void UpdateAmountScreen()
		{
			MoneyManager instance = NetworkSingleton<MoneyManager>.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return;
			}
			float num = (_isDepositing ? Mathf.Min(instance.cashBalance, 10000f - ATM.WeeklyDepositSum) : GetOnlineBalance(instance));
			for (int i = 0; i < _incrementButtons.Length; i++)
			{
				if (!((Object)(object)_incrementButtons[i] == (Object)null))
				{
					float num2 = _selectedAmount + (float)IncrementValues[i];
					((Selectable)_incrementButtons[i]).interactable = num2 >= 1f && num2 <= num;
				}
			}
			for (int j = 0; j < 6; j++)
			{
				if (!((Object)(object)_amountButtons[j] == (Object)null))
				{
					bool interactable = num >= (float)PresetAmounts[j];
					((Selectable)_amountButtons[j]).interactable = interactable;
				}
			}
			if ((Object)(object)_amountButtons[6] != (Object)null)
			{
				((Component)_amountButtons[6]).GetComponentInChildren<Text>().text = "MAX (" + MoneyManager.FormatAmount(num, false, false) + ")";
				((Selectable)_amountButtons[6]).interactable = num > 0f;
			}
			string text = (_isDepositing ? "DEPOSIT" : "WITHDRAW");
			_confirmButtonText.text = text + " " + MoneyManager.FormatAmount(_selectedAmount, false, false);
			((Selectable)_confirmButton).interactable = _selectedAmount > 0f && _selectedAmount <= num;
			_selectedAmountText.text = MoneyManager.FormatAmount(_selectedAmount, false, false);
		}

		private void AdjustAmount(int delta)
		{
			MoneyManager instance = NetworkSingleton<MoneyManager>.Instance;
			if (!((Object)(object)instance == (Object)null))
			{
				float num = (_isDepositing ? Mathf.Min(instance.cashBalance, 10000f - ATM.WeeklyDepositSum) : GetOnlineBalance(instance));
				_selectedAmount = Mathf.Clamp(_selectedAmount + (float)delta, 1f, num);
				_selectedAmountText.text = MoneyManager.FormatAmount(_selectedAmount, false, false);
			}
		}

		private void SelectPresetAmount(int index)
		{
			MoneyManager instance = NetworkSingleton<MoneyManager>.Instance;
			if (!((Object)(object)instance == (Object)null))
			{
				float num = (_isDepositing ? Mathf.Min(instance.cashBalance, 10000f - ATM.WeeklyDepositSum) : GetOnlineBalance(instance));
				if (index == 6)
				{
					_selectedAmount = num;
				}
				else if (index < PresetAmounts.Length)
				{
					_selectedAmount = Mathf.Min((float)PresetAmounts[index], num);
				}
				_selectedAmountText.text = MoneyManager.FormatAmount(_selectedAmount, false, false);
			}
		}

		private void OnDepositPressed()
		{
			_isDepositing = true;
			_amountSelectorTitle.text = "Select amount to deposit";
			_selectedAmount = 20f;
			SetActiveScreen(_amountScreen);
		}

		private void OnWithdrawPressed()
		{
			_isDepositing = false;
			_amountSelectorTitle.text = "Select amount to withdraw";
			_selectedAmount = 20f;
			SetActiveScreen(_amountScreen);
		}

		private void OnConfirmPressed()
		{
			if (!(_selectedAmount <= 0f))
			{
				MelonCoroutines.Start(ProcessTransaction(_selectedAmount, _isDepositing));
			}
		}

		private void OnCancelPressed()
		{
			SetActiveScreen(_menuScreen);
		}

		private void OnReturnToMenu()
		{
			SetActiveScreen(_menuScreen);
		}

		[IteratorStateMachine(typeof(<ProcessTransaction>d__74))]
		private IEnumerator ProcessTransaction(float amount, bool depositing)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ProcessTransaction>d__74(0)
			{
				<>4__this = this,
				amount = amount,
				depositing = depositing
			};
		}

		private static float GetOnlineBalance(MoneyManager moneyManager)
		{
			return moneyManager.onlineBalance;
		}
	}
}