Decompiled source of HireMe v2.0.0

HireMe_2.0.0_IL2Cpp.dll

Decompiled 3 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using HarmonyLib;
using HireMe;
using HireMe.TemplateUtils;
using HireMe.UI;
using HireMe.Utils;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppScheduleOne;
using Il2CppScheduleOne.DevUtilities;
using Il2CppScheduleOne.Dialogue;
using Il2CppScheduleOne.Employees;
using Il2CppScheduleOne.Money;
using Il2CppScheduleOne.NPCs;
using Il2CppScheduleOne.NPCs.CharacterClasses;
using Il2CppScheduleOne.Persistence;
using Il2CppScheduleOne.PlayerScripts;
using Il2CppScheduleOne.Property;
using Il2CppScheduleOne.UI;
using Il2CppScheduleOne.UI.Items;
using Il2CppScheduleOne.UI.Phone;
using Il2CppScheduleOne.Variables;
using Il2CppSystem.Collections.Generic;
using Il2CppSystem.IO;
using MelonLoader;
using MelonLoader.Preferences;
using MelonLoader.Utils;
using Microsoft.CodeAnalysis;
using ModManagerPhoneApp;
using UnityEngine;
using UnityEngine.EventSystems;
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), "Hire Me", "2.0.0", "OverweightUnicorn", null)]
[assembly: MelonColor(255, 191, 0, 255)]
[assembly: MelonGame("TVGS", "Schedule I")]
[assembly: MelonOptionalDependencies(new string[] { "ModManager&PhoneApp" })]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("HireMe_2.0.0_IL2Cpp")]
[assembly: AssemblyConfiguration("IL2CPP")]
[assembly: AssemblyFileVersion("2.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+9b466ef0c042fc74725d4a77883eb091bf663162")]
[assembly: AssemblyProduct("HireMe_2.0.0_IL2Cpp")]
[assembly: AssemblyTitle("HireMe_2.0.0_IL2Cpp")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.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 HireMe
{
	public static class BuildInfo
	{
		public const string Name = "Hire Me";

		public const string Description = "A user interface for hiring employees";

		public const string Author = "OverweightUnicorn";

		public const string Company = "UnicornsCanMod";

		public const string Version = "2.0.0";

		public const string DownloadLink = null;
	}
	public class Core : MelonMod
	{
		public static double? botanistSigningFee;

		public static bool? botanistSigningFeeEnabled;

		public static double? botanistDailyWage;

		public static double? chemistSigningFee;

		public static bool? chemistSigningFeeEnabled;

		public static double? chemistDailyWage;

		public static double? handlerSigningFee;

		public static bool? handlerSigningFeeEnabled;

		public static double? handlerDailyWage;

		public static double? cleanerSigningFee;

		public static bool? cleanerSigningFeeEnabled;

		public static double? cleanerDailyWage;

		private static bool _modManagerFound;

		public override void OnInitializeMelon()
		{
			ModSettings.Init();
			((MelonBase)this).LoggerInstance.Msg($"PhoneApp: {ModSettings.EnablePhoneApp.Value}");
			try
			{
				_modManagerFound = MelonBase.RegisteredMelons.Any(delegate(MelonBase mod)
				{
					object obj;
					if (mod == null)
					{
						obj = null;
					}
					else
					{
						MelonInfoAttribute info = mod.Info;
						obj = ((info != null) ? info.Name : null);
					}
					return (string?)obj == "Mod Manager & Phone App";
				});
				if (_modManagerFound)
				{
					((MelonBase)this).LoggerInstance.Msg("Mod Manager found. Attempting event subscription...");
					SubscribeToModManagerEvents();
				}
				else
				{
					((MelonBase)this).LoggerInstance.Warning("Mod Manager not found. Skipping event subscription.");
				}
			}
			catch (Exception value)
			{
				((MelonBase)this).LoggerInstance.Error($"Error checking RegisteredMelons: {value}");
				_modManagerFound = false;
			}
			((MelonBase)this).LoggerInstance.Msg("MyCoolMod Initialization complete.");
		}

		public override void OnLateInitializeMelon()
		{
			Singleton<LoadManager>.Instance.onLoadComplete.AddListener(UnityAction.op_Implicit((Action)Initialize));
			LoadBreadConfig();
		}

		public void Initialize()
		{
			AssetBundleUtils.LoadAssetBundle("hiremeassets");
			UIManager.LoadAssets();
			GameObject val = GameObject.Find("UI");
			if ((Object)(object)val != (Object)null)
			{
				UIManager.SetupUI(val.transform);
			}
			HomeScreen instance = PlayerSingleton<HomeScreen>.instance;
			if (Object.op_Implicit((Object)(object)instance))
			{
				UIManager.SetupPhoneApp(instance);
			}
		}

		private void SubscribeToModManagerEvents()
		{
			try
			{
				ModSettingsEvents.OnPhonePreferencesSaved += HandleSettingsUpdate;
				((MelonBase)this).LoggerInstance.Msg("Successfully subscribed to Mod Manager save events.");
			}
			catch (TypeLoadException)
			{
				((MelonBase)this).LoggerInstance.Error("TypeLoadException during subscription! Mod Manager incompatible?");
				_modManagerFound = false;
			}
			catch (Exception value)
			{
				((MelonBase)this).LoggerInstance.Error($"Unexpected error during subscription: {value}");
				_modManagerFound = false;
			}
		}

		private void HandleSettingsUpdate()
		{
			((MelonBase)this).LoggerInstance.Msg("Mod Manager saved preferences. Reloading settings...");
			try
			{
				bool value = ModSettings.EnablePhoneApp.Value;
				MelonLogger.Msg("EnablePhoneApp: " + value);
				UIManager.TogglePhoneApp(value);
				((MelonBase)this).LoggerInstance.Msg("Settings reloaded successfully.");
			}
			catch (Exception value2)
			{
				((MelonBase)this).LoggerInstance.Error($"Error applying updated settings after save: {value2}");
			}
		}

		private void UnsubscribeFromModManagerEvents()
		{
			try
			{
				ModSettingsEvents.OnPhonePreferencesSaved -= HandleSettingsUpdate;
				((MelonBase)this).LoggerInstance.Msg("Unsubscribed from Mod Manager events.");
			}
			catch (Exception ex)
			{
				((MelonBase)this).LoggerInstance.Warning("Ignoring error during unsubscribe: " + ex.Message);
			}
		}

		public override void OnDeinitializeMelon()
		{
			if (_modManagerFound)
			{
				UnsubscribeFromModManagerEvents();
			}
		}

		public void LoadBreadConfig()
		{
			if (BreadTweaksCompat.IsBreadTweaksInstalled())
			{
				LoadEmployeeConfig("Botanist", out botanistSigningFeeEnabled, out botanistSigningFee, out botanistDailyWage);
				LoadEmployeeConfig("Chemist", out chemistSigningFeeEnabled, out chemistSigningFee, out chemistDailyWage);
				LoadEmployeeConfig("Handler", out handlerSigningFeeEnabled, out handlerSigningFee, out handlerDailyWage);
				LoadEmployeeConfig("Cleaner", out cleanerSigningFeeEnabled, out cleanerSigningFee, out cleanerDailyWage);
			}
		}

		private void LoadEmployeeConfig(string name, out bool? signingFeeEnabled, out double? signingFee, out double? dailyWage)
		{
			signingFeeEnabled = BreadTweaksCompat.GetSigningFeeEnabled(name);
			signingFee = BreadTweaksCompat.GetSigningFee(name);
			dailyWage = BreadTweaksCompat.GetDailyWage(name);
			List<string> list = new List<string>();
			if (signingFeeEnabled.HasValue)
			{
				list.Add($"Signing Fee Enabled: {signingFeeEnabled.Value}");
			}
			if (signingFee.HasValue)
			{
				list.Add($"Signing Fee: {signingFee.Value}");
			}
			if (dailyWage.HasValue)
			{
				list.Add($"Daily Wage: {dailyWage.Value}");
			}
			if (list.Count > 0)
			{
				MelonLogger.Msg("\nLoaded " + name + " Config\n " + string.Join("\n ", list));
			}
		}
	}
}
namespace HireMe.UI
{
	[RegisterTypeInIl2Cpp]
	public class DraggableItem : EventTriggerBase
	{
		public bool newlySpawned = false;

		public Button deleteButton;

		public Image image;

		public Transform parentAfterDrag;

		public EEmployeeType employeeType;

		public Employee currentEmployee;

		public PropertyContainer currentContainer;

		public DraggableItem(IntPtr ptr)
			: base(ptr)
		{
		}

		public override void RegisterAllEventTriggers()
		{
			AddTrigger((EventTriggerType)13, UnityAction<BaseEventData>.op_Implicit((Action<BaseEventData>)OnBeginDrag));
			AddTrigger((EventTriggerType)5, UnityAction<BaseEventData>.op_Implicit((Action<BaseEventData>)OnDrag));
			AddTrigger((EventTriggerType)14, UnityAction<BaseEventData>.op_Implicit((Action<BaseEventData>)OnEndDrag));
			AddTrigger((EventTriggerType)0, UnityAction<BaseEventData>.op_Implicit((Action<BaseEventData>)OnPointerEnter));
			AddTrigger((EventTriggerType)1, UnityAction<BaseEventData>.op_Implicit((Action<BaseEventData>)OnPointerExit));
		}

		public override void Initialize()
		{
			base.Initialize();
			image = ((Component)this).GetComponent<Image>();
			deleteButton = ((Component)this).GetComponentInChildren<Button>(true);
			if ((Object)(object)deleteButton != (Object)null)
			{
				((UnityEvent)deleteButton.onClick).AddListener(UnityAction.op_Implicit((Action)OnDelete));
			}
		}

		public void OnBeginDrag(BaseEventData rawData)
		{
			PointerEventData val = ((Il2CppObjectBase)rawData).TryCast<PointerEventData>();
			if (val != null)
			{
				parentAfterDrag = ((Component)this).transform.parent;
				((Component)this).transform.SetParent(((Component)UIManager.hiringInterface.hireEmployeeCanvas).transform);
				((Component)this).transform.SetAsLastSibling();
				((Graphic)image).raycastTarget = false;
			}
		}

		public void OnDelete()
		{
			if ((Object)(object)currentContainer == (Object)null)
			{
				return;
			}
			currentContainer.employees--;
			currentContainer.UpdateCountText();
			if (UIManager.hiringInterface.OnEmployeeRemoved(currentContainer.currentProperty, this))
			{
				if (!newlySpawned)
				{
					currentEmployee.Fire();
				}
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		public void OnDrag(BaseEventData rawData)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			PointerEventData val = ((Il2CppObjectBase)rawData).TryCast<PointerEventData>();
			if (val != null)
			{
				((Component)this).transform.position = Input.mousePosition;
			}
		}

		public void OnEndDrag(BaseEventData rawData)
		{
			PointerEventData val = ((Il2CppObjectBase)rawData).TryCast<PointerEventData>();
			if (val != null)
			{
				((Component)this).transform.SetParent(parentAfterDrag);
				((Graphic)image).raycastTarget = true;
			}
		}

		public void OnPointerEnter(BaseEventData rawData)
		{
			PointerEventData val = ((Il2CppObjectBase)rawData).TryCast<PointerEventData>();
			if (val != null)
			{
				((Component)deleteButton).gameObject.SetActive(true);
			}
		}

		public void OnPointerExit(BaseEventData rawData)
		{
			PointerEventData val = ((Il2CppObjectBase)rawData).TryCast<PointerEventData>();
			if (val != null)
			{
				((Component)deleteButton).gameObject.SetActive(false);
			}
		}
	}
	[RegisterTypeInIl2Cpp]
	public class EmployeeListing : EventTriggerBase
	{
		public GameObject employeePrefab;

		public Transform dragParent;

		public GameObject currentInstance;

		public DraggableItem currentDraggable;

		public Sprite addIcon;

		public Sprite defaultIcon;

		public Text employeeCount;

		public Text signingFee;

		public Text dailyWage;

		public EEmployeeType employeeType;

		public EmployeeListing(IntPtr ptr)
			: base(ptr)
		{
		}

		public override void RegisterAllEventTriggers()
		{
			AddTrigger((EventTriggerType)13, UnityAction<BaseEventData>.op_Implicit((Action<BaseEventData>)OnBeginDrag));
			AddTrigger((EventTriggerType)5, UnityAction<BaseEventData>.op_Implicit((Action<BaseEventData>)OnDrag));
			AddTrigger((EventTriggerType)14, UnityAction<BaseEventData>.op_Implicit((Action<BaseEventData>)OnEndDrag));
		}

		public override void Initialize()
		{
			base.Initialize();
			Il2CppArrayBase<Text> componentsInChildren = ((Component)this).GetComponentsInChildren<Text>();
			foreach (Text item in componentsInChildren)
			{
				if (((Object)item).name == "EmployeeCount")
				{
					employeeCount = item;
				}
				else if (((Object)item).name == "DailyWage")
				{
					dailyWage = item;
				}
				else if (((Object)item).name == "SigningFee")
				{
					signingFee = item;
				}
			}
		}

		public void SetCountText(int quantity)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)employeeCount == (Object)null))
			{
				employeeCount.text = $"{quantity} x {employeeType}";
			}
		}

		public void SetSigningText(int fee)
		{
			if (!((Object)(object)signingFee == (Object)null))
			{
				signingFee.text = $"Signing Fee: <color=#54E717>${fee}</color>";
			}
		}

		public void SetWageText(int wage)
		{
			if (!((Object)(object)dailyWage == (Object)null))
			{
				dailyWage.text = $"Daily Wage: <color=#54E717>${wage}</color>";
			}
		}

		public void OnBeginDrag(BaseEventData rawData)
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: 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)
			PointerEventData val = ((Il2CppObjectBase)rawData).TryCast<PointerEventData>();
			if (val != null)
			{
				currentInstance = Object.Instantiate<GameObject>(employeePrefab, dragParent);
				Image component = currentInstance.GetComponent<Image>();
				component.sprite = addIcon;
				currentDraggable = currentInstance.AddComponent<DraggableItem>();
				currentDraggable.newlySpawned = true;
				currentDraggable.employeeType = employeeType;
				currentDraggable.currentContainer = null;
				((Graphic)currentDraggable.image).raycastTarget = false;
				currentInstance.transform.position = Input.mousePosition;
				CanvasGroup component2 = currentInstance.GetComponent<CanvasGroup>();
				if ((Object)(object)component2 != (Object)null)
				{
					component2.blocksRaycasts = false;
				}
			}
		}

		public void OnDrag(BaseEventData rawData)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			PointerEventData val = ((Il2CppObjectBase)rawData).TryCast<PointerEventData>();
			if (val != null && (Object)(object)currentInstance != (Object)null)
			{
				currentInstance.transform.position = Input.mousePosition;
			}
		}

		public void ClearCurrentInstance()
		{
			currentInstance = null;
			currentDraggable = null;
		}

		public void OnEndDrag(BaseEventData rawData)
		{
			PointerEventData val = ((Il2CppObjectBase)rawData).TryCast<PointerEventData>();
			if (val != null && (Object)(object)currentDraggable != (Object)null && (Object)(object)currentDraggable.parentAfterDrag == (Object)null)
			{
				Object.Destroy((Object)(object)currentInstance);
				currentDraggable = null;
			}
		}
	}
	[RegisterTypeInIl2Cpp]
	public class EventTriggerBase : MonoBehaviour
	{
		private EventTrigger _trigger;

		public EventTriggerBase(IntPtr ptr)
			: base(ptr)
		{
		}

		private void Awake()
		{
			EnsureEventTrigger();
			Initialize();
		}

		public virtual void Initialize()
		{
			RegisterAllEventTriggers();
		}

		private void EnsureEventTrigger()
		{
			_trigger = ((Component)this).gameObject.GetComponent<EventTrigger>();
			if ((Object)(object)_trigger == (Object)null)
			{
				_trigger = ((Component)this).gameObject.AddComponent<EventTrigger>();
			}
			if (_trigger.triggers == null)
			{
				_trigger.triggers = new List<Entry>();
			}
		}

		protected void AddTrigger(EventTriggerType type, UnityAction<BaseEventData> action)
		{
			//IL_0001: 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_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			Entry val = new Entry
			{
				eventID = type
			};
			((UnityEvent<BaseEventData>)(object)val.callback).AddListener(action);
			_trigger.triggers.Add(val);
		}

		public virtual void RegisterAllEventTriggers()
		{
			MelonLogger.Msg("Override Me");
		}
	}
	[RegisterTypeInIl2Cpp]
	public class HireEmployeeInterface : MonoBehaviour
	{
		[Serializable]
		public class PropertyInfo
		{
			public string propertyName;

			public int employeeCount;

			public int employeeCapacity;

			public string propertyCode;
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass52_0
		{
			public bool isHiringDone;

			internal void <HandlePayment>b__0()
			{
				isHiringDone = true;
			}
		}

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

			private object <>2__current;

			public Action OnComplete;

			public HireEmployeeInterface <>4__this;

			private <>c__DisplayClass52_0 <>8__1;

			private Text <payButtonText>5__2;

			private string <baseText>5__3;

			private int <dotCount>5__4;

			private float <interval>5__5;

			private Dictionary<Property, List<DraggableItem>>.Enumerator <>s__6;

			private KeyValuePair<Property, List<DraggableItem>> <kvp>5__7;

			private List<DraggableItem> <list>5__8;

			private List<(int index, GameObject go)> <temp>5__9;

			private int <i>5__10;

			private DraggableItem <item>5__11;

			private int <j>5__12;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>8__1 = null;
				<payButtonText>5__2 = null;
				<baseText>5__3 = null;
				<>s__6 = default(Dictionary<Property, List<DraggableItem>>.Enumerator);
				<kvp>5__7 = default(KeyValuePair<Property, List<DraggableItem>>);
				<list>5__8 = null;
				<temp>5__9 = null;
				<item>5__11 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_018a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0194: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>8__1 = new <>c__DisplayClass52_0();
					if ((Object)(object)<>4__this.payButton == (Object)null)
					{
						MelonLogger.Error("payButton is null.");
						OnComplete?.Invoke();
						return false;
					}
					<payButtonText>5__2 = ((Component)<>4__this.payButton).GetComponentInChildren<Text>();
					if ((Object)(object)<payButtonText>5__2 == (Object)null)
					{
						MelonLogger.Error("payButtonText is null.");
						OnComplete?.Invoke();
						return false;
					}
					((Selectable)<>4__this.payButton).interactable = false;
					<baseText>5__3 = "Processing";
					<dotCount>5__4 = 0;
					<interval>5__5 = 0.3f;
					<>8__1.isHiringDone = false;
					if ((Object)(object)<>4__this != (Object)null)
					{
						MelonCoroutines.Start(<>4__this.HireEmployees(delegate
						{
							<>8__1.isHiringDone = true;
						}));
						break;
					}
					MelonLogger.Error("HireEmployeeInterface is null while starting HireEmployees.");
					OnComplete?.Invoke();
					return false;
				case 1:
					<>1__state = -1;
					break;
				}
				if (!<>8__1.isHiringDone)
				{
					if ((Object)(object)<payButtonText>5__2 != (Object)null)
					{
						<payButtonText>5__2.text = <baseText>5__3 + new string('.', <dotCount>5__4);
					}
					<dotCount>5__4 = (<dotCount>5__4 + 1) % 3;
					<>2__current = (object)new WaitForSeconds(<interval>5__5);
					<>1__state = 1;
					return true;
				}
				<>s__6 = <>4__this.newPropertyAssignments.GetEnumerator();
				try
				{
					while (<>s__6.MoveNext())
					{
						<kvp>5__7 = <>s__6.Current;
						<list>5__8 = <kvp>5__7.Value;
						<temp>5__9 = new List<(int, GameObject)>();
						<i>5__10 = 0;
						while (<i>5__10 < <list>5__8.Count)
						{
							<item>5__11 = <list>5__8[<i>5__10];
							if (<item>5__11.newlySpawned)
							{
								if ((Object)(object)<item>5__11 != (Object)null && (Object)(object)((Component)<item>5__11).gameObject != (Object)null)
								{
									<temp>5__9.Add((<i>5__10, ((Component)<item>5__11).gameObject));
								}
								else
								{
									MelonLogger.Warning("Tried to destroy null item or item.gameObject.");
								}
								<item>5__11 = null;
							}
							<i>5__10++;
						}
						<j>5__12 = <temp>5__9.Count - 1;
						while (<j>5__12 >= 0)
						{
							<list>5__8.RemoveAt(<temp>5__9[<j>5__12].index);
							Object.Destroy((Object)(object)<temp>5__9[<j>5__12].go);
							<j>5__12--;
						}
						<list>5__8 = null;
						<temp>5__9 = null;
						<kvp>5__7 = default(KeyValuePair<Property, List<DraggableItem>>);
					}
				}
				finally
				{
					((IDisposable)<>s__6).Dispose();
				}
				<>s__6 = default(Dictionary<Property, List<DraggableItem>>.Enumerator);
				OnComplete?.Invoke();
				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 <HireEmployees>d__53 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Action onComplete;

			public HireEmployeeInterface <>4__this;

			private Dictionary<Property, List<DraggableItem>>.Enumerator <>s__1;

			private KeyValuePair<Property, List<DraggableItem>> <kvp>5__2;

			private Property <property>5__3;

			private List<DraggableItem> <employees>5__4;

			private List<DraggableItem>.Enumerator <>s__5;

			private DraggableItem <employee>5__6;

			private EEmployeeType <type>5__7;

			private (int count, int signingFee, int rate) <stats>5__8;

			private int <totalFee>5__9;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if ((uint)(num - -4) <= 1u || num == 1)
				{
					try
					{
						if (num == -4 || num == 1)
						{
							try
							{
							}
							finally
							{
								<>m__Finally2();
							}
						}
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<>s__1 = default(Dictionary<Property, List<DraggableItem>>.Enumerator);
				<kvp>5__2 = default(KeyValuePair<Property, List<DraggableItem>>);
				<property>5__3 = null;
				<employees>5__4 = null;
				<>s__5 = default(List<DraggableItem>.Enumerator);
				<employee>5__6 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
				//IL_0101: Unknown result type (might be due to invalid IL or missing references)
				//IL_0113: Unknown result type (might be due to invalid IL or missing references)
				//IL_0154: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ed: Expected O, but got Unknown
				try
				{
					int num = <>1__state;
					if (num != 0)
					{
						if (num != 1)
						{
							return false;
						}
						<>1__state = -4;
						<employee>5__6 = null;
						goto IL_020b;
					}
					<>1__state = -1;
					if (!NetworkSingleton<VariableDatabase>.Instance.GetValue<bool>("ClipboardAcquired"))
					{
						NetworkSingleton<VariableDatabase>.Instance.SetVariableValue("ClipboardAcquired", true.ToString(), true);
					}
					<>s__1 = <>4__this.newPropertyAssignments.GetEnumerator();
					<>1__state = -3;
					goto IL_0249;
					IL_0249:
					if (<>s__1.MoveNext())
					{
						<kvp>5__2 = <>s__1.Current;
						<property>5__3 = <kvp>5__2.Key;
						<employees>5__4 = <kvp>5__2.Value;
						<>s__5 = <employees>5__4.GetEnumerator();
						<>1__state = -4;
						goto IL_020b;
					}
					<>m__Finally1();
					<>s__1 = default(Dictionary<Property, List<DraggableItem>>.Enumerator);
					onComplete?.Invoke();
					return false;
					IL_020b:
					while (<>s__5.MoveNext())
					{
						<employee>5__6 = <>s__5.Current;
						if (<employee>5__6.newlySpawned)
						{
							<type>5__7 = <employee>5__6.employeeType;
							<stats>5__8 = <>4__this.employeeStats[<type>5__7];
							<totalFee>5__9 = <stats>5__8.signingFee;
							NetworkSingleton<MoneyManager>.Instance.ChangeCashBalance((float)(-<totalFee>5__9), true, false);
							NetworkSingleton<EmployeeManager>.Instance.CreateNewEmployee(<property>5__3, <type>5__7);
							continue;
						}
						if (<property>5__3.PropertyCode != <employee>5__6.currentEmployee.AssignedProperty.PropertyCode)
						{
							MelonLogger.Msg(<property>5__3.PropertyCode + " | " + <employee>5__6.currentEmployee.AssignedProperty.PropertyCode);
							<employee>5__6.currentEmployee.SendTransfer(<property>5__3.PropertyCode);
						}
						<>2__current = (object)new WaitForSeconds(0.1f);
						<>1__state = 1;
						return true;
					}
					<>m__Finally2();
					<>s__5 = default(List<DraggableItem>.Enumerator);
					<property>5__3 = null;
					<employees>5__4 = null;
					<kvp>5__2 = default(KeyValuePair<Property, List<DraggableItem>>);
					goto IL_0249;
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

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

			private void <>m__Finally1()
			{
				<>1__state = -1;
				((IDisposable)<>s__1).Dispose();
			}

			private void <>m__Finally2()
			{
				<>1__state = -3;
				((IDisposable)<>s__5).Dispose();
			}

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

		public GameObject propertyContainerPrefab;

		public EmployeeListing botanistListing;

		public EmployeeListing chemistListing;

		public EmployeeListing handlerListing;

		public EmployeeListing cleanerListing;

		public PopupHandler errorPopup;

		public Transform employeeListingsContainer;

		public Transform scrollablePropertyContainer;

		public Button payButton;

		public Canvas hireEmployeeCanvas;

		public Text totalCostLabel;

		public Text errorLabel;

		public UnityAction onClose;

		private bool isMobile = false;

		private bool showMiscUI = false;

		private string shopName = "MannysNetwork";

		private bool isOpen = false;

		private bool locationChanged = false;

		private string buttonText = "Accept";

		private bool isHandlingPayment = false;

		private Dictionary<EEmployeeType, (int count, int signingFee, int rate)> employeeStats = new Dictionary<EEmployeeType, (int, int, int)>
		{
			{
				(EEmployeeType)0,
				(0, 1200, 200)
			},
			{
				(EEmployeeType)2,
				(0, 1500, 300)
			},
			{
				(EEmployeeType)1,
				(0, 1200, 200)
			},
			{
				(EEmployeeType)3,
				(0, 1000, 100)
			}
		};

		private Dictionary<Property, List<DraggableItem>> newPropertyAssignments = new Dictionary<Property, List<DraggableItem>>();

		private Dictionary<Property, PropertyContainer> propertyContainers = new Dictionary<Property, PropertyContainer>();

		private HashSet<Property> ownedProperties = new HashSet<Property>();

		private float cash = 20000f;

		public void Setup()
		{
			InitializeExitListener();
			InitializeComponents();
			InitializeOwnedProperties();
			InitializeProperties();
			InitializeEmployeeListings();
			RefreshUI();
		}

		public void InitializeExitListener()
		{
			try
			{
				Action<ExitAction> action = Exit;
				ExitDelegate val = DelegateSupport.ConvertDelegate<ExitDelegate>((Delegate)action);
				GameInput.RegisterExitListener(val, 7);
			}
			catch (Exception value)
			{
				MelonLogger.Error($"Failed to register delegate: {value}");
			}
		}

		public void InitializeComponents()
		{
			hireEmployeeCanvas = ((Component)this).GetComponentInParent<Canvas>();
			InitializeLayoutGroups();
			InitializeButtons();
			InitializeText();
		}

		public void InitializeLayoutGroups()
		{
			Il2CppArrayBase<VerticalLayoutGroup> componentsInChildren = ((Component)this).GetComponentsInChildren<VerticalLayoutGroup>(true);
			foreach (VerticalLayoutGroup item in componentsInChildren)
			{
				if (((Object)((Component)item).gameObject).name == "ScrollablePropertyContent")
				{
					scrollablePropertyContainer = ((Component)item).transform;
				}
				else if (((Object)((Component)item).gameObject).name == "EmployeeListingsContainer")
				{
					employeeListingsContainer = ((Component)item).transform;
				}
			}
		}

		public void InitializeButtons()
		{
			Il2CppArrayBase<Button> componentsInChildren = ((Component)this).GetComponentsInChildren<Button>(true);
			foreach (Button item in componentsInChildren)
			{
				if (((Object)((Component)item).gameObject).name == "AcceptButton")
				{
					payButton = item;
					Text componentInChildren = ((Component)item).GetComponentInChildren<Text>();
					buttonText = componentInChildren.text;
					((UnityEvent)payButton.onClick).AddListener(UnityAction.op_Implicit((Action)HandlePaymentClick));
				}
			}
		}

		public void InitializeOwnedProperties()
		{
			ownedProperties = new HashSet<Property>((IEnumerable<Property>)Property.OwnedProperties.ToArray());
		}

		private void InitializeProperties()
		{
			Enumerator<Property> enumerator = Property.Properties.GetEnumerator();
			while (enumerator.MoveNext())
			{
				Property current = enumerator.Current;
				CreatePropertyContainer(current);
			}
		}

		public (int signingFee, int rate) GetEmployeeCosts(EEmployeeType employee)
		{
			//IL_0006: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: 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_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected I4, but got Unknown
			Employee employeePrefab = NetworkSingleton<EmployeeManager>.Instance.GetEmployeePrefab(employee);
			int item = Mathf.RoundToInt(employeePrefab.SigningFee + Fixer.GetAdditionalSigningFee());
			int item2 = Mathf.RoundToInt(employeePrefab.DailyWage);
			switch ((int)employee)
			{
			case 0:
				if (Core.botanistDailyWage.HasValue)
				{
					item2 = Mathf.RoundToInt((float)Core.botanistDailyWage.Value);
				}
				if (Core.botanistSigningFeeEnabled.GetValueOrDefault() && Core.botanistSigningFee.HasValue)
				{
					item = Mathf.RoundToInt((float)Core.botanistSigningFee.Value);
				}
				break;
			case 2:
				if (Core.chemistDailyWage.HasValue)
				{
					item2 = Mathf.RoundToInt((float)Core.chemistDailyWage.Value);
				}
				if (Core.chemistSigningFeeEnabled.GetValueOrDefault() && Core.chemistSigningFee.HasValue)
				{
					item = Mathf.RoundToInt((float)Core.chemistSigningFee.Value);
				}
				break;
			case 1:
				if (Core.handlerDailyWage.HasValue)
				{
					item2 = Mathf.RoundToInt((float)Core.handlerDailyWage.Value);
				}
				if (Core.handlerSigningFeeEnabled.GetValueOrDefault() && Core.handlerSigningFee.HasValue)
				{
					item = Mathf.RoundToInt((float)Core.handlerSigningFee.Value);
				}
				break;
			case 3:
				if (Core.cleanerDailyWage.HasValue)
				{
					item2 = Mathf.RoundToInt((float)Core.cleanerDailyWage.Value);
				}
				if (Core.cleanerSigningFeeEnabled.GetValueOrDefault() && Core.cleanerSigningFee.HasValue)
				{
					item = Mathf.RoundToInt((float)Core.cleanerSigningFee.Value);
				}
				break;
			}
			return (item, item2);
		}

		public void InitializeEmployeeListings()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Invalid comparison between Unknown and I4
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Invalid comparison between Unknown and I4
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Invalid comparison between Unknown and I4
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Invalid comparison between Unknown and I4
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: 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_0146: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				List<EEmployeeType> list = new List<EEmployeeType>(employeeStats.Keys);
				foreach (EEmployeeType item in list)
				{
					(int, int) employeeCosts = GetEmployeeCosts(item);
					employeeStats[item] = (0, employeeCosts.Item1, employeeCosts.Item2);
					if ((int)item == 0)
					{
						botanistListing.employeeType = item;
						botanistListing.SetCountText(0);
						botanistListing.SetSigningText(employeeCosts.Item1);
						botanistListing.SetWageText(employeeCosts.Item2);
					}
					else if ((int)item == 2)
					{
						chemistListing.employeeType = item;
						chemistListing.SetCountText(0);
						chemistListing.SetSigningText(employeeCosts.Item1);
						chemistListing.SetWageText(employeeCosts.Item2);
					}
					else if ((int)item == 1)
					{
						handlerListing.employeeType = item;
						handlerListing.SetCountText(0);
						handlerListing.SetSigningText(employeeCosts.Item1);
						handlerListing.SetWageText(employeeCosts.Item2);
					}
					else if ((int)item == 3)
					{
						cleanerListing.employeeType = item;
						cleanerListing.SetCountText(0);
						cleanerListing.SetSigningText(employeeCosts.Item1);
						cleanerListing.SetWageText(employeeCosts.Item2);
					}
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Msg((object)ex);
			}
		}

		public void InitializeText()
		{
			Il2CppArrayBase<Text> componentsInChildren = ((Component)this).GetComponentsInChildren<Text>(true);
			foreach (Text item in componentsInChildren)
			{
				if (((Object)((Component)item).gameObject).name == "TotalCostLabel")
				{
					totalCostLabel = item;
				}
				else if (((Object)((Component)item).gameObject).name == "ErrorLabel")
				{
					errorLabel = item;
				}
			}
		}

		public void CreatePropertyContainer(Property property)
		{
			GameObject val = Object.Instantiate<GameObject>(propertyContainerPrefab, scrollablePropertyContainer);
			PropertyContainer propertyContainer = val.AddComponent<PropertyContainer>();
			propertyContainer.currentProperty = property;
			propertyContainer.popup = errorPopup;
			propertyContainer.employees = property.Employees.Count;
			propertyContainer.total = property.EmployeeCapacity;
			propertyContainer.SetPropertyText(property.PropertyName);
			propertyContainer.UpdateCountText();
			newPropertyAssignments[property] = new List<DraggableItem>();
			propertyContainers[property] = propertyContainer;
			val.SetActive(ownedProperties.Contains(property) && property.EmployeeCapacity > 0);
		}

		public void SortProperties()
		{
			if ((Object)(object)scrollablePropertyContainer == (Object)null)
			{
				return;
			}
			List<KeyValuePair<Property, PropertyContainer>> list = propertyContainers.ToList();
			list.Sort(delegate(KeyValuePair<Property, PropertyContainer> a, KeyValuePair<Property, PropertyContainer> b)
			{
				PropertyContainer value = a.Value;
				PropertyContainer value2 = b.Value;
				bool flag = value.currentProperty.Employees.Count >= value.total;
				bool flag2 = value2.currentProperty.Employees.Count >= value2.total;
				if (flag != flag2)
				{
					return flag ? 1 : (-1);
				}
				if (value.total != value2.total)
				{
					return value.total.CompareTo(value2.total);
				}
				return (value.currentProperty.Employees.Count != value2.currentProperty.Employees.Count) ? value.currentProperty.Employees.Count.CompareTo(value2.currentProperty.Employees.Count) : string.Compare(value.currentProperty.PropertyName, value2.currentProperty.PropertyName, StringComparison.Ordinal);
			});
			for (int i = 0; i < list.Count; i++)
			{
				((Component)list[i].Value).transform.SetSiblingIndex(i);
			}
		}

		public void Open()
		{
			isMobile = true;
			showMiscUI = true;
			SetIsOpen(isOpen: true);
		}

		public void SetIsOpen(bool isOpen)
		{
			this.isOpen = isOpen;
			PlayerSingleton<PlayerCamera>.Instance.RemoveActiveUIElement(shopName);
			if (isOpen)
			{
				if (isMobile)
				{
					((Component)Singleton<ItemUIManager>.instance.InputsContainer).gameObject.SetActive(false);
					Singleton<GameplayMenuInterface>.instance.Close();
					PlayerSingleton<AppsCanvas>.Instance.SetIsOpen(true);
					PlayerSingleton<HomeScreen>.Instance.SetIsOpen(false);
					PlayerSingleton<Phone>.Instance.SetIsHorizontal(true);
					PlayerSingleton<Phone>.Instance.SetLookOffsetMultiplier(0.6f);
				}
				else
				{
					PlayerSingleton<PlayerCamera>.Instance.AddActiveUIElement(shopName);
					PlayerSingleton<PlayerCamera>.Instance.FreeMouse();
					PlayerSingleton<PlayerCamera>.Instance.SetCanLook(false);
					PlayerSingleton<PlayerMovement>.Instance.canMove = false;
					PlayerSingleton<PlayerInventory>.Instance.SetInventoryEnabled(true);
					PlayerSingleton<PlayerInventory>.Instance.SetEquippingEnabled(false);
					Singleton<InputPromptsCanvas>.Instance.LoadModule("exitonly");
				}
				cash = NetworkSingleton<MoneyManager>.Instance.cashBalance;
				Enumerator<Property> enumerator = Property.OwnedProperties.GetEnumerator();
				while (enumerator.MoveNext())
				{
					Property current = enumerator.Current;
					if (current.EmployeeCapacity <= 0 || !propertyContainers.ContainsKey(current))
					{
						continue;
					}
					LoadCurrentEmployees(current);
					PropertyContainer propertyContainer = propertyContainers[current];
					if (!((Object)(object)propertyContainer == (Object)null) && !((Object)(object)propertyContainer.currentProperty == (Object)null))
					{
						if (!ownedProperties.Contains(current))
						{
							ownedProperties.Add(current);
						}
						if (!((Component)propertyContainer).gameObject.activeInHierarchy)
						{
							((Component)propertyContainer).gameObject.SetActive(true);
						}
						if (newPropertyAssignments.ContainsKey(propertyContainer.currentProperty))
						{
							propertyContainer.employees = newPropertyAssignments[propertyContainer.currentProperty].Count;
						}
						propertyContainer.total = current.EmployeeCapacity;
						propertyContainer.UpdateCountText();
						if (propertyContainer.currentProperty.Employees.Count >= propertyContainer.total)
						{
							propertyContainer.ShrinkContainer();
						}
						else
						{
							propertyContainer.ExpandContainer();
						}
					}
				}
				SortProperties();
				RefreshUI();
			}
			else if (isMobile)
			{
				isMobile = false;
				PlayerSingleton<AppsCanvas>.Instance.SetIsOpen(false);
				PlayerSingleton<HomeScreen>.Instance.SetIsOpen(true);
				PlayerSingleton<Phone>.Instance.SetIsHorizontal(false);
				PlayerSingleton<Phone>.Instance.SetLookOffsetMultiplier(1f);
				Singleton<CursorManager>.Instance.SetCursorAppearance((ECursorType)0);
				if (showMiscUI)
				{
					((Component)Singleton<ItemUIManager>.instance.InputsContainer).gameObject.SetActive(false);
					Singleton<GameplayMenuInterface>.instance.Open();
				}
			}
			else
			{
				PlayerSingleton<PlayerCamera>.Instance.LockMouse();
				PlayerSingleton<PlayerCamera>.Instance.SetCanLook(true);
				PlayerSingleton<PlayerMovement>.Instance.canMove = true;
				PlayerSingleton<PlayerInventory>.Instance.SetEquippingEnabled(true);
				Singleton<CursorManager>.Instance.SetCursorAppearance((ECursorType)0);
				Singleton<InputPromptsCanvas>.Instance.UnloadModule();
			}
			((Behaviour)hireEmployeeCanvas).enabled = isOpen;
			((Component)hireEmployeeCanvas).gameObject.SetActive(isOpen);
		}

		public void LoadCurrentEmployees(Property property)
		{
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Expected I4, but got Unknown
			//IL_0128: 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)
			PropertyContainer propertyContainer = propertyContainers[property];
			if ((Object)(object)propertyContainer == (Object)null)
			{
				return;
			}
			Enumerator<Employee> enumerator = property.Employees.GetEnumerator();
			while (enumerator.MoveNext())
			{
				Employee emp = enumerator.Current;
				if (!((Object)(object)emp == (Object)null) && !newPropertyAssignments[property].Any((DraggableItem item) => ((NPC)item.currentEmployee).fullName == ((NPC)emp).fullName && item.currentEmployee.EmployeeType == emp.EmployeeType))
				{
					GameObject val = null;
					EEmployeeType type = emp.Type;
					EEmployeeType val2 = type;
					switch ((int)val2)
					{
					case 0:
						val = Object.Instantiate<GameObject>(botanistListing.employeePrefab, propertyContainer.employeeContainer);
						break;
					case 2:
						val = Object.Instantiate<GameObject>(chemistListing.employeePrefab, propertyContainer.employeeContainer);
						break;
					case 1:
						val = Object.Instantiate<GameObject>(handlerListing.employeePrefab, propertyContainer.employeeContainer);
						break;
					case 3:
						val = Object.Instantiate<GameObject>(cleanerListing.employeePrefab, propertyContainer.employeeContainer);
						break;
					}
					DraggableItem draggableItem = val.AddComponent<DraggableItem>();
					draggableItem.employeeType = emp.Type;
					draggableItem.currentEmployee = emp;
					draggableItem.currentContainer = propertyContainer;
					newPropertyAssignments[property].Add(draggableItem);
				}
			}
		}

		public void Exit(ExitAction action)
		{
			if (!action.Used && isOpen)
			{
				action.Used = true;
				SetIsOpen(isOpen: false);
			}
		}

		private void UpdateEmployeeListingCount(EEmployeeType employeeType)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: 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_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected I4, but got Unknown
			int item = employeeStats[employeeType].count;
			switch ((int)employeeType)
			{
			case 0:
				botanistListing.SetCountText(item);
				break;
			case 2:
				chemistListing.SetCountText(item);
				break;
			case 1:
				handlerListing.SetCountText(item);
				break;
			case 3:
				cleanerListing.SetCountText(item);
				break;
			}
		}

		public void OnNewEmployeeDropped(DraggableItem newEmployee, PropertyContainer targetContainer)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			newEmployee.currentContainer = targetContainer;
			OnEmployeeAssigned(newEmployee.employeeType, targetContainer.currentProperty, newEmployee);
			targetContainer.employees++;
			targetContainer.UpdateCountText();
		}

		public void OnEmployeeMoved(DraggableItem item, PropertyContainer targetContainer)
		{
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			PropertyContainer currentContainer = item.currentContainer;
			if (!((Object)(object)currentContainer == (Object)(object)targetContainer))
			{
				if (!item.newlySpawned && !((Selectable)payButton).interactable)
				{
					locationChanged = true;
				}
				OnEmployeeRemoved(currentContainer.currentProperty, item);
				currentContainer.employees--;
				currentContainer.UpdateCountText();
				item.currentContainer = targetContainer;
				targetContainer.employees++;
				targetContainer.UpdateCountText();
				OnEmployeeAssigned(item.employeeType, targetContainer.currentProperty, item);
			}
		}

		public void OnEmployeeAssigned(EEmployeeType employeeType, Property curr, DraggableItem instance)
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			if (instance.newlySpawned)
			{
				employeeStats[employeeType] = (employeeStats[employeeType].count + 1, employeeStats[employeeType].signingFee, employeeStats[employeeType].rate);
			}
			newPropertyAssignments[curr].Add(instance);
			UpdateEmployeeListingCount(employeeType);
			RefreshUI();
		}

		public bool OnEmployeeRemoved(Property curr, DraggableItem instance)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			EEmployeeType employeeType = instance.employeeType;
			bool flag = false;
			if (instance.newlySpawned)
			{
				employeeStats[employeeType] = (employeeStats[employeeType].count - 1, employeeStats[employeeType].signingFee, employeeStats[employeeType].rate);
			}
			if (newPropertyAssignments.ContainsKey(curr))
			{
				flag = newPropertyAssignments[curr].Remove(instance);
			}
			if (flag)
			{
				UpdateEmployeeListingCount(employeeType);
				RefreshUI();
			}
			return flag;
		}

		private void RefreshUI()
		{
			int totalCost = GetTotalCost();
			bool flag = (float)totalCost > cash;
			string value = ((!flag) ? "#000000" : "#FF0004");
			totalCostLabel.text = $"<color={value}>${totalCost}</color>";
			((Component)errorLabel).gameObject.SetActive(flag);
			if (flag)
			{
				errorLabel.text = "Not enough cash!";
			}
			((Selectable)payButton).interactable = !flag && (totalCost > 0 || locationChanged);
		}

		public int GetNewEmployees()
		{
			int num = 0;
			foreach (KeyValuePair<Property, List<DraggableItem>> newPropertyAssignment in newPropertyAssignments)
			{
				List<DraggableItem> value = newPropertyAssignment.Value;
				foreach (DraggableItem item in value)
				{
					if (item.newlySpawned)
					{
						num++;
					}
				}
			}
			return num;
		}

		public int GetTotalCost()
		{
			int num = 0;
			foreach (KeyValuePair<EEmployeeType, (int, int, int)> employeeStat in employeeStats)
			{
				int num2 = employeeStat.Value.Item1 * employeeStat.Value.Item2;
				num += num2;
			}
			return num;
		}

		public void HandlePaymentClick()
		{
			if (!isHandlingPayment)
			{
				isHandlingPayment = true;
				MelonCoroutines.Start(HandlePayment(HandlePaymentComplete));
			}
		}

		public void HandlePaymentComplete()
		{
			isHandlingPayment = false;
			Text componentInChildren = ((Component)payButton).GetComponentInChildren<Text>();
			componentInChildren.text = buttonText;
			totalCostLabel.text = "<color=#000000>$0</color>";
			((Selectable)payButton).interactable = false;
			employeeStats[(EEmployeeType)0] = (0, employeeStats[(EEmployeeType)0].signingFee, employeeStats[(EEmployeeType)0].rate);
			botanistListing.SetCountText(0);
			employeeStats[(EEmployeeType)2] = (0, employeeStats[(EEmployeeType)2].signingFee, employeeStats[(EEmployeeType)2].rate);
			chemistListing.SetCountText(0);
			employeeStats[(EEmployeeType)1] = (0, employeeStats[(EEmployeeType)1].signingFee, employeeStats[(EEmployeeType)1].rate);
			handlerListing.SetCountText(0);
			employeeStats[(EEmployeeType)3] = (0, employeeStats[(EEmployeeType)3].signingFee, employeeStats[(EEmployeeType)3].rate);
			cleanerListing.SetCountText(0);
			SetIsOpen(isOpen: false);
		}

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

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

		private void Update()
		{
			if (Input.GetKeyDown((KeyCode)9) && isOpen)
			{
				showMiscUI = false;
				SetIsOpen(isOpen: false);
			}
		}
	}
	[RegisterTypeInIl2Cpp]
	public class PopupHandler : MonoBehaviour
	{
		public Button closePopup;

		public PopupHandler(IntPtr ptr)
			: base(ptr)
		{
		}

		private void Awake()
		{
			closePopup = ((Component)this).GetComponentInChildren<Button>();
			((UnityEvent)closePopup.onClick).AddListener(UnityAction.op_Implicit((Action)ClosePopup));
		}

		public void OpenPopup()
		{
			((Component)this).gameObject.SetActive(true);
		}

		public void ClosePopup()
		{
			((Component)this).gameObject.SetActive(false);
		}
	}
	[RegisterTypeInIl2Cpp]
	public class PropertyContainer : EventTriggerBase
	{
		public PopupHandler popup;

		public Transform employeeContainer;

		public Button shrink;

		public Button expand;

		public Text propertyLabel;

		public Text employeeCount;

		public Property currentProperty;

		public HireEmployeeInterface hireInterface;

		public int employees { get; set; }

		public int total { get; set; }

		public PropertyContainer(IntPtr ptr)
			: base(ptr)
		{
		}

		public override void Initialize()
		{
			base.Initialize();
			hireInterface = Object.FindObjectOfType<HireEmployeeInterface>();
			employeeContainer = ((Component)((Component)((Component)this).transform).GetComponentInChildren<GridLayoutGroup>()).transform;
			InitializeShrinkButton();
			InitializeExpandButton();
			InitializePropertyLabel();
			InitializeEmployeeCount();
			UpdateCountText();
		}

		public override void RegisterAllEventTriggers()
		{
			AddTrigger((EventTriggerType)6, UnityAction<BaseEventData>.op_Implicit((Action<BaseEventData>)OnDrop));
		}

		private void InitializeShrinkButton()
		{
			Transform val = ((Component)this).transform.Find("Header/Shrink");
			if ((Object)(object)val != (Object)null)
			{
				shrink = ((Component)val).GetComponent<Button>();
				((UnityEvent)shrink.onClick).AddListener(UnityAction.op_Implicit((Action)ShrinkContainer));
			}
		}

		private void InitializeExpandButton()
		{
			Transform val = ((Component)this).transform.Find("Header/Expand");
			if ((Object)(object)val != (Object)null)
			{
				expand = ((Component)val).GetComponent<Button>();
				((UnityEvent)expand.onClick).AddListener(UnityAction.op_Implicit((Action)ExpandContainer));
			}
		}

		private void InitializePropertyLabel()
		{
			Transform val = ((Component)this).transform.Find("Header/PropertyLabel");
			if ((Object)(object)val != (Object)null)
			{
				propertyLabel = ((Component)val).GetComponent<Text>();
			}
		}

		private void InitializeEmployeeCount()
		{
			Transform val = ((Component)this).transform.Find("Header/EmployeeCount");
			if ((Object)(object)val != (Object)null)
			{
				employeeCount = ((Component)val).GetComponent<Text>();
			}
		}

		public void SetPropertyText(string newText)
		{
			if (!((Object)(object)propertyLabel == (Object)null))
			{
				propertyLabel.text = newText;
			}
		}

		public void UpdateCountText()
		{
			if (!((Object)(object)employeeCount == (Object)null))
			{
				employeeCount.text = $"{employees} / {total}";
			}
		}

		public void ShrinkContainer()
		{
			((Component)employeeContainer).gameObject.SetActive(false);
			((Component)shrink).gameObject.SetActive(false);
			((Component)expand).gameObject.SetActive(true);
		}

		public void ExpandContainer()
		{
			((Component)employeeContainer).gameObject.SetActive(true);
			((Component)shrink).gameObject.SetActive(true);
			((Component)expand).gameObject.SetActive(false);
		}

		public void OnDrop(BaseEventData rawData)
		{
			PointerEventData val = ((Il2CppObjectBase)rawData).TryCast<PointerEventData>();
			if (val == null)
			{
				return;
			}
			GameObject pointerDrag = val.pointerDrag;
			EmployeeListing component = pointerDrag.GetComponent<EmployeeListing>();
			if ((Object)(object)component != (Object)null)
			{
				if (employees + 1 > total)
				{
					popup.OpenPopup();
					return;
				}
				DraggableItem draggableItem = component.currentDraggable;
				if ((Object)(object)draggableItem == (Object)null)
				{
					draggableItem = component.currentInstance.GetComponent<DraggableItem>();
				}
				draggableItem.newlySpawned = true;
				((Component)draggableItem).transform.SetParent(employeeContainer);
				((Graphic)draggableItem.image).raycastTarget = true;
				hireInterface.OnNewEmployeeDropped(draggableItem, this);
				component.ClearCurrentInstance();
				return;
			}
			DraggableItem component2 = pointerDrag.GetComponent<DraggableItem>();
			if ((Object)(object)component2 != (Object)null)
			{
				if (employees + 1 > total && (Object)(object)((Component)component2.parentAfterDrag).transform != (Object)(object)((Component)employeeContainer).transform)
				{
					popup.OpenPopup();
					return;
				}
				component2.parentAfterDrag = employeeContainer;
				hireInterface.OnEmployeeMoved(component2, this);
			}
		}
	}
	public static class UIManager
	{
		private static Core mod = MelonAssembly.FindMelonInstance<Core>();

		public const string ASSET_BUNDLE_NAME = "hiremeassets";

		public static GameObject propertyContainerPrefab;

		public static GameObject hireEmployeeUIPrefab;

		public static GameObject handlerPrefab;

		public static GameObject cleanerPrefab;

		public static GameObject chemistPrefab;

		public static GameObject botanistPrefab;

		public static GameObject addHandlerListingPrefab;

		public static GameObject addCleanerListingPrefab;

		public static GameObject addChemistListingPrefab;

		public static GameObject addBotanistListingPrefab;

		public static Sprite handlerAdd;

		public static Sprite handlerIcon;

		public static Sprite cleanerAdd;

		public static Sprite cleanerIcon;

		public static Sprite chemistAdd;

		public static Sprite chemistIcon;

		public static Sprite botanistAdd;

		public static Sprite botanistIcon;

		public static Sprite expandIcon;

		public static Sprite collapseIcon;

		public static Sprite deleteIcon;

		public static Sprite appIcon;

		public static HireEmployeeInterface hiringInterface;

		public static Button appButton;

		public static void LoadAssets()
		{
			try
			{
				if ((Object)(object)propertyContainerPrefab == (Object)null)
				{
					propertyContainerPrefab = AssetBundleUtils.LoadAssetFromBundle<GameObject>("propertycontainer.prefab", "hiremeassets");
				}
				if ((Object)(object)hireEmployeeUIPrefab == (Object)null)
				{
					hireEmployeeUIPrefab = AssetBundleUtils.LoadAssetFromBundle<GameObject>("hireemployeeui.prefab", "hiremeassets");
				}
				if ((Object)(object)handlerPrefab == (Object)null)
				{
					handlerPrefab = AssetBundleUtils.LoadAssetFromBundle<GameObject>("handler.prefab", "hiremeassets");
				}
				if ((Object)(object)cleanerPrefab == (Object)null)
				{
					cleanerPrefab = AssetBundleUtils.LoadAssetFromBundle<GameObject>("cleaner.prefab", "hiremeassets");
				}
				if ((Object)(object)chemistPrefab == (Object)null)
				{
					chemistPrefab = AssetBundleUtils.LoadAssetFromBundle<GameObject>("chemist.prefab", "hiremeassets");
				}
				if ((Object)(object)botanistPrefab == (Object)null)
				{
					botanistPrefab = AssetBundleUtils.LoadAssetFromBundle<GameObject>("botanist.prefab", "hiremeassets");
				}
				if ((Object)(object)addHandlerListingPrefab == (Object)null)
				{
					addHandlerListingPrefab = AssetBundleUtils.LoadAssetFromBundle<GameObject>("addhandlerlisting.prefab", "hiremeassets");
				}
				if ((Object)(object)addCleanerListingPrefab == (Object)null)
				{
					addCleanerListingPrefab = AssetBundleUtils.LoadAssetFromBundle<GameObject>("addcleanerlisting.prefab", "hiremeassets");
				}
				if ((Object)(object)addChemistListingPrefab == (Object)null)
				{
					addChemistListingPrefab = AssetBundleUtils.LoadAssetFromBundle<GameObject>("addchemistlisting.prefab", "hiremeassets");
				}
				if ((Object)(object)addBotanistListingPrefab == (Object)null)
				{
					addBotanistListingPrefab = AssetBundleUtils.LoadAssetFromBundle<GameObject>("addbotanistlisting.prefab", "hiremeassets");
				}
				if ((Object)(object)handlerAdd == (Object)null)
				{
					handlerAdd = AssetBundleUtils.LoadAssetFromBundle<Sprite>("handler_add.png", "hiremeassets");
				}
				if ((Object)(object)handlerIcon == (Object)null)
				{
					handlerIcon = AssetBundleUtils.LoadAssetFromBundle<Sprite>("handler.png", "hiremeassets");
				}
				if ((Object)(object)cleanerAdd == (Object)null)
				{
					cleanerAdd = AssetBundleUtils.LoadAssetFromBundle<Sprite>("cleaner_add.png", "hiremeassets");
				}
				if ((Object)(object)cleanerIcon == (Object)null)
				{
					cleanerIcon = AssetBundleUtils.LoadAssetFromBundle<Sprite>("cleaner.png", "hiremeassets");
				}
				if ((Object)(object)chemistAdd == (Object)null)
				{
					chemistAdd = AssetBundleUtils.LoadAssetFromBundle<Sprite>("chemist_add.png", "hiremeassets");
				}
				if ((Object)(object)chemistIcon == (Object)null)
				{
					chemistIcon = AssetBundleUtils.LoadAssetFromBundle<Sprite>("chemist.png", "hiremeassets");
				}
				if ((Object)(object)botanistAdd == (Object)null)
				{
					botanistAdd = AssetBundleUtils.LoadAssetFromBundle<Sprite>("botanist_add.png", "hiremeassets");
				}
				if ((Object)(object)botanistIcon == (Object)null)
				{
					botanistIcon = AssetBundleUtils.LoadAssetFromBundle<Sprite>("botanist.png", "hiremeassets");
				}
				if ((Object)(object)expandIcon == (Object)null)
				{
					expandIcon = AssetBundleUtils.LoadAssetFromBundle<Sprite>("expand.png", "hiremeassets");
				}
				if ((Object)(object)collapseIcon == (Object)null)
				{
					collapseIcon = AssetBundleUtils.LoadAssetFromBundle<Sprite>("collapse.png", "hiremeassets");
				}
				if ((Object)(object)deleteIcon == (Object)null)
				{
					deleteIcon = AssetBundleUtils.LoadAssetFromBundle<Sprite>("deletebutton.png", "hiremeassets");
				}
				if ((Object)(object)appIcon == (Object)null)
				{
					appIcon = AssetBundleUtils.LoadAssetFromBundle<Sprite>("appicon.png", "hiremeassets");
				}
			}
			catch (Exception ex)
			{
				((MelonBase)mod).Unregister("Unregistering mod due to error:\n " + ex.Source + "\n " + ex.Message, false);
			}
		}

		public static void SetupUI(Transform parent)
		{
			GameObject val = Object.Instantiate<GameObject>(hireEmployeeUIPrefab, parent);
			hiringInterface = ((Component)val.transform.GetChild(0)).gameObject.AddComponent<HireEmployeeInterface>();
			hiringInterface.propertyContainerPrefab = propertyContainerPrefab;
			Transform val2 = val.transform.Find("HireEmployeeInterface/PopupBackground");
			if ((Object)(object)val2 != (Object)null)
			{
				hiringInterface.errorPopup = ((Component)val2).gameObject.AddComponent<PopupHandler>();
			}
			Transform val3 = val.transform.Find("HireEmployeeInterface/Cart/EmployeeListingsContainer");
			if ((Object)(object)val3 != (Object)null)
			{
				SetupListings(val3, val.transform);
			}
			hiringInterface.Setup();
			val.SetActive(false);
		}

		private static void SetupListings(Transform parentContainer, Transform parentCanvas)
		{
			GameObject val = Object.Instantiate<GameObject>(addBotanistListingPrefab, parentContainer);
			EmployeeListing employeeListing = val.AddComponent<EmployeeListing>();
			employeeListing.addIcon = botanistAdd;
			employeeListing.defaultIcon = botanistIcon;
			employeeListing.employeePrefab = botanistPrefab;
			employeeListing.dragParent = parentCanvas;
			hiringInterface.botanistListing = employeeListing;
			GameObject val2 = Object.Instantiate<GameObject>(addChemistListingPrefab, parentContainer);
			EmployeeListing employeeListing2 = val2.AddComponent<EmployeeListing>();
			employeeListing2.addIcon = chemistAdd;
			employeeListing2.defaultIcon = chemistIcon;
			employeeListing2.employeePrefab = chemistPrefab;
			employeeListing2.dragParent = parentCanvas;
			hiringInterface.chemistListing = employeeListing2;
			GameObject val3 = Object.Instantiate<GameObject>(addHandlerListingPrefab, parentContainer);
			EmployeeListing employeeListing3 = val3.AddComponent<EmployeeListing>();
			employeeListing3.addIcon = handlerAdd;
			employeeListing3.defaultIcon = handlerIcon;
			employeeListing3.employeePrefab = handlerPrefab;
			employeeListing3.dragParent = parentCanvas;
			hiringInterface.handlerListing = employeeListing3;
			GameObject val4 = Object.Instantiate<GameObject>(addCleanerListingPrefab, parentContainer);
			EmployeeListing employeeListing4 = val4.AddComponent<EmployeeListing>();
			employeeListing4.addIcon = cleanerAdd;
			employeeListing4.defaultIcon = cleanerIcon;
			employeeListing4.employeePrefab = cleanerPrefab;
			employeeListing4.dragParent = parentCanvas;
			hiringInterface.cleanerListing = employeeListing4;
		}

		public static void AppClose()
		{
			((Component)Singleton<ItemUIManager>.instance.InputsContainer).gameObject.SetActive(false);
			Singleton<GameplayMenuInterface>.instance.Open();
		}

		public static void SetupPhoneApp(HomeScreen home)
		{
			GameplayMenu componentInParent = ((Component)((Component)home).transform).GetComponentInParent<GameplayMenu>();
			RectTransform component = Object.Instantiate<GameObject>(home.appIconPrefab, (Transform)(object)home.appIconContainer).GetComponent<RectTransform>();
			((Component)((Transform)component).Find("Mask/Image")).GetComponent<Image>().sprite = appIcon;
			((Component)((Transform)component).Find("Label")).GetComponent<Text>().text = "HireMe";
			appButton = ((Component)component).GetComponent<Button>();
			home.appIcons.Add(appButton);
			((UnityEvent)appButton.onClick).AddListener(UnityAction.op_Implicit((Action)hiringInterface.Open));
			Transform val = ((Component)appButton).transform.Find("Notifications");
			((Component)val).gameObject.SetActive(false);
			((Component)appButton).gameObject.SetActive(ModSettings.EnablePhoneApp.Value);
			hiringInterface.onClose = UnityAction.op_Implicit((Action)AppClose);
		}

		public static void TogglePhoneApp(bool isEnabled)
		{
			if ((Object)(object)appButton == (Object)null)
			{
				MelonLogger.Error("Phone App is null and cannot be toggled");
			}
			else
			{
				((Component)appButton).gameObject.SetActive(isEnabled);
			}
		}
	}
}
namespace HireMe.TemplateUtils
{
	public static class AssetBundleUtils
	{
		private static Core mod = MelonAssembly.FindMelonInstance<Core>();

