Decompiled source of BankingApp v1.3.0

BankingApp_Il2cpp.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
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 System.Text;
using BankingApp;
using BankingApp.Features;
using BankingApp.Utils;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppScheduleOne;
using Il2CppScheduleOne.DevUtilities;
using Il2CppScheduleOne.Money;
using Il2CppScheduleOne.Persistence;
using Il2CppScheduleOne.PlayerScripts;
using Il2CppScheduleOne.UI;
using Il2CppScheduleOne.UI.ATM;
using Il2CppScheduleOne.UI.Phone;
using Il2CppSystem;
using MelonLoader;
using MelonLoader.Preferences;
using MelonLoader.Utils;
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.3.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+0b8a8272925a4b4c22723541037c9da88e654de9")]
[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 static class Config
	{
		private static MelonPreferences_Category _category;

		private static MelonPreferences_Entry<string> _theme;

		private static MelonPreferences_Entry<string> _headerTitle;

		private static MelonPreferences_Entry<float> _processingDelay;

		private static MelonPreferences_Entry<float> _weeklyDepositLimit;

		private static MelonPreferences_Entry<bool> _autoDepositEnabled;

		public static string Theme => _theme.Value;

		public static string HeaderTitle => _headerTitle.Value;

		public static float ProcessingDelay => _processingDelay.Value;

		public static float WeeklyDepositLimit => _weeklyDepositLimit.Value;

		public static bool AutoDepositEnabled => _autoDepositEnabled.Value;

		public static void Initialize()
		{
			_category = MelonPreferences.CreateCategory("BankingApp", "Banking App");
			_theme = _category.CreateEntry<string>("Theme", "Blue", "Color Theme", "Color theme for the banking app UI. Options: Blue, Dark, Green, Pink", false, false, (ValueValidator)null, (string)null);
			_headerTitle = _category.CreateEntry<string>("HeaderTitle", "ATM", "Header Title", "Text displayed in the app header", false, false, (ValueValidator)null, (string)null);
			_processingDelay = _category.CreateEntry<float>("ProcessingDelay", 1f, "Processing Delay", "How long the processing screen shows (seconds)", false, false, (ValueValidator)null, (string)null);
			_weeklyDepositLimit = _category.CreateEntry<float>("WeeklyDepositLimit", 10000f, "Weekly Deposit Limit", "Weekly deposit limit (0 = unlimited)", false, false, (ValueValidator)null, (string)null);
			_autoDepositEnabled = _category.CreateEntry<bool>("AutoDepositEnabled", false, "Auto Deposit Enabled", "Automatically deposit cash when the weekly limit resets", false, false, (ValueValidator)null, (string)null);
		}
	}
	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;
			Config.Initialize();
			MelonLogger.Msg("BankingApp v1.3.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 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 WITHDRAWAL_RED = "#FF6B6B";

			public const string AUTO_DEPOSIT_CYAN = "#00CED1";
		}

		public const string MOD_NAME = "BankingApp";

		public const string MOD_VERSION = "1.3.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.Patches
{
	[HarmonyPatch(typeof(ATMInterface))]
	public static class ATMInterfacePatches
	{
		private static bool _reflectionCached;

		private static MemberInfo _amountButtonsMember;

		private static MethodInfo _listGetItem;

		private static PropertyInfo _listCount;

		private static MemberInfo _depositLimitTextMember;

		private static MemberInfo _menuDepositButtonMember;

		private static MemberInfo _activeScreenMember;

		private static MemberInfo _menuScreenMember;

		private static MemberInfo _amountSelectorScreenMember;

		private static MemberInfo _depositingMember;

		private static MemberInfo _selectedAmountMember;

		private static MemberInfo _amountLabelTextMember;

		private static float GetRemainingAllowedDeposit()
		{
			float weeklyDepositLimit = Config.WeeklyDepositLimit;
			if (weeklyDepositLimit <= 0f)
			{
				return float.MaxValue;
			}
			return Mathf.Max(0f, weeklyDepositLimit - ATM.WeeklyDepositSum);
		}

		private static MemberInfo FindMember(string name)
		{
			return (MemberInfo)(((object)AccessTools.Property(typeof(ATMInterface), name)) ?? ((object)AccessTools.Field(typeof(ATMInterface), name)));
		}

		private static object GetMemberValue(MemberInfo member, object instance)
		{
			if (member is FieldInfo fieldInfo)
			{
				return fieldInfo.GetValue(instance);
			}
			if (member is PropertyInfo propertyInfo)
			{
				return propertyInfo.GetValue(instance);
			}
			return null;
		}

		private static void SetMemberValue(MemberInfo member, object instance, object value)
		{
			if (member is FieldInfo fieldInfo)
			{
				fieldInfo.SetValue(instance, value);
			}
			else if (member is PropertyInfo propertyInfo)
			{
				propertyInfo.SetValue(instance, value);
			}
		}

		private static void EnsureReflectionCached(ATMInterface instance)
		{
			if (!_reflectionCached)
			{
				_reflectionCached = true;
				_amountButtonsMember = FindMember("amountButtons");
				_depositLimitTextMember = FindMember("depositLimitText");
				_menuDepositButtonMember = FindMember("menu_DepositButton");
				_activeScreenMember = FindMember("activeScreen");
				_menuScreenMember = FindMember("menuScreen");
				_amountSelectorScreenMember = FindMember("amountSelectorScreen");
				_depositingMember = FindMember("depositing");
				_selectedAmountMember = FindMember("selectedAmount");
				_amountLabelTextMember = FindMember("amountLabelText");
				object memberValue = GetMemberValue(_amountButtonsMember, instance);
				if (memberValue != null)
				{
					Type type = memberValue.GetType();
					_listGetItem = type.GetMethod("get_Item", new Type[1] { typeof(int) });
					_listCount = type.GetProperty("Count");
				}
			}
		}

		private static int GetAmountButtonCount(ATMInterface instance)
		{
			object memberValue = GetMemberValue(_amountButtonsMember, instance);
			return (int)_listCount.GetValue(memberValue);
		}

		private static Button GetAmountButton(ATMInterface instance, int index)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			object memberValue = GetMemberValue(_amountButtonsMember, instance);
			return (Button)_listGetItem.Invoke(memberValue, new object[1] { index });
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void Update_Postfix(ATMInterface __instance)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Expected O, but got Unknown
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			if (!__instance.isOpen)
			{
				return;
			}
			EnsureReflectionCached(__instance);
			float weeklyDepositLimit = Config.WeeklyDepositLimit;
			Text val = (Text)GetMemberValue(_depositLimitTextMember, __instance);
			RectTransform val2 = (RectTransform)GetMemberValue(_activeScreenMember, __instance);
			RectTransform val3 = (RectTransform)GetMemberValue(_menuScreenMember, __instance);
			RectTransform val4 = (RectTransform)GetMemberValue(_amountSelectorScreenMember, __instance);
			bool flag = (bool)GetMemberValue(_depositingMember, __instance);
			if ((Object)(object)val != (Object)null)
			{
				if (weeklyDepositLimit <= 0f)
				{
					val.text = MoneyManager.FormatAmount(ATM.WeeklyDepositSum, false, false) + " / Unlimited";
					((Graphic)val).color = Color.white;
				}
				else
				{
					val.text = MoneyManager.FormatAmount(ATM.WeeklyDepositSum, false, false) + " / " + MoneyManager.FormatAmount(weeklyDepositLimit, false, false);
					((Graphic)val).color = ((ATM.WeeklyDepositSum >= weeklyDepositLimit) ? Color32.op_Implicit(new Color32(byte.MaxValue, (byte)75, (byte)75, byte.MaxValue)) : Color.white);
				}
			}
			if ((Object)(object)val2 == (Object)(object)val3)
			{
				Button val5 = (Button)GetMemberValue(_menuDepositButtonMember, __instance);
				if ((Object)(object)val5 != (Object)null)
				{
					((Selectable)val5).interactable = weeklyDepositLimit <= 0f || ATM.WeeklyDepositSum < weeklyDepositLimit;
				}
			}
			if (!((Object)(object)val2 == (Object)(object)val4 && flag))
			{
				return;
			}
			int amountButtonCount = GetAmountButtonCount(__instance);
			if (amountButtonCount <= 0)
			{
				return;
			}
			Button amountButton = GetAmountButton(__instance, amountButtonCount - 1);
			if ((Object)(object)amountButton != (Object)null)
			{
				float num = Mathf.Min(NetworkSingleton<MoneyManager>.Instance.cashBalance, GetRemainingAllowedDeposit());
				Transform val6 = ((Component)amountButton).transform.Find("Text");
				if ((Object)(object)val6 != (Object)null)
				{
					((Component)val6).GetComponent<Text>().text = "MAX (" + MoneyManager.FormatAmount(num, false, false) + ")";
				}
			}
		}

		[HarmonyPatch("UpdateAvailableAmounts")]
		[HarmonyPrefix]
		public static bool UpdateAvailableAmounts_Prefix(ATMInterface __instance)
		{
			EnsureReflectionCached(__instance);
			float weeklyDepositLimit = Config.WeeklyDepositLimit;
			float remainingAllowedDeposit = GetRemainingAllowedDeposit();
			bool flag = (bool)GetMemberValue(_depositingMember, __instance);
			float num = (flag ? NetworkSingleton<MoneyManager>.Instance.cashBalance : NetworkSingleton<MoneyManager>.Instance.onlineBalance);
			for (int i = 0; i < ((Il2CppArrayBase<int>)(object)ATMInterface.amounts).Length; i++)
			{
				Button amountButton = GetAmountButton(__instance, i);
				if (flag && i == ((Il2CppArrayBase<int>)(object)ATMInterface.amounts).Length - 1)
				{
					((Selectable)amountButton).interactable = num > 0f && remainingAllowedDeposit > 0f;
					break;
				}
				if (flag)
				{
					bool flag2 = num >= (float)((Il2CppArrayBase<int>)(object)ATMInterface.amounts)[i];
					bool flag3 = weeklyDepositLimit <= 0f || ATM.WeeklyDepositSum + (float)((Il2CppArrayBase<int>)(object)ATMInterface.amounts)[i] <= weeklyDepositLimit;
					((Selectable)amountButton).interactable = flag2 && flag3;
				}
				else
				{
					((Selectable)amountButton).interactable = num >= (float)((Il2CppArrayBase<int>)(object)ATMInterface.amounts)[i];
				}
			}
			return false;
		}

		[HarmonyPatch("SetSelectedAmount")]
		[HarmonyPrefix]
		public static bool SetSelectedAmount_Prefix(ATMInterface __instance, float amount)
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			EnsureReflectionCached(__instance);
			float num = (((bool)GetMemberValue(_depositingMember, __instance)) ? Mathf.Min(NetworkSingleton<MoneyManager>.Instance.cashBalance, GetRemainingAllowedDeposit()) : NetworkSingleton<MoneyManager>.Instance.onlineBalance);
			float num2 = Mathf.Clamp(amount, 0f, num);
			SetMemberValue(_selectedAmountMember, __instance, num2);
			Text val = (Text)GetMemberValue(_amountLabelTextMember, __instance);
			val.text = MoneyManager.FormatAmount(num2, false, false);
			return false;
		}

		[HarmonyPatch("GetAmountFromIndex")]
		[HarmonyPrefix]
		public static bool GetAmountFromIndex_Prefix(int index, bool depositing, ref float __result)
		{
			if (index == -1 || index >= ((Il2CppArrayBase<int>)(object)ATMInterface.amounts).Length)
			{
				__result = 0f;
				return false;
			}
			if (depositing && index == ((Il2CppArrayBase<int>)(object)ATMInterface.amounts).Length - 1)
			{
				__result = Mathf.Min(NetworkSingleton<MoneyManager>.Instance.cashBalance, GetRemainingAllowedDeposit());
				return false;
			}
			__result = ((Il2CppArrayBase<int>)(object)ATMInterface.amounts)[index];
			return false;
		}
	}
	[HarmonyPatch(typeof(MoneyManager))]
	public static class MoneyManagerPatches
	{
		[HarmonyPatch("CreateOnlineTransaction")]
		[HarmonyPostfix]
		public static void CreateOnlineTransaction_Postfix(string _transaction_Name, float _unit_Amount)
		{
			if (!(_transaction_Name == "Cash Deposit"))
			{
				if (_transaction_Name == "Cash Withdrawal")
				{
					TransactionHistory.AddTransaction(TransactionType.Withdrawal, Math.Abs(_unit_Amount), "ATM");
				}
			}
			else
			{
				TransactionHistory.AddTransaction(TransactionType.Deposit, _unit_Amount, "ATM");
			}
		}
	}
}
namespace BankingApp.Features
{
	public class AutoDeposit
	{
		[CompilerGenerated]
		private sealed class <PollCoroutine>d__3 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public AutoDeposit <>4__this;

