Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of LaundryApp v1.1.2
Mods/LaundryApp.dll
Decompiled 2 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using Il2CppFishNet.Object; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppScheduleOne; using Il2CppScheduleOne.DevUtilities; using Il2CppScheduleOne.GameTime; using Il2CppScheduleOne.Money; using Il2CppScheduleOne.Persistence; using Il2CppScheduleOne.Property; using Il2CppScheduleOne.UI; using Il2CppScheduleOne.UI.Phone; using Il2CppScheduleOne.Variables; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using LaundryApp; using LaundryApp.App; using MelonLoader; using MelonLoader.Preferences; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(Core), "Laundry App", "1.1.2", "DazUki", null)] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: AssemblyMetadata("NexusModID", "1455")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("LaundryApp")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.1.2.0")] [assembly: AssemblyInformationalVersion("1.0.0+94e2b507e558ef49c3e5da1740945ad8c0d521d1")] [assembly: AssemblyProduct("LaundryApp")] [assembly: AssemblyTitle("LaundryApp")] [assembly: NeutralResourcesLanguage("en-US")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.2.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 LaundryApp { public class Core : MelonMod { [CompilerGenerated] private sealed class <InitializeLaundryApp>d__8 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Core <>4__this; private int <attempts>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <InitializeLaundryApp>d__8(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Expected O, but got Unknown int num = <>1__state; Core core = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <attempts>5__2 = 0; break; case 1: <>1__state = -1; break; } if (!PlayerSingleton<HomeScreen>.InstanceExists || !PlayerSingleton<AppsCanvas>.InstanceExists) { <attempts>5__2++; if (<attempts>5__2 % 50 == 1) { ((MelonBase)core).LoggerInstance.Msg($"Core: waiting for phone UI, elapsed={(float)<attempts>5__2 * 0.1f:F0}s"); } <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 1; return true; } try { ((MelonBase)core).LoggerInstance.Msg("Core: phone UI ready, creating app"); core._laundryApp = new LaundryApp(); core._laundryApp.Initialize(); ((MelonBase)core).LoggerInstance.Msg("Core: initialized successfully"); } catch (Exception ex) { ((MelonBase)core).LoggerInstance.Error("Core: failed to initialize, error=" + ex.Message); ((MelonBase)core).LoggerInstance.Error("Core: stack trace=" + ex.StackTrace); } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private bool _initialized; private LaundryApp _laundryApp; public static Core Instance { get; private set; } public override void OnInitializeMelon() { Instance = this; Settings.Initialize(); ((MelonBase)this).LoggerInstance.Msg("Core: loaded"); } public override void OnSceneWasLoaded(int buildIndex, string sceneName) { if (sceneName == "Menu") { _initialized = false; _laundryApp?.Cleanup(); _laundryApp = null; } else if (sceneName == "Main" && !_initialized) { _initialized = true; MelonCoroutines.Start(InitializeLaundryApp()); } } [IteratorStateMachine(typeof(<InitializeLaundryApp>d__8))] private IEnumerator InitializeLaundryApp() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <InitializeLaundryApp>d__8(0) { <>4__this = this }; } public override void OnUpdate() { _laundryApp?.Update(); } } public static class Settings { private static MelonPreferences_Category s_category; public static MelonPreferences_Entry<bool> ShowProgressCircle { get; private set; } public static MelonPreferences_Entry<bool> ProgressCircleColorLerp { get; private set; } public static MelonPreferences_Entry<bool> ShowPauseIcon { get; private set; } public static MelonPreferences_Entry<bool> AutoCapAmount { get; private set; } public static MelonPreferences_Entry<bool> ShowBalanceSummary { get; private set; } public static MelonPreferences_Entry<bool> AutoLaunderMorning { get; private set; } public static void Initialize() { s_category = MelonPreferences.CreateCategory("LaundryApp", "Laundry App Settings"); ShowProgressCircle = s_category.CreateEntry<bool>("ShowProgressCircle", true, "Show Progress Circle", "Show a progress circle next to each laundering operation.", false, false, (ValueValidator)null, (string)null); ProgressCircleColorLerp = s_category.CreateEntry<bool>("ProgressCircleColorLerp", true, "Progress Circle Colored", "Color the progress circles based on completion (red to green). Disable for plain white circles.", false, false, (ValueValidator)null, (string)null); ShowPauseIcon = s_category.CreateEntry<bool>("ShowPauseIcon", true, "Show Pause Icon", "Show a pause icon on businesses when laundering is paused at 4 AM.", false, false, (ValueValidator)null, (string)null); AutoCapAmount = s_category.CreateEntry<bool>("AutoCapAmount", false, "Auto-Cap Amount", "Always pre-fill the amount with the most you can launder based on your cash and business capacity.", false, false, (ValueValidator)null, (string)null); ShowBalanceSummary = s_category.CreateEntry<bool>("ShowBalanceSummary", true, "Show Balance Summary", "Show your current bank balance and expected balance after all current laundering operations are completed.", false, false, (ValueValidator)null, (string)null); AutoLaunderMorning = s_category.CreateEntry<bool>("AutoLaunderMorning", false, "Auto-Launder at Morning", "Automatically launder the max amount for all businesses when you wake up each morning.", false, false, (ValueValidator)null, (string)null); } } public class LaundryApp { private readonly UI _ui; private BusinessView _businessView; private bool _isOpen; private bool _wasPhoneOpen; private float _lastRefreshTime; private float _lastAddButtonClickTime = -2f; private int _initDay = -1; private static int s_lastAutoLaunderDay = -1; private readonly List<Business> _ownedBusinesses = new List<Business>(); private readonly Sprite _autoLaunderIcon = BusinessView.LoadEmbeddedSprite("autoicon.png"); public LaundryApp() { _ui = new UI(); } public void Initialize() { _ui.Initialize(); if (_ui.BusinessListContainer == null || _ui.CircleSprite == null) { MelonLogger.Error("UI components are null, aborting init"); return; } _businessView = new BusinessView(_ui.BusinessListContainer, _ui.CircleSprite, OnBusinessListItemClicked); RegisterEventHandlers(); MelonLogger.Msg("initialized"); } private void RegisterEventHandlers() { UI.RegisterIconClickHandler(OnAppIconClicked); OperationsView operationsView = _ui.OperationsView; if (operationsView != null) { Button startOperationButton = operationsView.StartOperationButton; if (startOperationButton != null) { ((UnityEvent)startOperationButton.onClick).AddListener(UnityAction.op_Implicit((Action)OnStartOperationClicked)); } } OperationsView operationsView2 = _ui.OperationsView; if (operationsView2 != null) { InputField amountInput = operationsView2.AmountInput; if (amountInput != null) { ((UnityEvent<string>)(object)amountInput.onValueChanged).AddListener(UnityAction<string>.op_Implicit((Action<string>)delegate { ValidateAmountInput(); })); } } OperationsView operationsView3 = _ui.OperationsView; if (operationsView3 != null) { Dropdown businessDropdown = operationsView3.BusinessDropdown; if (businessDropdown != null) { ((UnityEvent<int>)(object)businessDropdown.onValueChanged).AddListener(UnityAction<int>.op_Implicit((Action<int>)OnBusinessDropdownChanged)); } } OperationsView operationsView4 = _ui.OperationsView; if (operationsView4 != null) { Button maxButton = operationsView4.MaxButton; if (maxButton != null) { ((UnityEvent)maxButton.onClick).AddListener(UnityAction.op_Implicit((Action)OnMaxButtonClicked)); } } GameInput.RegisterExitListener(ExitDelegate.op_Implicit((Action<ExitAction>)OnExitAction), 1); if (PlayerSingleton<Phone>.InstanceExists) { Phone instance = PlayerSingleton<Phone>.Instance; instance.closeApps += Action.op_Implicit((Action)Close); } } private void ValidateAmountInput() { //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) OperationsView operationsView = _ui.OperationsView; if (!((Object)(object)operationsView?.AmountInput == (Object)null) && !((Object)(object)operationsView?.StartOperationButton == (Object)null)) { string text = operationsView.AmountInput.text; bool flag = false; if (int.TryParse(text, out var result) && result >= 100) { Dropdown businessDropdown = operationsView.BusinessDropdown; int dropdownIndex = ((businessDropdown != null) ? businessDropdown.value : (-1)); float availableCapacity = GetAvailableCapacity(dropdownIndex); MoneyManager instance = NetworkSingleton<MoneyManager>.Instance; float num = ((instance != null) ? instance.cashBalance : 0f); flag = result <= Mathf.FloorToInt(num) && result <= Mathf.FloorToInt(availableCapacity); } ((Selectable)operationsView.StartOperationButton).interactable = flag; Image image = ((Selectable)operationsView.StartOperationButton).image; if (image != null) { ((Graphic)image).color = Color32.op_Implicit(flag ? Constants.BUTTON_BACKGROUND_COLOR : Constants.BUTTON_DISABLED_COLOR); } } } private float GetAvailableCapacity(int dropdownIndex) { if (dropdownIndex < 0 || dropdownIndex >= _ownedBusinesses.Count) { return 0f; } Business val = _ownedBusinesses[dropdownIndex]; return val.LaunderCapacity - val.currentLaunderTotal; } private int GetMaxLaunderAmount(int dropdownIndex) { float availableCapacity = GetAvailableCapacity(dropdownIndex); if (availableCapacity <= 0f) { return 0; } MoneyManager instance = NetworkSingleton<MoneyManager>.Instance; float num = ((instance != null) ? instance.cashBalance : 0f); return Mathf.FloorToInt(Mathf.Min(availableCapacity, num)); } private void OnAppIconClicked() { if (_isOpen) { Close(); } else { Open(); } } private void OnMaxButtonClicked() { OperationsView operationsView = _ui?.OperationsView; if (operationsView?.BusinessDropdown != null && operationsView?.AmountInput != null) { int value = operationsView.BusinessDropdown.value; int maxLaunderAmount = GetMaxLaunderAmount(value); if (maxLaunderAmount >= 100) { operationsView.AmountInput.text = maxLaunderAmount.ToString(); } } } private void PopulateBusinessDropdown() { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown OperationsView operationsView = _ui.OperationsView; if ((Object)(object)operationsView?.BusinessDropdown == (Object)null) { return; } _ownedBusinesses.Clear(); List<Business> ownedBusinesses = Business.OwnedBusinesses; List<OptionData> val = new List<OptionData>(); for (int i = 0; i < ownedBusinesses.Count; i++) { Business val2 = ownedBusinesses[i]; if ((Object)(object)val2 != (Object)null) { _ownedBusinesses.Add(val2); OptionData val3 = new OptionData { text = ((Property)val2).PropertyName }; val.Add(val3); } } operationsView.BusinessDropdown.ClearOptions(); operationsView.BusinessDropdown.AddOptions(val); operationsView.BusinessDropdown.value = 0; UpdateCapacityDisplay(0); } private void OnBusinessDropdownChanged(int index) { UpdateCapacityDisplay(index); } private void OnBusinessListItemClicked(int index) { OperationsView operationsView = _ui.OperationsView; if (operationsView?.BusinessDropdown != null && index >= 0 && index < operationsView.BusinessDropdown.options.Count) { operationsView.BusinessDropdown.value = index; } } private void CheckAutoLaunder() { if (!Settings.AutoLaunderMorning.Value || !NetworkSingleton<TimeManager>.InstanceExists || !Singleton<LoadManager>.InstanceExists || !Singleton<LoadManager>.Instance.IsGameLoaded) { return; } TimeManager instance = NetworkSingleton<TimeManager>.Instance; int elapsedDays = instance.ElapsedDays; int currentTime = instance.CurrentTime; if (_initDay < 0) { _initDay = elapsedDays; if (_initDay < s_lastAutoLaunderDay) { s_lastAutoLaunderDay = -1; } } if (currentTime < 700 || elapsedDays <= s_lastAutoLaunderDay) { return; } s_lastAutoLaunderDay = elapsedDays; try { MoneyManager instance2 = NetworkSingleton<MoneyManager>.Instance; if (instance2 == null) { ((MelonBase)Core.Instance).LoggerInstance.Error("auto-launder: MoneyManager is null"); return; } if (!((NetworkBehaviour)instance2).IsClientInitialized) { ((MelonBase)Core.Instance).LoggerInstance.Warning("auto-launder: FishNet not ready, will retry"); s_lastAutoLaunderDay = elapsedDays - 1; return; } List<Business> ownedBusinesses = Business.OwnedBusinesses; if (ownedBusinesses == null || ownedBusinesses.Count == 0) { return; } VariableDatabase instance3 = NetworkSingleton<VariableDatabase>.Instance; int num = 0; float num2 = 0f; for (int i = 0; i < ownedBusinesses.Count; i++) { Business val = ownedBusinesses[i]; if (val == null) { continue; } float num3 = val.LaunderCapacity - val.currentLaunderTotal; float cashBalance = instance2.cashBalance; int num4 = Mathf.FloorToInt(Mathf.Min(num3, cashBalance)); if (num4 >= 100) { instance2.ChangeCashBalance((float)(-num4), true, true); val.StartLaunderingOperation((float)num4, 0); num++; num2 += (float)num4; if (instance3 != null) { float value = instance3.GetValue<float>("LaunderingOperationsStarted"); instance3.SetVariableValue("LaunderingOperationsStarted", (value + 1f).ToString(), true); } } } if (num > 0) { ((MelonBase)Core.Instance).LoggerInstance.Msg($"auto-launder: day={elapsedDays}, started {num} operations, total=${num2:F0}"); Singleton<NotificationsManager>.Instance.SendNotification("Auto-Launder", $"<color=#16F01C>{MoneyManager.FormatAmount(num2, false, false)}</color> started ({num} ops)", _autoLaunderIcon ?? instance2.LaunderingNotificationIcon, 5f, true); } } catch (Exception ex) { ((MelonBase)Core.Instance).LoggerInstance.Error("auto-launder: error=" + ex.Message); } } private void UpdateCapacityDisplay(int businessIndex) { if (businessIndex >= 0 && businessIndex < _ownedBusinesses.Count) { ValidateAmountInput(); } } private void UpdateBalanceSummary() { //IL_0084: Unknown result type (might be due to invalid IL or missing references) bool flag = _ownedBusinesses.Count > 0; bool flag2 = flag && Settings.ShowBalanceSummary.Value; if ((Object)(object)_ui.BalanceSummaryRow != (Object)null) { _ui.BalanceSummaryRow.SetActive(flag2); } if ((Object)(object)_ui.BusinessListScrollRect != (Object)null) { float num = ((!flag) ? 0.89f : (flag2 ? 0.74f : 0.79f)); _ui.BusinessListScrollRect.anchorMax = new Vector2(0.92f, num); } if (!flag2) { return; } MoneyManager instance = NetworkSingleton<MoneyManager>.Instance; if (instance == null) { return; } float onlineBalance = instance.onlineBalance; if ((Object)(object)_ui.BalanceText != (Object)null) { _ui.BalanceText.text = $"<color={"#4CBFFF"}>${onlineBalance:N0}</color>"; } float num2 = 0f; int num3 = 0; List<Business> ownedBusinesses = Business.OwnedBusinesses; if (ownedBusinesses != null) { for (int i = 0; i < ownedBusinesses.Count; i++) { Business val = ownedBusinesses[i]; if (val == null) { continue; } List<LaunderingOperation> launderingOperations = val.LaunderingOperations; for (int j = 0; j < launderingOperations.Count; j++) { LaunderingOperation val2 = launderingOperations[j]; if (val2 != null) { num2 += val2.amount; int num4 = val2.completionTime_Minutes - val2.minutesSinceStarted; if (num4 > num3) { num3 = num4; } } } } } bool flag3 = num2 > 0f; if ((Object)(object)_ui.ExpectedBalanceText != (Object)null) { if (flag3) { int num5 = num3 / 60; int value = num3 % 60; string value2 = ((num5 > 0) ? $"{num5}h" : $"{value}m"); float value3 = onlineBalance + num2; string value4 = "#5EFF5E"; _ui.ExpectedBalanceText.text = $"{value2} <color={value4}>» ${value3:N0}</color>"; } else { _ui.ExpectedBalanceText.text = $"<color=#FFFFFF80>${onlineBalance:N0}</color>"; } } } private void OnStartOperationClicked() { OperationsView operationsView = _ui.OperationsView; if (Time.time - _lastAddButtonClickTime < 2f) { if ((Object)(object)operationsView?.StartOperationButtonText != (Object)null) { operationsView.StartOperationButtonText.text = "..."; } return; } if (operationsView?.BusinessDropdown == null || operationsView?.AmountInput == null) { MelonLogger.Error("OperationsView components are null"); return; } int value = operationsView.BusinessDropdown.value; if (value < 0 || value >= _ownedBusinesses.Count) { MelonLogger.Warning("invalid business selection"); return; } Business val = _ownedBusinesses[value]; if (!int.TryParse(operationsView.AmountInput.text, out var result) || result < 100) { MelonLogger.Warning("invalid amount"); return; } MoneyManager instance = NetworkSingleton<MoneyManager>.Instance; if (instance == null) { MelonLogger.Error("MoneyManager is null"); return; } int maxLaunderAmount = GetMaxLaunderAmount(value); if (result > maxLaunderAmount) { MelonLogger.Warning($"amount={result} exceeds max={maxLaunderAmount}"); return; } try { instance.ChangeCashBalance((float)(-result), true, true); val.StartLaunderingOperation((float)result, 0); _lastAddButtonClickTime = Time.time; if ((Object)(object)operationsView?.StartOperationButtonText != (Object)null) { operationsView.StartOperationButtonText.text = "..."; } VariableDatabase instance2 = NetworkSingleton<VariableDatabase>.Instance; if (instance2 != null) { float value2 = instance2.GetValue<float>("LaunderingOperationsStarted"); instance2.SetVariableValue("LaunderingOperationsStarted", (value2 + 1f).ToString(), true); } _businessView.RefreshBusinessList(); } catch (Exception value3) { MelonLogger.Error($"start operation failed, error={value3}"); } } public void Open() { if (!_isOpen && Phone.ActiveApp == null) { _isOpen = true; _ui.AppContainer.SetActive(true); Phone.ActiveApp = _ui.AppContainer; PlayerSingleton<HomeScreen>.Instance.SetIsOpen(false); PlayerSingleton<AppsCanvas>.Instance.SetIsOpen(true); PlayerSingleton<Phone>.Instance.SetIsHorizontal(false); PlayerSingleton<Phone>.Instance.SetLookOffsetMultiplier(1f); _businessView.InvalidateCache(); _businessView.RefreshBusinessList(); PopulateBusinessDropdown(); } } public void Close() { if (_isOpen) { _isOpen = false; if ((Object)(object)_ui.AppContainer != (Object)null) { _ui.AppContainer.SetActive(false); } if ((Object)(object)Phone.ActiveApp == (Object)(object)_ui.AppContainer) { Phone.ActiveApp = null; } if (PlayerSingleton<HomeScreen>.InstanceExists) { PlayerSingleton<HomeScreen>.Instance.SetIsOpen(true); } if (PlayerSingleton<Phone>.InstanceExists) { PlayerSingleton<Phone>.Instance.SetIsHorizontal(false); PlayerSingleton<Phone>.Instance.SetLookOffsetMultiplier(1f); } } } public void Cleanup() { Close(); OperationsView operationsView = _ui.OperationsView; if (operationsView != null) { Button startOperationButton = operationsView.StartOperationButton; if (startOperationButton != null) { ((UnityEventBase)startOperationButton.onClick).RemoveAllListeners(); } } OperationsView operationsView2 = _ui.OperationsView; if (operationsView2 != null) { InputField amountInput = operationsView2.AmountInput; if (amountInput != null) { ((UnityEventBase)amountInput.onValueChanged).RemoveAllListeners(); } } OperationsView operationsView3 = _ui.OperationsView; if (operationsView3 != null) { InputField amountInput2 = operationsView3.AmountInput; if (amountInput2 != null) { ((UnityEventBase)amountInput2.onEndEdit).RemoveAllListeners(); } } OperationsView operationsView4 = _ui.OperationsView; if (operationsView4 != null) { Dropdown businessDropdown = operationsView4.BusinessDropdown; if (businessDropdown != null) { ((UnityEventBase)businessDropdown.onValueChanged).RemoveAllListeners(); } } OperationsView operationsView5 = _ui.OperationsView; if (operationsView5 != null) { Button maxButton = operationsView5.MaxButton; if (maxButton != null) { ((UnityEventBase)maxButton.onClick).RemoveAllListeners(); } } if (PlayerSingleton<Phone>.InstanceExists) { Phone instance = PlayerSingleton<Phone>.Instance; instance.closeApps -= Action.op_Implicit((Action)Close); } _ownedBusinesses.Clear(); } private void OnExitAction(ExitAction exit) { if (exit != null && !exit.Used && _isOpen && PlayerSingleton<Phone>.InstanceExists && PlayerSingleton<Phone>.Instance.IsOpen) { exit.Used = true; Close(); } } public void Update() { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Invalid comparison between Unknown and I4 //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) CheckAutoLaunder(); bool flag = PlayerSingleton<Phone>.InstanceExists && PlayerSingleton<Phone>.Instance.IsOpen; if (_isOpen && flag && !_wasPhoneOpen) { _businessView.InvalidateCache(); PopulateBusinessDropdown(); } _wasPhoneOpen = flag; if (!_isOpen) { return; } _businessView?.UpdatePauseIconPulse(); _businessView?.UpdateAutoIconRotation(); if ((Object)(object)_ui.BusinessListScroll != (Object)null && Input.mouseScrollDelta.y != 0f) { _ui.BusinessListScroll.movementType = (MovementType)2; } else if ((Object)(object)_ui.BusinessListScroll != (Object)null && (int)_ui.BusinessListScroll.movementType == 2) { _ui.BusinessListScroll.movementType = (MovementType)1; } if (PlayerSingleton<Phone>.Instance.IsOpen && IsHoveringHomeButton() && GameInput.GetButtonDown((ButtonCode)0)) { Close(); } OperationsView operationsView = _ui.OperationsView; if (Time.time - _lastRefreshTime >= 0.1f) { _lastRefreshTime = Time.time; bool flag2 = _businessView.RefreshBusinessList(); if ((Object)(object)_ui.OperationsFormContainer != (Object)null) { _ui.OperationsFormContainer.SetActive(flag2); } if (flag2 && (Object)(object)operationsView?.BusinessDropdown != (Object)null) { UpdateCapacityDisplay(operationsView.BusinessDropdown.value); } UpdateBalanceSummary(); if (flag2) { EnforceAutoCapAmount(); } if ((Object)(object)operationsView?.MaxButton != (Object)null) { bool value = Settings.AutoCapAmount.Value; ((Component)operationsView.MaxButton).gameObject.SetActive(!value); Button startOperationButton = operationsView.StartOperationButton; RectTransform val = ((startOperationButton != null) ? ((Component)startOperationButton).GetComponent<RectTransform>() : null); if (val != null) { float num = (value ? 0.02f : 0.53f); val.anchorMin = new Vector2(num, val.anchorMin.y); } } } if ((Object)(object)operationsView?.StartOperationButtonText != (Object)null && operationsView.StartOperationButtonText.text == "..." && Time.time - _lastAddButtonClickTime >= 2f) { operationsView.StartOperationButtonText.text = "Add"; } } private void EnforceAutoCapAmount() { OperationsView operationsView = _ui.OperationsView; if (Settings.AutoCapAmount.Value && !((Object)(object)operationsView?.AmountInput == (Object)null) && !((Object)(object)operationsView?.BusinessDropdown == (Object)null)) { int value = operationsView.BusinessDropdown.value; int maxLaunderAmount = GetMaxLaunderAmount(value); string text = Mathf.Max(100, maxLaunderAmount).ToString(); if (operationsView.AmountInput.text != text) { operationsView.AmountInput.text = text; } } } private static bool IsHoveringHomeButton() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (Physics.Raycast(Singleton<GameplayMenu>.Instance.OverlayCamera.ScreenPointToRay(Input.mousePosition), ref val, 2f, 1 << LayerMask.NameToLayer("Overlay"))) { return ((Object)((Component)((RaycastHit)(ref val)).collider).gameObject).name == "Button"; } return false; } } } namespace LaundryApp.App { public static class Constants { public const float REFRESH_INTERVAL = 0.1f; public const int HEADER_FONT_SIZE = 48; public const int BUSINESS_NAME_FONT_SIZE = 44; public const int CAPACITY_FONT_SIZE = 36; public const int OPERATION_FONT_SIZE = 38; public const int MESSAGE_FONT_SIZE = 34; public const float BUSINESS_NAME_HEIGHT = 50f; public const float CAPACITY_HEIGHT = 40f; public const float OPERATION_HEIGHT = 50f; public const float BUSINESS_SPACING = 14f; public const float OPERATIONS_TOP_SPACING = 6f; public const float BUSINESS_INFO_PADDING = 8f; public const float CIRCLE_SIZE = 40f; public const float CIRCLE_LEFT_OFFSET = 25f; public const int CIRCLE_TEXTURE_SIZE = 64; public const float CIRCLE_TEXTURE_RADIUS = 30f; public static readonly Color32 BACKGROUND_COLOR = new Color32((byte)20, (byte)20, (byte)20, byte.MaxValue); public static readonly Color32 BUSINESS_BACKGROUND_COLOR = new Color32((byte)40, (byte)40, (byte)40, byte.MaxValue); public static readonly Color32 CIRCLE_BACKGROUND_COLOR = new Color32((byte)10, (byte)10, (byte)10, byte.MaxValue); public static readonly Color CIRCLE_PROGRESS_START = new Color(0.9f, 0.2f, 0.2f, 1f); public static readonly Color CIRCLE_PROGRESS_MID = new Color(1f, 0.6f, 0.2f, 1f); public static readonly Color CIRCLE_PROGRESS_END = new Color(0.3f, 0.9f, 0.3f, 1f); public static readonly Color32 BUTTON_BACKGROUND_COLOR = new Color32(byte.MaxValue, (byte)184, (byte)93, byte.MaxValue); public static readonly Color32 MAX_BUTTON_BACKGROUND_COLOR = new Color32((byte)33, (byte)33, (byte)33, byte.MaxValue); public static readonly Color32 BUTTON_DISABLED_COLOR = new Color32(byte.MaxValue, (byte)103, (byte)93, byte.MaxValue); public static readonly Color32 BUTTON_TEXT_COLOR = new Color32((byte)0, (byte)0, (byte)0, byte.MaxValue); public static readonly Color32 WHITE_TEXT_COLOR = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue); public static readonly Color32 PLACEHOLDER_TEXT_COLOR = new Color32((byte)60, (byte)60, (byte)60, byte.MaxValue); public static readonly Color32 INPUT_BACKGROUND_COLOR = new Color32((byte)43, (byte)43, (byte)43, byte.MaxValue); public const string COLOR_LIGHT_GREEN = "#5EFF5E"; public const string COLOR_LIGHT_ORANGE = "#FFB85D"; public const string COLOR_ONLINE_BALANCE_BLUE = "#4CBFFF"; public const float SUMMARY_ROW_HEIGHT = 50f; public const int SUMMARY_FONT_SIZE = 32; public const float PAUSE_ICON_SIZE = 48f; public const float PAUSE_ICON_OFFSET = 4f; public const float PAUSE_PULSE_SPEED = 4f; public const float PAUSE_PULSE_MIN_ALPHA = 0.3f; public const string PAUSE_ICON_FILENAME = "pauseicon.png"; public const string AUTO_ICON_FILENAME = "autoicon.png"; public const float AUTO_ICON_SIZE = 48f; public const float AUTO_ICON_OFFSET = 4f; public const float AUTO_ICON_ROTATE_SPEED = 50f; public const string APP_NAME = "Laundry"; public const string APP_TITLE = "Laundry Operations"; public const string ICON_FILENAME = "appicon.png"; public const string LOGO_FILENAME = "applogo.png"; public const string NO_BUSINESSES_MESSAGE = "No businesses available"; public const string NO_OPERATIONS_MESSAGE = "No ongoing operations"; public const int MIN_LAUNDER_AMOUNT = 100; public const int INPUT_CHARACTER_LIMIT = 7; public const string ICON_OBJECT_NAME = "LaundryAppIcon"; public const string CONTAINER_OBJECT_NAME = "LaundryApp"; public const string DEALER_APP_NAME = "DealerManagement"; public const string DELIVERY_APP_NAME = "Delivery"; public const string PRODUCT_MANAGER_APP_NAME = "ProductManager"; public const string COUNTEROFFER_APP_NAME = "Counteroffer"; public static Font ArialFont { get; } = Resources.GetBuiltinResource<Font>("Arial.ttf"); } public class UI { public GameObject OperationsFormContainer { get; private set; } public GameObject AppContainer { get; private set; } public Text HeaderText { get; private set; } public GameObject BusinessListContainer { get; private set; } public Sprite CircleSprite { get; private set; } public OperationsView OperationsView { get; private set; } public Text BalanceText { get; private set; } public Text ExpectedBalanceText { get; private set; } public GameObject BalanceSummaryRow { get; private set; } public RectTransform BusinessListScrollRect { get; private set; } public ScrollRect BusinessListScroll { get; private set; } public void Initialize() { CreateCircleSprite(); CreateAppIcon(); CreateAppUI(); } private void CreateCircleSprite() { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_00a0: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(64, 64); Color[] array = (Color[])(object)new Color[4096]; Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(32f, 32f); for (int i = 0; i < 64; i++) { for (int j = 0; j < 64; j++) { float num = Vector2.Distance(new Vector2((float)j, (float)i), val2); array[i * 64 + j] = ((num <= 30f) ? Color.white : Color.clear); } } val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array)); val.Apply(); CircleSprite = Sprite.Create(val, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f)); } private static void CreateAppIcon() { //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) HomeScreen instance = PlayerSingleton<HomeScreen>.Instance; if (instance == null) { MelonLogger.Error("UI: HomeScreen not found"); return; } RectTransform appIconContainer = instance.appIconContainer; GameObject appIconPrefab = instance.appIconPrefab; if (appIconContainer == null || appIconPrefab == null) { MelonLogger.Error("UI: icon container or prefab is null"); return; } GameObject obj = Object.Instantiate<GameObject>(appIconPrefab, ((Component)appIconContainer).transform); ((Object)obj).name = "LaundryAppIcon"; Transform obj2 = obj.transform.Find("Label"); Text val = ((obj2 != null) ? ((Component)obj2).GetComponent<Text>() : null); if (val != null) { val.text = "Laundry"; } Transform obj3 = obj.transform.Find("Mask/Image"); Image val2 = ((obj3 != null) ? ((Component)obj3).GetComponent<Image>() : null); if (val2 != null) { Sprite val3 = LoadEmbeddedSprite("appicon.png"); val2.sprite = val3 ?? val2.sprite; if (val3 == null) { ((Graphic)val2).color = Color32.op_Implicit(new Color32((byte)45, (byte)45, (byte)45, byte.MaxValue)); } } Transform val4 = obj.transform.Find("Notifications"); if (val4 != null) { ((Component)val4).gameObject.SetActive(false); } MelonLogger.Msg("UI: app icon created"); } public static void RegisterIconClickHandler(Action onClickHandler) { if (onClickHandler == null) { MelonLogger.Error("UI: icon click handler is null"); return; } HomeScreen instance = PlayerSingleton<HomeScreen>.Instance; if (instance == null) { MelonLogger.Error("UI: HomeScreen instance is null"); return; } Transform val = ((Component)instance.appIconContainer).transform.Find("LaundryAppIcon"); if (val == null) { MelonLogger.Error("UI: icon transform not found"); return; } Button component = ((Component)val).GetComponent<Button>(); if (component != null) { ((UnityEventBase)component.onClick).RemoveAllListeners(); ((UnityEvent)component.onClick).AddListener(UnityAction.op_Implicit((Action)onClickHandler.Invoke)); } } private void CreateAppUI() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) AppsCanvas instance = PlayerSingleton<AppsCanvas>.Instance; if (instance != null) { AppContainer = new GameObject("LaundryApp"); AppContainer.transform.SetParent(((Component)instance.canvas).transform, false); Transform val = ((Component)instance.canvas).transform.Find("DealerManagement"); if (val != null) { RectTransform component = ((Component)val).GetComponent<RectTransform>(); RectTransform obj = AppContainer.AddComponent<RectTransform>(); obj.anchorMin = component.anchorMin; obj.anchorMax = component.anchorMax; obj.anchoredPosition = component.anchoredPosition; obj.sizeDelta = component.sizeDelta; obj.pivot = component.pivot; ((Transform)obj).localScale = ((Transform)component).localScale; ((Transform)obj).localRotation = ((Transform)component).localRotation; } else { RectTransform obj2 = AppContainer.AddComponent<RectTransform>(); obj2.anchorMin = Vector2.zero; obj2.anchorMax = Vector2.one; obj2.offsetMin = Vector2.zero; obj2.offsetMax = Vector2.zero; MelonLogger.Warning("UI: DealerManagement not found, using fallback RectTransform"); } CreateBackground(); CreateHeader(); CreateOperationsFormContainer(); CreateBalanceSummaryRow(); CreateBusinessListContainer(); AppContainer.SetActive(false); MelonLogger.Msg("UI: app UI created"); } } private void CreateBackground() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Background"); val.transform.SetParent(AppContainer.transform, false); RectTransform obj = val.AddComponent<RectTransform>(); obj.anchorMin = Vector2.zero; obj.anchorMax = Vector2.one; obj.offsetMin = Vector2.zero; obj.offsetMax = Vector2.zero; ((Graphic)val.AddComponent<Image>()).color = Color32.op_Implicit(Constants.BACKGROUND_COLOR); } private void CreateHeader() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Header"); val.transform.SetParent(AppContainer.transform, false); RectTransform obj = val.AddComponent<RectTransform>(); obj.anchorMin = new Vector2(0.05f, 0.9f); obj.anchorMax = new Vector2(0.95f, 0.97f); obj.offsetMin = Vector2.zero; obj.offsetMax = Vector2.zero; Sprite val2 = LoadEmbeddedSprite("applogo.png"); if (val2 != null) { Image obj2 = val.AddComponent<Image>(); obj2.sprite = val2; obj2.preserveAspect = true; ((Graphic)obj2).raycastTarget = false; } else { HeaderText = val.AddComponent<Text>(); HeaderText.fontSize = 48; HeaderText.alignment = (TextAnchor)1; ((Graphic)HeaderText).color = Color.white; HeaderText.font = Constants.ArialFont; HeaderText.fontStyle = (FontStyle)1; HeaderText.text = "Laundry Operations"; } } private void CreateOperationsFormContainer() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) OperationsFormContainer = new GameObject("OperationsForm"); OperationsFormContainer.transform.SetParent(AppContainer.transform, false); RectTransform obj = OperationsFormContainer.AddComponent<RectTransform>(); obj.anchorMin = new Vector2(0.08f, 0.8f); obj.anchorMax = new Vector2(0.92f, 0.89f); obj.offsetMin = new Vector2(-11f, 0f); obj.offsetMax = Vector2.zero; OperationsView = new OperationsView(OperationsFormContainer); } private void CreateBalanceSummaryRow() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Expected O, but got Unknown //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) BalanceSummaryRow = new GameObject("BalanceSummary"); GameObject balanceSummaryRow = BalanceSummaryRow; balanceSummaryRow.transform.SetParent(AppContainer.transform, false); RectTransform obj = balanceSummaryRow.AddComponent<RectTransform>(); obj.anchorMin = new Vector2(0.08f, 0.75f); obj.anchorMax = new Vector2(0.92f, 0.79f); obj.offsetMin = Vector2.zero; obj.offsetMax = Vector2.zero; GameObject val = new GameObject("BalanceText"); val.transform.SetParent(balanceSummaryRow.transform, false); RectTransform obj2 = val.AddComponent<RectTransform>(); obj2.anchorMin = new Vector2(0.03f, 0f); obj2.anchorMax = new Vector2(0.4f, 1f); obj2.offsetMin = Vector2.zero; obj2.offsetMax = Vector2.zero; BalanceText = val.AddComponent<Text>(); BalanceText.font = Constants.ArialFont; BalanceText.fontSize = 32; BalanceText.alignment = (TextAnchor)3; ((Graphic)BalanceText).color = Color.white; BalanceText.supportRichText = true; BalanceText.text = ""; GameObject val2 = new GameObject("ExpectedBalanceText"); val2.transform.SetParent(balanceSummaryRow.transform, false); RectTransform obj3 = val2.AddComponent<RectTransform>(); obj3.anchorMin = new Vector2(0.3f, 0f); obj3.anchorMax = new Vector2(0.97f, 1f); obj3.offsetMin = Vector2.zero; obj3.offsetMax = Vector2.zero; ExpectedBalanceText = val2.AddComponent<Text>(); ExpectedBalanceText.font = Constants.ArialFont; ExpectedBalanceText.fontSize = 32; ExpectedBalanceText.alignment = (TextAnchor)5; ((Graphic)ExpectedBalanceText).color = Color.white; ExpectedBalanceText.supportRichText = true; ExpectedBalanceText.text = ""; } private void CreateBusinessListContainer() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Expected O, but got Unknown //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("BusinessListScroll"); val.transform.SetParent(AppContainer.transform, false); BusinessListScrollRect = val.AddComponent<RectTransform>(); BusinessListScrollRect.anchorMin = new Vector2(0.08f, 0f); BusinessListScrollRect.anchorMax = new Vector2(0.92f, 0.74f); BusinessListScrollRect.offsetMin = Vector2.zero; BusinessListScrollRect.offsetMax = Vector2.zero; GameObject val2 = new GameObject("Viewport"); val2.transform.SetParent(val.transform, false); RectTransform val3 = val2.AddComponent<RectTransform>(); val3.anchorMin = Vector2.zero; val3.anchorMax = Vector2.one; val3.offsetMin = Vector2.zero; val3.offsetMax = Vector2.zero; ((Graphic)val2.AddComponent<Image>()).color = Color.white; val2.AddComponent<Mask>().showMaskGraphic = false; GameObject val4 = new GameObject("Content"); val4.transform.SetParent(val2.transform, false); RectTransform val5 = val4.AddComponent<RectTransform>(); val5.anchorMin = new Vector2(0f, 1f); val5.anchorMax = new Vector2(1f, 1f); val5.pivot = new Vector2(0.5f, 1f); val5.sizeDelta = new Vector2(0f, 0f); ScrollRect val6 = val.AddComponent<ScrollRect>(); val6.horizontal = false; val6.vertical = true; val6.movementType = (MovementType)1; val6.scrollSensitivity = 10f; val6.viewport = val3; val6.content = val5; BusinessListScroll = val6; BusinessListContainer = val4; } private static Sprite LoadEmbeddedSprite(string filename) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) try { Assembly executingAssembly = Assembly.GetExecutingAssembly(); string text = "LaundryApp.Assets." + filename; using Stream stream = executingAssembly.GetManifestResourceStream(text); if (stream == null) { MelonLogger.Warning("UI: embedded resource not found, name=" + text); return null; } byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); ImageConversion.LoadImage(val, Il2CppStructArray<byte>.op_Implicit(array)); if (((Texture)val).width == 2 && ((Texture)val).height == 2) { MelonLogger.Error("UI: failed to load texture, name=" + text); return null; } ((Texture)val).filterMode = (FilterMode)1; ((Texture)val).wrapMode = (TextureWrapMode)1; return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f); } catch (Exception ex) { MelonLogger.Error("UI: error loading sprite, file=" + filename + ", error=" + ex.Message); return null; } } } public class BusinessView { private class CachedOperation { public GameObject Root; public Text AmountText; public Text TimeText; public Image ForegroundCircleImage; } private class CachedBusiness { public GameObject Root; public Text CapacityText; public GameObject PauseIcon; public Image PauseIconImage; public GameObject AutoIcon; public RectTransform AutoIconRect; public List<CachedOperation> Operations; public int OperationCount; public float Height; } private readonly GameObject _businessListContainer = businessListContainer ?? throw new ArgumentNullException("businessListContainer"); private readonly Sprite _circleSprite = circleSprite ?? throw new ArgumentNullException("circleSprite"); private readonly Action<int> _onBusinessClicked; private readonly Sprite _pauseSprite; private readonly Sprite _autoSprite; private readonly List<CachedBusiness> _cachedBusinesses; private int _cachedBusinessCount; private GameObject _noBusinessesMessage; private bool _lastShowProgressCircle; private bool _lastShowPauseIcon; private bool _lastShowAutoLaunder; public BusinessView(GameObject businessListContainer, Sprite circleSprite, Action<int> onBusinessClicked = null) { _onBusinessClicked = onBusinessClicked; _pauseSprite = LoadEmbeddedSprite("pauseicon.png"); _autoSprite = LoadEmbeddedSprite("autoicon.png"); _cachedBusinesses = new List<CachedBusiness>(); base..ctor(); } public bool RefreshBusinessList() { try { List<Business> ownedBusinesses = Business.OwnedBusinesses; if (ownedBusinesses == null || ownedBusinesses.Count == 0) { if (_cachedBusinesses.Count > 0) { ClearBusinessList(); } EnsureNoBusinessesMessage(); return false; } if (_noBusinessesMessage != null) { Object.Destroy((Object)(object)_noBusinessesMessage); _noBusinessesMessage = null; } if (NeedsFullRebuild(ownedBusinesses)) { ClearBusinessList(); RenderBusinessListCached(ownedBusinesses); Canvas.ForceUpdateCanvases(); } else { UpdateOrRebuildBusinesses(ownedBusinesses); } return true; } catch (Exception ex) { DisplayError(ex.Message); MelonLogger.Error("BusinessView: error=" + ex.Message); return false; } } private bool NeedsFullRebuild(List<Business> ownedBusinesses) { if (ownedBusinesses.Count != _cachedBusinessCount) { return true; } if (_cachedBusinesses.Count == 0) { return true; } if (_cachedBusinesses[0].Root == null) { return true; } if (Settings.ShowProgressCircle.Value != _lastShowProgressCircle || Settings.ShowPauseIcon.Value != _lastShowPauseIcon || Settings.AutoLaunderMorning.Value != _lastShowAutoLaunder) { return true; } return false; } private void UpdateOrRebuildBusinesses(List<Business> ownedBusinesses) { bool flag = false; for (int i = 0; i < ownedBusinesses.Count; i++) { Business val = ownedBusinesses[i]; if (val != null) { CachedBusiness cachedBusiness = _cachedBusinesses[i]; if (CountValidOperations(val.LaunderingOperations) != cachedBusiness.OperationCount) { RebuildSingleBusiness(i, val); flag = true; } else { UpdateBusinessValues(i, val); } } } if (flag) { RepositionBusinesses(); } UpdateContentHeight(); } private void UpdateBusinessValues(int index, Business business) { CachedBusiness cachedBusiness = _cachedBusinesses[index]; cachedBusiness.CapacityText.text = FormatCapacityString(business); bool active = NetworkSingleton<TimeManager>.InstanceExists && NetworkSingleton<TimeManager>.Instance.CurrentTime == 400 && _pauseSprite != null && Settings.ShowPauseIcon.Value; if (cachedBusiness.PauseIcon != null) { cachedBusiness.PauseIcon.SetActive(active); } if (cachedBusiness.AutoIcon != null) { cachedBusiness.AutoIcon.SetActive(Settings.AutoLaunderMorning.Value); } List<LaunderingOperation> launderingOperations = business.LaunderingOperations; int num = 0; for (int i = 0; i < launderingOperations.Count; i++) { LaunderingOperation val = launderingOperations[i]; if (val != null) { if (num >= cachedBusiness.Operations.Count) { break; } UpdateOperationValues(cachedBusiness.Operations[num], val); num++; } } } private static void UpdateOperationValues(CachedOperation cachedOp, LaunderingOperation op) { //IL_0083: Unknown result type (might be due to invalid IL or missing references) int num = op.completionTime_Minutes - op.minutesSinceStarted; int hours = num / 60; int mins = num % 60; cachedOp.AmountText.text = $"${op.amount:F0}"; cachedOp.TimeText.text = FormatTimeString(hours, mins); if (cachedOp.ForegroundCircleImage != null) { float operationProgress = GetOperationProgress(op); cachedOp.ForegroundCircleImage.fillAmount = operationProgress; ((Graphic)cachedOp.ForegroundCircleImage).color = GetProgressColor(operationProgress); } } private void RebuildSingleBusiness(int index, Business business) { CachedBusiness cachedBusiness = _cachedBusinesses[index]; if (cachedBusiness.Root != null) { Object.Destroy((Object)(object)cachedBusiness.Root); } CachedBusiness value = BuildSingleBusiness(index, business); _cachedBusinesses[index] = value; } private void RepositionBusinesses() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) float num = 0f; for (int i = 0; i < _cachedBusinesses.Count; i++) { CachedBusiness cachedBusiness = _cachedBusinesses[i]; if (cachedBusiness.Root != null) { cachedBusiness.Root.GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, num); num -= cachedBusiness.Height; } } } public void InvalidateCache() { _cachedBusinessCount = -1; } public void UpdatePauseIconPulse() { //IL_0076: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Lerp(0.3f, 1f, (Mathf.Sin(Time.time * 4f) + 1f) * 0.5f); for (int i = 0; i < _cachedBusinesses.Count; i++) { CachedBusiness cachedBusiness = _cachedBusinesses[i]; if (cachedBusiness.PauseIcon != null && cachedBusiness.PauseIcon.activeSelf && (Object)(object)cachedBusiness.PauseIconImage != (Object)null) { ((Graphic)cachedBusiness.PauseIconImage).color = new Color(1f, 1f, 1f, num); } } } public void UpdateAutoIconRotation() { for (int i = 0; i < _cachedBusinesses.Count; i++) { CachedBusiness cachedBusiness = _cachedBusinesses[i]; if (cachedBusiness.AutoIcon != null && cachedBusiness.AutoIcon.activeSelf && (Object)(object)cachedBusiness.AutoIconRect != (Object)null) { ((Transform)cachedBusiness.AutoIconRect).Rotate(0f, 0f, -50f * Time.deltaTime); } } } private void ClearBusinessList() { for (int num = _businessListContainer.transform.childCount - 1; num >= 0; num--) { Object.Destroy((Object)(object)((Component)_businessListContainer.transform.GetChild(num)).gameObject); } _cachedBusinesses.Clear(); _cachedBusinessCount = 0; } private void EnsureNoBusinessesMessage() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) if (_noBusinessesMessage == null) { _noBusinessesMessage = new GameObject("NoBusinesses"); _noBusinessesMessage.transform.SetParent(_businessListContainer.transform, false); RectTransform obj = _noBusinessesMessage.AddComponent<RectTransform>(); obj.anchorMin = new Vector2(0f, 1f); obj.anchorMax = new Vector2(1f, 1f); obj.pivot = new Vector2(0.5f, 1f); obj.sizeDelta = new Vector2(0f, 50f); obj.anchoredPosition = new Vector2(0f, -60f); Text obj2 = _noBusinessesMessage.AddComponent<Text>(); obj2.text = "No businesses available"; obj2.fontSize = 34; obj2.alignment = (TextAnchor)4; ((Graphic)obj2).color = Color.white; obj2.font = Constants.ArialFont; } } private void DisplayError(string errorMessage) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_006c: 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) ClearBusinessList(); GameObject val = new GameObject("Error"); val.transform.SetParent(_businessListContainer.transform, false); RectTransform obj = val.AddComponent<RectTransform>(); obj.anchorMin = new Vector2(0f, 0.5f); obj.anchorMax = new Vector2(1f, 0.5f); obj.sizeDelta = new Vector2(0f, 50f); obj.anchoredPosition = Vector2.zero; Text obj2 = val.AddComponent<Text>(); obj2.text = "Error: " + errorMessage; obj2.fontSize = 34; obj2.alignment = (TextAnchor)4; ((Graphic)obj2).color = Color.red; obj2.font = Constants.ArialFont; } private void RenderBusinessListCached(List<Business> ownedBusinesses) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) _lastShowProgressCircle = Settings.ShowProgressCircle.Value; _lastShowPauseIcon = Settings.ShowPauseIcon.Value; _lastShowAutoLaunder = Settings.AutoLaunderMorning.Value; float num = 0f; for (int i = 0; i < ownedBusinesses.Count; i++) { Business val = ownedBusinesses[i]; if (val != null) { CachedBusiness cachedBusiness = BuildSingleBusiness(i, val); _cachedBusinesses.Add(cachedBusiness); cachedBusiness.Root.GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, num); num -= cachedBusiness.Height; } } _cachedBusinessCount = ownedBusinesses.Count; UpdateContentHeight(); } private void UpdateContentHeight() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) float num = 0f; for (int i = 0; i < _cachedBusinesses.Count; i++) { num += _cachedBusinesses[i].Height; } RectTransform component = _businessListContainer.GetComponent<RectTransform>(); component.sizeDelta = new Vector2(component.sizeDelta.x, num); } private CachedBusiness BuildSingleBusiness(int index, Business business) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject($"Business_{index}"); val.transform.SetParent(_businessListContainer.transform, false); RectTransform obj = val.AddComponent<RectTransform>(); obj.anchorMin = new Vector2(0f, 1f); obj.anchorMax = new Vector2(1f, 1f); obj.pivot = new Vector2(0.5f, 1f); float height = 0f; Text capacityText = CreateBusinessInfo(index, business, val, ref height); GameObject val2 = null; Image iconImage = null; if (_pauseSprite != null) { val2 = CreatePauseIcon(((Component)val.transform.Find("BusinessInfo")).gameObject, out iconImage); bool flag = NetworkSingleton<TimeManager>.InstanceExists && NetworkSingleton<TimeManager>.Instance.CurrentTime == 400; val2.SetActive(flag && Settings.ShowPauseIcon.Value); } GameObject val3 = null; if (_autoSprite != null) { val3 = CreateAutoIcon(((Component)val.transform.Find("BusinessInfo")).gameObject); val3.SetActive(Settings.AutoLaunderMorning.Value); } height += 6f; List<LaunderingOperation> launderingOperations = business.LaunderingOperations; List<CachedOperation> operations = CreateOperationsListCached(launderingOperations, val, ref height); height += 14f; obj.sizeDelta = new Vector2(0f, height); CachedBusiness obj2 = new CachedBusiness { Root = val, CapacityText = capacityText, PauseIcon = val2, PauseIconImage = iconImage, AutoIcon = val3 }; object autoIconRect; if (val3 == null) { autoIconRect = null; } else { Transform obj3 = val3.transform.Find("Icon"); autoIconRect = ((obj3 != null) ? ((Component)obj3).GetComponent<RectTransform>() : null); } obj2.AutoIconRect = (RectTransform)autoIconRect; obj2.Operations = operations; obj2.OperationCount = CountValidOperations(launderingOperations); obj2.Height = height; return obj2; } private Text CreateBusinessInfo(int index, Business business, GameObject parent, ref float height) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_003b: 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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("BusinessInfo"); val.transform.SetParent(parent.transform, false); RectTransform obj = val.AddComponent<RectTransform>(); obj.anchorMin = new Vector2(0f, 1f); obj.anchorMax = new Vector2(1f, 1f); obj.pivot = new Vector2(0.5f, 1f); obj.sizeDelta = new Vector2(0f, 106f); obj.anchoredPosition = new Vector2(0f, 0f - height); Image val2 = val.AddComponent<Image>(); ((Graphic)val2).color = Color32.op_Implicit(Constants.BUSINESS_BACKGROUND_COLOR); if (_onBusinessClicked != null) { Button obj2 = val.AddComponent<Button>(); ((Selectable)obj2).targetGraphic = (Graphic)(object)val2; ((Selectable)obj2).transition = (Transition)1; ColorBlock colors = ((Selectable)obj2).colors; ((ColorBlock)(ref colors)).normalColor = Color.white; ((ColorBlock)(ref colors)).highlightedColor = new Color(1.3f, 1.3f, 1.3f, 1f); ((ColorBlock)(ref colors)).pressedColor = new Color(1.3f, 1.3f, 1.3f, 1f); ((ColorBlock)(ref colors)).selectedColor = new Color(1.3f, 1.3f, 1.3f, 1f); ((ColorBlock)(ref colors)).fadeDuration = 0.1f; ((Selectable)obj2).colors = colors; int businessIndex = index; ((UnityEvent)obj2.onClick).AddListener(UnityAction.op_Implicit((Action)delegate { _onBusinessClicked(businessIndex); EventSystem current = EventSystem.current; if (current != null) { current.SetSelectedGameObject((GameObject)null); } })); } CreateBusinessName(((Property)business).PropertyName, val); Text result = CreateCapacityText(business, val); height += 106f; return result; } private static void CreateBusinessName(string propertyName, GameObject parent) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("BusinessName"); val.transform.SetParent(parent.transform, false); RectTransform obj = val.AddComponent<RectTransform>(); obj.anchorMin = new Vector2(0f, 1f); obj.anchorMax = new Vector2(1f, 1f); obj.pivot = new Vector2(0.5f, 1f); obj.sizeDelta = new Vector2(0f, 50f); obj.anchoredPosition = new Vector2(0f, -8f); Text obj2 = val.AddComponent<Text>(); obj2.text = propertyName; obj2.fontSize = 44; obj2.fontStyle = (FontStyle)1; obj2.alignment = (TextAnchor)4; ((Graphic)obj2).color = Color.white; obj2.font = Constants.ArialFont; } private static Text CreateCapacityText(Business business, GameObject parent) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Capacity"); val.transform.SetParent(parent.transform, false); RectTransform obj = val.AddComponent<RectTransform>(); obj.anchorMin = new Vector2(0f, 1f); obj.anchorMax = new Vector2(1f, 1f); obj.pivot = new Vector2(0.5f, 1f); obj.sizeDelta = new Vector2(0f, 40f); obj.anchoredPosition = new Vector2(0f, -58f); Text obj2 = val.AddComponent<Text>(); obj2.text = FormatCapacityString(business); obj2.fontSize = 36; obj2.alignment = (TextAnchor)4; ((Graphic)obj2).color = Color.white; obj2.font = Constants.ArialFont; obj2.supportRichText = true; return obj2; } private static string FormatCapacityString(Business business) { if (business.currentLaunderTotal >= business.LaunderCapacity) { string obj = $"<color={"#5EFF5E"}>${business.currentLaunderTotal:F0}</color>"; string text = $"<color={"#5EFF5E"}>${business.LaunderCapacity:F0}</color>"; string text2 = ((business.appliedLaunderLimit > 0f) ? $" (${business.appliedLaunderLimit:F0} left)" : ""); return obj + " / " + text + text2; } if (business.currentLaunderTotal > 0f) { string obj2 = $"<color={"#FFB85D"}>${business.currentLaunderTotal:F0}</color>"; string text3 = $"${business.LaunderCapacity:F0}"; string text4 = ((business.appliedLaunderLimit > 0f) ? $" (<color={"#FFB85D"}>${business.appliedLaunderLimit:F0}</color> left)" : ""); return obj2 + " / " + text3 + text4; } string obj3 = $"${business.currentLaunderTotal:F0}"; string text5 = $"${business.LaunderCapacity:F0}"; string text6 = ((business.appliedLaunderLimit > 0f) ? $" (<color={"#5EFF5E"}>${business.appliedLaunderLimit:F0}</color> left)" : ""); return obj3 + " / " + text5 + text6; } private static string FormatTimeString(int hours, int mins) { if (hours <= 0) { if (mins < 10) { return $"<color=#FFFFFF50>0</color>{mins}m"; } return $"{mins}m"; } string obj = ((hours < 10) ? $"<color=#FFFFFF50>0</color>{hours}h" : $"{hours}h"); string text = ((mins < 10) ? $"<color=#FFFFFF50>0</color>{mins}m" : $"{mins}m"); return obj + " " + text; } private static float GetOperationProgress(LaunderingOperation op) { int num = Math.Max(1, op.completionTime_Minutes); return (float)op.minutesSinceStarted / (float)num; } private static Color GetProgressColor(float progress) { //IL_000c: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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) if (!Settings.ProgressCircleColorLerp.Value) { return Color.white; } if (!(progress < 0.5f)) { return Color.Lerp(Constants.CIRCLE_PROGRESS_MID, Constants.CIRCLE_PROGRESS_END, (progress - 0.5f) * 2f); } return Color.Lerp(Constants.CIRCLE_PROGRESS_START, Constants.CIRCLE_PROGRESS_MID, progress * 2f); } private List<CachedOperation> CreateOperationsListCached(List<LaunderingOperation> operations, GameObject parent, ref float height) { List<CachedOperation> list = new List<CachedOperation>(); for (int i = 0; i < operations.Count; i++) { LaunderingOperation val = operations[i]; if (val != null) { CachedOperation item = CreateOperationEntryCached(val, i, parent, height); list.Add(item); height += 50f; } } if (list.Count == 0) { CreatePlaceholderEntry(parent, height); height += 50f; } return list; } private static void CreatePlaceholderEntry(GameObject parent, float yOffset) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("PlaceholderOperation"); val.transform.SetParent(parent.transform, false); RectTransform obj = val.AddComponent<RectTransform>(); obj.anchorMin = new Vector2(0f, 1f); obj.anchorMax = new Vector2(1f, 1f); obj.pivot = new Vector2(0.5f, 1f); obj.sizeDelta = new Vector2(0f, 50f); obj.anchoredPosition = new Vector2(0f, 0f - yOffset); Text obj2 = val.AddComponent<Text>(); obj2.text = "No ongoing operations"; obj2.fontSize = 38; obj2.alignment = (TextAnchor)4; ((Graphic)obj2).color = Color32.op_Implicit(Constants.PLACEHOLDER_TEXT_COLOR); obj2.font = Constants.ArialFont; } private CachedOperation CreateOperationEntryCached(LaunderingOperation op, int index, GameObject parent, float yOffset) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) int num = op.completionTime_Minutes - op.minutesSinceStarted; int hours = num / 60; int mins = num % 60; GameObject val = new GameObject($"Operation_{index}"); val.transform.SetParent(parent.transform, false); RectTransform obj = val.AddComponent<RectTransform>(); obj.anchorMin = new Vector2(0f, 1f); obj.anchorMax = new Vector2(1f, 1f); obj.pivot = new Vector2(0.5f, 1f); obj.sizeDelta = new Vector2(0f, 50f); obj.anchoredPosition = new Vector2(0f, 0f - yOffset); Image foregroundCircleImage = null; if (Settings.ShowProgressCircle.Value) { foregroundCircleImage = CreateProgressCircle(op, val); } float num2 = (Settings.ShowProgressCircle.Value ? 53f : 6f); GameObject val2 = new GameObject("AmountText"); val2.transform.SetParent(val.transform, false); RectTransform obj2 = val2.AddComponent<RectTransform>(); obj2.anchorMin = Vector2.zero; obj2.anchorMax = new Vector2(0.5f, 1f); obj2.offsetMin = new Vector2(num2, 0f); obj2.offsetMax = Vector2.zero; Text val3 = val2.AddComponent<Text>(); val3.text = $"${op.amount:F0}"; val3.fontSize = 38; val3.alignment = (TextAnchor)3; ((Graphic)val3).color = Color.white; val3.font = Constants.ArialFont; GameObject val4 = new GameObject("TimeText"); val4.transform.SetParent(val.transform, false); RectTransform obj3 = val4.AddComponent<RectTransform>(); obj3.anchorMin = new Vector2(0.5f, 0f); obj3.anchorMax = Vector2.one; obj3.offsetMin = Vector2.zero; obj3.offsetMax = new Vector2(-10f, 0f); Text val5 = val4.AddComponent<Text>(); val5.text = FormatTimeString(hours, mins); val5.fontSize = 38; val5.alignment = (TextAnchor)5; ((Graphic)val5).color = Color.white; val5.font = Constants.ArialFont; return new CachedOperation { Root = val, AmountText = val3, TimeText = val5, ForegroundCircleImage = foregroundCircleImage }; } private Image CreateProgressCircle(LaunderingOperation op, GameObject parent) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("ProgressCircle"); val.transform.SetParent(parent.transform, false); RectTransform obj = val.AddComponent<RectTransform>(); obj.anchorMin = new Vector2(0f, 0.5f); obj.anchorMax = new Vector2(0f, 0.5f); obj.pivot = new Vector2(0.5f, 0.5f); obj.sizeDelta = new Vector2(40f, 40f); obj.anchoredPosition = new Vector2(25f, 0f); CreateOutlineCircle(val); CreateBackgroundCircle(val); return CreateForegroundCircle(op, val); } private void CreateOutlineCircle(GameObject parent) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("OutlineCircle"); val.transform.SetParent(parent.transform, false); RectTransform obj = val.AddComponent<RectTransform>(); obj.anchorMin = Vector2.zero; obj.anchorMax = Vector2.one; obj.offsetMin = new Vector2(-3f, -3f); obj.offsetMax = new Vector2(3f, 3f); Image obj2 = val.AddComponent<Image>(); obj2.sprite = _circleSprite; ((Graphic)obj2).color = Color32.op_Implicit(Constants.BUSINESS_BACKGROUND_COLOR); } private void CreateBackgroundCircle(GameObject parent) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("BackgroundCircle"); val.transform.SetParent(parent.transform, false); RectTransform obj = val.AddComponent<RectTransform>(); obj.anchorMin = Vector2.zero; obj.anchorMax = Vector2.one; obj.offsetMin = Vector2.zero; obj.offsetMax = Vector2.zero; Image obj2 = val.AddComponent<Image>(); obj2.sprite = _circleSprite; ((Graphic)obj2).color = Color32.op_Implicit(Constants.CIRCLE_BACKGROUND_COLOR); } private Image CreateForegroundCircle(LaunderingOperation op, GameObject parent) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("ForegroundCircle"); val.transform.SetParent(parent.transform, false); RectTransform obj = val.AddComponent<RectTransform>(); obj.anchorMin = Vector2.zero; obj.anchorMax = Vector2.one; obj.offsetMin = Vector2.zero; obj.offsetMax = Vector2.zero; Image obj2 = val.AddComponent<Image>(); obj2.sprite = _circleSprite; obj2.type = (Type)3; obj2.fillMethod = (FillMethod)4; obj2.fillOrigin = 2; obj2.fillClockwise = true; float progress = (obj2.fillAmount = GetOperationProgress(op)); ((Graphic)obj2).color = GetProgressColor(progress); return obj2; } private GameObject CreatePauseIcon(GameObject parent, out Image iconImage) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("PauseIcon"); val.transform.SetParent(parent.transform, false); RectTransform obj = val.AddComponent<RectTransform>(); obj.anchorMin = new Vector2(1f, 1f); obj.anchorMax = new Vector2(1f, 1f); obj.pivot = new Vector2(1f, 1f); obj.sizeDelta = new Vector2(48f, 48f); obj.anchoredPosition = new Vector2(-4f, -4f); iconImage = val.AddComponent<Image>(); iconImage.sprite = _pauseSprite; ((Graphic)iconImage).color = Color.white; return val; } private GameObject CreateAutoIcon(GameObject parent) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("AutoIcon"); val.transform.SetParent(parent.transform, false); RectTransform obj = val.AddComponent<RectTransform>(); obj.anchorMin = new Vector2(0f, 1f); obj.anchorMax = new Vector2(0f, 1f); obj.pivot = new Vector2(0f, 1f); obj.sizeDelta = new Vector2(48f, 48f); obj.anchoredPosition = new Vector2(4f, -4f); GameObject val2 = new GameObject("Icon"); val2.transform.SetParent(val.transform, false); RectTransform obj2 = val2.AddComponent<RectTransform>(); obj2.anchorMin = Vector2.zero; obj2.anchorMax = Vector2.one; obj2.pivot = new Vector2(0.5f, 0.5f); obj2.offsetMin = Vector2.zero; obj2.offsetMax = Vector2.zero; Image obj3 = val2.AddComponent<Image>(); obj3.sprite = _autoSprite; ((Graphic)obj3).color = Color.white; ((Graphic)obj3).raycastTarget = false; return val; } private static int CountValidOperations(List<LaunderingOperation> operations) { int num = 0; for (int i = 0; i < operations.Count; i++) { if (operations[i] != null) { num++; } } return num; } internal static Sprite LoadEmbeddedSprite(string filename) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) try { Assembly executingAssembly = Assembly.GetExecutingAssembly(); string text = "LaundryApp.Assets." + filename; using Stream stream = executingAssembly.GetManifestResourceStream(text); if (stream == null) { MelonLogger.Warning("BusinessView: embedded icon not found, name=" + text); return null; } byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); Texture2D val = new Texture2D(2, 2); ImageConversion.LoadImage(val, Il2CppStructArray<byte>.op_Implicit(array)); return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); } catch (Exception ex) { MelonLogger.Error("BusinessView: error loading icon, file=" + filename + ", error=" + ex.Message); return null; } } } public class OperationsView { private readonly GameObject _container; public Dropdown BusinessDropdown { get; private set; } public InputField AmountInput { get; private set; } public Button MaxButton { get; private set; } public Button StartOperationButton { get; private set; } public Text StartOperationButtonText { get; private set; } public OperationsView(GameObject container) { _container = container ?? throw new ArgumentNullException("container"); CreateForm(); } private void CreateForm() { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0444: Unknown result type (might be due to invalid IL or missing references) //IL_044b: Expected O, but got Unknown //IL_046a: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_0490: Unknown result type (might be due to invalid IL or missing references) //IL_049b: Unknown result type (might be due to invalid IL or missing references) //IL_04a5: Unknown result type (might be due to invalid IL or missing references) //IL_04ba: Unknown result type (might be due to invalid IL or missing references) //IL_04bf: Unknown result type (might be due to invalid IL or missing references) //IL_04fd: Unknown result type (might be due to invalid IL or missing references) //IL_0502: Unknown result type (might be due to invalid IL or missing references) //IL_0506: Unknown result type (might be due to invalid IL or missing references) //IL_0526: Unknown result type (might be due to invalid IL or missing references) //IL_0546: Unknown result type (might be due to invalid IL or missing references) //IL_0562: Unknown result type (might be due to invalid IL or missing references) //IL_056e: Unknown result type (might be due to invalid IL or missing references) //IL_0573: Unknown result type (might be due to invalid IL or missing references) //IL_0586: Unknown result type (might be due to invalid IL or missing references) //IL_058d: Unknown result type (might be due to invalid IL or missing references) //IL_0598: Unknown result type (might be due to invalid IL or missing references) //IL_05a3: Unknown result type (might be due to invalid IL or missing references) //IL_05ad: Unknown result type (might be due to invalid IL or missing references) //IL_05e5: Unknown result type (might be due to invalid IL or missing references) //IL_05ea: Unknown result type (might be due to invalid IL or missing references) //IL_05ff: Unknown result type (might be due to invalid IL or missing references) //IL_0606: Expected O, but got Unknown //IL_0625: Unknown result type (might be due to invalid IL or missing references) //IL_063b: Unknown result type (might be due to invalid IL or missing references) //IL_0649: Unknown result type (might be due to invalid IL or missing references) //IL_0654: Unknown result type (might be due to invalid IL or missing references) //IL_065e: Unknown result type (might be due to invalid IL or missing references) //IL_0673: Unknown result type (might be due to invalid IL or missing references) //IL_0678: Unknown result type (might be due to invalid IL or missing references) //IL_06b6: Unknown result type (might be due to invalid IL or missing references) //IL_06bb: Unknown result type (might be due to invalid IL or missing references) //IL_06bf: Unknown result type (might be due to invalid IL or missing references) //IL_06df: Unknown result type (might be due to invalid IL or missing references) //IL_06ff: Unknown result type (might be due to invalid IL or missing references) //IL_071b: Unknown result type (might be due to invalid IL or missing references) //IL_0727: Unknown result type (might be due to invalid IL or missing references) //IL_072e: Expected O, but got Unknown //IL_074a: Unknown result type (might be due to invalid IL or missing references) //IL_0755: Unknown result type (might be due to invalid IL or missing references) //IL_0760: Unknown result type (might be due to invalid IL or missing references) //IL_076a: Unknown result type (might be due to invalid IL or missing references) //IL_07c8: Unknown result type (might be due to invalid IL or missing references) //IL_07cd: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03da: Unknown result type (might be due to invalid IL or missing references) //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Unknown result type (might be due to invalid IL or missing references) Font arialFont = Constants.ArialFont; float num = 0.01f; float num2 = 0.02f; float num3 = 1f; float num4 = 0.46f; float num5 = 0.98f; float num6 = 0.5f; float num7 = num2 + num6 + num; GameObject val = FindAndCloneComponent<Dropdown>("Delivery"); if (val != null) { ((Object)val).name = "BusinessDropdown"; val.transform.SetParent(_container.transform, false); val.transform.localScale = Vector3.one; RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = new Vector2(num2, num4); component.anchorMax = new Vector2(num2 + num6, num5); component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; BusinessDropdown = val.GetComponent<Dropdown>(); BusinessDropdown.ClearOptions(); StripDropdownImages(BusinessDropdown); if (BusinessDropdown.captionText != null) { ((Graphic)BusinessDropdown.captionText).color = Color.white; BusinessDropdown.captionText.resizeTextForBestFit = true; BusinessDropdown.captionText.resizeTextMinSize = 18; BusinessDropdown.captionText.resizeTextMaxSize = 30; ExpandTextToFillParent(BusinessDropdown.captionText); } if (BusinessDropdown.itemText != null) { ((Graphic)BusinessDropdown.itemText).color = Color.white; BusinessDropdown.itemText.fontSize = 28; ExpandTextToFillParent(BusinessDropdown.itemText); } } else { MelonLogger.Warning("OperationsView: failed to find Dropdown for cloning"); } GameObject val2 = FindAndCloneComponent<InputField>("ProductManager"); if (val2 == null) { val2 = FindAndCloneComponent<InputField>("Counteroffer"); } if (val2 != null) { ((Object)val2).name = "AmountInput"; val2.transform.SetParent(_container.transform, false); val2.transform.localScale = Vector3.one; RectTransform component2 = val2.GetComponent<RectTransform>(); component2.anchorMin = new Vector2(num7, num4); component2.anchorMax = new Vector2(num3, num5); component2.offsetMin = Vector2.zero; component2.offsetMax = Vector2.zero; Image component3 = val2.GetComponent<Image>(); if (component3 != null) { component3.sprite = null; ((Graphic)component3).color = Color32.op_Implicit(Constants.INPUT_BACKGROUND_COLOR); } AmountInput = val2.GetComponent<InputField>(); ((UnityEventBase)AmountInput.onValueChanged).RemoveAllListeners(); ((UnityEventBase)AmountInput.onEndEdit).RemoveAllListeners(); AmountInput.text = "100"; AmountInput.contentType = (ContentType)2; AmountInput.lineType = (LineType)0; AmountInput.characterLimit = 7; if (AmountInput.textComponent != null) { ((Graphic)AmountInput.textComponent).color = Color.white; AmountInput.textComponent.fontSize = 62; AmountInput.textComponent.alignment = (TextAnchor)3; RectTransform component4 = ((Component)AmountInput.textComponent).GetComponent<RectTransform>(); if (component4 != null) { component4.anchorMin = Vector2.zero; component4.anchorMax = Vector2.one; component4.offsetMin = new Vector2(-20f, 0f); component4.offsetMax = Vector2.zero; } } if (AmountInput.placeholder != null) { Object.Destroy((Object)(object)((Component)AmountInput.placeholder).gameObject); AmountInput.placeholder = null; } Text[] array = Il2CppArrayBase<Text>.op_Implicit(((Component)AmountInput).GetComponentsInChildren<Text>(true)); foreach (Text val3 in array) { if (val3.text.Contains('$')) { val3.text = "$"; ((Graphic)val3).color = Color.white; val3.fontSize = 62; val3.alignment = (TextAnchor)3; RectTransform component5 = ((Component)val3).GetComponent<RectTransform>(); if (component5 != null) { component5.anchorMin = Vector2.zero; component5.anchorMax = Vector2.one; component5.offsetMin = new Vector2(-40f, 0f); component5.offsetMax = Vector2.zero; } break; } } } else { MelonLogger.Warning("OperationsView: failed to find InputField for cloning"); } float num8 = 0.02f; float num9 = 0.42f; GameObject val4 = new GameObject("MaxButton"); val4.transform.SetParent(_container.transform, false); val4.transform.localScale = Vector3.one; RectTransform obj = val4.AddComponent<RectTransform>(); obj.anchorMin = new Vector2(num2, num8); obj.anchorMax = new Vector2(num2 + num6, num9); obj.offsetMin = Vector2.zero; obj.offsetMax = Vector2.zero; Image val5 = val4.AddComponent<Image>(); ((Graphic)val5).color = Color32.op_Implicit(Constants.MAX_BUTTON_BACKGROUND_COLOR); ((Graphic)val5).raycastTarget = true; MaxButton = val4.AddComponent<Button>(); ((Selectable)MaxButton).transition = (Transition)1; ((Selectable)MaxButton).targetGraphic = (Graphic)(object)val5; ColorBlock colors = ((Selectable)MaxButton).colors; ((ColorBlock)(ref colors)).normalColor = Color.white; ((ColorBlock)(ref colors)).highlightedColor = new Color(1.3f, 1.3f, 1.3f, 1f); ((ColorBlock)(ref colors)).pressedColor = new Color(0.9f, 0.9f, 0.9f, 1f); ((ColorBlock)(ref colors)).fadeDuration = 0.1f; ((Selectable)MaxButton).colors = colors; GameObject val6 = new GameObject("Text"); val6.transform.SetParent(val4.transform, false); RectTransform obj2 = val6.AddComponent<RectTransform>(); obj2.anchorMin = Vector2.zero; obj2.anchorMax = Vector2.one; obj2.offsetMin = Vector2.zero; obj2.offsetMax = Vector2.zero; Text obj3 = val6.AddComponent<Text>(); obj3.text = "Max"; obj3.font = arialFont; obj3.fontStyle = (FontStyle)1; obj3.fontSize = 30; obj3.alignment = (TextAnchor)4; ((Graphic)obj3).color = Color32.op_Implicit(Constants.WHITE_TEXT_COLOR); ((Graphic)obj3).raycastTarget = false; GameObject val7 = new GameObject("LaunderButton"); val7.transform.SetParent(_container.transform, false); val7.transform.localScale = Vector3.one; RectTransform obj4 = val7.AddComponent<RectTransform>(); obj4.anchorMin = new Vector2(num7, num8); obj4.anchorMax = new Vector2(num3, num9); obj4.offsetMin = Vector2.zero; obj4.offsetMax = Vector2.zero; Image val8 = val7.AddComponent<Image>(); ((Graphic)val8).color = Color32.op_Implicit(Constants.BUTTON_BACKGROUND_COLOR); ((Graphic)val8).raycastTarget = true; StartOperationButton = val7.AddComponent<Button>(); ((Selectable)StartOperationButton).transition = (Transition)1; ((Selectable)StartOperationButton).targetGraphic = (Graphic)(object)val8; ColorBlock colors2 = ((Selectable)StartOperationButton).colors; ((ColorBlock)(ref colors2)).normalColor = Color.white; ((ColorBlock)(ref colors2)).highlightedColor = new Color(1.3f, 1.3f, 1.3f, 1f); ((Col