		private static MelonAssembly melonAssembly = ((MelonBase)mod).MelonAssembly;

		private static Dictionary<string, Il2CppAssetBundle> assetBundles = new Dictionary<string, Il2CppAssetBundle>();

		public static Il2CppAssetBundle LoadAssetBundle(string bundleFileName)
		{
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Expected O, but got Unknown
			if (assetBundles.ContainsKey(bundleFileName))
			{
				return assetBundles[bundleFileName];
			}
			try
			{
				string text = typeof(Core).Namespace + ".Assets." + bundleFileName;
				Stream manifestResourceStream = melonAssembly.Assembly.GetManifestResourceStream(text ?? "");
				if (manifestResourceStream == null)
				{
					((MelonBase)mod).Unregister($"AssetBundle: '{text}' not found. \nOpen .csproj file and search for '{bundleFileName}'.\nIf it doesn't exist,\nCopy your asset to Assets/ folder then look for 'your.assetbundle' in .csproj file.", false);
					return null;
				}
				byte[] array;
				using (MemoryStream memoryStream = new MemoryStream())
				{
					manifestResourceStream.CopyTo(memoryStream);
					array = memoryStream.ToArray();
				}
				Stream val = (Stream)new MemoryStream(Il2CppStructArray<byte>.op_Implicit(array));
				Il2CppAssetBundle val2 = Il2CppAssetBundleManager.LoadFromStream(val);
				assetBundles.Add(bundleFileName, val2);
				return val2;
			}
			catch (Exception value)
			{
				((MelonBase)mod).Unregister($"Failed to load AssetBundle. Please report to dev: {value}", false);
				return null;
			}
		}