			private MoneyManager <moneyManager>5__1;

			private float <currentSum>5__2;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Expected O, but got Unknown
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				//IL_0061: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(5f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					break;
				case 2:
					<>1__state = -1;
					if (!Config.AutoDepositEnabled)
					{
						break;
					}
					<moneyManager>5__1 = NetworkSingleton<MoneyManager>.Instance;
					if (!((Object)(object)<moneyManager>5__1 == (Object)null))
					{
						<currentSum>5__2 = ATM.WeeklyDepositSum;
						if (<>4__this._previousWeeklySum > 0f && <currentSum>5__2 == 0f)
						{
							DebugLog.Msg("Weekly deposit reset detected, attempting auto-deposit");
							<>4__this.TryAutoDeposit(<moneyManager>5__1);
						}
						<>4__this._previousWeeklySum = <currentSum>5__2;
						<moneyManager>5__1 = null;
					}
					break;
				}
				<>2__current = (object)new WaitForSeconds(60f);
				<>1__state = 2;
				return true;
			}

			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 BankingAppManager _manager;

		private float _previousWeeklySum = -1f;

		public AutoDeposit(BankingAppManager manager)
		{
			_manager = manager;
		}

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

		private void TryAutoDeposit(MoneyManager moneyManager)
		{
			float cashBalance = moneyManager.cashBalance;
			if (cashBalance <= 0f)
			{
				return;
			}
			float weeklyDepositLimit = Config.WeeklyDepositLimit;
			float num;
			if (weeklyDepositLimit <= 0f)
			{
				num = cashBalance;
			}
			else
			{
				float num2 = weeklyDepositLimit - ATM.WeeklyDepositSum;
				if (num2 <= 0f)
				{
					return;
				}
				num = Mathf.Min(cashBalance, num2);
			}
			if (!(num <= 0f))
			{
				moneyManager.ChangeCashBalance(0f - num, true, true);
				moneyManager.CreateOnlineTransaction("Auto Deposit", num, 1f, string.Empty);
				ATM.WeeklyDepositSum += num;
				TransactionHistory.AddTransaction(TransactionType.AutoDeposit, num, "Auto");
				_manager.ShowNotificationBadge();
				DebugLog.Msg("Auto-deposit completed: " + MoneyManager.FormatAmount(num, false, false));
			}
		}
	}
	public class BankingAppManager
	{
		private GameObject _appContainer;

		private Button _appIconButton;

		private BankingAppUI _bankingUI;

		private bool _isOpen;

		private GameObject _notificationBadge;

		private AutoDeposit _autoDeposit;

		public bool IsOpen => _isOpen;

		public void Initialize()
		{
			TransactionHistory.Initialize();
			CreateAppIcon();
			CreateAppUI();
			RegisterEventHandlers();
			_autoDeposit = new AutoDeposit(this);
			MelonCoroutines.Start(_autoDeposit.PollCoroutine());
			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)
			{
				_notificationBadge = ((Component)val7).gameObject;
				_notificationBadge.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);
				ClearNotificationBadge();
				_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;
		}

		public void ShowNotificationBadge()
		{
			if ((Object)(object)_notificationBadge != (Object)null)
			{
				_notificationBadge.SetActive(true);
			}
		}

		public void ClearNotificationBadge()
		{
			if ((Object)(object)_notificationBadge != (Object)null)
			{
				_notificationBadge.SetActive(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
	{
		private struct ColorTheme
		{
			public Color32 Background;

			public Color32 HeaderBg;

			public Color32 Button;

			public Color32 Accent;
		}

		[CompilerGenerated]
		private sealed class <FadeIn>d__72 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public CanvasGroup group;

			public float duration;

			private float <elapsed>5__1;

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

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

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

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

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<elapsed>5__1 = 0f;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (<elapsed>5__1 < duration)
				{
					<elapsed>5__1 += Time.deltaTime;
					group.alpha = Mathf.Clamp01(<elapsed>5__1 / duration);
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				group.alpha = 1f;
				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();
			}
		}

		[CompilerGenerated]
		private sealed class <ProcessTransaction>d__91 : 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__91(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.SetActiveScreenAnimated(<>4__this._processingScreen);
					<>2__current = (object)new WaitForSeconds(Config.ProcessingDelay);
					<>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.SetActiveScreenAnimated(<>4__this._menuScreen);
						return false;
					}
					if (depositing)
					{
						if (<moneyManager>5__1.cashBalance >= amount)
						{
							<moneyManager>5__1.ChangeCashBalance(0f - amount, true, true);
							<moneyManager>5__1.CreateOnlineTransaction("Mobile Deposit", amount, 1f, string.Empty);
							ATM.WeeklyDepositSum += amount;
							TransactionHistory.AddTransaction(TransactionType.Deposit, amount);
							<>4__this._successSubtitle.text = "You have deposited " + MoneyManager.FormatAmount(amount, false, false);
							<>4__this.SetActiveScreenAnimated(<>4__this._successScreen);
						}
						else
						{
							<>4__this.SetActiveScreenAnimated(<>4__this._menuScreen);
						}
					}
					else if (GetOnlineBalance(<moneyManager>5__1) >= amount)
					{
						<moneyManager>5__1.ChangeCashBalance(amount, true, true);
						<moneyManager>5__1.CreateOnlineTransaction("Mobile Withdrawal", 0f - amount, 1f, string.Empty);
						TransactionHistory.AddTransaction(TransactionType.Withdrawal, amount);
						<>4__this._successSubtitle.text = "You have withdrawn " + MoneyManager.FormatAmount(amount, false, false);
						<>4__this.SetActiveScreenAnimated(<>4__this._successScreen);
					}
					else
					{
						<>4__this.SetActiveScreenAnimated(<>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 ColorTheme _theme;

		private string _currentThemeName;

		private string _currentHeaderTitle;

		private GameObject _background;

		private GameObject _menuScreen;

		private GameObject _amountScreen;

		private GameObject _processingScreen;

		private GameObject _successScreen;

		private GameObject _historyScreen;

		private GameObject _activeScreen;

		private Text _titleText;

		private Text _headerDepositLimitText;

		private Text _headerOnlineBalanceText;

		private Text _headerCashText;

		private Text _headerNetWorthText;

		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 _quickDepositButton;

		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 float _lastDepositAmount = 20f;

		private float _lastWithdrawAmount = 20f;

		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 Color32 NetWorthGold = new Color32(byte.MaxValue, (byte)215, (byte)0, byte.MaxValue);

		private static readonly Color32 WithdrawalRed = new Color32(byte.MaxValue, (byte)107, (byte)107, byte.MaxValue);

		private static readonly Color32 AutoDepositCyan = new Color32((byte)0, (byte)206, (byte)209, 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 };

		private Transform _historyContentTransform;

		public event Action OnCloseRequested;

		public BankingAppUI(Transform root)
		{
			_root = root;
			_currentThemeName = Config.Theme;
			_currentHeaderTitle = Config.HeaderTitle;
			_theme = GetTheme(_currentThemeName);
			BuildUI();
		}

		private static ColorTheme GetTheme(string name)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			switch (name)
			{
			case "Dark":
			{
				ColorTheme result = default(ColorTheme);
				result.Background = new Color32((byte)26, (byte)26, (byte)46, byte.MaxValue);
				result.HeaderBg = new Color32((byte)22, (byte)33, (byte)62, byte.MaxValue);
				result.Button = new Color32((byte)20, (byte)25, (byte)50, byte.MaxValue);
				result.Accent = new Color32((byte)76, (byte)191, byte.MaxValue, byte.MaxValue);
				return result;
			}
			case "Green":
			{
				ColorTheme result = default(ColorTheme);
				result.Background = new Color32((byte)27, (byte)67, (byte)50, byte.MaxValue);
				result.HeaderBg = new Color32((byte)45, (byte)106, (byte)79, byte.MaxValue);
				result.Button = new Color32((byte)20, (byte)50, (byte)35, byte.MaxValue);
				result.Accent = new Color32(byte.MaxValue, (byte)215, (byte)0, byte.MaxValue);
				return result;
			}
			case "Pink":
			{
				ColorTheme result = default(ColorTheme);
				result.Background = new Color32((byte)46, (byte)26, (byte)46, byte.MaxValue);
				result.HeaderBg = new Color32((byte)74, (byte)32, (byte)80, byte.MaxValue);
				result.Button = new Color32((byte)58, (byte)21, (byte)64, byte.MaxValue);
				result.Accent = new Color32(byte.MaxValue, (byte)105, (byte)180, byte.MaxValue);
				return result;
			}
			default:
			{
				ColorTheme result = default(ColorTheme);
				result.Background = new Color32((byte)59, (byte)127, (byte)212, byte.MaxValue);
				result.HeaderBg = new Color32((byte)40, (byte)59, (byte)140, byte.MaxValue);
				result.Button = new Color32((byte)35, (byte)65, (byte)110, byte.MaxValue);
				result.Accent = new Color32((byte)76, (byte)191, byte.MaxValue, byte.MaxValue);
				return result;
			}
			}
		}

		private void BuildUI()
		{
			CreateBackground();
			CreateMenuScreen();
			CreateAmountScreen();
			CreateProcessingScreen();
			CreateSuccessScreen();
			CreateHistoryScreen();
			_menuScreen.AddComponent<CanvasGroup>();
			_amountScreen.AddComponent<CanvasGroup>();
			_processingScreen.AddComponent<CanvasGroup>();
			_successScreen.AddComponent<CanvasGroup>();
			_historyScreen.AddComponent<CanvasGroup>();
			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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: 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(_theme.Background);
		}

		private void CreateMenuScreen()
		{
			//IL_000e: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_036c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_044b: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_054e: 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(_theme.HeaderBg));
			SetFullRect(val.GetComponent<RectTransform>(), 0f, 0.88f, 1f, 1f);
			_titleText = CreateText(val.transform, "Title", Config.HeaderTitle, 24, (TextAnchor)3);
			_titleText.fontStyle = (FontStyle)1;
			SetFullRect(((Component)_titleText).GetComponent<RectTransform>(), 0.03f, 0f, 0.12f, 1f);
			Text val2 = CreateText(val.transform, "DepositLimitLabel", "Weekly Deposit Limit", 10, (TextAnchor)7);
			SetFullRect(((Component)val2).GetComponent<RectTransform>(), 0.12f, 0.52f, 0.32f, 1f);
			_headerDepositLimitText = CreateText(val.transform, "DepositLimitValue", "$0 / $10,000", 14, (TextAnchor)1);
			_headerDepositLimitText.fontStyle = (FontStyle)1;
			SetFullRect(((Component)_headerDepositLimitText).GetComponent<RectTransform>(), 0.12f, 0f, 0.32f, 0.52f);
			Text val3 = CreateText(val.transform, "OnlineLabel", "Online Balance", 10, (TextAnchor)7);
			SetFullRect(((Component)val3).GetComponent<RectTransform>(), 0.32f, 0.52f, 0.52f, 1f);
			_headerOnlineBalanceText = CreateText(val.transform, "OnlineValue", "$0", 16, (TextAnchor)1);
			((Graphic)_headerOnlineBalanceText).color = Color32.op_Implicit(_theme.Accent);
			_headerOnlineBalanceText.fontStyle = (FontStyle)1;
			SetFullRect(((Component)_headerOnlineBalanceText).GetComponent<RectTransform>(), 0.32f, 0f, 0.52f, 0.52f);
			Text val4 = CreateText(val.transform, "CashLabel", "Cash", 10, (TextAnchor)7);
			SetFullRect(((Component)val4).GetComponent<RectTransform>(), 0.52f, 0.52f, 0.72f, 1f);
			_headerCashText = CreateText(val.transform, "CashValue", "$0", 16, (TextAnchor)1);
			((Graphic)_headerCashText).color = Color32.op_Implicit(GreenColor);
			_headerCashText.fontStyle = (FontStyle)1;
			SetFullRect(((Component)_headerCashText).GetComponent<RectTransform>(), 0.52f, 0f, 0.72f, 0.52f);
			Text val5 = CreateText(val.transform, "NetWorthLabel", "Net Worth", 10, (TextAnchor)7);
			SetFullRect(((Component)val5).GetComponent<RectTransform>(), 0.72f, 0.52f, 0.97f, 1f);
			_headerNetWorthText = CreateText(val.transform, "NetWorthValue", "$0", 16, (TextAnchor)1);
			((Graphic)_headerNetWorthText).color = Color32.op_Implicit(NetWorthGold);
			_headerNetWorthText.fontStyle = (FontStyle)1;
			SetFullRect(((Component)_headerNetWorthText).GetComponent<RectTransform>(), 0.72f, 0f, 0.97f, 0.52f);
			GameObject val6 = CreatePanel(_menuScreen.transform, "ContentArea", Color.clear);
			SetFullRect(val6.GetComponent<RectTransform>(), 0.05f, 0.15f, 0.95f, 0.85f);
			Text val7 = CreateText(val6.transform, "Welcome", "Select Transaction Type", 24, (TextAnchor)4);
			SetFullRect(((Component)val7).GetComponent<RectTransform>(), 0f, 0.8f, 1f, 0.95f);
			_depositButton = CreateStyledButton(val6.transform, "DepositButton", "DEPOSIT", _theme.Accent, OnDepositPressed);
			SetFullRect(((Component)_depositButton).GetComponent<RectTransform>(), 0.1f, 0.68f, 0.9f, 0.82f);
			_withdrawButton = CreateStyledButton(val6.transform, "WithdrawButton", "WITHDRAW", _theme.Accent, OnWithdrawPressed);
			SetFullRect(((Component)_withdrawButton).GetComponent<RectTransform>(), 0.1f, 0.5f, 0.9f, 0.64f);
			_quickDepositButton = CreateStyledButton(val6.transform, "QuickDepositButton", "QUICK DEPOSIT", _theme.Accent, OnQuickDepositPressed);
			SetFullRect(((Component)_quickDepositButton).GetComponent<RectTransform>(), 0.1f, 0.32f, 0.9f, 0.46f);
			Button val8 = CreateStyledButton(val6.transform, "HistoryButton", "HISTORY", _theme.Accent, OnHistoryPressed);
			SetFullRect(((Component)val8).GetComponent<RectTransform>(), 0.1f, 0.14f, 0.9f, 0.28f);
			Button val9 = CreateStyledButton(_menuScreen.transform, "CloseButton", "CLOSE", OrangeColor, delegate
			{
				this.OnCloseRequested?.Invoke();
			});
			SetFullRect(((Component)val9).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_005a: 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_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0386: 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(_theme.HeaderBg));
			SetFullRect(val.GetComponent<RectTransform>(), 0f, 0.88f, 1f, 1f);
			Text val2 = CreateText(val.transform, "ATM", Config.HeaderTitle, 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(_theme.Accent);
			_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_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: 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(_theme.Button));
					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], _theme.Accent, 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_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: 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)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: 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_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreatePanel(parent, name, Color32.op_Implicit(_theme.Accent));
			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(_theme.Accent);
			((ColorBlock)(ref colors)).highlightedColor = Color32.op_Implicit(new Color32((byte)Mathf.Min(255, _theme.Accent.r + 30), (byte)Mathf.Min(255, _theme.Accent.g + 30), (byte)Mathf.Min(255, _theme.Accent.b + 30), byte.MaxValue));
			((ColorBlock)(ref colors)).pressedColor = Color32.op_Implicit(new Color32((byte)Mathf.Max(0, _theme.Accent.r - 20), (byte)Mathf.Max(0, _theme.Accent.g - 20), (byte)Mathf.Max(0, _theme.Accent.b - 20), byte.MaxValue));
			((ColorBlock)(ref colors)).selectedColor = ((ColorBlock)(ref colors)).pressedColor;
			((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_015b: 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", _theme.Button, OnReturnToMenu);
			SetFullRect(((Component)_returnButton).GetComponent<RectTransform>(), 0.15f, 0.1f, 0.85f, 0.23f);
			_successScreen.SetActive(false);
		}

		private void CreateHistoryScreen()
		{
			//IL_000e: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Expected O, but got Unknown
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Expected O, but got Unknown
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Expected O, but got Unknown
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			_historyScreen = CreatePanel(_root, "HistoryScreen", Color.clear);
			SetFullRect(_historyScreen.GetComponent<RectTransform>(), 0f, 0f, 1f, 1f);
			GameObject val = CreatePanel(_historyScreen.transform, "Header", Color32.op_Implicit(_theme.HeaderBg));
			SetFullRect(val.GetComponent<RectTransform>(), 0f, 0.88f, 1f, 1f);
			Text val2 = CreateText(val.transform, "Title", "Transaction History", 22, (TextAnchor)4);
			val2.fontStyle = (FontStyle)1;
			SetFullRect(((Component)val2).GetComponent<RectTransform>(), 0f, 0f, 1f, 1f);
			GameObject val3 = new GameObject("ScrollArea");
			val3.transform.SetParent(_historyScreen.transform, false);
			RectTransform rect = val3.AddComponent<RectTransform>();
			SetFullRect(rect, 0.02f, 0.12f, 0.98f, 0.87f);
			ScrollRect val4 = val3.AddComponent<ScrollRect>();
			val4.horizontal = false;
			val4.vertical = true;
			val4.movementType = (MovementType)2;
			val4.scrollSensitivity = 20f;
			Image val5 = val3.AddComponent<Image>();
			((Graphic)val5).color = new Color(0f, 0f, 0f, 0.01f);
			val3.AddComponent<Mask>().showMaskGraphic = false;
			GameObject val6 = new GameObject("Content");
			val6.transform.SetParent(val3.transform, false);
			RectTransform val7 = val6.AddComponent<RectTransform>();
			val7.anchorMin = new Vector2(0f, 1f);
			val7.anchorMax = new Vector2(1f, 1f);
			val7.pivot = new Vector2(0.5f, 1f);
			val7.offsetMin = Vector2.zero;
			val7.offsetMax = Vector2.zero;
			val7.sizeDelta = new Vector2(0f, 0f);
			VerticalLayoutGroup val8 = val6.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val8).spacing = 4f;
			((HorizontalOrVerticalLayoutGroup)val8).childForceExpandWidth = true;
			((HorizontalOrVerticalLayoutGroup)val8).childForceExpandHeight = false;
			((HorizontalOrVerticalLayoutGroup)val8).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)val8).childControlHeight = true;
			((LayoutGroup)val8).padding = new RectOffset(4, 4, 4, 4);
			ContentSizeFitter val9 = val6.AddComponent<ContentSizeFitter>();
			val9.verticalFit = (FitMode)2;
			val4.content = val7;
			_historyContentTransform = val6.transform;
			Button val10 = CreateStyledButton(_historyScreen.transform, "BackButton", "BACK", OrangeColor, delegate
			{
				SetActiveScreenAnimated(_menuScreen);
			});
			SetFullRect(((Component)val10).GetComponent<RectTransform>(), 0.3f, 0.02f, 0.7f, 0.1f);
			_historyScreen.SetActive(false);
		}

		private void RefreshHistoryContent()
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			for (int num = _historyContentTransform.childCount - 1; num >= 0; num--)
			{
				Object.Destroy((Object)(object)((Component)_historyContentTransform.GetChild(num)).gameObject);
			}
			IReadOnlyList<TransactionRecord> records = TransactionHistory.Records;
			if (records.Count == 0)
			{
				GameObject val = new GameObject("EmptyRow");
				val.transform.SetParent(_historyContentTransform, false);
				LayoutElement val2 = val.AddComponent<LayoutElement>();
				val2.preferredHeight = 60f;
				Text val3 = CreateText(val.transform, "Text", "No transactions yet", 18, (TextAnchor)4);
				((Graphic)val3).color = new Color(1f, 1f, 1f, 0.5f);
				SetFullRect(((Component)val3).GetComponent<RectTransform>(), 0f, 0f, 1f, 1f);
				return;
			}
			foreach (TransactionRecord item in records)
			{
				CreateHistoryRow(item);
			}
		}

		private void CreateHistoryRow(TransactionRecord record)
		{
			//IL_001e: 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_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: 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_007a: 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)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreatePanel(_historyContentTransform, "Row", Color32.op_Implicit(new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)20)));
			LayoutElement val2 = val.AddComponent<LayoutElement>();
			val2.preferredHeight = 48f;
			string content;
			Color32 val3;
			string text;
			switch (record.Type)
			{
			case TransactionType.Deposit:
				content = "DEPOSIT";
				val3 = GreenColor;
				text = "+";
				break;
			case TransactionType.AutoDeposit:
				content = "AUTO DEP";
				val3 = AutoDepositCyan;
				text = "+";
				break;
			default:
				content = "WITHDRAW";
				val3 = WithdrawalRed;
				text = "-";
				break;
			}
			string content2 = record.Source ?? "App";
			Text val4 = CreateText(val.transform, "Type", content, 14, (TextAnchor)3);
			val4.fontStyle = (FontStyle)1;
			((Graphic)val4).color = Color32.op_Implicit(val3);
			SetFullRect(((Component)val4).GetComponent<RectTransform>(), 0.03f, 0f, 0.22f, 1f);
			Text val5 = CreateText(val.transform, "Source", content2, 11, (TextAnchor)3);
			((Graphic)val5).color = new Color(1f, 1f, 1f, 0.5f);
			SetFullRect(((Component)val5).GetComponent<RectTransform>(), 0.22f, 0f, 0.35f, 1f);
			Text val6 = CreateText(val.transform, "Amount", text + MoneyManager.FormatAmount(record.Amount, false, false), 16, (TextAnchor)4);
			val6.fontStyle = (FontStyle)1;
			((Graphic)val6).color = Color32.op_Implicit(val3);
			SetFullRect(((Component)val6).GetComponent<RectTransform>(), 0.35f, 0f, 0.6f, 1f);
			Text val7 = CreateText(val.transform, "Time", record.Timestamp, 11, (TextAnchor)5);
			((Graphic)val7).color = new Color(1f, 1f, 1f, 0.6f);
			SetFullRect(((Component)val7).GetComponent<RectTransform>(), 0.6f, 0f, 0.97f, 1f);
		}

		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);
			_historyScreen.SetActive(false);
			_activeScreen = screen;
			_activeScreen.SetActive(true);
		}

		private void SetActiveScreenAnimated(GameObject screen)
		{
			_menuScreen.SetActive(false);
			_amountScreen.SetActive(false);
			_processingScreen.SetActive(false);
			_successScreen.SetActive(false);
			_historyScreen.SetActive(false);
			_activeScreen = screen;
			_activeScreen.SetActive(true);
			CanvasGroup component = _activeScreen.GetComponent<CanvasGroup>();
			if ((Object)(object)component != (Object)null)
			{
				component.alpha = 0f;
				MelonCoroutines.Start(FadeIn(component, 0.15f));
			}
		}

		[IteratorStateMachine(typeof(<FadeIn>d__72))]
		private static IEnumerator FadeIn(CanvasGroup group, float duration)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <FadeIn>d__72(0)
			{
				group = group,
				duration = duration
			};
		}

		public void Show()
		{
			if (_currentThemeName != Config.Theme || _currentHeaderTitle != Config.HeaderTitle)
			{
				RebuildUI();
			}
			SetActiveScreen(_menuScreen);
			UpdateBalanceDisplay();
		}

		private void RebuildUI()
		{
			if ((Object)(object)_background != (Object)null)
			{
				Object.Destroy((Object)(object)_background);
			}
			if ((Object)(object)_menuScreen != (Object)null)
			{
				Object.Destroy((Object)(object)_menuScreen);
			}
			if ((Object)(object)_amountScreen != (Object)null)
			{
				Object.Destroy((Object)(object)_amountScreen);
			}
			if ((Object)(object)_processingScreen != (Object)null)
			{
				Object.Destroy((Object)(object)_processingScreen);
			}
			if ((Object)(object)_successScreen != (Object)null)
			{
				Object.Destroy((Object)(object)_successScreen);
			}
			if ((Object)(object)_historyScreen != (Object)null)
			{
				Object.Destroy((Object)(object)_historyScreen);
			}
			_currentThemeName = Config.Theme;
			_currentHeaderTitle = Config.HeaderTitle;
			_theme = GetTheme(_currentThemeName);
			BuildUI();
		}

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

		public bool HandleBack()
		{
			if ((Object)(object)_activeScreen == (Object)(object)_amountScreen || (Object)(object)_activeScreen == (Object)(object)_historyScreen)
			{
				SetActiveScreenAnimated(_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 float GetMaxDeposit(MoneyManager moneyManager)
		{
			float weeklyDepositLimit = Config.WeeklyDepositLimit;
			if (weeklyDepositLimit <= 0f)
			{
				return moneyManager.cashBalance;
			}
			return Mathf.Max(0f, Mathf.Min(moneyManager.cashBalance, weeklyDepositLimit - ATM.WeeklyDepositSum));
		}

		private bool IsDepositLimitReached()
		{
			float weeklyDepositLimit = Config.WeeklyDepositLimit;
			return weeklyDepositLimit > 0f && ATM.WeeklyDepositSum >= weeklyDepositLimit;
		}

		private void UpdateBalanceDisplay()
		{
			MoneyManager instance = NetworkSingleton<MoneyManager>.Instance;
			if (!((Object)(object)instance == (Object)null))
			{
				float weeklyDepositSum = ATM.WeeklyDepositSum;
				float weeklyDepositLimit = Config.WeeklyDepositLimit;
				string text = ((weeklyDepositLimit <= 0f) ? (MoneyManager.FormatAmount(weeklyDepositSum, false, false) + " / Unlimited") : (MoneyManager.FormatAmount(weeklyDepositSum, false, false) + " / " + MoneyManager.FormatAmount(weeklyDepositLimit, 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)_headerNetWorthText != (Object)null)
				{
					_headerNetWorthText.text = MoneyManager.FormatAmount(instance.GetNetWorth(), false, false);
				}
				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 ((Object)(object)_depositButton != (Object)null)
				{
					((Selectable)_depositButton).interactable = !IsDepositLimitReached();
				}
				if ((Object)(object)_quickDepositButton != (Object)null)
				{
					float maxDeposit = GetMaxDeposit(instance);
					((Selectable)_quickDepositButton).interactable = maxDeposit > 0f;
				}
			}
		}

		private void UpdateAmountScreen()
		{
			MoneyManager instance = NetworkSingleton<MoneyManager>.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return;
			}
			float num = (_isDepositing ? GetMaxDeposit(instance) : 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 ? GetMaxDeposit(instance) : 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 ? GetMaxDeposit(instance) : 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 = _lastDepositAmount;
			SetActiveScreenAnimated(_amountScreen);
		}

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

		private void OnQuickDepositPressed()
		{
			MoneyManager instance = NetworkSingleton<MoneyManager>.Instance;
			if (!((Object)(object)instance == (Object)null))
			{
				float maxDeposit = GetMaxDeposit(instance);
				if (maxDeposit > 0f)
				{
					MelonCoroutines.Start(ProcessTransaction(maxDeposit, depositing: true));
				}
			}
		}

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

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

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

		private void OnHistoryPressed()
		{
			RefreshHistoryContent();
			SetActiveScreenAnimated(_historyScreen);
		}

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

		private static float GetOnlineBalance(MoneyManager moneyManager)
		{
			return moneyManager.onlineBalance;
		}
	}
	public enum TransactionType
	{
		Deposit,
		Withdrawal,
		AutoDeposit
	}
	public class TransactionRecord
	{
		public TransactionType Type;

		public float Amount;

		public string Timestamp;

		public string Source;

		public TransactionRecord()
		{
		}

		public TransactionRecord(TransactionType type, float amount, string source)
		{
			Type = type;
			Amount = amount;
			Timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
			Source = source;
		}
	}
	public static class TransactionHistory
	{
		private const int MAX_ENTRIES = 50;

		private static readonly List<TransactionRecord> _records = new List<TransactionRecord>();

		private static string _filePath;

		public static IReadOnlyList<TransactionRecord> Records => _records;

		public static void Initialize()
		{
			string organisationName = GetOrganisationName();
			string path = SanitizeFolderName(organisationName);
			string text = Path.Combine(MelonEnvironment.ModsDirectory, "BankingApp", path);
			if (!Directory.Exists(text))
			{
				Directory.CreateDirectory(text);
			}
			_filePath = Path.Combine(text, "transactions.json");
			Load();
			DebugLog.Msg($"TransactionHistory initialized with {_records.Count} records for '{organisationName}'");
		}

		private static string GetOrganisationName()
		{
			LoadManager instance = Singleton<LoadManager>.Instance;
			if (((instance != null) ? instance.ActiveSaveInfo : null) != null && !string.IsNullOrEmpty(instance.ActiveSaveInfo.OrganisationName))
			{
				return instance.ActiveSaveInfo.OrganisationName;
			}
			return "Unknown";
		}

		private static string SanitizeFolderName(string name)
		{
			char[] invalidFileNameChars = Path.GetInvalidFileNameChars();
			StringBuilder stringBuilder = new StringBuilder(name.Length);
			foreach (char c in name)
			{
				stringBuilder.Append((Array.IndexOf(invalidFileNameChars, c) >= 0) ? '_' : c);
			}
			return stringBuilder.ToString();
		}

		public static void AddTransaction(TransactionType type, float amount, string source = "App")
		{
			TransactionRecord item = new TransactionRecord(type, amount, source);
			_records.Insert(0, item);
			while (_records.Count > 50)
			{
				_records.RemoveAt(_records.Count - 1);
			}
			Save();
			DebugLog.Msg($"Transaction logged: {type} {amount:F0}");
		}

		private static void Save()
		{
			try
			{
				StringBuilder stringBuilder = new StringBuilder();
				stringBuilder.AppendLine("[");
				for (int i = 0; i < _records.Count; i++)
				{
					TransactionRecord transactionRecord = _records[i];
					stringBuilder.Append("  {");
					stringBuilder.Append($"\"type\":{(int)transactionRecord.Type},");
					stringBuilder.Append($"\"amount\":{transactionRecord.Amount:F2},");
					stringBuilder.Append("\"source\":\"" + EscapeJson(transactionRecord.Source ?? "App") + "\",");
					stringBuilder.Append("\"timestamp\":\"" + EscapeJson(transactionRecord.Timestamp) + "\"");
					stringBuilder.Append("}");
					if (i < _records.Count - 1)
					{
						stringBuilder.Append(",");
					}
					stringBuilder.AppendLine();
				}
				stringBuilder.AppendLine("]");
				File.WriteAllText(_filePath, stringBuilder.ToString());
			}
			catch (Exception ex)
			{
				DebugLog.Error("[TransactionHistory] Failed to save: " + ex.Message);
				DebugLog.Error("[TransactionHistory] Stack trace: " + ex.StackTrace);
			}
		}

		private static void Load()
		{
			_records.Clear();
			if (!File.Exists(_filePath))
			{
				return;
			}
			try
			{
				string json = File.ReadAllText(_filePath);
				ParseJsonArray(json);
			}
			catch (Exception ex)
			{
				DebugLog.Error("[TransactionHistory] Failed to load: " + ex.Message);
				DebugLog.Error("[TransactionHistory] Stack trace: " + ex.StackTrace);
			}
		}

		private static void ParseJsonArray(string json)
		{
			int num = json.IndexOf('[');
			if (num < 0)
			{
				return;
			}
			num++;
			while (num < json.Length)
			{
				int num2 = json.IndexOf('{', num);
				if (num2 < 0)
				{
					break;
				}
				int num3 = json.IndexOf('}', num2);
				if (num3 < 0)
				{
					break;
				}
				string obj = json.Substring(num2 + 1, num3 - num2 - 1);
				TransactionRecord transactionRecord = ParseRecord(obj);
				if (transactionRecord != null)
				{
					_records.Add(transactionRecord);
				}
				num = num3 + 1;
			}
		}

		private static TransactionRecord ParseRecord(string obj)
		{
			TransactionRecord transactionRecord = new TransactionRecord();
			string text = ExtractValue(obj, "type");
			string text2 = ExtractValue(obj, "amount");
			string text3 = ExtractStringValue(obj, "timestamp");
			string text4 = ExtractStringValue(obj, "source");
			if (text == null || text2 == null || text3 == null)
			{
				return null;
			}
			if (int.TryParse(text, out var result))
			{
				transactionRecord.Type = (TransactionType)result;
			}
			if (float.TryParse(text2, NumberStyles.Float, CultureInfo.InvariantCulture, out var result2))
			{
				transactionRecord.Amount = result2;
			}
			transactionRecord.Timestamp = text3;
			transactionRecord.Source = text4 ?? "App";
			return transactionRecord;
		}

		private static string ExtractValue(string obj, string key)
		{
			string text = "\"" + key + "\":";
			int num = obj.IndexOf(text);
			if (num < 0)
			{
				return null;
			}
			num += text.Length;
			int num2 = obj.IndexOfAny(new char[3] { ',', '}', '"' }, num);
			if (num2 < 0)
			{
				num2 = obj.Length;
			}
			return obj.Substring(num, num2 - num).Trim();
		}

		private static string ExtractStringValue(string obj, string key)
		{
			string text = "\"" + key + "\":\"";
			int num = obj.IndexOf(text);
			if (num < 0)
			{
				return null;
			}
			num += text.Length;
			int num2 = obj.IndexOf('"', num);
			if (num2 < 0)
			{
				return null;
			}
			return obj.Substring(num, num2 - num);
		}

		private static string EscapeJson(string s)
		{
			return s.Replace("\\", "\\\\").Replace("\"", "\\\"");
		}
	}
}

BankingApp_Mono.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
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 System.Text;
using BankingApp;
using BankingApp.Features;
using BankingApp.Utils;
using HarmonyLib;
using MelonLoader;
using MelonLoader.Preferences;
using MelonLoader.Utils;
using Microsoft.CodeAnalysis;
using ScheduleOne;
using ScheduleOne.DevUtilities;
using ScheduleOne.Money;
using ScheduleOne.Persistence;
using ScheduleOne.PlayerScripts;
using ScheduleOne.UI;
using ScheduleOne.UI.ATM;
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.3.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+0b8a8272925a4b4c22723541037c9da88e654de9")]
[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 static class Config
	{
		private static MelonPreferences_Category _category;

		private static MelonPreferences_Entry<string> _theme;

		private static MelonPreferences_Entry<string> _headerTitle;

		private static MelonPreferences_Entry<float> _processingDelay;

		private static MelonPreferences_Entry<float> _weeklyDepositLimit;

		private static MelonPreferences_Entry<bool> _autoDepositEnabled;

		public static string Theme => _theme.Value;

		public static string HeaderTitle => _headerTitle.Value;

		public static float ProcessingDelay => _processingDelay.Value;

		public static float WeeklyDepositLimit => _weeklyDepositLimit.Value;

		public static bool AutoDepositEnabled => _autoDepositEnabled.Value;

		public static void Initialize()
		{
			_category = MelonPreferences.CreateCategory("BankingApp", "Banking App");
			_theme = _category.CreateEntry<string>("Theme", "Blue", "Color Theme", "Color theme for the banking app UI. Options: Blue, Dark, Green, Pink", false, false, (ValueValidator)null, (string)null);
			_headerTitle = _category.CreateEntry<string>("HeaderTitle", "ATM", "Header Title", "Text displayed in the app header", false, false, (ValueValidator)null, (string)null);
			_processingDelay = _category.CreateEntry<float>("ProcessingDelay", 1f, "Processing Delay", "How long the processing screen shows (seconds)", false, false, (ValueValidator)null, (string)null);
			_weeklyDepositLimit = _category.CreateEntry<float>("WeeklyDepositLimit", 10000f, "Weekly Deposit Limit", "Weekly deposit limit (0 = unlimited)", false, false, (ValueValidator)null, (string)null);
			_autoDepositEnabled = _category.CreateEntry<bool>("AutoDepositEnabled", false, "Auto Deposit Enabled", "Automatically deposit cash when the weekly limit resets", false, false, (ValueValidator)null, (string)null);
		}
	}
	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;
			Config.Initialize();
			MelonLogger.Msg("BankingApp v1.3.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 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 WITHDRAWAL_RED = "#FF6B6B";

			public const string AUTO_DEPOSIT_CYAN = "#00CED1";
		}

		public const string MOD_NAME = "BankingApp";

		public const string MOD_VERSION = "1.3.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.Patches
{
	[HarmonyPatch(typeof(ATMInterface))]
	public static class ATMInterfacePatches
	{
		private static bool _reflectionCached;

		private static MemberInfo _amountButtonsMember;

		private static MethodInfo _listGetItem;

		private static PropertyInfo _listCount;

		private static MemberInfo _depositLimitTextMember;

		private static MemberInfo _menuDepositButtonMember;

		private static MemberInfo _activeScreenMember;

		private static MemberInfo _menuScreenMember;

		private static MemberInfo _amountSelectorScreenMember;

		private static MemberInfo _depositingMember;

		private static MemberInfo _selectedAmountMember;

		private static MemberInfo _amountLabelTextMember;

		private static float GetRemainingAllowedDeposit()
		{
			float weeklyDepositLimit = Config.WeeklyDepositLimit;
			if (weeklyDepositLimit <= 0f)
			{
				return float.MaxValue;
			}
			return Mathf.Max(0f, weeklyDepositLimit - ATM.WeeklyDepositSum);
		}

		private static MemberInfo FindMember(string name)
		{
			return (MemberInfo)(((object)AccessTools.Field(typeof(ATMInterface), name)) ?? ((object)AccessTools.Property(typeof(ATMInterface), name)));
		}

		private static object GetMemberValue(MemberInfo member, object instance)
		{
			if (member is FieldInfo fieldInfo)
			{
				return fieldInfo.GetValue(instance);
			}
			if (member is PropertyInfo propertyInfo)
			{
				return propertyInfo.GetValue(instance);
			}
			return null;
		}

		private static void SetMemberValue(MemberInfo member, object instance, object value)
		{
			if (member is FieldInfo fieldInfo)
			{
				fieldInfo.SetValue(instance, value);
			}
			else if (member is PropertyInfo propertyInfo)
			{
				propertyInfo.SetValue(instance, value);
			}
		}

		private static void EnsureReflectionCached(ATMInterface instance)
		{
			if (!_reflectionCached)
			{
				_reflectionCached = true;
				_amountButtonsMember = FindMember("amountButtons");
				_depositLimitTextMember = FindMember("depositLimitText");
				_menuDepositButtonMember = FindMember("menu_DepositButton");
				_activeScreenMember = FindMember("activeScreen");
				_menuScreenMember = FindMember("menuScreen");
				_amountSelectorScreenMember = FindMember("amountSelectorScreen");
				_depositingMember = FindMember("depositing");
				_selectedAmountMember = FindMember("selectedAmount");
				_amountLabelTextMember = FindMember("amountLabelText");
				object memberValue = GetMemberValue(_amountButtonsMember, instance);
				if (memberValue != null)
				{
					Type type = memberValue.GetType();
					_listGetItem = type.GetMethod("get_Item", new Type[1] { typeof(int) });
					_listCount = type.GetProperty("Count");
				}
			}
		}

		private static int GetAmountButtonCount(ATMInterface instance)
		{
			object memberValue = GetMemberValue(_amountButtonsMember, instance);
			return (int)_listCount.GetValue(memberValue);
		}

		private static Button GetAmountButton(ATMInterface instance, int index)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			object memberValue = GetMemberValue(_amountButtonsMember, instance);
			return (Button)_listGetItem.Invoke(memberValue, new object[1] { index });
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void Update_Postfix(ATMInterface __instance)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Expected O, but got Unknown
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			if (!__instance.isOpen)
			{
				return;
			}
			EnsureReflectionCached(__instance);
			float weeklyDepositLimit = Config.WeeklyDepositLimit;
			Text val = (Text)GetMemberValue(_depositLimitTextMember, __instance);
			RectTransform val2 = (RectTransform)GetMemberValue(_activeScreenMember, __instance);
			RectTransform val3 = (RectTransform)GetMemberValue(_menuScreenMember, __instance);
			RectTransform val4 = (RectTransform)GetMemberValue(_amountSelectorScreenMember, __instance);
			bool flag = (bool)GetMemberValue(_depositingMember, __instance);
			if ((Object)(object)val != (Object)null)
			{
				if (weeklyDepositLimit <= 0f)
				{
					val.text = MoneyManager.FormatAmount(ATM.WeeklyDepositSum, false, false) + " / Unlimited";
					((Graphic)val).color = Color.white;
				}
				else
				{
					val.text = MoneyManager.FormatAmount(ATM.WeeklyDepositSum, false, false) + " / " + MoneyManager.FormatAmount(weeklyDepositLimit, false, false);
					((Graphic)val).color = ((ATM.WeeklyDepositSum >= weeklyDepositLimit) ? Color32.op_Implicit(new Color32(byte.MaxValue, (byte)75, (byte)75, byte.MaxValue)) : Color.white);
				}
			}
			if ((Object)(object)val2 == (Object)(object)val3)
			{
				Button val5 = (Button)GetMemberValue(_menuDepositButtonMember, __instance);
				if ((Object)(object)val5 != (Object)null)
				{
					((Selectable)val5).interactable = weeklyDepositLimit <= 0f || ATM.WeeklyDepositSum < weeklyDepositLimit;
				}
			}
			if (!((Object)(object)val2 == (Object)(object)val4 && flag))
			{
				return;
			}
			int amountButtonCount = GetAmountButtonCount(__instance);
			if (amountButtonCount <= 0)
			{
				return;
			}
			Button amountButton = GetAmountButton(__instance, amountButtonCount - 1);
			if ((Object)(object)amountButton != (Object)null)
			{
				float num = Mathf.Min(NetworkSingleton<MoneyManager>.Instance.cashBalance, GetRemainingAllowedDeposit());
				Transform val6 = ((Component)amountButton).transform.Find("Text");
				if ((Object)(object)val6 != (Object)null)
				{
					((Component)val6).GetComponent<Text>().text = "MAX (" + MoneyManager.FormatAmount(num, false, false) + ")";
				}
			}
		}

		[HarmonyPatch("UpdateAvailableAmounts")]
		[HarmonyPrefix]
		public static bool UpdateAvailableAmounts_Prefix(ATMInterface __instance)
		{
			EnsureReflectionCached(__instance);
			float weeklyDepositLimit = Config.WeeklyDepositLimit;
			float remainingAllowedDeposit = GetRemainingAllowedDeposit();
			bool flag = (bool)GetMemberValue(_depositingMember, __instance);
			float num = (flag ? NetworkSingleton<MoneyManager>.Instance.cashBalance : NetworkSingleton<MoneyManager>.Instance.onlineBalance);
			for (int i = 0; i < ATMInterface.amounts.Length; i++)
			{
				Button amountButton = GetAmountButton(__instance, i);
				if (flag && i == ATMInterface.amounts.Length - 1)
				{
					((Selectable)amountButton).interactable = num > 0f && remainingAllowedDeposit > 0f;
					break;
				}
				if (flag)
				{
					bool flag2 = num >= (float)ATMInterface.amounts[i];
					bool flag3 = weeklyDepositLimit <= 0f || ATM.WeeklyDepositSum + (float)ATMInterface.amounts[i] <= weeklyDepositLimit;
					((Selectable)amountButton).interactable = flag2 && flag3;
				}
				else
				{
					((Selectable)amountButton).interactable = num >= (float)ATMInterface.amounts[i];
				}
			}
			return false;
		}

		[HarmonyPatch("SetSelectedAmount")]
		[HarmonyPrefix]
		public static bool SetSelectedAmount_Prefix(ATMInterface __instance, float amount)
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			EnsureReflectionCached(__instance);
			float num = (((bool)GetMemberValue(_depositingMember, __instance)) ? Mathf.Min(NetworkSingleton<MoneyManager>.Instance.cashBalance, GetRemainingAllowedDeposit()) : NetworkSingleton<MoneyManager>.Instance.onlineBalance);
			float num2 = Mathf.Clamp(amount, 0f, num);
			SetMemberValue(_selectedAmountMember, __instance, num2);
			Text val = (Text)GetMemberValue(_amountLabelTextMember, __instance);
			val.text = MoneyManager.FormatAmount(num2, false, false);
			return false;
		}

		[HarmonyPatch("GetAmountFromIndex")]
		[HarmonyPrefix]
		public static bool GetAmountFromIndex_Prefix(int index, bool depositing, ref float __result)
		{
			if (index == -1 || index >= ATMInterface.amounts.Length)
			{
				__result = 0f;
				return false;
			}
			if (depositing && index == ATMInterface.amounts.Length - 1)
			{
				__result = Mathf.Min(NetworkSingleton<MoneyManager>.Instance.cashBalance, GetRemainingAllowedDeposit());
				return false;
			}
			__result = ATMInterface.amounts[index];
			return false;
		}
	}
	[HarmonyPatch(typeof(MoneyManager))]
	public static class MoneyManagerPatches
	{
		[HarmonyPatch("CreateOnlineTransaction")]
		[HarmonyPostfix]
		public static void CreateOnlineTransaction_Postfix(string _transaction_Name, float _unit_Amount)
		{
			if (!(_transaction_Name == "Cash Deposit"))
			{
				if (_transaction_Name == "Cash Withdrawal")
				{
					TransactionHistory.AddTransaction(TransactionType.Withdrawal, Math.Abs(_unit_Amount), "ATM");
				}
			}
			else
			{
				TransactionHistory.AddTransaction(TransactionType.Deposit, _unit_Amount, "ATM");
			}
		}
	}
}
namespace BankingApp.Features
{
	public class AutoDeposit
	{
		[CompilerGenerated]
		private sealed class <PollCoroutine>d__3 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public AutoDeposit <>4__this;

			private MoneyManager <moneyManager>5__1;

			private float <currentSum>5__2;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Expected O, but got Unknown
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				//IL_0061: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(5f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					break;
				case 2:
					<>1__state = -1;
					if (!Config.AutoDepositEnabled)
					{
						break;
					}
					<moneyManager>5__1 = NetworkSingleton<MoneyManager>.Instance;
					if (!((Object)(object)<moneyManager>5__1 == (Object)null))
					{
						<currentSum>5__2 = ATM.WeeklyDepositSum;
						if (<>4__this._previousWeeklySum > 0f && <currentSum>5__2 == 0f)
						{
							DebugLog.Msg("Weekly deposit reset detected, attempting auto-deposit");
							<>4__this.TryAutoDeposit(<moneyManager>5__1);
						}
						<>4__this._previousWeeklySum = <currentSum>5__2;
						<moneyManager>5__1 = null;
					}
					break;
				}
				<>2__current = (object)new WaitForSeconds(60f);
				<>1__state = 2;
				return true;
			}

			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 BankingAppManager _manager;

		private float _previousWeeklySum = -1f;

		public AutoDeposit(BankingAppManager manager)
		{
			_manager = manager;
		}

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

		private void TryAutoDeposit(MoneyManager moneyManager)
		{
			float cashBalance = moneyManager.cashBalance;
			if (cashBalance <= 0f)
			{
				return;
			}
			float weeklyDepositLimit = Config.WeeklyDepositLimit;
			float num;
			if (weeklyDepositLimit <= 0f)
			{
				num = cashBalance;
			}
			else
			{
				float num2 = weeklyDepositLimit - ATM.WeeklyDepositSum;
				if (num2 <= 0f)
				{
					return;
				}
				num = Mathf.Min(cashBalance, num2);
			}
			if (!(num <= 0f))
			{
				moneyManager.ChangeCashBalance(0f - num, true, true);
				moneyManager.CreateOnlineTransaction("Auto Deposit", num, 1f, string.Empty);
				ATM.WeeklyDepositSum += num;
				TransactionHistory.AddTransaction(TransactionType.AutoDeposit, num, "Auto");
				_manager.ShowNotificationBadge();
				DebugLog.Msg("Auto-deposit completed: " + MoneyManager.FormatAmount(num, false, false));
			}
		}
	}
	public class BankingAppManager
	{
		private GameObject _appContainer;

		private Button _appIconButton;

		private BankingAppUI _bankingUI;

		private bool _isOpen;

		private GameObject _notificationBadge;

		private AutoDeposit _autoDeposit;

		public bool IsOpen => _isOpen;

		public void Initialize()
		{
			TransactionHistory.Initialize();
			CreateAppIcon();
			CreateAppUI();
			RegisterEventHandlers();
			_autoDeposit = new AutoDeposit(this);
			MelonCoroutines.Start(_autoDeposit.PollCoroutine());
			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_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: 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)
			{
				_notificationBadge = ((Component)val7).gameObject;
				_notificationBadge.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);
				ClearNotificationBadge();
				_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;
		}

		public void ShowNotificationBadge()
		{
			if ((Object)(object)_notificationBadge != (Object)null)
			{
				_notificationBadge.SetActive(true);
			}
		}

		public void ClearNotificationBadge()
		{
			if ((Object)(object)_notificationBadge != (Object)null)
			{
				_notificationBadge.SetActive(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
	{
		private struct ColorTheme
		{
			public Color32 Background;

			public Color32 HeaderBg;

			public Color32 Button;

			public Color32 Accent;
		}

		[CompilerGenerated]
		private sealed class <FadeIn>d__72 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public CanvasGroup group;

			public float duration;

			private float <elapsed>5__1;

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

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

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

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

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<elapsed>5__1 = 0f;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (<elapsed>5__1 < duration)
				{
					<elapsed>5__1 += Time.deltaTime;
					group.alpha = Mathf.Clamp01(<elapsed>5__1 / duration);
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				group.alpha = 1f;
				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();
			}
		}

		[CompilerGenerated]
		private sealed class <ProcessTransaction>d__91 : 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__91(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.SetActiveScreenAnimated(<>4__this._processingScreen);
					<>2__current = (object)new WaitForSeconds(Config.ProcessingDelay);
					<>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.SetActiveScreenAnimated(<>4__this._menuScreen);
						return false;
					}
					if (depositing)
					{
						if (<moneyManager>5__1.cashBalance >= amount)
						{
							<moneyManager>5__1.ChangeCashBalance(0f - amount, true, true);
							<moneyManager>5__1.CreateOnlineTransaction("Mobile Deposit", amount, 1f, string.Empty);
							ATM.WeeklyDepositSum += amount;
							TransactionHistory.AddTransaction(TransactionType.Deposit, amount);
							<>4__this._successSubtitle.text = "You have deposited " + MoneyManager.FormatAmount(amount, false, false);
							<>4__this.SetActiveScreenAnimated(<>4__this._successScreen);
						}
						else
						{
							<>4__this.SetActiveScreenAnimated(<>4__this._menuScreen);
						}
					}
					else if (GetOnlineBalance(<moneyManager>5__1) >= amount)
					{
						<moneyManager>5__1.ChangeCashBalance(amount, true, true);
						<moneyManager>5__1.CreateOnlineTransaction("Mobile Withdrawal", 0f - amount, 1f, string.Empty);
						TransactionHistory.AddTransaction(TransactionType.Withdrawal, amount);
						<>4__this._successSubtitle.text = "You have withdrawn " + MoneyManager.FormatAmount(amount, false, false);
						<>4__this.SetActiveScreenAnimated(<>4__this._successScreen);
					}
					else
					{
						<>4__this.SetActiveScreenAnimated(<>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 ColorTheme _theme;

		private string _currentThemeName;

		private string _currentHeaderTitle;

		private GameObject _background;

		private GameObject _menuScreen;

		private GameObject _amountScreen;

		private GameObject _processingScreen;

		private GameObject _successScreen;

		private GameObject _historyScreen;

		private GameObject _activeScreen;

		private Text _titleText;

		private Text _headerDepositLimitText;

		private Text _headerOnlineBalanceText;

		private Text _headerCashText;

		private Text _headerNetWorthText;

		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 _quickDepositButton;

		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 float _lastDepositAmount = 20f;

		private float _lastWithdrawAmount = 20f;

		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 Color32 NetWorthGold = new Color32(byte.MaxValue, (byte)215, (byte)0, byte.MaxValue);

		private static readonly Color32 WithdrawalRed = new Color32(byte.MaxValue, (byte)107, (byte)107, byte.MaxValue);

		private static readonly Color32 AutoDepositCyan = new Color32((byte)0, (byte)206, (byte)209, 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 };

		private Transform _historyContentTransform;

		public event Action OnCloseRequested;

		public BankingAppUI(Transform root)
		{
			_root = root;
			_currentThemeName = Config.Theme;
			_currentHeaderTitle = Config.HeaderTitle;
			_theme = GetTheme(_currentThemeName);
			BuildUI();
		}

		private static ColorTheme GetTheme(string name)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			switch (name)
			{
			case "Dark":
			{
				ColorTheme result = default(ColorTheme);
				result.Background = new Color32((byte)26, (byte)26, (byte)46, byte.MaxValue);
				result.HeaderBg = new Color32((byte)22, (byte)33, (byte)62, byte.MaxValue);
				result.Button = new Color32((byte)20, (byte)25, (byte)50, byte.MaxValue);
				result.Accent = new Color32((byte)76, (byte)191, byte.MaxValue, byte.MaxValue);
				return result;
			}
			case "Green":
			{
				ColorTheme result = default(ColorTheme);
				result.Background = new Color32((byte)27, (byte)67, (byte)50, byte.MaxValue);
				result.HeaderBg = new Color32((byte)45, (byte)106, (byte)79, byte.MaxValue);
				result.Button = new Color32((byte)20, (byte)50, (byte)35, byte.MaxValue);
				result.Accent = new Color32(byte.MaxValue, (byte)215, (byte)0, byte.MaxValue);
				return result;
			}
			case "Pink":
			{
				ColorTheme result = default(ColorTheme);
				result.Background = new Color32((byte)46, (byte)26, (byte)46, byte.MaxValue);
				result.HeaderBg = new Color32((byte)74, (byte)32, (byte)80, byte.MaxValue);
				result.Button = new Color32((byte)58, (byte)21, (byte)64, byte.MaxValue);
				result.Accent = new Color32(byte.MaxValue, (byte)105, (byte)180, byte.MaxValue);
				return result;
			}
			default:
			{
				ColorTheme result = default(ColorTheme);
				result.Background = new Color32((byte)59, (byte)127, (byte)212, byte.MaxValue);
				result.HeaderBg = new Color32((byte)40, (byte)59, (byte)140, byte.MaxValue);
				result.Button = new Color32((byte)35, (byte)65, (byte)110, byte.MaxValue);
				result.Accent = new Color32((byte)76, (byte)191, byte.MaxValue, byte.MaxValue);
				return result;
			}
			}
		}

		private void BuildUI()
		{
			CreateBackground();
			CreateMenuScreen();
			CreateAmountScreen();
			CreateProcessingScreen();
			CreateSuccessScreen();
			CreateHistoryScreen();
			_menuScreen.AddComponent<CanvasGroup>();
			_amountScreen.AddComponent<CanvasGroup>();
			_processingScreen.AddComponent<CanvasGroup>();
			_successScreen.AddComponent<CanvasGroup>();
			_historyScreen.AddComponent<CanvasGroup>();
			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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: 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(_theme.Background);
		}

		private void CreateMenuScreen()
		{
			//IL_000e: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_036c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_044b: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_054e: 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(_theme.HeaderBg));
			SetFullRect(val.GetComponent<RectTransform>(), 0f, 0.88f, 1f, 1f);
			_titleText = CreateText(val.transform, "Title", Config.HeaderTitle, 24, (TextAnchor)3);
			_titleText.fontStyle = (FontStyle)1;
			SetFullRect(((Component)_titleText).GetComponent<RectTransform>(), 0.03f, 0f, 0.12f, 1f);
			Text val2 = CreateText(val.transform, "DepositLimitLabel", "Weekly Deposit Limit", 10, (TextAnchor)7);
			SetFullRect(((Component)val2).GetComponent<RectTransform>(), 0.12f, 0.52f, 0.32f, 1f);
			_headerDepositLimitText = CreateText(val.transform, "DepositLimitValue", "$0 / $10,000", 14, (TextAnchor)1);
			_headerDepositLimitText.fontStyle = (FontStyle)1;
			SetFullRect(((Component)_headerDepositLimitText).GetComponent<RectTransform>(), 0.12f, 0f, 0.32f, 0.52f);
			Text val3 = CreateText(val.transform, "OnlineLabel", "Online Balance", 10, (TextAnchor)7);
			SetFullRect(((Component)val3).GetComponent<RectTransform>(), 0.32f, 0.52f, 0.52f, 1f);
			_headerOnlineBalanceText = CreateText(val.transform, "OnlineValue", "$0", 16, (TextAnchor)1);
			((Graphic)_headerOnlineBalanceText).color = Color32.op_Implicit(_theme.Accent);
			_headerOnlineBalanceText.fontStyle = (FontStyle)1;
			SetFullRect(((Component)_headerOnlineBalanceText).GetComponent<RectTransform>(), 0.32f, 0f, 0.52f, 0.52f);
			Text val4 = CreateText(val.transform, "CashLabel", "Cash", 10, (TextAnchor)7);
			SetFullRect(((Component)val4).GetComponent<RectTransform>(), 0.52f, 0.52f, 0.72f, 1f);
			_headerCashText = CreateText(val.transform, "CashValue", "$0", 16, (TextAnchor)1);
			((Graphic)_headerCashText).color = Color32.op_Implicit(GreenColor);
			_headerCashText.fontStyle = (FontStyle)1;
			SetFullRect(((Component)_headerCashText).GetComponent<RectTransform>(), 0.52f, 0f, 0.72f, 0.52f);
			Text val5 = CreateText(val.transform, "NetWorthLabel", "Net Worth", 10, (TextAnchor)7);
			SetFullRect(((Component)val5).GetComponent<RectTransform>(), 0.72f, 0.52f, 0.97f, 1f);
			_headerNetWorthText = CreateText(val.transform, "NetWorthValue", "$0", 16, (TextAnchor)1);
			((Graphic)_headerNetWorthText).color = Color32.op_Implicit(NetWorthGold);
			_headerNetWorthText.fontStyle = (FontStyle)1;
			SetFullRect(((Component)_headerNetWorthText).GetComponent<RectTransform>(), 0.72f, 0f, 0.97f, 0.52f);
			GameObject val6 = CreatePanel(_menuScreen.transform, "ContentArea", Color.clear);
			SetFullRect(val6.GetComponent<RectTransform>(), 0.05f, 0.15f, 0.95f, 0.85f);
			Text val7 = CreateText(val6.transform, "Welcome", "Select Transaction Type", 24, (TextAnchor)4);
			SetFullRect(((Component)val7).GetComponent<RectTransform>(), 0f, 0.8f, 1f, 0.95f);
			_depositButton = CreateStyledButton(val6.transform, "DepositButton", "DEPOSIT", _theme.Accent, OnDepositPressed);
			SetFullRect(((Component)_depositButton).GetComponent<RectTransform>(), 0.1f, 0.68f, 0.9f, 0.82f);
			_withdrawButton = CreateStyledButton(val6.transform, "WithdrawButton", "WITHDRAW", _theme.Accent, OnWithdrawPressed);
			SetFullRect(((Component)_withdrawButton).GetComponent<RectTransform>(), 0.1f, 0.5f, 0.9f, 0.64f);
			_quickDepositButton = CreateStyledButton(val6.transform, "QuickDepositButton", "QUICK DEPOSIT", _theme.Accent, OnQuickDepositPressed);
			SetFullRect(((Component)_quickDepositButton).GetComponent<RectTransform>(), 0.1f, 0.32f, 0.9f, 0.46f);
			Button val8 = CreateStyledButton(val6.transform, "HistoryButton", "HISTORY", _theme.Accent, OnHistoryPressed);
			SetFullRect(((Component)val8).GetComponent<RectTransform>(), 0.1f, 0.14f, 0.9f, 0.28f);
			Button val9 = CreateStyledButton(_menuScreen.transform, "CloseButton", "CLOSE", OrangeColor, delegate
			{
				this.OnCloseRequested?.Invoke();
			});
			SetFullRect(((Component)val9).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_005a: 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_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0386: 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(_theme.HeaderBg));
			SetFullRect(val.GetComponent<RectTransform>(), 0f, 0.88f, 1f, 1f);
			Text val2 = CreateText(val.transform, "ATM", Config.HeaderTitle, 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(_theme.Accent);
			_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_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: 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(_theme.Button));
					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], _theme.Accent, 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_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: 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)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: 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_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: 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_01c6: Expected O, but got Unknown
			GameObject val = CreatePanel(parent, name, Color32.op_Implicit(_theme.Accent));
			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(_theme.Accent);
			((ColorBlock)(ref colors)).highlightedColor = Color32.op_Implicit(new Color32((byte)Mathf.Min(255, _theme.Accent.r + 30), (byte)Mathf.Min(255, _theme.Accent.g + 30), (byte)Mathf.Min(255, _theme.Accent.b + 30), byte.MaxValue));
			((ColorBlock)(ref colors)).pressedColor = Color32.op_Implicit(new Color32((byte)Mathf.Max(0, _theme.Accent.r - 20), (byte)Mathf.Max(0, _theme.Accent.g - 20), (byte)Mathf.Max(0, _theme.Accent.b - 20), byte.MaxValue));
			((ColorBlock)(ref colors)).selectedColor = ((ColorBlock)(ref colors)).pressedColor;
			((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_015b: 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", _theme.Button, OnReturnToMenu);
			SetFullRect(((Component)_returnButton).GetComponent<RectTransform>(), 0.15f, 0.1f, 0.85f, 0.23f);
			_successScreen.SetActive(false);
		}

		private void CreateHistoryScreen()
		{
			//IL_000e: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Expected O, but got Unknown
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Expected O, but got Unknown
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Expected O, but got Unknown
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			_historyScreen = CreatePanel(_root, "HistoryScreen", Color.clear);
			SetFullRect(_historyScreen.GetComponent<RectTransform>(), 0f, 0f, 1f, 1f);
			GameObject val = CreatePanel(_historyScreen.transform, "Header", Color32.op_Implicit(_theme.HeaderBg));
			SetFullRect(val.GetComponent<RectTransform>(), 0f, 0.88f, 1f, 1f);
			Text val2 = CreateText(val.transform, "Title", "Transaction History", 22, (TextAnchor)4);
			val2.fontStyle = (FontStyle)1;
			SetFullRect(((Component)val2).GetComponent<RectTransform>(), 0f, 0f, 1f, 1f);
			GameObject val3 = new GameObject("ScrollArea");
			val3.transform.SetParent(_historyScreen.transform, false);
			RectTransform rect = val3.AddComponent<RectTransform>();
			SetFullRect(rect, 0.02f, 0.12f, 0.98f, 0.87f);
			ScrollRect val4 = val3.AddComponent<ScrollRect>();
			val4.horizontal = false;
			val4.vertical = true;
			val4.movementType = (MovementType)2;
			val4.scrollSensitivity = 20f;
			Image val5 = val3.AddComponent<Image>();
			((Graphic)val5).color = new Color(0f, 0f, 0f, 0.01f);
			val3.AddComponent<Mask>().showMaskGraphic = false;
			GameObject val6 = new GameObject("Content");
			val6.transform.SetParent(val3.transform, false);
			RectTransform val7 = val6.AddComponent<RectTransform>();
			val7.anchorMin = new Vector2(0f, 1f);
			val7.anchorMax = new Vector2(1f, 1f);
			val7.pivot = new Vector2(0.5f, 1f);
			val7.offsetMin = Vector2.zero;
			val7.offsetMax = Vector2.zero;
			val7.sizeDelta = new Vector2(0f, 0f);
			VerticalLayoutGroup val8 = val6.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val8).spacing = 4f;
			((HorizontalOrVerticalLayoutGroup)val8).childForceExpandWidth = true;
			((HorizontalOrVerticalLayoutGroup)val8).childForceExpandHeight = false;
			((HorizontalOrVerticalLayoutGroup)val8).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)val8).childControlHeight = true;
			((LayoutGroup)val8).padding = new RectOffset(4, 4, 4, 4);
			ContentSizeFitter val9 = val6.AddComponent<ContentSizeFitter>();
			val9.verticalFit = (FitMode)2;
			val4.content = val7;
			_historyContentTransform = val6.transform;
			Button val10 = CreateStyledButton(_historyScreen.transform, "BackButton", "BACK", OrangeColor, delegate
			{
				SetActiveScreenAnimated(_menuScreen);
			});
			SetFullRect(((Component)val10).GetComponent<RectTransform>(), 0.3f, 0.02f, 0.7f, 0.1f);
			_historyScreen.SetActive(false);
		}

		private void RefreshHistoryContent()
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			for (int num = _historyContentTransform.childCount - 1; num >= 0; num--)
			{
				Object.Destroy((Object)(object)((Component)_historyContentTransform.GetChild(num)).gameObject);
			}
			IReadOnlyList<TransactionRecord> records = TransactionHistory.Records;
			if (records.Count == 0)
			{
				GameObject val = new GameObject("EmptyRow");
				val.transform.SetParent(_historyContentTransform, false);
				LayoutElement val2 = val.AddComponent<LayoutElement>();
				val2.preferredHeight = 60f;
				Text val3 = CreateText(val.transform, "Text", "No transactions yet", 18, (TextAnchor)4);
				((Graphic)val3).color = new Color(1f, 1f, 1f, 0.5f);
				SetFullRect(((Component)val3).GetComponent<RectTransform>(), 0f, 0f, 1f, 1f);
				return;
			}
			foreach (TransactionRecord item in records)
			{
				CreateHistoryRow(item);
			}
		}

		private void CreateHistoryRow(TransactionRecord record)
		{
			//IL_001e: 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_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: 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_007a: 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)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreatePanel(_historyContentTransform, "Row", Color32.op_Implicit(new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)20)));
			LayoutElement val2 = val.AddComponent<LayoutElement>();
			val2.preferredHeight = 48f;
			string content;
			Color32 val3;
			string text;
			switch (record.Type)
			{
			case TransactionType.Deposit:
				content = "DEPOSIT";
				val3 = GreenColor;
				text = "+";
				break;
			case TransactionType.AutoDeposit:
				content = "AUTO DEP";
				val3 = AutoDepositCyan;
				text = "+";
				break;
			default:
				content = "WITHDRAW";
				val3 = WithdrawalRed;
				text = "-";
				break;
			}
			string content2 = record.Source ?? "App";
			Text val4 = CreateText(val.transform, "Type", content, 14, (TextAnchor)3);
			val4.fontStyle = (FontStyle)1;
			((Graphic)val4).color = Color32.op_Implicit(val3);
			SetFullRect(((Component)val4).GetComponent<RectTransform>(), 0.03f, 0f, 0.22f, 1f);
			Text val5 = CreateText(val.transform, "Source", content2, 11, (TextAnchor)3);
			((Graphic)val5).color = new Color(1f, 1f, 1f, 0.5f);
			SetFullRect(((Component)val5).GetComponent<RectTransform>(), 0.22f, 0f, 0.35f, 1f);
			Text val6 = CreateText(val.transform, "Amount", text + MoneyManager.FormatAmount(record.Amount, false, false), 16, (TextAnchor)4);
			val6.fontStyle = (FontStyle)1;
			((Graphic)val6).color = Color32.op_Implicit(val3);
			SetFullRect(((Component)val6).GetComponent<RectTransform>(), 0.35f, 0f, 0.6f, 1f);
			Text val7 = CreateText(val.transform, "Time", record.Timestamp, 11, (TextAnchor)5);
			((Graphic)val7).color = new Color(1f, 1f, 1f, 0.6f);
			SetFullRect(((Component)val7).GetComponent<RectTransform>(), 0.6f, 0f, 0.97f, 1f);
		}

		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);
			_historyScreen.SetActive(false);
			_activeScreen = screen;
			_activeScreen.SetActive(true);
		}

		private void SetActiveScreenAnimated(GameObject screen)
		{
			_menuScreen.SetActive(false);
			_amountScreen.SetActive(false);
			_processingScreen.SetActive(false);
			_successScreen.SetActive(false);
			_historyScreen.SetActive(false);
			_activeScreen = screen;
			_activeScreen.SetActive(true);
			CanvasGroup component = _activeScreen.GetComponent<CanvasGroup>();
			if ((Object)(object)component != (Object)null)
			{
				component.alpha = 0f;
				MelonCoroutines.Start(FadeIn(component, 0.15f));
			}
		}

		[IteratorStateMachine(typeof(<FadeIn>d__72))]
		private static IEnumerator FadeIn(CanvasGroup group, float duration)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <FadeIn>d__72(0)
			{
				group = group,
				duration = duration
			};
		}

		public void Show()
		{
			if (_currentThemeName != Config.Theme || _currentHeaderTitle != Config.HeaderTitle)
			{
				RebuildUI();
			}
			SetActiveScreen(_menuScreen);
			UpdateBalanceDisplay();
		}

		private void RebuildUI()
		{
			if ((Object)(object)_background != (Object)null)
			{
				Object.Destroy((Object)(object)_background);
			}
			if ((Object)(object)_menuScreen != (Object)null)
			{
				Object.Destroy((Object)(object)_menuScreen);
			}
			if ((Object)(object)_amountScreen != (Object)null)
			{
				Object.Destroy((Object)(object)_amountScreen);
			}
			if ((Object)(object)_processingScreen != (Object)null)
			{
				Object.Destroy((Object)(object)_processingScreen);
			}
			if ((Object)(object)_successScreen != (Object)null)
			{
				Object.Destroy((Object)(object)_successScreen);
			}
			if ((Object)(object)_historyScreen != (Object)null)
			{
				Object.Destroy((Object)(object)_historyScreen);
			}
			_currentThemeName = Config.Theme;
			_currentHeaderTitle = Config.HeaderTitle;
			_theme = GetTheme(_currentThemeName);
			BuildUI();
		}

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

		public bool HandleBack()
		{
			if ((Object)(object)_activeScreen == (Object)(object)_amountScreen || (Object)(object)_activeScreen == (Object)(object)_historyScreen)
			{
				SetActiveScreenAnimated(_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 float GetMaxDeposit(MoneyManager moneyManager)
		{
			float weeklyDepositLimit = Config.WeeklyDepositLimit;
			if (weeklyDepositLimit <= 0f)
			{
				return moneyManager.cashBalance;
			}
			return Mathf.Max(0f, Mathf.Min(moneyManager.cashBalance, weeklyDepositLimit - ATM.WeeklyDepositSum));
		}

		private bool IsDepositLimitReached()
		{
			float weeklyDepositLimit = Config.WeeklyDepositLimit;
			return weeklyDepositLimit > 0f && ATM.WeeklyDepositSum >= weeklyDepositLimit;
		}

		private void UpdateBalanceDisplay()
		{
			MoneyManager instance = NetworkSingleton<MoneyManager>.Instance;
			if (!((Object)(object)instance == (Object)null))
			{
				float weeklyDepositSum = ATM.WeeklyDepositSum;
				float weeklyDepositLimit = Config.WeeklyDepositLimit;
				string text = ((weeklyDepositLimit <= 0f) ? (MoneyManager.FormatAmount(weeklyDepositSum, false, false) + " / Unlimited") : (MoneyManager.FormatAmount(weeklyDepositSum, false, false) + " / " + MoneyManager.FormatAmount(weeklyDepositLimit, 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)_headerNetWorthText != (Object)null)
				{
					_headerNetWorthText.text = MoneyManager.FormatAmount(instance.GetNetWorth(), false, false);
				}
				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 ((Object)(object)_depositButton != (Object)null)
				{
					((Selectable)_depositButton).interactable = !IsDepositLimitReached();
				}
				if ((Object)(object)_quickDepositButton != (Object)null)
				{
					float maxDeposit = GetMaxDeposit(instance);
					((Selectable)_quickDepositButton).interactable = maxDeposit > 0f;
				}
			}
		}

		private void UpdateAmountScreen()
		{
			MoneyManager instance = NetworkSingleton<MoneyManager>.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return;
			}
			float num = (_isDepositing ? GetMaxDeposit(instance) : 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 ? GetMaxDeposit(instance) : 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 ? GetMaxDeposit(instance) : 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 = _lastDepositAmount;
			SetActiveScreenAnimated(_amountScreen);
		}

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

		private void OnQuickDepositPressed()
		{
			MoneyManager instance = NetworkSingleton<MoneyManager>.Instance;
			if (!((Object)(object)instance == (Object)null))
			{
				float maxDeposit = GetMaxDeposit(instance);
				if (maxDeposit > 0f)
				{
					MelonCoroutines.Start(ProcessTransaction(maxDeposit, depositing: true));
				}
			}
		}

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

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

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

		private void OnHistoryPressed()
		{
			RefreshHistoryContent();
			SetActiveScreenAnimated(_historyScreen);
		}

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

		private static float GetOnlineBalance(MoneyManager moneyManager)
		{
			return moneyManager.onlineBalance;
		}
	}
	public enum TransactionType
	{
		Deposit,
		Withdrawal,
		AutoDeposit
	}
	public class TransactionRecord
	{
		public TransactionType Type;

		public float Amount;

		public string Timestamp;

		public string Source;

		public TransactionRecord()
		{
		}

		public TransactionRecord(TransactionType type, float amount, string source)
		{
			Type = type;
			Amount = amount;
			Timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
			Source = source;
		}
	}
	public static class TransactionHistory
	{
		private const int MAX_ENTRIES = 50;

		private static readonly List<TransactionRecord> _records = new List<TransactionRecord>();

		private static string _filePath;

		public static IReadOnlyList<TransactionRecord> Records => _records;

		public static void Initialize()
		{
			string organisationName = GetOrganisationName();
			string path = SanitizeFolderName(organisationName);
			string text = Path.Combine(MelonEnvironment.ModsDirectory, "BankingApp", path);
			if (!Directory.Exists(text))
			{
				Directory.CreateDirectory(text);
			}
			_filePath = Path.Combine(text, "transactions.json");
			Load();
			DebugLog.Msg($"TransactionHistory initialized with {_records.Count} records for '{organisationName}'");
		}

		private static string GetOrganisationName()
		{
			LoadManager instance = Singleton<LoadManager>.Instance;
			if (((instance != null) ? instance.ActiveSaveInfo : null) != null && !string.IsNullOrEmpty(instance.ActiveSaveInfo.OrganisationName))
			{
				return instance.ActiveSaveInfo.OrganisationName;
			}
			return "Unknown";
		}

		private static string SanitizeFolderName(string name)
		{
			char[] invalidFileNameChars = Path.GetInvalidFileNameChars();
			StringBuilder stringBuilder = new StringBuilder(name.Length);
			foreach (char c in name)
			{
				stringBuilder.Append((Array.IndexOf(invalidFileNameChars, c) >= 0) ? '_' : c);
			}
			return stringBuilder.ToString();
		}

		public static void AddTransaction(TransactionType type, float amount, string source = "App")
		{
			TransactionRecord item = new TransactionRecord(type, amount, source);
			_records.Insert(0, item);
			while (_records.Count > 50)
			{
				_records.RemoveAt(_records.Count - 1);
			}
			Save();
			DebugLog.Msg($"Transaction logged: {type} {amount:F0}");
		}

		private static void Save()
		{
			try
			{
				StringBuilder stringBuilder = new StringBuilder();
				stringBuilder.AppendLine("[");
				for (int i = 0; i < _records.Count; i++)
				{
					TransactionRecord transactionRecord = _records[i];
					stringBuilder.Append("  {");
					stringBuilder.Append($"\"type\":{(int)transactionRecord.Type},");
					stringBuilder.Append($"\"amount\":{transactionRecord.Amount:F2},");
					stringBuilder.Append("\"source\":\"" + EscapeJson(transactionRecord.Source ?? "App") + "\",");
					stringBuilder.Append("\"timestamp\":\"" + EscapeJson(transactionRecord.Timestamp) + "\"");
					stringBuilder.Append("}");
					if (i < _records.Count - 1)
					{
						stringBuilder.Append(",");
					}
					stringBuilder.AppendLine();
				}
				stringBuilder.AppendLine("]");
				File.WriteAllText(_filePath, stringBuilder.ToString());
			}
			catch (Exception ex)
			{
				DebugLog.Error("[TransactionHistory] Failed to save: " + ex.Message);
				DebugLog.Error("[TransactionHistory] Stack trace: " + ex.StackTrace);
			}
		}

		private static void Load()
		{
			_records.Clear();
			if (!File.Exists(_filePath))
			{
				return;
			}
			try
			{
				string json = File.ReadAllText(_filePath);
				ParseJsonArray(json);
			}
			catch (Exception ex)
			{
				DebugLog.Error("[TransactionHistory] Failed to load: " + ex.Message);
				DebugLog.Error("[TransactionHistory] Stack trace: " + ex.StackTrace);
			}
		}

		private static void ParseJsonArray(string json)
		{
			int num = json.IndexOf('[');
			if (num < 0)
			{
				return;
			}
			num++;
			while (num < json.Length)
			{
				int num2 = json.IndexOf('{', num);
				if (num2 < 0)
				{
					break;
				}
				int num3 = json.IndexOf('}', num2);
				if (num3 < 0)
				{
					break;
				}
				string obj = json.Substring(num2 + 1, num3 - num2 - 1);
				TransactionRecord transactionRecord = ParseRecord(obj);
				if (transactionRecord != null)
				{
					_records.Add(transactionRecord);
				}
				num = num3 + 1;
			}
		}

		private static TransactionRecord ParseRecord(string obj)
		{
			TransactionRecord transactionRecord = new TransactionRecord();
			string text = ExtractValue(obj, "type");
			string text2 = ExtractValue(obj, "amount");
			string text3 = ExtractStringValue(obj, "timestamp");
			string text4 = ExtractStringValue(obj, "source");
			if (text == null || text2 == null || text3 == null)
			{
				return null;
			}
			if (int.TryParse(text, out var result))
			{
				transactionRecord.Type = (TransactionType)result;
			}
			if (float.TryParse(text2, NumberStyles.Float, CultureInfo.InvariantCulture, out var result2))
			{
				transactionRecord.Amount = result2;
			}
			transactionRecord.Timestamp = text3;
			transactionRecord.Source = text4 ?? "App";
			return transactionRecord;
		}

		private static string ExtractValue(string obj, string key)
		{
			string text = "\"" + key + "\":";
			int num = obj.IndexOf(text);
			if (num < 0)
			{
				return null;
			}
			num += text.Length;
			int num2 = obj.IndexOfAny(new char[3] { ',', '}', '"' }, num);
			if (num2 < 0)
			{
				num2 = obj.Length;
			}
			return obj.Substring(num, num2 - num).Trim();
		}

		private static string ExtractStringValue(string obj, string key)
		{
			string text = "\"" + key + "\":\"";
			int num = obj.IndexOf(text);
			if (num < 0)
			{
				return null;
			}
			num += text.Length;
			int num2 = obj.IndexOf('"', num);
			if (num2 < 0)
			{
				return null;
			}
			return obj.Substring(num, num2 - num);
		}

		private static string EscapeJson(string s)
		{
			return s.Replace("\\", "\\\\").Replace("\"", "\\\"");
		}
	}
}