		public static Il2CppAssetBundle GetLoadedAssetBundle(string bundleName)
		{
			if (assetBundles.ContainsKey(bundleName))
			{
				return assetBundles[bundleName];
			}
			((MelonBase)mod).Unregister("Failed to get " + bundleName, false);
			throw new Exception("Asset '" + bundleName + "' has not been loaded in yet");
		}

		public static T LoadAssetFromBundle<T>(string assetName, string bundleName) where T : Object
		{
			Il2CppAssetBundle loadedAssetBundle = GetLoadedAssetBundle(bundleName);
			if (loadedAssetBundle == null)
			{
				throw new Exception("Bundle not found for asset: " + assetName);
			}
			T result = loadedAssetBundle.LoadAsset<T>(assetName);
			if (loadedAssetBundle == null)
			{
				throw new Exception(assetName + " not found in bundle " + bundleName);
			}
			return result;
		}
	}
	public static class BreadTweaksCompat
	{
		private static readonly string BreadPrefsPath = Path.Combine(MelonEnvironment.UserDataDirectory, "Bread_Tweaks", "Employees.cfg");

		public static bool IsBreadTweaksInstalled()
		{
			int result;
			if (File.Exists(BreadPrefsPath))
			{
				MelonPreferences_Category category = MelonPreferences.GetCategory("Botanist");
				result = ((((category != null) ? category.GetEntry<double>("Daily Wage") : null) != null) ? 1 : 0);
			}
			else
			{
				result = 0;
			}
			return (byte)result != 0;
		}

		public static double? GetDailyWage(string employeeType)
		{
			try
			{
				MelonPreferences_Category category = MelonPreferences.GetCategory(employeeType);
				if (category == null)
				{
					return null;
				}
				return category.GetEntry<double>("Daily Wage")?.Value;
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[BreadCompat] Failed to get Daily Wage for '" + employeeType + "': " + ex.Message);
				return null;
			}
		}

		public static double? GetSigningFee(string employeeType)
		{
			try
			{
				MelonPreferences_Category category = MelonPreferences.GetCategory(employeeType);
				if (category == null)
				{
					return null;
				}
				return category.GetEntry<double>("Signing Fee")?.Value;
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[BreadCompat] Failed to get Signing Fee for '" + employeeType + "': " + ex.Message);
				return null;
			}
		}

		public static bool? GetSigningFeeEnabled(string employeeType)
		{
			try
			{
				MelonPreferences_Category category = MelonPreferences.GetCategory(employeeType);
				if (category == null)
				{
					return null;
				}
				return category.GetEntry<bool>("Custom Signing Fee")?.Value;
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[BreadCompat] Failed to get Custom Signing Fee value for '" + employeeType + "': " + ex.Message);
				return null;
			}
		}
	}
}
namespace HireMe.Utils
{
	public static class ModSettings
	{
		public static MelonPreferences_Category MainCategory;

		public static MelonPreferences_Entry<bool> EnablePhoneApp;

		public static void Init()
		{
			MainCategory = MelonPreferences.CreateCategory("HireMe_01_Main", "Main Settings");
			EnablePhoneApp = MainCategory.CreateEntry<bool>("EnablePhoneApp", true, "Enable the Phone Application", "Enables the Hire Me Phone Application to manage your employees remotely and at any time.", false, false, (ValueValidator)null, (string)null);
		}
	}
}
namespace HireMe.Patches
{
	public class FixerDialoguePatches
	{
		[HarmonyPatch(typeof(DialogueController_Fixer), "ChoiceCallback")]
		public static class DialogueControllerFixer_ChoiceCallback_Patch
		{
			public static bool Prefix(DialogueController_Fixer __instance, string choiceLabel)
			{
				try
				{
					if (choiceLabel.Contains("GENERIC_CHOICE"))
					{
						UIManager.hiringInterface.SetIsOpen(isOpen: true);
						return false;
					}
					return true;
				}
				catch (Exception ex)
				{
					MelonLogger.Error((object)ex);
					return true;
				}
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		internal IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}

HireMe_2.0.0_Mono.dll

Decompiled 3 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using HarmonyLib;
using HireMe;
using HireMe.TemplateUtils;
using HireMe.UI;
using HireMe.Utils;
using MelonLoader;
using MelonLoader.Preferences;
using MelonLoader.Utils;
using Microsoft.CodeAnalysis;
using ModManagerPhoneApp;
using ScheduleOne;
using ScheduleOne.DevUtilities;
using ScheduleOne.Dialogue;
using ScheduleOne.Employees;
using ScheduleOne.Money;
using ScheduleOne.NPCs;
using ScheduleOne.NPCs.CharacterClasses;
using ScheduleOne.Persistence;
using ScheduleOne.PlayerScripts;
using ScheduleOne.Property;
using ScheduleOne.UI;
using ScheduleOne.UI.Items;
using ScheduleOne.UI.Phone;
using ScheduleOne.Variables;
using UnityEngine;
using UnityEngine.EventSystems;
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), "Hire Me", "2.0.0", "OverweightUnicorn", null)]
[assembly: MelonColor(255, 191, 0, 255)]
[assembly: MelonGame("TVGS", "Schedule I")]
[assembly: MelonOptionalDependencies(new string[] { "ModManagerPhoneApp" })]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("HireMe_2.0.0_Mono")]
[assembly: AssemblyConfiguration("MONO")]
[assembly: AssemblyFileVersion("2.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+9b466ef0c042fc74725d4a77883eb091bf663162")]
[assembly: AssemblyProduct("HireMe_2.0.0_Mono")]
[assembly: AssemblyTitle("HireMe_2.0.0_Mono")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.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 HireMe
{
	public static class BuildInfo
	{
		public const string Name = "Hire Me";

		public const string Description = "A user interface for hiring employees";

		public const string Author = "OverweightUnicorn";

		public const string Company = "UnicornsCanMod";

		public const string Version = "2.0.0";

		public const string DownloadLink = null;
	}
	public class Core : MelonMod
	{
		public static double? botanistSigningFee;

		public static bool? botanistSigningFeeEnabled;

		public static double? botanistDailyWage;

		public static double? chemistSigningFee;

		public static bool? chemistSigningFeeEnabled;

		public static double? chemistDailyWage;

		public static double? handlerSigningFee;

		public static bool? handlerSigningFeeEnabled;

		public static double? handlerDailyWage;

		public static double? cleanerSigningFee;

		public static bool? cleanerSigningFeeEnabled;

		public static double? cleanerDailyWage;

		private static bool _modManagerFound;

		public override void OnInitializeMelon()
		{
			ModSettings.Init();
			((MelonBase)this).LoggerInstance.Msg($"PhoneApp: {ModSettings.EnablePhoneApp.Value}");
			try
			{
				_modManagerFound = MelonBase.RegisteredMelons.Any(delegate(MelonBase mod)
				{
					object obj;
					if (mod == null)
					{
						obj = null;
					}
					else
					{
						MelonInfoAttribute info = mod.Info;
						obj = ((info != null) ? info.Name : null);
					}
					return (string?)obj == "Mod Manager & Phone App";
				});
				if (_modManagerFound)
				{
					((MelonBase)this).LoggerInstance.Msg("Mod Manager found. Attempting event subscription...");
					SubscribeToModManagerEvents();
				}
				else
				{
					((MelonBase)this).LoggerInstance.Warning("Mod Manager not found. Skipping event subscription.");
				}
			}
			catch (Exception arg)
			{
				((MelonBase)this).LoggerInstance.Error($"Error checking RegisteredMelons: {arg}");
				_modManagerFound = false;
			}
			((MelonBase)this).LoggerInstance.Msg("MyCoolMod Initialization complete.");
		}

		public override void OnLateInitializeMelon()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			Singleton<LoadManager>.Instance.onLoadComplete.AddListener(new UnityAction(Initialize));
			LoadBreadConfig();
		}

		public void Initialize()
		{
			AssetBundleUtils.LoadAssetBundle("hiremeassets");
			UIManager.LoadAssets();
			GameObject val = GameObject.Find("UI");
			if ((Object)(object)val != (Object)null)
			{
				UIManager.SetupUI(val.transform);
			}
			HomeScreen instance = PlayerSingleton<HomeScreen>.instance;
			if (Object.op_Implicit((Object)(object)instance))
			{
				UIManager.SetupPhoneApp(instance);
			}
		}

		private void SubscribeToModManagerEvents()
		{
			try
			{
				ModSettingsEvents.OnPreferencesSaved += HandleSettingsUpdate;
				((MelonBase)this).LoggerInstance.Msg("Successfully subscribed to Mod Manager save events.");
			}
			catch (TypeLoadException)
			{
				((MelonBase)this).LoggerInstance.Error("TypeLoadException during subscription! Mod Manager incompatible?");
				_modManagerFound = false;
			}
			catch (Exception arg)
			{
				((MelonBase)this).LoggerInstance.Error($"Unexpected error during subscription: {arg}");
				_modManagerFound = false;
			}
		}

		private void HandleSettingsUpdate()
		{
			((MelonBase)this).LoggerInstance.Msg("Mod Manager saved preferences. Reloading settings...");
			try
			{
				bool value = ModSettings.EnablePhoneApp.Value;
				MelonLogger.Msg("EnablePhoneApp: " + value);
				UIManager.TogglePhoneApp(value);
				((MelonBase)this).LoggerInstance.Msg("Settings reloaded successfully.");
			}
			catch (Exception arg)
			{
				((MelonBase)this).LoggerInstance.Error($"Error applying updated settings after save: {arg}");
			}
		}

		private void UnsubscribeFromModManagerEvents()
		{
			try
			{
				ModSettingsEvents.OnPreferencesSaved -= HandleSettingsUpdate;
				((MelonBase)this).LoggerInstance.Msg("Unsubscribed from Mod Manager events.");
			}
			catch (Exception ex)
			{
				((MelonBase)this).LoggerInstance.Warning("Ignoring error during unsubscribe: " + ex.Message);
			}
		}

		public override void OnDeinitializeMelon()
		{
			if (_modManagerFound)
			{
				UnsubscribeFromModManagerEvents();
			}
		}

		public void LoadBreadConfig()
		{
			if (BreadTweaksCompat.IsBreadTweaksInstalled())
			{
				LoadEmployeeConfig("Botanist", out botanistSigningFeeEnabled, out botanistSigningFee, out botanistDailyWage);
				LoadEmployeeConfig("Chemist", out chemistSigningFeeEnabled, out chemistSigningFee, out chemistDailyWage);
				LoadEmployeeConfig("Handler", out handlerSigningFeeEnabled, out handlerSigningFee, out handlerDailyWage);
				LoadEmployeeConfig("Cleaner", out cleanerSigningFeeEnabled, out cleanerSigningFee, out cleanerDailyWage);
			}
		}

		private void LoadEmployeeConfig(string name, out bool? signingFeeEnabled, out double? signingFee, out double? dailyWage)
		{
			signingFeeEnabled = BreadTweaksCompat.GetSigningFeeEnabled(name);
			signingFee = BreadTweaksCompat.GetSigningFee(name);
			dailyWage = BreadTweaksCompat.GetDailyWage(name);
			List<string> list = new List<string>();
			if (signingFeeEnabled.HasValue)
			{
				list.Add($"Signing Fee Enabled: {signingFeeEnabled.Value}");
			}
			if (signingFee.HasValue)
			{
				list.Add($"Signing Fee: {signingFee.Value}");
			}
			if (dailyWage.HasValue)
			{
				list.Add($"Daily Wage: {dailyWage.Value}");
			}
			if (list.Count > 0)
			{
				MelonLogger.Msg("\nLoaded " + name + " Config\n " + string.Join("\n ", list));
			}
		}
	}
}
namespace HireMe.UI
{
	public class DraggableItem : EventTriggerBase
	{
		public bool newlySpawned = false;

		public Button deleteButton;

		public Image image;

		public Transform parentAfterDrag;

		public EEmployeeType employeeType;

		public Employee currentEmployee;

		public PropertyContainer currentContainer;

		public override void RegisterAllEventTriggers()
		{
			AddTrigger((EventTriggerType)13, OnBeginDrag);
			AddTrigger((EventTriggerType)5, OnDrag);
			AddTrigger((EventTriggerType)14, OnEndDrag);
			AddTrigger((EventTriggerType)0, OnPointerEnter);
			AddTrigger((EventTriggerType)1, OnPointerExit);
		}

		public override void Initialize()
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			base.Initialize();
			image = ((Component)this).GetComponent<Image>();
			deleteButton = ((Component)this).GetComponentInChildren<Button>(true);
			if ((Object)(object)deleteButton != (Object)null)
			{
				((UnityEvent)deleteButton.onClick).AddListener(new UnityAction(OnDelete));
			}
		}

		public void OnBeginDrag(BaseEventData rawData)
		{
			PointerEventData val = (PointerEventData)(object)((rawData is PointerEventData) ? rawData : null);
			if (val != null)
			{
				parentAfterDrag = ((Component)this).transform.parent;
				((Component)this).transform.SetParent(((Component)UIManager.hiringInterface.hireEmployeeCanvas).transform);
				((Component)this).transform.SetAsLastSibling();
				((Graphic)image).raycastTarget = false;
			}
		}

		public void OnDelete()
		{
			if ((Object)(object)currentContainer == (Object)null)
			{
				return;
			}
			currentContainer.employees--;
			currentContainer.UpdateCountText();
			if (UIManager.hiringInterface.OnEmployeeRemoved(currentContainer.currentProperty, this))
			{
				if (!newlySpawned)
				{
					currentEmployee.Fire();
				}
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		public void OnDrag(BaseEventData rawData)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			PointerEventData val = (PointerEventData)(object)((rawData is PointerEventData) ? rawData : null);
			if (val != null)
			{
				((Component)this).transform.position = Input.mousePosition;
			}
		}

		public void OnEndDrag(BaseEventData rawData)
		{
			PointerEventData val = (PointerEventData)(object)((rawData is PointerEventData) ? rawData : null);
			if (val != null)
			{
				((Component)this).transform.SetParent(parentAfterDrag);
				((Graphic)image).raycastTarget = true;
			}
		}

		public void OnPointerEnter(BaseEventData rawData)
		{
			PointerEventData val = (PointerEventData)(object)((rawData is PointerEventData) ? rawData : null);
			if (val != null)
			{
				((Component)deleteButton).gameObject.SetActive(true);
			}
		}

		public void OnPointerExit(BaseEventData rawData)
		{
			PointerEventData val = (PointerEventData)(object)((rawData is PointerEventData) ? rawData : null);
			if (val != null)
			{
				((Component)deleteButton).gameObject.SetActive(false);
			}
		}
	}
	public class EmployeeListing : EventTriggerBase
	{
		public GameObject employeePrefab;

		public Transform dragParent;

		public GameObject currentInstance;

		public DraggableItem currentDraggable;

		public Sprite addIcon;

		public Sprite defaultIcon;

		public Text employeeCount;

		public Text signingFee;

		public Text dailyWage;

		public EEmployeeType employeeType;

		public override void RegisterAllEventTriggers()
		{
			AddTrigger((EventTriggerType)13, OnBeginDrag);
			AddTrigger((EventTriggerType)5, OnDrag);
			AddTrigger((EventTriggerType)14, OnEndDrag);
		}

		public override void Initialize()
		{
			base.Initialize();
			Text[] componentsInChildren = ((Component)this).GetComponentsInChildren<Text>();
			Text[] array = componentsInChildren;
			foreach (Text val in array)
			{
				if (((Object)val).name == "EmployeeCount")
				{
					employeeCount = val;
				}
				else if (((Object)val).name == "DailyWage")
				{
					dailyWage = val;
				}
				else if (((Object)val).name == "SigningFee")
				{
					signingFee = val;
				}
			}
		}

		public void SetCountText(int quantity)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)employeeCount == (Object)null))
			{
				employeeCount.text = $"{quantity} x {employeeType}";
			}
		}

		public void SetSigningText(int fee)
		{
			if (!((Object)(object)signingFee == (Object)null))
			{
				signingFee.text = $"Signing Fee: <color=#54E717>${fee}</color>";
			}
		}

		public void SetWageText(int wage)
		{
			if (!((Object)(object)dailyWage == (Object)null))
			{
				dailyWage.text = $"Daily Wage: <color=#54E717>${wage}</color>";
			}
		}

		public void OnBeginDrag(BaseEventData rawData)
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: 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)
			PointerEventData val = (PointerEventData)(object)((rawData is PointerEventData) ? rawData : null);
			if (val != null)
			{
				currentInstance = Object.Instantiate<GameObject>(employeePrefab, dragParent);
				Image component = currentInstance.GetComponent<Image>();
				component.sprite = addIcon;
				currentDraggable = currentInstance.AddComponent<DraggableItem>();
				currentDraggable.newlySpawned = true;
				currentDraggable.employeeType = employeeType;
				currentDraggable.currentContainer = null;
				((Graphic)currentDraggable.image).raycastTarget = false;
				currentInstance.transform.position = Input.mousePosition;
				CanvasGroup component2 = currentInstance.GetComponent<CanvasGroup>();
				if ((Object)(object)component2 != (Object)null)
				{
					component2.blocksRaycasts = false;
				}
			}
		}

		public void OnDrag(BaseEventData rawData)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			PointerEventData val = (PointerEventData)(object)((rawData is PointerEventData) ? rawData : null);
			if (val != null && (Object)(object)currentInstance != (Object)null)
			{
				currentInstance.transform.position = Input.mousePosition;
			}
		}

		public void ClearCurrentInstance()
		{
			currentInstance = null;
			currentDraggable = null;
		}

		public void OnEndDrag(BaseEventData rawData)
		{
			PointerEventData val = (PointerEventData)(object)((rawData is PointerEventData) ? rawData : null);
			if (val != null && (Object)(object)currentDraggable != (Object)null && (Object)(object)currentDraggable.parentAfterDrag == (Object)null)
			{
				Object.Destroy((Object)(object)currentInstance);
				currentDraggable = null;
			}
		}
	}
	public class EventTriggerBase : MonoBehaviour
	{
		private EventTrigger _trigger;

		private void Awake()
		{
			EnsureEventTrigger();
			Initialize();
		}

		public virtual void Initialize()
		{
			RegisterAllEventTriggers();
		}

		private void EnsureEventTrigger()
		{
			_trigger = ((Component)this).gameObject.GetComponent<EventTrigger>();
			if ((Object)(object)_trigger == (Object)null)
			{
				_trigger = ((Component)this).gameObject.AddComponent<EventTrigger>();
			}
			if (_trigger.triggers == null)
			{
				_trigger.triggers = new List<Entry>();
			}
		}

		protected void AddTrigger(EventTriggerType type, UnityAction<BaseEventData> action)
		{
			//IL_0001: 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_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			Entry val = new Entry
			{
				eventID = type
			};
			((UnityEvent<BaseEventData>)(object)val.callback).AddListener(action);
			_trigger.triggers.Add(val);
		}

		public virtual void RegisterAllEventTriggers()
		{
			MelonLogger.Msg("Override Me");
		}
	}
	public class HireEmployeeInterface : MonoBehaviour
	{
		[Serializable]
		public class PropertyInfo
		{
			public string propertyName;

			public int employeeCount;

			public int employeeCapacity;

			public string propertyCode;
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass51_0
		{
			public bool isHiringDone;

			internal void <HandlePayment>b__0()
			{
				isHiringDone = true;
			}
		}

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

			private object <>2__current;

			public Action OnComplete;

			public HireEmployeeInterface <>4__this;

			private <>c__DisplayClass51_0 <>8__1;

			private Text <payButtonText>5__2;

			private string <baseText>5__3;

			private int <dotCount>5__4;

			private float <interval>5__5;

			private Dictionary<Property, List<DraggableItem>>.Enumerator <>s__6;

			private KeyValuePair<Property, List<DraggableItem>> <kvp>5__7;

			private List<DraggableItem> <list>5__8;

			private List<(int index, GameObject go)> <temp>5__9;

			private int <i>5__10;

			private DraggableItem <item>5__11;

			private int <j>5__12;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>8__1 = null;
				<payButtonText>5__2 = null;
				<baseText>5__3 = null;
				<>s__6 = default(Dictionary<Property, List<DraggableItem>>.Enumerator);
				<kvp>5__7 = default(KeyValuePair<Property, List<DraggableItem>>);
				<list>5__8 = null;
				<temp>5__9 = null;
				<item>5__11 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_018a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0194: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>8__1 = new <>c__DisplayClass51_0();
					if ((Object)(object)<>4__this.payButton == (Object)null)
					{
						MelonLogger.Error("payButton is null.");
						OnComplete?.Invoke();
						return false;
					}
					<payButtonText>5__2 = ((Component)<>4__this.payButton).GetComponentInChildren<Text>();
					if ((Object)(object)<payButtonText>5__2 == (Object)null)
					{
						MelonLogger.Error("payButtonText is null.");
						OnComplete?.Invoke();
						return false;
					}
					((Selectable)<>4__this.payButton).interactable = false;
					<baseText>5__3 = "Processing";
					<dotCount>5__4 = 0;
					<interval>5__5 = 0.3f;
					<>8__1.isHiringDone = false;
					if ((Object)(object)<>4__this != (Object)null)
					{
						MelonCoroutines.Start(<>4__this.HireEmployees(delegate
						{
							<>8__1.isHiringDone = true;
						}));
						break;
					}
					MelonLogger.Error("HireEmployeeInterface is null while starting HireEmployees.");
					OnComplete?.Invoke();
					return false;
				case 1:
					<>1__state = -1;
					break;
				}
				if (!<>8__1.isHiringDone)
				{
					if ((Object)(object)<payButtonText>5__2 != (Object)null)
					{
						<payButtonText>5__2.text = <baseText>5__3 + new string('.', <dotCount>5__4);
					}
					<dotCount>5__4 = (<dotCount>5__4 + 1) % 3;
					<>2__current = (object)new WaitForSeconds(<interval>5__5);
					<>1__state = 1;
					return true;
				}
				<>s__6 = <>4__this.newPropertyAssignments.GetEnumerator();
				try
				{
					while (<>s__6.MoveNext())
					{
						<kvp>5__7 = <>s__6.Current;
						<list>5__8 = <kvp>5__7.Value;
						<temp>5__9 = new List<(int, GameObject)>();
						<i>5__10 = 0;
						while (<i>5__10 < <list>5__8.Count)
						{
							<item>5__11 = <list>5__8[<i>5__10];
							if (<item>5__11.newlySpawned)
							{
								if ((Object)(object)<item>5__11 != (Object)null && (Object)(object)((Component)<item>5__11).gameObject != (Object)null)
								{
									<temp>5__9.Add((<i>5__10, ((Component)<item>5__11).gameObject));
								}
								else
								{
									MelonLogger.Warning("Tried to destroy null item or item.gameObject.");
								}
								<item>5__11 = null;
							}
							<i>5__10++;
						}
						<j>5__12 = <temp>5__9.Count - 1;
						while (<j>5__12 >= 0)
						{
							<list>5__8.RemoveAt(<temp>5__9[<j>5__12].index);
							Object.Destroy((Object)(object)<temp>5__9[<j>5__12].go);
							<j>5__12--;
						}
						<list>5__8 = null;
						<temp>5__9 = null;
						<kvp>5__7 = default(KeyValuePair<Property, List<DraggableItem>>);
					}
				}
				finally
				{
					((IDisposable)<>s__6).Dispose();
				}
				<>s__6 = default(Dictionary<Property, List<DraggableItem>>.Enumerator);
				OnComplete?.Invoke();
				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 <HireEmployees>d__52 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Action onComplete;

			public HireEmployeeInterface <>4__this;

			private Dictionary<Property, List<DraggableItem>>.Enumerator <>s__1;

			private KeyValuePair<Property, List<DraggableItem>> <kvp>5__2;

			private Property <property>5__3;

			private List<DraggableItem> <employees>5__4;

			private List<DraggableItem>.Enumerator <>s__5;

			private DraggableItem <employee>5__6;

			private EEmployeeType <type>5__7;

			private (int count, int signingFee, int rate) <stats>5__8;

			private int <totalFee>5__9;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if ((uint)(num - -4) <= 1u || num == 1)
				{
					try
					{
						if (num == -4 || num == 1)
						{
							try
							{
							}
							finally
							{
								<>m__Finally2();
							}
						}
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<>s__1 = default(Dictionary<Property, List<DraggableItem>>.Enumerator);
				<kvp>5__2 = default(KeyValuePair<Property, List<DraggableItem>>);
				<property>5__3 = null;
				<employees>5__4 = null;
				<>s__5 = default(List<DraggableItem>.Enumerator);
				<employee>5__6 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
				//IL_0101: Unknown result type (might be due to invalid IL or missing references)
				//IL_0113: Unknown result type (might be due to invalid IL or missing references)
				//IL_0154: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ed: Expected O, but got Unknown
				try
				{
					int num = <>1__state;
					if (num != 0)
					{
						if (num != 1)
						{
							return false;
						}
						<>1__state = -4;
						<employee>5__6 = null;
						goto IL_020b;
					}
					<>1__state = -1;
					if (!NetworkSingleton<VariableDatabase>.Instance.GetValue<bool>("ClipboardAcquired"))
					{
						NetworkSingleton<VariableDatabase>.Instance.SetVariableValue("ClipboardAcquired", true.ToString(), true);
					}
					<>s__1 = <>4__this.newPropertyAssignments.GetEnumerator();
					<>1__state = -3;
					goto IL_0249;
					IL_0249:
					if (<>s__1.MoveNext())
					{
						<kvp>5__2 = <>s__1.Current;
						<property>5__3 = <kvp>5__2.Key;
						<employees>5__4 = <kvp>5__2.Value;
						<>s__5 = <employees>5__4.GetEnumerator();
						<>1__state = -4;
						goto IL_020b;
					}
					<>m__Finally1();
					<>s__1 = default(Dictionary<Property, List<DraggableItem>>.Enumerator);
					onComplete?.Invoke();
					return false;
					IL_020b:
					while (<>s__5.MoveNext())
					{
						<employee>5__6 = <>s__5.Current;
						if (<employee>5__6.newlySpawned)
						{
							<type>5__7 = <employee>5__6.employeeType;
							<stats>5__8 = <>4__this.employeeStats[<type>5__7];
							<totalFee>5__9 = <stats>5__8.signingFee;
							NetworkSingleton<MoneyManager>.Instance.ChangeCashBalance((float)(-<totalFee>5__9), true, false);
							NetworkSingleton<EmployeeManager>.Instance.CreateNewEmployee(<property>5__3, <type>5__7);
							continue;
						}
						if (<property>5__3.PropertyCode != <employee>5__6.currentEmployee.AssignedProperty.PropertyCode)
						{
							MelonLogger.Msg(<property>5__3.PropertyCode + " | " + <employee>5__6.currentEmployee.AssignedProperty.PropertyCode);
							<employee>5__6.currentEmployee.SendTransfer(<property>5__3.PropertyCode);
						}
						<>2__current = (object)new WaitForSeconds(0.1f);
						<>1__state = 1;
						return true;
					}
					<>m__Finally2();
					<>s__5 = default(List<DraggableItem>.Enumerator);
					<property>5__3 = null;
					<employees>5__4 = null;
					<kvp>5__2 = default(KeyValuePair<Property, List<DraggableItem>>);
					goto IL_0249;
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

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

			private void <>m__Finally1()
			{
				<>1__state = -1;
				((IDisposable)<>s__1).Dispose();
			}

			private void <>m__Finally2()
			{
				<>1__state = -3;
				((IDisposable)<>s__5).Dispose();
			}

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

		public GameObject propertyContainerPrefab;

		public EmployeeListing botanistListing;

		public EmployeeListing chemistListing;

		public EmployeeListing handlerListing;

		public EmployeeListing cleanerListing;

		public PopupHandler errorPopup;

		public Transform employeeListingsContainer;

		public Transform scrollablePropertyContainer;

		public Button payButton;

		public Canvas hireEmployeeCanvas;

		public Text totalCostLabel;

		public Text errorLabel;

		public UnityAction onClose;

		private bool isMobile = false;

		private bool showMiscUI = false;

		private string shopName = "MannysNetwork";

		private bool isOpen = false;

		private bool locationChanged = false;

		private string buttonText = "Accept";

		private bool isHandlingPayment = false;

		private Dictionary<EEmployeeType, (int count, int signingFee, int rate)> employeeStats = new Dictionary<EEmployeeType, (int, int, int)>
		{
			{
				(EEmployeeType)0,
				(0, 1200, 200)
			},
			{
				(EEmployeeType)2,
				(0, 1500, 300)
			},
			{
				(EEmployeeType)1,
				(0, 1200, 200)
			},
			{
				(EEmployeeType)3,
				(0, 1000, 100)
			}
		};

		private Dictionary<Property, List<DraggableItem>> newPropertyAssignments = new Dictionary<Property, List<DraggableItem>>();

		private Dictionary<Property, PropertyContainer> propertyContainers = new Dictionary<Property, PropertyContainer>();

		private HashSet<Property> ownedProperties = new HashSet<Property>();

		private float cash = 20000f;

		public void Setup()
		{
			//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(Exit), 7);
			InitializeComponents();
			InitializeOwnedProperties();
			InitializeProperties();
			InitializeEmployeeListings();
			RefreshUI();
		}

		public void InitializeComponents()
		{
			hireEmployeeCanvas = ((Component)this).GetComponentInParent<Canvas>();
			InitializeLayoutGroups();
			InitializeButtons();
			InitializeText();
		}

		public void InitializeLayoutGroups()
		{
			VerticalLayoutGroup[] componentsInChildren = ((Component)this).GetComponentsInChildren<VerticalLayoutGroup>(true);
			VerticalLayoutGroup[] array = componentsInChildren;
			foreach (VerticalLayoutGroup val in array)
			{
				if (((Object)((Component)val).gameObject).name == "ScrollablePropertyContent")
				{
					scrollablePropertyContainer = ((Component)val).transform;
				}
				else if (((Object)((Component)val).gameObject).name == "EmployeeListingsContainer")
				{
					employeeListingsContainer = ((Component)val).transform;
				}
			}
		}

		public void InitializeButtons()
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected O, but got Unknown
			Button[] componentsInChildren = ((Component)this).GetComponentsInChildren<Button>(true);
			Button[] array = componentsInChildren;
			foreach (Button val in array)
			{
				if (((Object)((Component)val).gameObject).name == "AcceptButton")
				{
					payButton = val;
					Text componentInChildren = ((Component)val).GetComponentInChildren<Text>();
					buttonText = componentInChildren.text;
					((UnityEvent)payButton.onClick).AddListener(new UnityAction(HandlePaymentClick));
				}
			}
		}

		public void InitializeOwnedProperties()
		{
			ownedProperties = new HashSet<Property>(Property.OwnedProperties.ToArray());
		}

		private void InitializeProperties()
		{
			foreach (Property property in Property.Properties)
			{
				CreatePropertyContainer(property);
			}
		}

		public (int signingFee, int rate) GetEmployeeCosts(EEmployeeType employee)
		{
			//IL_0006: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: 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_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected I4, but got Unknown
			Employee employeePrefab = NetworkSingleton<EmployeeManager>.Instance.GetEmployeePrefab(employee);
			int item = Mathf.RoundToInt(employeePrefab.SigningFee + Fixer.GetAdditionalSigningFee());
			int item2 = Mathf.RoundToInt(employeePrefab.DailyWage);
			switch ((int)employee)
			{
			case 0:
				if (Core.botanistDailyWage.HasValue)
				{
					item2 = Mathf.RoundToInt((float)Core.botanistDailyWage.Value);
				}
				if (Core.botanistSigningFeeEnabled.GetValueOrDefault() && Core.botanistSigningFee.HasValue)
				{
					item = Mathf.RoundToInt((float)Core.botanistSigningFee.Value);
				}
				break;
			case 2:
				if (Core.chemistDailyWage.HasValue)
				{
					item2 = Mathf.RoundToInt((float)Core.chemistDailyWage.Value);
				}
				if (Core.chemistSigningFeeEnabled.GetValueOrDefault() && Core.chemistSigningFee.HasValue)
				{
					item = Mathf.RoundToInt((float)Core.chemistSigningFee.Value);
				}
				break;
			case 1:
				if (Core.handlerDailyWage.HasValue)
				{
					item2 = Mathf.RoundToInt((float)Core.handlerDailyWage.Value);
				}
				if (Core.handlerSigningFeeEnabled.GetValueOrDefault() && Core.handlerSigningFee.HasValue)
				{
					item = Mathf.RoundToInt((float)Core.handlerSigningFee.Value);
				}
				break;
			case 3:
				if (Core.cleanerDailyWage.HasValue)
				{
					item2 = Mathf.RoundToInt((float)Core.cleanerDailyWage.Value);
				}
				if (Core.cleanerSigningFeeEnabled.GetValueOrDefault() && Core.cleanerSigningFee.HasValue)
				{
					item = Mathf.RoundToInt((float)Core.cleanerSigningFee.Value);
				}
				break;
			}
			return (item, item2);
		}

		public void InitializeEmployeeListings()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Invalid comparison between Unknown and I4
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Invalid comparison between Unknown and I4
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Invalid comparison between Unknown and I4
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Invalid comparison between Unknown and I4
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: 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_0146: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				List<EEmployeeType> list = new List<EEmployeeType>(employeeStats.Keys);
				foreach (EEmployeeType item in list)
				{
					(int, int) employeeCosts = GetEmployeeCosts(item);
					employeeStats[item] = (0, employeeCosts.Item1, employeeCosts.Item2);
					if ((int)item == 0)
					{
						botanistListing.employeeType = item;
						botanistListing.SetCountText(0);
						botanistListing.SetSigningText(employeeCosts.Item1);
						botanistListing.SetWageText(employeeCosts.Item2);
					}
					else if ((int)item == 2)
					{
						chemistListing.employeeType = item;
						chemistListing.SetCountText(0);
						chemistListing.SetSigningText(employeeCosts.Item1);
						chemistListing.SetWageText(employeeCosts.Item2);
					}
					else if ((int)item == 1)
					{
						handlerListing.employeeType = item;
						handlerListing.SetCountText(0);
						handlerListing.SetSigningText(employeeCosts.Item1);
						handlerListing.SetWageText(employeeCosts.Item2);
					}
					else if ((int)item == 3)
					{
						cleanerListing.employeeType = item;
						cleanerListing.SetCountText(0);
						cleanerListing.SetSigningText(employeeCosts.Item1);
						cleanerListing.SetWageText(employeeCosts.Item2);
					}
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Msg((object)ex);
			}
		}

		public void InitializeText()
		{
			Text[] componentsInChildren = ((Component)this).GetComponentsInChildren<Text>(true);
			Text[] array = componentsInChildren;
			foreach (Text val in array)
			{
				if (((Object)((Component)val).gameObject).name == "TotalCostLabel")
				{
					totalCostLabel = val;
				}
				else if (((Object)((Component)val).gameObject).name == "ErrorLabel")
				{
					errorLabel = val;
				}
			}
		}

		public void CreatePropertyContainer(Property property)
		{
			GameObject val = Object.Instantiate<GameObject>(propertyContainerPrefab, scrollablePropertyContainer);
			PropertyContainer propertyContainer = val.AddComponent<PropertyContainer>();
			propertyContainer.currentProperty = property;
			propertyContainer.popup = errorPopup;
			propertyContainer.employees = property.Employees.Count;
			propertyContainer.total = property.EmployeeCapacity;
			propertyContainer.SetPropertyText(property.PropertyName);
			propertyContainer.UpdateCountText();
			newPropertyAssignments[property] = new List<DraggableItem>();
			propertyContainers[property] = propertyContainer;
			val.SetActive(ownedProperties.Contains(property) && property.EmployeeCapacity > 0);
		}

		public void SortProperties()
		{
			if ((Object)(object)scrollablePropertyContainer == (Object)null)
			{
				return;
			}
			List<KeyValuePair<Property, PropertyContainer>> list = propertyContainers.ToList();
			list.Sort(delegate(KeyValuePair<Property, PropertyContainer> a, KeyValuePair<Property, PropertyContainer> b)
			{
				PropertyContainer value = a.Value;
				PropertyContainer value2 = b.Value;
				bool flag = value.currentProperty.Employees.Count >= value.total;
				bool flag2 = value2.currentProperty.Employees.Count >= value2.total;
				if (flag != flag2)
				{
					return flag ? 1 : (-1);
				}
				if (value.total != value2.total)
				{
					return value.total.CompareTo(value2.total);
				}
				return (value.currentProperty.Employees.Count != value2.currentProperty.Employees.Count) ? value.currentProperty.Employees.Count.CompareTo(value2.currentProperty.Employees.Count) : string.Compare(value.currentProperty.PropertyName, value2.currentProperty.PropertyName, StringComparison.Ordinal);
			});
			for (int i = 0; i < list.Count; i++)
			{
				((Component)list[i].Value).transform.SetSiblingIndex(i);
			}
		}

		public void Open()
		{
			isMobile = true;
			showMiscUI = true;
			SetIsOpen(isOpen: true);
		}

		public void SetIsOpen(bool isOpen)
		{
			this.isOpen = isOpen;
			PlayerSingleton<PlayerCamera>.Instance.RemoveActiveUIElement(shopName);
			if (isOpen)
			{
				if (isMobile)
				{
					((Component)Singleton<ItemUIManager>.instance.InputsContainer).gameObject.SetActive(false);
					Singleton<GameplayMenuInterface>.instance.Close();
					PlayerSingleton<AppsCanvas>.Instance.SetIsOpen(true);
					PlayerSingleton<HomeScreen>.Instance.SetIsOpen(false);
					PlayerSingleton<Phone>.Instance.SetIsHorizontal(true);
					PlayerSingleton<Phone>.Instance.SetLookOffsetMultiplier(0.6f);
				}
				else
				{
					PlayerSingleton<PlayerCamera>.Instance.AddActiveUIElement(shopName);
					PlayerSingleton<PlayerCamera>.Instance.FreeMouse();
					PlayerSingleton<PlayerCamera>.Instance.SetCanLook(false);
					PlayerSingleton<PlayerMovement>.Instance.canMove = false;
					PlayerSingleton<PlayerInventory>.Instance.SetInventoryEnabled(true);
					PlayerSingleton<PlayerInventory>.Instance.SetEquippingEnabled(false);
					Singleton<InputPromptsCanvas>.Instance.LoadModule("exitonly");
				}
				cash = NetworkSingleton<MoneyManager>.Instance.cashBalance;
				foreach (Property ownedProperty in Property.OwnedProperties)
				{
					if (ownedProperty.EmployeeCapacity <= 0 || !propertyContainers.ContainsKey(ownedProperty))
					{
						continue;
					}
					LoadCurrentEmployees(ownedProperty);
					PropertyContainer propertyContainer = propertyContainers[ownedProperty];
					if (!((Object)(object)propertyContainer == (Object)null) && !((Object)(object)propertyContainer.currentProperty == (Object)null))
					{
						if (!ownedProperties.Contains(ownedProperty))
						{
							ownedProperties.Add(ownedProperty);
						}
						if (!((Component)propertyContainer).gameObject.activeInHierarchy)
						{
							((Component)propertyContainer).gameObject.SetActive(true);
						}
						if (newPropertyAssignments.ContainsKey(propertyContainer.currentProperty))
						{
							propertyContainer.employees = newPropertyAssignments[propertyContainer.currentProperty].Count;
						}
						propertyContainer.total = ownedProperty.EmployeeCapacity;
						propertyContainer.UpdateCountText();
						if (propertyContainer.currentProperty.Employees.Count >= propertyContainer.total)
						{
							propertyContainer.ShrinkContainer();
						}
						else
						{
							propertyContainer.ExpandContainer();
						}
					}
				}
				SortProperties();
				RefreshUI();
			}
			else if (isMobile)
			{
				isMobile = false;
				PlayerSingleton<AppsCanvas>.Instance.SetIsOpen(false);
				PlayerSingleton<HomeScreen>.Instance.SetIsOpen(true);
				PlayerSingleton<Phone>.Instance.SetIsHorizontal(false);
				PlayerSingleton<Phone>.Instance.SetLookOffsetMultiplier(1f);
				Singleton<CursorManager>.Instance.SetCursorAppearance((ECursorType)0);
				if (showMiscUI)
				{
					((Component)Singleton<ItemUIManager>.instance.InputsContainer).gameObject.SetActive(false);
					Singleton<GameplayMenuInterface>.instance.Open();
				}
			}
			else
			{
				PlayerSingleton<PlayerCamera>.Instance.LockMouse();
				PlayerSingleton<PlayerCamera>.Instance.SetCanLook(true);
				PlayerSingleton<PlayerMovement>.Instance.canMove = true;
				PlayerSingleton<PlayerInventory>.Instance.SetEquippingEnabled(true);
				Singleton<CursorManager>.Instance.SetCursorAppearance((ECursorType)0);
				Singleton<InputPromptsCanvas>.Instance.UnloadModule();
			}
			((Behaviour)hireEmployeeCanvas).enabled = isOpen;
			((Component)hireEmployeeCanvas).gameObject.SetActive(isOpen);
		}

		public void LoadCurrentEmployees(Property property)
		{
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: 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_00ae: Expected I4, but got Unknown
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			PropertyContainer propertyContainer = propertyContainers[property];
			if ((Object)(object)propertyContainer == (Object)null)
			{
				return;
			}
			foreach (Employee emp in property.Employees)
			{
				if (!((Object)(object)emp == (Object)null) && !newPropertyAssignments[property].Any((DraggableItem item) => ((NPC)item.currentEmployee).fullName == ((NPC)emp).fullName && item.currentEmployee.EmployeeType == emp.EmployeeType))
				{
					GameObject val = null;
					EEmployeeType type = emp.Type;
					EEmployeeType val2 = type;
					switch ((int)val2)
					{
					case 0:
						val = Object.Instantiate<GameObject>(botanistListing.employeePrefab, propertyContainer.employeeContainer);
						break;
					case 2:
						val = Object.Instantiate<GameObject>(chemistListing.employeePrefab, propertyContainer.employeeContainer);
						break;
					case 1:
						val = Object.Instantiate<GameObject>(handlerListing.employeePrefab, propertyContainer.employeeContainer);
						break;
					case 3:
						val = Object.Instantiate<GameObject>(cleanerListing.employeePrefab, propertyContainer.employeeContainer);
						break;
					}
					DraggableItem draggableItem = val.AddComponent<DraggableItem>();
					draggableItem.employeeType = emp.Type;
					draggableItem.currentEmployee = emp;
					draggableItem.currentContainer = propertyContainer;
					newPropertyAssignments[property].Add(draggableItem);
				}
			}
		}

		public void Exit(ExitAction action)
		{
			if (!action.Used && isOpen)
			{
				action.Used = true;
				SetIsOpen(isOpen: false);
			}
		}

		private void UpdateEmployeeListingCount(EEmployeeType employeeType)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: 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_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected I4, but got Unknown
			int item = employeeStats[employeeType].count;
			switch ((int)employeeType)
			{
			case 0:
				botanistListing.SetCountText(item);
				break;
			case 2:
				chemistListing.SetCountText(item);
				break;
			case 1:
				handlerListing.SetCountText(item);
				break;
			case 3:
				cleanerListing.SetCountText(item);
				break;
			}
		}

		public void OnNewEmployeeDropped(DraggableItem newEmployee, PropertyContainer targetContainer)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			newEmployee.currentContainer = targetContainer;
			OnEmployeeAssigned(newEmployee.employeeType, targetContainer.currentProperty, newEmployee);
			targetContainer.employees++;
			targetContainer.UpdateCountText();
		}

		public void OnEmployeeMoved(DraggableItem item, PropertyContainer targetContainer)
		{
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			PropertyContainer currentContainer = item.currentContainer;
			if (!((Object)(object)currentContainer == (Object)(object)targetContainer))
			{
				if (!item.newlySpawned && !((Selectable)payButton).interactable)
				{
					locationChanged = true;
				}
				OnEmployeeRemoved(currentContainer.currentProperty, item);
				currentContainer.employees--;
				currentContainer.UpdateCountText();
				item.currentContainer = targetContainer;
				targetContainer.employees++;
				targetContainer.UpdateCountText();
				OnEmployeeAssigned(item.employeeType, targetContainer.currentProperty, item);
			}
		}

		public void OnEmployeeAssigned(EEmployeeType employeeType, Property curr, DraggableItem instance)
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			if (instance.newlySpawned)
			{
				employeeStats[employeeType] = (employeeStats[employeeType].count + 1, employeeStats[employeeType].signingFee, employeeStats[employeeType].rate);
			}
			newPropertyAssignments[curr].Add(instance);
			UpdateEmployeeListingCount(employeeType);
			RefreshUI();
		}

		public bool OnEmployeeRemoved(Property curr, DraggableItem instance)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			EEmployeeType employeeType = instance.employeeType;
			bool flag = false;
			if (instance.newlySpawned)
			{
				employeeStats[employeeType] = (employeeStats[employeeType].count - 1, employeeStats[employeeType].signingFee, employeeStats[employeeType].rate);
			}
			if (newPropertyAssignments.ContainsKey(curr))
			{
				flag = newPropertyAssignments[curr].Remove(instance);
			}
			if (flag)
			{
				UpdateEmployeeListingCount(employeeType);
				RefreshUI();
			}
			return flag;
		}

		private void RefreshUI()
		{
			int totalCost = GetTotalCost();
			bool flag = (float)totalCost > cash;
			string arg = ((!flag) ? "#000000" : "#FF0004");
			totalCostLabel.text = $"<color={arg}>${totalCost}</color>";
			((Component)errorLabel).gameObject.SetActive(flag);
			if (flag)
			{
				errorLabel.text = "Not enough cash!";
			}
			((Selectable)payButton).interactable = !flag && (totalCost > 0 || locationChanged);
		}

		public int GetNewEmployees()
		{
			int num = 0;
			foreach (KeyValuePair<Property, List<DraggableItem>> newPropertyAssignment in newPropertyAssignments)
			{
				List<DraggableItem> value = newPropertyAssignment.Value;
				foreach (DraggableItem item in value)
				{
					if (item.newlySpawned)
					{
						num++;
					}
				}
			}
			return num;
		}

		public int GetTotalCost()
		{
			int num = 0;
			foreach (KeyValuePair<EEmployeeType, (int, int, int)> employeeStat in employeeStats)
			{
				int num2 = employeeStat.Value.Item1 * employeeStat.Value.Item2;
				num += num2;
			}
			return num;
		}

		public void HandlePaymentClick()
		{
			if (!isHandlingPayment)
			{
				isHandlingPayment = true;
				((MonoBehaviour)this).StartCoroutine(HandlePayment(HandlePaymentComplete));
			}
		}

		public void HandlePaymentComplete()
		{
			isHandlingPayment = false;
			Text componentInChildren = ((Component)payButton).GetComponentInChildren<Text>();
			componentInChildren.text = buttonText;
			totalCostLabel.text = "<color=#000000>$0</color>";
			((Selectable)payButton).interactable = false;
			employeeStats[(EEmployeeType)0] = (0, employeeStats[(EEmployeeType)0].signingFee, employeeStats[(EEmployeeType)0].rate);
			botanistListing.SetCountText(0);
			employeeStats[(EEmployeeType)2] = (0, employeeStats[(EEmployeeType)2].signingFee, employeeStats[(EEmployeeType)2].rate);
			chemistListing.SetCountText(0);
			employeeStats[(EEmployeeType)1] = (0, employeeStats[(EEmployeeType)1].signingFee, employeeStats[(EEmployeeType)1].rate);
			handlerListing.SetCountText(0);
			employeeStats[(EEmployeeType)3] = (0, employeeStats[(EEmployeeType)3].signingFee, employeeStats[(EEmployeeType)3].rate);
			cleanerListing.SetCountText(0);
			SetIsOpen(isOpen: false);
		}

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

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

		private void Update()
		{
			if (Input.GetKeyDown((KeyCode)9) && isOpen)
			{
				showMiscUI = false;
				SetIsOpen(isOpen: false);
			}
		}
	}
	public class PopupHandler : MonoBehaviour
	{
		public Button closePopup;

		private void Awake()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			closePopup = ((Component)this).GetComponentInChildren<Button>();
			((UnityEvent)closePopup.onClick).AddListener(new UnityAction(ClosePopup));
		}

		public void OpenPopup()
		{
			((Component)this).gameObject.SetActive(true);
		}

		public void ClosePopup()
		{
			((Component)this).gameObject.SetActive(false);
		}
	}
	public class PropertyContainer : EventTriggerBase
	{
		public PopupHandler popup;

		public Transform employeeContainer;

		public Button shrink;

		public Button expand;

		public Text propertyLabel;

		public Text employeeCount;

		public Property currentProperty;

		public HireEmployeeInterface hireInterface;

		public int employees { get; set; }

		public int total { get; set; }

		public override void Initialize()
		{
			base.Initialize();
			hireInterface = Object.FindObjectOfType<HireEmployeeInterface>();
			employeeContainer = ((Component)((Component)((Component)this).transform).GetComponentInChildren<GridLayoutGroup>()).transform;
			InitializeShrinkButton();
			InitializeExpandButton();
			InitializePropertyLabel();
			InitializeEmployeeCount();
			UpdateCountText();
		}

		public override void RegisterAllEventTriggers()
		{
			AddTrigger((EventTriggerType)6, OnDrop);
		}

		private void InitializeShrinkButton()
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			Transform val = ((Component)this).transform.Find("Header/Shrink");
			if ((Object)(object)val != (Object)null)
			{
				shrink = ((Component)val).GetComponent<Button>();
				((UnityEvent)shrink.onClick).AddListener(new UnityAction(ShrinkContainer));
			}
		}

		private void InitializeExpandButton()
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			Transform val = ((Component)this).transform.Find("Header/Expand");
			if ((Object)(object)val != (Object)null)
			{
				expand = ((Component)val).GetComponent<Button>();
				((UnityEvent)expand.onClick).AddListener(new UnityAction(ExpandContainer));
			}
		}

		private void InitializePropertyLabel()
		{
			Transform val = ((Component)this).transform.Find("Header/PropertyLabel");
			if ((Object)(object)val != (Object)null)
			{
				propertyLabel = ((Component)val).GetComponent<Text>();
			}
		}

		private void InitializeEmployeeCount()
		{
			Transform val = ((Component)this).transform.Find("Header/EmployeeCount");
			if ((Object)(object)val != (Object)null)
			{
				employeeCount = ((Component)val).GetComponent<Text>();
			}
		}

		public void SetPropertyText(string newText)
		{
			if (!((Object)(object)propertyLabel == (Object)null))
			{
				propertyLabel.text = newText;
			}
		}

		public void UpdateCountText()
		{
			if (!((Object)(object)employeeCount == (Object)null))
			{
				employeeCount.text = $"{employees} / {total}";
			}
		}

		public void ShrinkContainer()
		{
			((Component)employeeContainer).gameObject.SetActive(false);
			((Component)shrink).gameObject.SetActive(false);
			((Component)expand).gameObject.SetActive(true);
		}

		public void ExpandContainer()
		{
			((Component)employeeContainer).gameObject.SetActive(true);
			((Component)shrink).gameObject.SetActive(true);
			((Component)expand).gameObject.SetActive(false);
		}

		public void OnDrop(BaseEventData rawData)
		{
			PointerEventData val = (PointerEventData)(object)((rawData is PointerEventData) ? rawData : null);
			if (val == null)
			{
				return;
			}
			GameObject pointerDrag = val.pointerDrag;
			EmployeeListing component = pointerDrag.GetComponent<EmployeeListing>();
			if ((Object)(object)component != (Object)null)
			{
				if (employees + 1 > total)
				{
					popup.OpenPopup();
					return;
				}
				DraggableItem draggableItem = component.currentDraggable;
				if ((Object)(object)draggableItem == (Object)null)
				{
					draggableItem = component.currentInstance.GetComponent<DraggableItem>();
				}
				draggableItem.newlySpawned = true;
				((Component)draggableItem).transform.SetParent(employeeContainer);
				((Graphic)draggableItem.image).raycastTarget = true;
				hireInterface.OnNewEmployeeDropped(draggableItem, this);
				component.ClearCurrentInstance();
				return;
			}
			DraggableItem component2 = pointerDrag.GetComponent<DraggableItem>();
			if ((Object)(object)component2 != (Object)null)
			{
				if (employees + 1 > total && (Object)(object)((Component)component2.parentAfterDrag).transform != (Object)(object)((Component)employeeContainer).transform)
				{
					popup.OpenPopup();
					return;
				}
				component2.parentAfterDrag = employeeContainer;
				hireInterface.OnEmployeeMoved(component2, this);
			}
		}
	}
	public static class UIManager
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static UnityAction <0>__AppClose;
		}

		private static Core mod = MelonAssembly.FindMelonInstance<Core>();

		public const string ASSET_BUNDLE_NAME = "hiremeassets";

		public static GameObject propertyContainerPrefab;

		public static GameObject hireEmployeeUIPrefab;

		public static GameObject handlerPrefab;

		public static GameObject cleanerPrefab;

		public static GameObject chemistPrefab;

		public static GameObject botanistPrefab;

		public static GameObject addHandlerListingPrefab;

		public static GameObject addCleanerListingPrefab;

		public static GameObject addChemistListingPrefab;

		public static GameObject addBotanistListingPrefab;

		public static Sprite handlerAdd;

		public static Sprite handlerIcon;

		public static Sprite cleanerAdd;

		public static Sprite cleanerIcon;

		public static Sprite chemistAdd;

		public static Sprite chemistIcon;

		public static Sprite botanistAdd;

		public static Sprite botanistIcon;

		public static Sprite expandIcon;

		public static Sprite collapseIcon;

		public static Sprite deleteIcon;

		public static Sprite appIcon;

		public static HireEmployeeInterface hiringInterface;

		public static Button appButton;

		public static void LoadAssets()
		{
			try
			{
				if ((Object)(object)propertyContainerPrefab == (Object)null)
				{
					propertyContainerPrefab = AssetBundleUtils.LoadAssetFromBundle<GameObject>("propertycontainer.prefab", "hiremeassets");
				}
				if ((Object)(object)hireEmployeeUIPrefab == (Object)null)
				{
					hireEmployeeUIPrefab = AssetBundleUtils.LoadAssetFromBundle<GameObject>("hireemployeeui.prefab", "hiremeassets");
				}
				if ((Object)(object)handlerPrefab == (Object)null)
				{
					handlerPrefab = AssetBundleUtils.LoadAssetFromBundle<GameObject>("handler.prefab", "hiremeassets");
				}
				if ((Object)(object)cleanerPrefab == (Object)null)
				{
					cleanerPrefab = AssetBundleUtils.LoadAssetFromBundle<GameObject>("cleaner.prefab", "hiremeassets");
				}
				if ((Object)(object)chemistPrefab == (Object)null)
				{
					chemistPrefab = AssetBundleUtils.LoadAssetFromBundle<GameObject>("chemist.prefab", "hiremeassets");
				}
				if ((Object)(object)botanistPrefab == (Object)null)
				{
					botanistPrefab = AssetBundleUtils.LoadAssetFromBundle<GameObject>("botanist.prefab", "hiremeassets");
				}
				if ((Object)(object)addHandlerListingPrefab == (Object)null)
				{
					addHandlerListingPrefab = AssetBundleUtils.LoadAssetFromBundle<GameObject>("addhandlerlisting.prefab", "hiremeassets");
				}
				if ((Object)(object)addCleanerListingPrefab == (Object)null)
				{
					addCleanerListingPrefab = AssetBundleUtils.LoadAssetFromBundle<GameObject>("addcleanerlisting.prefab", "hiremeassets");
				}
				if ((Object)(object)addChemistListingPrefab == (Object)null)
				{
					addChemistListingPrefab = AssetBundleUtils.LoadAssetFromBundle<GameObject>("addchemistlisting.prefab", "hiremeassets");
				}
				if ((Object)(object)addBotanistListingPrefab == (Object)null)
				{
					addBotanistListingPrefab = AssetBundleUtils.LoadAssetFromBundle<GameObject>("addbotanistlisting.prefab", "hiremeassets");
				}
				if ((Object)(object)handlerAdd == (Object)null)
				{
					handlerAdd = AssetBundleUtils.LoadAssetFromBundle<Sprite>("handler_add.png", "hiremeassets");
				}
				if ((Object)(object)handlerIcon == (Object)null)
				{
					handlerIcon = AssetBundleUtils.LoadAssetFromBundle<Sprite>("handler.png", "hiremeassets");
				}
				if ((Object)(object)cleanerAdd == (Object)null)
				{
					cleanerAdd = AssetBundleUtils.LoadAssetFromBundle<Sprite>("cleaner_add.png", "hiremeassets");
				}
				if ((Object)(object)cleanerIcon == (Object)null)
				{
					cleanerIcon = AssetBundleUtils.LoadAssetFromBundle<Sprite>("cleaner.png", "hiremeassets");
				}
				if ((Object)(object)chemistAdd == (Object)null)
				{
					chemistAdd = AssetBundleUtils.LoadAssetFromBundle<Sprite>("chemist_add.png", "hiremeassets");
				}
				if ((Object)(object)chemistIcon == (Object)null)
				{
					chemistIcon = AssetBundleUtils.LoadAssetFromBundle<Sprite>("chemist.png", "hiremeassets");
				}
				if ((Object)(object)botanistAdd == (Object)null)
				{
					botanistAdd = AssetBundleUtils.LoadAssetFromBundle<Sprite>("botanist_add.png", "hiremeassets");
				}
				if ((Object)(object)botanistIcon == (Object)null)
				{
					botanistIcon = AssetBundleUtils.LoadAssetFromBundle<Sprite>("botanist.png", "hiremeassets");
				}
				if ((Object)(object)expandIcon == (Object)null)
				{
					expandIcon = AssetBundleUtils.LoadAssetFromBundle<Sprite>("expand.png", "hiremeassets");
				}
				if ((Object)(object)collapseIcon == (Object)null)
				{
					collapseIcon = AssetBundleUtils.LoadAssetFromBundle<Sprite>("collapse.png", "hiremeassets");
				}
				if ((Object)(object)deleteIcon == (Object)null)
				{
					deleteIcon = AssetBundleUtils.LoadAssetFromBundle<Sprite>("deletebutton.png", "hiremeassets");
				}
				if ((Object)(object)appIcon == (Object)null)
				{
					appIcon = AssetBundleUtils.LoadAssetFromBundle<Sprite>("appicon.png", "hiremeassets");
				}
			}
			catch (Exception ex)
			{
				((MelonBase)mod).Unregister("Unregistering mod due to error:\n " + ex.Source + "\n " + ex.Message, false);
			}
		}

		public static void SetupUI(Transform parent)
		{
			GameObject val = Object.Instantiate<GameObject>(hireEmployeeUIPrefab, parent);
			hiringInterface = ((Component)val.transform.GetChild(0)).gameObject.AddComponent<HireEmployeeInterface>();
			hiringInterface.propertyContainerPrefab = propertyContainerPrefab;
			Transform val2 = val.transform.Find("HireEmployeeInterface/PopupBackground");
			if ((Object)(object)val2 != (Object)null)
			{
				hiringInterface.errorPopup = ((Component)val2).gameObject.AddComponent<PopupHandler>();
			}
			Transform val3 = val.transform.Find("HireEmployeeInterface/Cart/EmployeeListingsContainer");
			if ((Object)(object)val3 != (Object)null)
			{
				SetupListings(val3, val.transform);
			}
			hiringInterface.Setup();
			val.SetActive(false);
		}

		private static void SetupListings(Transform parentContainer, Transform parentCanvas)
		{
			GameObject val = Object.Instantiate<GameObject>(addBotanistListingPrefab, parentContainer);
			EmployeeListing employeeListing = val.AddComponent<EmployeeListing>();
			employeeListing.addIcon = botanistAdd;
			employeeListing.defaultIcon = botanistIcon;
			employeeListing.employeePrefab = botanistPrefab;
			employeeListing.dragParent = parentCanvas;
			hiringInterface.botanistListing = employeeListing;
			GameObject val2 = Object.Instantiate<GameObject>(addChemistListingPrefab, parentContainer);
			EmployeeListing employeeListing2 = val2.AddComponent<EmployeeListing>();
			employeeListing2.addIcon = chemistAdd;
			employeeListing2.defaultIcon = chemistIcon;
			employeeListing2.employeePrefab = chemistPrefab;
			employeeListing2.dragParent = parentCanvas;
			hiringInterface.chemistListing = employeeListing2;
			GameObject val3 = Object.Instantiate<GameObject>(addHandlerListingPrefab, parentContainer);
			EmployeeListing employeeListing3 = val3.AddComponent<EmployeeListing>();
			employeeListing3.addIcon = handlerAdd;
			employeeListing3.defaultIcon = handlerIcon;
			employeeListing3.employeePrefab = handlerPrefab;
			employeeListing3.dragParent = parentCanvas;
			hiringInterface.handlerListing = employeeListing3;
			GameObject val4 = Object.Instantiate<GameObject>(addCleanerListingPrefab, parentContainer);
			EmployeeListing employeeListing4 = val4.AddComponent<EmployeeListing>();
			employeeListing4.addIcon = cleanerAdd;
			employeeListing4.defaultIcon = cleanerIcon;
			employeeListing4.employeePrefab = cleanerPrefab;
			employeeListing4.dragParent = parentCanvas;
			hiringInterface.cleanerListing = employeeListing4;
		}

		public static void AppClose()
		{
			((Component)Singleton<ItemUIManager>.instance.InputsContainer).gameObject.SetActive(false);
			Singleton<GameplayMenuInterface>.instance.Open();
		}

		public static void SetupPhoneApp(HomeScreen home)
		{
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Expected O, but got Unknown
			//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_00f2: Expected O, but got Unknown
			GameplayMenu componentInParent = ((Component)((Component)home).transform).GetComponentInParent<GameplayMenu>();
			RectTransform component = Object.Instantiate<GameObject>(home.appIconPrefab, (Transform)(object)home.appIconContainer).GetComponent<RectTransform>();
			((Component)((Transform)component).Find("Mask/Image")).GetComponent<Image>().sprite = appIcon;
			((Component)((Transform)component).Find("Label")).GetComponent<Text>().text = "HireMe";
			appButton = ((Component)component).GetComponent<Button>();
			home.appIcons.Add(appButton);
			((UnityEvent)appButton.onClick).AddListener(new UnityAction(hiringInterface.Open));
			Transform val = ((Component)appButton).transform.Find("Notifications");
			((Component)val).gameObject.SetActive(false);
			((Component)appButton).gameObject.SetActive(ModSettings.EnablePhoneApp.Value);
			HireEmployeeInterface hireEmployeeInterface = hiringInterface;
			object obj = <>O.<0>__AppClose;
			if (obj == null)
			{
				UnityAction val2 = AppClose;
				<>O.<0>__AppClose = val2;
				obj = (object)val2;
			}
			hireEmployeeInterface.onClose = (UnityAction)obj;
		}

		public static void TogglePhoneApp(bool isEnabled)
		{
			if ((Object)(object)appButton == (Object)null)
			{
				MelonLogger.Error("Phone App is null and cannot be toggled");
			}
			else
			{
				((Component)appButton).gameObject.SetActive(isEnabled);
			}
		}
	}
}
namespace HireMe.TemplateUtils
{
	public static class AssetBundleUtils
	{
		private static Core mod = MelonAssembly.FindMelonInstance<Core>();

		private static MelonAssembly melonAssembly = ((MelonBase)mod).MelonAssembly;

		private static Dictionary<string, AssetBundle> assetBundles = new Dictionary<string, AssetBundle>();

		public static AssetBundle LoadAssetBundle(string bundleFileName)
		{
			if (assetBundles.ContainsKey(bundleFileName))
			{
				return assetBundles[bundleFileName];
			}
			try
			{
				string text = typeof(Core).Namespace + ".Assets." + bundleFileName;
				Stream manifestResourceStream = melonAssembly.Assembly.GetManifestResourceStream(text ?? "");
				if (manifestResourceStream == null)
				{
					((MelonBase)mod).Unregister("AssetBundle: '" + text + "' not found. \nOpen .csproj file and search for '" + bundleFileName + "'.\nIf it doesn't exist,\nCopy your asset to Assets/ folder then look for 'your.assetbundle' in .csproj file.", false);
					return null;
				}
				AssetBundle val = AssetBundle.LoadFromStream(manifestResourceStream);
				assetBundles.Add(bundleFileName, val);
				return val;
			}
			catch (Exception arg)
			{
				((MelonBase)mod).Unregister($"Failed to load AssetBundle. Please report to dev: {arg}", false);
				return null;
			}
		}

		public static AssetBundle GetLoadedAssetBundle(string bundleName)
		{
			if (assetBundles.ContainsKey(bundleName))
			{
				return assetBundles[bundleName];
			}
			((MelonBase)mod).Unregister("Failed to get " + bundleName, false);
			throw new Exception("Asset '" + bundleName + "' has not been loaded in yet");
		}

		public static T LoadAssetFromBundle<T>(string assetName, string bundleName) where T : Object
		{
			AssetBundle loadedAssetBundle = GetLoadedAssetBundle(bundleName);
			if ((Object)(object)loadedAssetBundle == (Object)null)
			{
				throw new Exception("Bundle not found for asset: " + assetName);
			}
			T result = loadedAssetBundle.LoadAsset<T>(assetName);
			if ((Object)(object)loadedAssetBundle == (Object)null)
			{
				throw new Exception(assetName + " not found in bundle " + bundleName);
			}
			return result;
		}
	}
	public static class BreadTweaksCompat
	{
		private static readonly string BreadPrefsPath = Path.Combine(MelonEnvironment.UserDataDirectory, "Bread_Tweaks", "Employees.cfg");

		public static bool IsBreadTweaksInstalled()
		{
			int result;
			if (File.Exists(BreadPrefsPath))
			{
				MelonPreferences_Category category = MelonPreferences.GetCategory("Botanist");
				result = ((((category != null) ? category.GetEntry<double>("Daily Wage") : null) != null) ? 1 : 0);
			}
			else
			{
				result = 0;
			}
			return (byte)result != 0;
		}

		public static double? GetDailyWage(string employeeType)
		{
			try
			{
				MelonPreferences_Category category = MelonPreferences.GetCategory(employeeType);
				if (category == null)
				{
					return null;
				}
				return category.GetEntry<double>("Daily Wage")?.Value;
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[BreadCompat] Failed to get Daily Wage for '" + employeeType + "': " + ex.Message);
				return null;
			}
		}

		public static double? GetSigningFee(string employeeType)
		{
			try
			{
				MelonPreferences_Category category = MelonPreferences.GetCategory(employeeType);
				if (category == null)
				{
					return null;
				}
				return category.GetEntry<double>("Signing Fee")?.Value;
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[BreadCompat] Failed to get Signing Fee for '" + employeeType + "': " + ex.Message);
				return null;
			}
		}

		public static bool? GetSigningFeeEnabled(string employeeType)
		{
			try
			{
				MelonPreferences_Category category = MelonPreferences.GetCategory(employeeType);
				if (category == null)
				{
					return null;
				}
				return category.GetEntry<bool>("Custom Signing Fee")?.Value;
			}
			catch (Exception ex)
			{
				MelonLogger.Warning("[BreadCompat] Failed to get Custom Signing Fee value for '" + employeeType + "': " + ex.Message);
				return null;
			}
		}
	}
}
namespace HireMe.Utils
{
	public static class ModSettings
	{
		public static MelonPreferences_Category MainCategory;

		public static MelonPreferences_Entry<bool> EnablePhoneApp;

		public static void Init()
		{
			MainCategory = MelonPreferences.CreateCategory("HireMe_01_Main", "Main Settings");
			EnablePhoneApp = MainCategory.CreateEntry<bool>("EnablePhoneApp", true, "Enable the Phone Application", "Enables the Hire Me Phone Application to manage your employees remotely and at any time.", false, false, (ValueValidator)null, (string)null);
		}
	}
}
namespace HireMe.Patches
{
	public class FixerDialoguePatches
	{
		[HarmonyPatch(typeof(DialogueController_Fixer), "ChoiceCallback")]
		public static class DialogueControllerFixer_ChoiceCallback_Patch
		{
			public static bool Prefix(DialogueController_Fixer __instance, string choiceLabel)
			{
				try
				{
					if (choiceLabel.Contains("GENERIC_CHOICE"))
					{
						UIManager.hiringInterface.SetIsOpen(isOpen: true);
						return false;
					}
					return true;
				}
				catch (Exception ex)
				{
					MelonLogger.Error((object)ex);
					return true;
				}
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		internal IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}