Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of DealerReports v2.8.6
Mods/NightlyDealerReports.dll
Decompiled 11 hours 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.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security.Cryptography; using System.Text; using System.Text.Json; using HarmonyLib; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem; using MelonLoader; using MelonLoader.Utils; using Microsoft.CodeAnalysis; using NightlyDealerReports; using S1API.PhoneApp; using S1API.UI; using S1API.Utils; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(NightlyDealerReportsMod), "DealerReports", "2.8.5", "Z0mbz", null)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("NightlyDealerReports")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("2.8.5.0")] [assembly: AssemblyInformationalVersion("2.8.5")] [assembly: AssemblyProduct("NightlyDealerReports")] [assembly: AssemblyTitle("NightlyDealerReports")] [assembly: AssemblyVersion("2.8.5.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [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 NightlyDealerReports { public static class BadgeStatus { public static string Text(int unread) { if (unread <= 99) { if (unread > 0) { return unread.ToString(CultureInfo.InvariantCulture); } return ""; } return "99+"; } } public static class ClockDisplay { public static string FormatHhmm(int hhmm) { int num = hhmm / 100; int num2 = hhmm % 100; if (hhmm < 0 || num > 23 || num2 > 59) { return "--"; } return FormatHourMinute(num, num2); } public static string FormatHourMinute(int hour, int minute) { if (hour < 0 || hour > 23 || minute < 0 || minute > 59) { return "--"; } int num = hour % 12; if (num == 0) { num = 12; } string value = ((hour < 12) ? "AM" : "PM"); if (minute == 0) { return $"{num} {value}"; } return $"{num}:{minute:D2} {value}"; } public static string FormatSlot(int businessMinute) { if (businessMinute < 0) { return "wake-up"; } int num = (businessMinute + 420) % 1440; return FormatHourMinute(num / 60, num % 60); } } public static class CustomerDeals { public static bool HasRealName(string? customer) { if (string.IsNullOrWhiteSpace(customer)) { return false; } string text = customer.Trim(); if (!text.Equals("Customer", StringComparison.OrdinalIgnoreCase) && !text.Equals("Unknown", StringComparison.OrdinalIgnoreCase) && !text.Equals("Unidentified customer", StringComparison.OrdinalIgnoreCase) && !text.StartsWith("Il2Cpp", StringComparison.OrdinalIgnoreCase)) { return !text.StartsWith("ScheduleOne.", StringComparison.OrdinalIgnoreCase); } return false; } public static string Format(int hhmm, string? customer, IEnumerable<(string Product, int Quantity)>? products, string? fallbackDescription, decimal? paid) { string value = (HasRealName(customer) ? customer.Trim() : "Unidentified customer"); string[] array = (from g in (products ?? Enumerable.Empty<(string, int)>()).Where<(string, int)>(((string Product, int Quantity) p) => p.Quantity > 0 && !string.IsNullOrWhiteSpace(p.Product)).GroupBy<(string, int), string>(((string Product, int Quantity) p) => p.Product.Trim(), StringComparer.OrdinalIgnoreCase) select $"{g.Sum(((string Product, int Quantity) p) => p.Quantity)}x {g.Key}").ToArray(); string value2 = ((array.Length != 0) ? string.Join(" + ", array) : ((!string.IsNullOrWhiteSpace(fallbackDescription)) ? fallbackDescription.Trim() : "product (details unavailable)")); string value3 = (paid.HasValue ? ("$" + paid.Value.ToString("#,##0.00", CultureInfo.InvariantCulture)) : "an unavailable amount"); return $"{ClockDisplay.FormatHhmm(hhmm)} {value} purchased {value2} for {value3}"; } } public static class DealerAlertText { public static string FormatLowStock(IEnumerable<(string Key, string Name)> dealerAlerts) { List<(string, string)> list = (from g in dealerAlerts.Where<(string, string)>(((string Key, string Name) d) => !string.IsNullOrWhiteSpace(d.Key)).GroupBy<(string, string), string>(((string Key, string Name) d) => d.Key, StringComparer.Ordinal) select g.First()).ToList(); if (list.Count == 0) { return string.Empty; } if (list.Count == 1) { return (string.IsNullOrWhiteSpace(list[0].Item2) ? list[0].Item1 : list[0].Item2.Trim()) + " is low on stock"; } return list.Count + " dealers low on stock"; } } public static class DealerCashFormat { public static decimal Rounded(decimal value) { return decimal.Ceiling(value); } public static string Display(decimal value) { return "$" + Rounded(value).ToString("#,##0", CultureInfo.InvariantCulture); } } internal sealed class DealerHomeBadge { private const string RegisteredAppName = "NDR.DealerReports.Settings.v1"; private GameObject? _badge; private Text? _countText; private bool _warned; public void Reset() { _badge = null; _countText = null; _warned = false; } public void Refresh(PhoneApp app, int unreadCount) { try { if ((Object)(object)_badge == (Object)null || (Object)(object)_countText == (Object)null) { _badge = null; _countText = null; TryBind(app); } if ((Object)(object)_badge == (Object)null || (Object)(object)_countText == (Object)null) { return; } if (unreadCount <= 0) { if (_badge.activeSelf) { _badge.SetActive(false); } return; } string text = BadgeStatus.Text(unreadCount); if (_countText.text != text) { _countText.text = text; } if (!((Component)_countText).gameObject.activeSelf) { ((Component)_countText).gameObject.SetActive(true); } if (!_badge.activeSelf) { _badge.SetActive(true); } } catch (Exception ex) { if (!_warned) { _warned = true; MelonLogger.Warning("DealerReports: home-screen unread badge unavailable; notifications inside app remain functional: " + ex.GetBaseException().Message); } _badge = null; _countText = null; } } private void TryBind(PhoneApp app) { object obj = typeof(PhoneApp).GetField("_homeScreenInstance", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(app); Component val = (Component)((obj is Component) ? obj : null); object obj2; if (val == null) { GameObject val2 = (GameObject)((obj is GameObject) ? obj : null); obj2 = ((val2 != null) ? val2.transform : null); } else { obj2 = val.transform; } Transform val3 = (Transform)obj2; if ((Object)(object)val3 == (Object)null) { return; } Transform val4 = FindDescendant(val3, "AppIcons", 0); if ((Object)(object)val4 == (Object)null) { return; } Transform val5 = val4.Find("NDR.DealerReports.Settings.v1"); if ((Object)(object)val5 == (Object)null) { for (int i = 0; i < val4.childCount; i++) { Transform child = val4.GetChild(i); if (((Object)child).name.IndexOf("DealerReports", StringComparison.OrdinalIgnoreCase) >= 0 || ((Object)child).name.IndexOf("Dealer Reports", StringComparison.OrdinalIgnoreCase) >= 0) { val5 = child; break; } } } Transform val6 = ((val5 != null) ? val5.Find("Notifications") : null); Transform obj3 = ((val6 != null) ? val6.Find("Text") : null); Text val7 = ((obj3 != null) ? ((Component)obj3).GetComponent<Text>() : null); if (!((Object)(object)val6 == (Object)null) && !((Object)(object)val7 == (Object)null)) { _badge = ((Component)val6).gameObject; _countText = val7; ((Graphic)_countText).raycastTarget = false; } } private static Transform? FindDescendant(Transform root, string name, int depth) { if (((Object)root).name == name) { return root; } if (depth >= 12) { return null; } for (int i = 0; i < root.childCount; i++) { Transform val = FindDescendant(root.GetChild(i), name, depth + 1); if ((Object)(object)val != (Object)null) { return val; } } return null; } } public sealed class DealerReportsPhoneApp : PhoneApp { private enum CustomTab { Home, Overview, Inventory, Activity, Settings } public sealed class SceneDocument { public List<SceneNode> nodes { get; set; } = new List<SceneNode>(); } public sealed class SceneNode { public string name { get; set; } = ""; public int parentIndex { get; set; } public bool active { get; set; } public float[] anchorMin { get; set; } = new float[2] { 0.5f, 0.5f }; public float[] anchorMax { get; set; } = new float[2] { 0.5f, 0.5f }; public float[] anchoredPosition { get; set; } = new float[2]; public float[] sizeDelta { get; set; } = new float[2]; public float[] pivot { get; set; } = new float[2] { 0.5f, 0.5f }; public float[] localScale { get; set; } = new float[3] { 1f, 1f, 1f }; public float rotationZ { get; set; } public bool mask { get; set; } public SceneImage? image { get; set; } public SceneButton? button { get; set; } public bool rectMask { get; set; } public SceneScroll? scroll { get; set; } public SceneScrollbar? scrollbar { get; set; } public SceneText? text { get; set; } } public sealed class SceneImage { public string spritePath { get; set; } = ""; public float[] color { get; set; } = new float[4] { 1f, 1f, 1f, 1f }; public bool preserveAspect { get; set; } } public sealed class SceneButton { public bool interactable { get; set; } = true; } public sealed class SceneScroll { public bool horizontal { get; set; } public bool vertical { get; set; } } public sealed class SceneScrollbar { public int direction { get; set; } public float value { get; set; } } public sealed class SceneText { public string value { get; set; } = ""; public float fontSize { get; set; } = 20f; public int fontStyle { get; set; } public bool autoSize { get; set; } public float fontSizeMin { get; set; } = 12f; public float fontSizeMax { get; set; } = 30f; public float[] color { get; set; } = new float[4] { 1f, 1f, 1f, 1f }; public int horizontalAlignment { get; set; } = 2; public int verticalAlignment { get; set; } = 512; public bool wrapping { get; set; } } private enum ActiveTab { Overview, Inventory, Activity, Settings } private CustomTab _customTab; private bool _customUiReady; private bool _customDaily; private int _customDailyRange = 7; private int _customHistoryOffset; private Button? _customOlderButton; private Button? _customNewerButton; private RectTransform? _customRoot; private RectTransform? _customHost; private RectTransform? _customPlot; private GameObject? _customHome; private GameObject? _customOverview; private GameObject? _customInventory; private GameObject? _customActivity; private GameObject? _customSettings; private GameObject? _customDailyRangeGroup; private Text? _customDealerName; private Text? _customDealerIndex; private Text? _customEarnings; private Text? _customUnits; private Text? _customGross; private Text? _customCut; private Text? _customLoss; private Text? _customNet; private Text? _customGraphNote; private Text? _customInventoryNew; private Text? _customActivityNew; private Image? _customHeroPortrait; private Image? _customLeftPortrait; private Image? _customRightPortrait; private Button? _customLogoButton; private float _customWidth = -1f; private float _customHeight = -1f; private readonly Dictionary<string, GameObject> _customObjects = new Dictionary<string, GameObject>(StringComparer.Ordinal); private static readonly Dictionary<string, Sprite> _customSprites = new Dictionary<string, Sprite>(StringComparer.Ordinal); private static readonly List<Texture2D> _customTextures = new List<Texture2D>(); private readonly Dictionary<CustomTab, (Button Button, Sprite? Normal, Sprite? Selected)> _customNav = new Dictionary<CustomTab, (Button, Sprite, Sprite)>(); private readonly List<GameObject> _customChartObjects = new List<GameObject>(); private readonly List<Button> _customRangeButtons = new List<Button>(); private int _customChartSignature; private string _customChartDealer = ""; private int _customLastRevision = -1; private const string LayoutResource = "NightlyDealerReports.CustomLayout"; private bool _finishedUiReady; private CustomTab _finishedTab; private RectTransform? _finishedRoot; private RectTransform? _finishedHost; private float _finishedWidth = -1f; private float _finishedHeight = -1f; private readonly Dictionary<string, GameObject> _finishedObjects = new Dictionary<string, GameObject>(StringComparer.Ordinal); private readonly Dictionary<string, Color> _finishedOriginalColors = new Dictionary<string, Color>(StringComparer.Ordinal); private readonly Dictionary<string, bool> _finishedExpanded = new Dictionary<string, bool>(StringComparer.OrdinalIgnoreCase); private readonly List<GameObject> _finishedInventoryInstances = new List<GameObject>(); private readonly List<GameObject> _finishedActivityInstances = new List<GameObject>(); private GameObject? _finishedInventoryTemplate; private GameObject? _finishedActivityTemplate; private RectTransform? _finishedInventoryContent; private RectTransform? _finishedActivityContent; private RectTransform? _finishedGraphContent; private RectTransform? _finishedGraphBars; private RectTransform? _finishedGraphLabels; private ScrollRect? _finishedGraphScroll; private RectTransform? _finishedBarTemplate; private RectTransform? _finishedTimeTemplate; private readonly List<GameObject> _finishedExtraBars = new List<GameObject>(); private readonly List<GameObject> _finishedExtraLabels = new List<GameObject>(); private ScrollRect? _finishedInventoryScroll; private ScrollRect? _finishedActivityScroll; private Text? _finishedDealerName; private Text? _finishedDealerCount; private Image? _finishedLeftPortrait; private Image? _finishedHeroPortrait; private Image? _finishedRightPortrait; private Image? _finishedUnreadDot; private Image? _finishedInventoryUnreadDot; private Image? _finishedActivityUnreadDot; private string _finishedInventSignature = ""; private string _finishedActivitySignature = ""; private string _finishedGraphDealer = ""; private int _finishedInventoryRevision = -1; private int _finishedActivityRevision = -1; private int _finishedGraphRevision = -1; private bool _finishedDaily; private string _finishedGraphRange = ""; private readonly Dictionary<int, Vector2> _finishedAuthoredTimeX = new Dictionary<int, Vector2>(); private const string FinishedSceneResource = "NightlyDealerReports.FinishedLayout"; private int _finishedMaxHoldDirection; private int _finishedMaxIgnoreClickDirection; private bool _finishedMaxHoldRepeated; private float _finishedMaxHoldStart; private float _finishedMaxNextRepeat; private float _finishedMaxIgnoreClickUntil; private static readonly Color Navy = new Color(0.007f, 0.036f, 0.045f, 0.98f); private static readonly Color CardInk = new Color(0.015f, 0.088f, 0.095f, 0.93f); private static readonly Color RowInk = new Color(0.015f, 0.123f, 0.13f, 0.96f); private static readonly Color Teal = new Color(0.1f, 0.74f, 0.55f, 1f); private static readonly Color BrightTeal = new Color(0.2f, 0.96f, 0.84f, 1f); private static readonly Color Gold = new Color(1f, 0.78f, 0.17f, 1f); private static readonly Color White = new Color(0.97f, 0.985f, 1f, 1f); private static readonly Color Muted = new Color(0.74f, 0.85f, 0.89f, 1f); private static readonly Color Off = new Color(0.035f, 0.17f, 0.235f, 1f); private static readonly Color DividerColor = new Color(0.08f, 0.66f, 0.57f, 0.72f); private static readonly Color Lime = new Color(0.61f, 0.98f, 0.16f, 1f); private static readonly Color Violet = new Color(0.65f, 0.3f, 0.94f, 1f); private static readonly Color Alarm = new Color(1f, 0.31f, 0.35f, 1f); private static Texture2D? _iconTexture; private static Texture2D? _backgroundTexture; private static Texture2D? _brandTexture; private static Texture2D? _ringTexture; private static Sprite? _iconSprite; private static Sprite? _backgroundSprite; private static Sprite? _brandSprite; private static Sprite? _ringSprite; private static readonly Dictionary<string, Sprite> Portraits = new Dictionary<string, Sprite>(StringComparer.OrdinalIgnoreCase); private static readonly Dictionary<string, Texture2D> PortraitTextures = new Dictionary<string, Texture2D>(StringComparer.OrdinalIgnoreCase); private readonly Dictionary<string, (Button Button, Text Label)> _buttons = new Dictionary<string, (Button, Text)>(StringComparer.Ordinal); private readonly Dictionary<string, Outline> _outlines = new Dictionary<string, Outline>(StringComparer.Ordinal); private Text? _timeText; private Text? _summary; private Text? _tracking; private Text? _callbacks; private Text? _schedule; private Text? _notice; private Text? _stockThresholdText; private GameObject? _timePanel; private RectTransform? _scrollContent; private ScrollRect? _scrollView; private bool _layoutLogged; private GameObject? _settingsTabRoot; private GameObject? _dashboardTabRoot; private GameObject? _summaryTabRoot; private GameObject? _inventoryTabRoot; private ActiveTab _tab; private GameObject? _portraitHero; private GameObject? _heroDealerMenu; private CanvasGroup? _portraitFade; private RectTransform? _heroRect; private Image? _heroSelectedPortrait; private Image? _heroLeftPortrait; private Image? _heroRightPortrait; private Text? _heroName; private Text? _heroIndex; private Text? _heroDots; private Text? _heroNew; private Text? _lowStockNew; private Text? _inventoryNew; private Text? _activityNew; private ScrollRect? _inventoryScroller; private RectTransform? _inventoryScrollContent; private readonly List<string> _dealerKeys = new List<string>(); private bool _transitionActive; private float _transitionStart; private float _transitionDirection = 1f; private const float TransitionSeconds = 0.24f; private string _portraitShownFor = ""; private bool _wasOpen; private GameObject? _deferredUiContainer; private bool _deferredUiAttempted; private bool _deferredUiBuilding; private int _lastRenderedRevision = -1; private readonly DealerHomeBadge _homeBadge = new DealerHomeBadge(); private string _selectedDealerKey = ""; private Text? _dealerPosition; private Text? _dealerOverview; private Text? _dealerCash; private Text? _dealerProducts; private Text? _dealerInventory; private Text? _dealerCustomerSales; private string _inventorySignature = ""; private string _summaryInventorySignature = ""; private readonly List<GameObject> _summaryInventoryRows = new List<GameObject>(); private readonly HashSet<string> _expandedProducts = new HashSet<string>(StringComparer.OrdinalIgnoreCase); private GameObject? _summaryInventoryCard; private Text? _summaryInventoryText; private GameObject? _summaryDealerMenu; private GameObject? _detailDealerMenu; private bool _dealerMenuExpanded; private int _dealerMenuPage; private string _dealerMenuSignature = ""; private readonly List<string> _dealerMenuButtonIds = new List<string>(); private readonly List<GameObject> _inventoryRows = new List<GameObject>(); private readonly List<GameObject> _soldRows = new List<GameObject>(); private readonly List<GameObject> _summarySoldRows = new List<GameObject>(); private readonly Dictionary<string, Sprite> _knownProductIcons = new Dictionary<string, Sprite>(StringComparer.OrdinalIgnoreCase); private string _soldSignature = ""; private string _summarySoldSignature = ""; private GameObject? _productsCard; private GameObject? _inventoryCard; private GameObject? _customersCard; private RectTransform? _dealerScrollContent; private ScrollRect? _dealerScroller; private ScrollRect? _summaryScroller; private Text? _summaryTime; private Text? _summarySales; private Text? _summaryPayout; private Text? _summaryGrandTotal; private Text? _summaryLowStock; private GameObject? _summarySalesCard; private GameObject? _summaryStockCard; private GameObject? _summaryDivider; private RectTransform? _summaryScrollContent; private static readonly (string Name, string Id)[] PortraitNames = new(string, string)[6] { ("Benji Coleman", "BenjiColeman"), ("Molly Presley", "MollyPresley"), ("Brad Crosby", "BradCrosby"), ("Jane Lucero", "JaneLucero"), ("Wei Long", "WeiLong"), ("Leo Rivers", "LeoRivers") }; public static DealerReportsPhoneApp? Active { get; private set; } public static Sprite? NotificationSprite => _iconSprite; protected override string AppName => "NDR.DealerReports.Settings.v1"; protected override string AppTitle => "Dealer Reports"; protected override string IconLabel => "Dealer Reports"; protected override string IconFileName => string.Empty; protected override EOrientation Orientation => (EOrientation)1; private static string UiStatusPath => Path.Combine(MelonEnvironment.UserDataDirectory, "NightlyDealerReports", "ui_startup_status.txt"); private static string FinishedUiSafeModePath => Path.Combine(MelonEnvironment.UserDataDirectory, "NightlyDealerReports", "disable_finished_ui.flag"); private bool TryCreateCustomUi(GameObject container) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown //IL_008c: Unknown result type (might be due to invalid IL or missing references) //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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Expected O, but got Unknown //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_05e2: Unknown result type (might be due to invalid IL or missing references) //IL_05e7: Unknown result type (might be due to invalid IL or missing references) //IL_05eb: Unknown result type (might be due to invalid IL or missing references) //IL_060b: Unknown result type (might be due to invalid IL or missing references) //IL_062b: Unknown result type (might be due to invalid IL or missing references) //IL_0637: Unknown result type (might be due to invalid IL or missing references) //IL_0659: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0327: 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_0343: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) bool flag; try { using Stream stream = typeof(DealerReportsPhoneApp).Assembly.GetManifestResourceStream("NightlyDealerReports.CustomLayout"); if (stream == null) { throw new FileNotFoundException("Embedded Unity layout JSON missing", "NightlyDealerReports.CustomLayout"); } SceneDocument sceneDocument = JsonSerializer.Deserialize<SceneDocument>(stream); if (sceneDocument?.nodes == null || sceneDocument.nodes.Count < 50) { throw new InvalidDataException("Saved Unity scene contains fewer than 50 nodes"); } GameObject val = new GameObject("DealerReports.CustomUnity6Layout"); val.transform.SetParent(container.transform, false); RectTransform val2 = val.AddComponent<RectTransform>(); val2.anchorMin = new Vector2(0.5f, 0.5f); val2.anchorMax = new Vector2(0.5f, 0.5f); val2.pivot = new Vector2(0.5f, 0.5f); val2.anchoredPosition = Vector2.zero; val2.sizeDelta = new Vector2(450f, 900f); ((Transform)val2).localScale = Vector3.one; _customRoot = val2; _customHost = container.GetComponent<RectTransform>(); _customObjects.Clear(); _customNav.Clear(); List<GameObject> list = new List<GameObject>(sceneDocument.nodes.Count); foreach (SceneNode node in sceneDocument.nodes) { if (node.parentIndex < 0) { list.Add(val); continue; } Transform transform = list[node.parentIndex].transform; GameObject val3 = new GameObject(node.name); val3.transform.SetParent(transform, false); RectTransform obj = val3.AddComponent<RectTransform>(); obj.anchorMin = new Vector2(node.anchorMin[0], node.anchorMin[1]); obj.anchorMax = new Vector2(node.anchorMax[0], node.anchorMax[1]); obj.pivot = new Vector2(node.pivot[0], node.pivot[1]); obj.anchoredPosition = new Vector2(node.anchoredPosition[0], node.anchoredPosition[1]); obj.sizeDelta = new Vector2(node.sizeDelta[0], node.sizeDelta[1]); ((Transform)obj).localScale = Vector3.one; if (node.image != null) { Image obj2 = val3.AddComponent<Image>(); obj2.sprite = EmbeddedSprite(node.image.spritePath); obj2.type = (Type)0; ((Graphic)obj2).color = SceneColor(node.image.color); obj2.preserveAspect = node.image.preserveAspect; ((Graphic)obj2).raycastTarget = node.button != null; } if (node.text != null) { string text = node.name + ".LiveText"; string text2 = node.text.value ?? ""; Transform transform2 = val3.transform; int num = Mathf.RoundToInt(node.text.fontSize); Text val4 = UIFactory.Text(text, text2, transform2, num, (TextAnchor)4, (FontStyle)((node.text.fontStyle & 3) switch { 3 => 3, 2 => 2, 1 => 1, _ => 0, })); RectTransform component = ((Component)val4).GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; ((Graphic)val4).color = SceneColor(node.text.color); ((Graphic)val4).raycastTarget = false; val4.resizeTextForBestFit = node.text.autoSize; val4.resizeTextMinSize = Math.Max(11, Mathf.RoundToInt(node.text.fontSizeMin)); val4.resizeTextMaxSize = Math.Max(val4.resizeTextMinSize, Mathf.RoundToInt(node.text.fontSizeMax)); val4.horizontalOverflow = (HorizontalWrapMode)1; val4.verticalOverflow = (VerticalWrapMode)0; switch (node.name) { case "EarningsValue": case "UnitsValue": case "StatGrossValue": case "StatDealerCutValue": case "StatRobberyValue": case "StatNetEarningsValue": flag = true; break; default: flag = false; break; } if (flag) { val4.alignment = (TextAnchor)3; } switch (node.name) { case "DealerNameText": _customDealerName = val4; break; case "DealerCountText": _customDealerIndex = val4; break; case "EarningsValue": _customEarnings = val4; break; case "UnitsValue": _customUnits = val4; break; case "StatGrossValue": _customGross = val4; break; case "StatDealerCutValue": _customCut = val4; break; case "StatRobberyValue": _customLoss = val4; break; case "StatNetEarningsValue": _customNet = val4; break; } } if (node.button != null) { Button obj3 = val3.AddComponent<Button>(); ((Selectable)obj3).interactable = node.button.interactable; ((Selectable)obj3).targetGraphic = (Graphic)(object)val3.GetComponent<Image>(); ((Selectable)obj3).transition = (Transition)1; ColorBlock colors = ((Selectable)obj3).colors; ((ColorBlock)(ref colors)).normalColor = Color.white; ((ColorBlock)(ref colors)).highlightedColor = new Color(0.79f, 0.97f, 1f, 1f); ((ColorBlock)(ref colors)).pressedColor = new Color(0.66f, 0.8f, 1f, 1f); ((ColorBlock)(ref colors)).selectedColor = Color.white; ((ColorBlock)(ref colors)).colorMultiplier = 1.25f; ((ColorBlock)(ref colors)).fadeDuration = 0.12f; ((Selectable)obj3).colors = colors; } val3.SetActive(node.active); list.Add(val3); _customObjects[node.name] = val3; } _customHeroPortrait = ObjectImage("BenjiPortrait"); _customLeftPortrait = ObjectImage("MollyPortrait"); _customRightPortrait = ObjectImage("BradPortrait"); _customHome = ObjectNamed("HomePanel"); _customOverview = ObjectNamed("OverviewPanel"); GameObject? obj4 = ObjectNamed("PlotArea"); _customPlot = ((obj4 != null) ? obj4.GetComponent<RectTransform>() : null); if ((Object)(object)_customPlot == (Object)null || (Object)(object)_customHome == (Object)null || (Object)(object)_customOverview == (Object)null) { goto IL_0762; } Image? obj5 = ObjectImage("AppBackground"); if ((Object)(object)((obj5 != null) ? obj5.sprite : null) == (Object)null) { goto IL_0762; } HookCustomNavigation(); HookCustomGraphMode(); BuildCustomDealerArrows(); BuildCustomOtherScreens(); HideSavedPlaceholderGraph(); BuildGraphAccessories(); _customTab = CustomTab.Home; _customDaily = false; _customUiReady = true; FitCustomUi(); ApplyCustomTab(); MelonLogger.Msg("DealerReports UI 2.6.0: recreated 61 original Unity objects and completed runtime controls."); flag = true; goto end_IL_001a; IL_0762: throw new InvalidDataException("Layout missing background, graph, Home or Overview panel"); end_IL_001a:; } catch (Exception ex) { _customUiReady = false; MelonLogger.Error("DealerReports custom UI failed, falling back to original v2.3 view: " + ex); if ((Object)(object)_customRoot != (Object)null) { Object.Destroy((Object)(object)((Component)_customRoot).gameObject); } _customRoot = null; flag = false; } return flag; } private GameObject? ObjectNamed(string name) { if (!_customObjects.TryGetValue(name, out GameObject value)) { return null; } return value; } private Image? ObjectImage(string name) { GameObject? obj = ObjectNamed(name); if (obj == null) { return null; } return obj.GetComponent<Image>(); } private Button? ObjectButton(string name) { GameObject? obj = ObjectNamed(name); if (obj == null) { return null; } return obj.GetComponent<Button>(); } private static Color SceneColor(float[] arr) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) if (arr.Length < 4) { return Color.white; } return new Color(arr[0], arr[1], arr[2], arr[3]); } private Sprite? EmbeddedSprite(string path) { if (string.IsNullOrWhiteSpace(path)) { return null; } string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(path); if (_customSprites.TryGetValue(fileNameWithoutExtension, out Sprite value)) { try { if ((Object)(object)value != (Object)null && (Object)(object)value.texture != (Object)null) { return value; } } catch { } _customSprites.Remove(fileNameWithoutExtension); } try { Texture2D val = LoadPng("NightlyDealerReports.CustomSprites." + fileNameWithoutExtension); _customTextures.Add(val); Sprite val2 = ToSprite(val); _customSprites[fileNameWithoutExtension] = val2; return val2; } catch (Exception ex) { MelonLogger.Warning("DealerReports sprite " + fileNameWithoutExtension + ": " + ex.Message); return null; } } private void HookCustomNavigation() { //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0152: 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) //IL_0170: Unknown result type (might be due to invalid IL or missing references) (string, CustomTab)[] array = new(string, CustomTab)[4] { ("OverviewButton", CustomTab.Overview), ("InventoryButton", CustomTab.Inventory), ("ActivityButton", CustomTab.Activity), ("SettingsButton", CustomTab.Settings) }; for (int i = 0; i < array.Length; i++) { (string, CustomTab) tuple = array[i]; string item = tuple.Item1; CustomTab tab = tuple.Item2; Button val = ObjectButton(item); if ((Object)(object)val == (Object)null) { continue; } Image component = ((Component)val).GetComponent<Image>(); Sprite item2 = ((component != null) ? component.sprite : null); Sprite item3 = EmbeddedSprite(item + "_Selected.png"); _customNav[tab] = (val, item2, item3); CustomTab customTab = tab; if ((uint)(customTab - 2) <= 1u) { Text val2 = CustomText("DealerReports.Unread." + tab, "", ((Component)val).transform, 12, Lime, (TextAnchor)4); CustomRect(((Component)val2).gameObject, new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(-7f, 8f), new Vector2(41f, 18f)); if (tab == CustomTab.Inventory) { _customInventoryNew = val2; } else { _customActivityNew = val2; } } ButtonUtils.AddListener(val, (Action)delegate { _customTab = tab; ApplyCustomTab(); Refresh(); }); } GameObject val3 = ObjectNamed("IconDR"); if (val3 != null) { Image component2 = val3.GetComponent<Image>(); if ((Object)(object)component2 != (Object)null) { ((Graphic)component2).raycastTarget = true; } Button val4 = val3.AddComponent<Button>(); ((Selectable)val4).targetGraphic = (Graphic)(object)component2; ((Selectable)val4).transition = (Transition)1; _customLogoButton = val4; ButtonUtils.AddListener(val4, (Action)delegate { _customTab = CustomTab.Home; ApplyCustomTab(); Refresh(); }); CustomRect(((Component)CustomText("HomeLabel", "HOME", val3.transform, 13, BrightTeal, (TextAnchor)4)).gameObject, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(0f, -9f), new Vector2(90f, 19f)); } } private static void CustomRect(GameObject obj, Vector2 anchorMin, Vector2 anchorMax, Vector2 pos, Vector2 size) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) RectTransform component = obj.GetComponent<RectTransform>(); component.anchorMin = anchorMin; component.anchorMax = anchorMax; component.pivot = new Vector2(0.5f, 0.5f); component.anchoredPosition = pos; component.sizeDelta = size; ((Transform)component).localScale = Vector3.one; } private static Text CustomText(string name, string label, Transform parent, int size, Color tint, TextAnchor anchor = (TextAnchor)4) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) Text obj = UIFactory.Text(name, label, parent, size, anchor, (FontStyle)1); ((Graphic)obj).color = tint; ((Graphic)obj).raycastTarget = false; obj.horizontalOverflow = (HorizontalWrapMode)1; return obj; } private Button SmallCustomButton(string name, string title, Transform parent, Vector2 pos, Vector2 size, Action callback, Color? highlight = null) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) var (val, val2, val3) = UIFactory.RoundedButtonWithLabel(name, title, parent, new Color(0.018f, 0.15f, 0.18f, 0.97f), size.x, size.y, Math.Max(13, (int)(size.y * 0.47f)), White); CustomRect(val, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), pos, size); ((Selectable)val2).transition = (Transition)1; ColorBlock colors = ((Selectable)val2).colors; ((ColorBlock)(ref colors)).normalColor = Color.white; ((ColorBlock)(ref colors)).highlightedColor = (Color)(((??)highlight) ?? new Color(0.72f, 0.95f, 1f, 1f)); ((ColorBlock)(ref colors)).pressedColor = new Color(0.52f, 0.89f, 0.98f, 1f); ((ColorBlock)(ref colors)).fadeDuration = 0.12f; ((Selectable)val2).colors = colors; Outline(val, DividerColor); ((Graphic)val3).color = White; ButtonUtils.AddListener(val2, (Action)delegate { callback(); Refresh(); }); return val2; } private void BuildCustomDealerArrows() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) GameObject val = ObjectNamed("DealerCarousel"); if ((Object)(object)val == (Object)null) { return; } SmallCustomButton("DealerReports.PreviousDealer", "‹", val.transform, new Vector2(-193f, 123f), new Vector2(38f, 44f), delegate { StepDealer(-1); }, Lime); SmallCustomButton("DealerReports.NextDealer", "›", val.transform, new Vector2(193f, 123f), new Vector2(38f, 44f), delegate { StepDealer(1); }, Lime); GameObject val2 = ObjectNamed("MollyPortrait"); if (val2 != null) { Button obj = val2.AddComponent<Button>(); ((Selectable)obj).targetGraphic = (Graphic)(object)val2.GetComponent<Image>(); Image component = val2.GetComponent<Image>(); if ((Object)(object)component != (Object)null) { ((Graphic)component).raycastTarget = true; } ButtonUtils.AddListener(obj, (Action)delegate { StepDealer(-1); Refresh(); }); } GameObject val3 = ObjectNamed("BradPortrait"); if (val3 != null) { Button obj2 = val3.AddComponent<Button>(); ((Selectable)obj2).targetGraphic = (Graphic)(object)val3.GetComponent<Image>(); Image component2 = val3.GetComponent<Image>(); if ((Object)(object)component2 != (Object)null) { ((Graphic)component2).raycastTarget = true; } ButtonUtils.AddListener(obj2, (Action)delegate { StepDealer(1); Refresh(); }); } } private void HookCustomGraphMode() { (string, bool)[] array = new(string, bool)[2] { ("HourlyButton", false), ("DailyButton", true) }; for (int i = 0; i < array.Length; i++) { (string, bool) tuple = array[i]; string item = tuple.Item1; bool daily = tuple.Item2; Button val = ObjectButton(item); if ((Object)(object)val != (Object)null) { ButtonUtils.AddListener(val, (Action)delegate { _customDaily = daily; CustomGraphMode(); Refresh(); }); } } } private void BuildCustomOtherScreens() { //IL_0018: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) Transform transform = ObjectNamed("ContentArea").transform; _customInventory = UIFactory.Panel("DealerReports.CustomInventory", transform, Color.clear, (Vector2?)null, (Vector2?)null, true); _customActivity = UIFactory.Panel("DealerReports.CustomActivity", transform, Color.clear, (Vector2?)null, (Vector2?)null, true); _customSettings = UIFactory.Panel("DealerReports.CustomSettings", transform, Color.clear, (Vector2?)null, (Vector2?)null, true); DisableBackgroundRaycast(_customInventory); DisableBackgroundRaycast(_customActivity); DisableBackgroundRaycast(_customSettings); _customUiReady = true; BuildInventoryTab(_customInventory.transform); BuildDealerDashboard(_customActivity.transform); ScrollRect val2 = default(ScrollRect); RectTransform val = (_scrollContent = UIFactory.ScrollableVerticalList("DealerReports.CustomSettingsScroll", _customSettings.transform, ref val2)); _scrollView = val2; Stretch(((Component)val2).gameObject, 5f, 5f, 0f, 0f); ConfigureScroll(val, val2); GameObject val3 = Card("DealerReports.CustomControls", (Transform)(object)val, 225f); Heading(val3.transform, "DEALER CONTROLS", "D", 0f); ToggleRow(val3.transform, "NDR.Tracking", "Dealer Tracking", 52f, delegate { NightlyDealerReportsMod.Current?.PhoneToggleTracking(); }); ToggleRow(val3.transform, "NDR.Reports", "Scheduled Reports", 108f, delegate { NightlyDealerReportsMod.Current?.PhoneToggleReports(); }); ToggleRow(val3.transform, "NDR.Notifications", "Low-stock Alerts", 164f, delegate { NightlyDealerReportsMod.Current?.PhoneToggleAlerts(); }); BuildIntervalCard((Transform)(object)val); BuildLowStockCard((Transform)(object)val); BuildOptionsCard((Transform)(object)val); BuildHistorySettings((Transform)(object)val); BuildDiagnosticsCard((Transform)(object)val); GameObject val4 = Card("DealerReports.RefreshActions", (Transform)(object)val, 105f); Button("NDR.Test", val4.transform, 0.04f, 0.96f, 10f, 60f, 22, delegate { NightlyDealerReportsMod.Current?.PhoneRefreshDashboard(); }, Gold); _notice = Text("DealerReports.CustomStatus", "", val4.transform, 0.04f, 0.96f, 72f, 24f, 14, Muted, (FontStyle)0, (TextAnchor)3); } private void BuildHistorySettings(Transform parent) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) GameObject val = Card("DealerReports.HistorySettings", parent, 164f); Heading(val.transform, "GRAPH HISTORY RETENTION", "H", 0f); Text("DealerReports.HistoryHelp", "Completed-day totals only; unlimited keeps daily summaries", val.transform, 0.045f, 0.955f, 46f, 42f, 17, Muted, (FontStyle)0, (TextAnchor)3); int[] array = new int[4] { 7, 30, 100, 0 }; for (int i = 0; i < array.Length; i++) { int days = array[i]; string id = "NDR.History" + days; float num = 0.04f + (float)i * 0.2325f; Button(id, val.transform, num, num + 0.217f, 98f, 53f, 16, delegate { NightlyDealerReportsMod.Current?.PhoneSetHistoryRetention(days); }, DividerColor); } } private void HideSavedPlaceholderGraph() { string[] array = new string[12] { "YAxisLabels", "HourLabels", "GridLine01", "GridLine02", "GridLine03", "GridLine04", "Bar01", "Bar02", "Bar03", "Bar04", "Bar05", "Bar06" }; foreach (string name in array) { GameObject? obj = ObjectNamed(name); if (obj != null) { obj.SetActive(false); } } } private void BuildGraphAccessories() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_007e: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_customPlot == (Object)null) { return; } _customGraphNote = CustomText("DealerReports.GraphNote", "", ObjectNamed("GraphContainer").transform, 12, Muted, (TextAnchor)3); CustomRect(((Component)_customGraphNote).gameObject, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -52f), new Vector2(370f, 24f)); _customDailyRangeGroup = UIFactory.Panel("DealerReports.GraphRanges", ObjectNamed("GraphContainer").transform, Color.clear, (Vector2?)null, (Vector2?)null, false); DisableBackgroundRaycast(_customDailyRangeGroup); CustomRect(_customDailyRangeGroup, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -79f), new Vector2(230f, 26f)); int[] array = new int[4] { 7, 14, 30, 100 }; for (int i = 0; i < array.Length; i++) { int num = array[i]; int period = num; float num2 = num switch { 30 => 28f, 14 => -28f, 7 => -83f, _ => 83f, }; Button item = SmallCustomButton("NDR.GraphDays" + num, num + "D", _customDailyRangeGroup.transform, new Vector2(num2, 0f), new Vector2(52f, 24f), delegate { _customDailyRange = period; _customHistoryOffset = 0; _customChartSignature = -1; }); _customRangeButtons.Add(item); } _customOlderButton = SmallCustomButton("NDR.GraphOlder", "‹", ObjectNamed("GraphContainer").transform, new Vector2(-193f, 99f), new Vector2(35f, 24f), delegate { _customHistoryOffset += _customDailyRange; _customChartSignature = -1; }); _customNewerButton = SmallCustomButton("NDR.GraphNewer", "›", ObjectNamed("GraphContainer").transform, new Vector2(193f, 99f), new Vector2(35f, 24f), delegate { _customHistoryOffset = Math.Max(0, _customHistoryOffset - _customDailyRange); _customChartSignature = -1; }); CustomGraphMode(); } private void CustomGraphMode() { //IL_0057: 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) for (int i = 0; i < 2; i++) { Button? obj = ObjectButton((i == 0) ? "HourlyButton" : "DailyButton"); Image val = ((obj != null) ? ((Component)obj).GetComponent<Image>() : null); if ((Object)(object)val != (Object)null) { ((Graphic)val).color = (Color)((_customDaily == (i == 1)) ? new Color(0.48f, 1f, 0.52f, 1f) : Color.white); } } GameObject? customDailyRangeGroup = _customDailyRangeGroup; if (customDailyRangeGroup != null) { customDailyRangeGroup.SetActive(_customDaily); } Button? customOlderButton = _customOlderButton; if (customOlderButton != null) { ((Component)customOlderButton).gameObject.SetActive(_customDaily); } Button? customNewerButton = _customNewerButton; if (customNewerButton != null) { ((Component)customNewerButton).gameObject.SetActive(_customDaily); } _customChartSignature = -1; } private void ApplyCustomTab() { //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) if (!_customUiReady) { return; } GameObject? customHome = _customHome; if (customHome != null) { customHome.SetActive(_customTab == CustomTab.Home); } GameObject? customOverview = _customOverview; if (customOverview != null) { customOverview.SetActive(_customTab == CustomTab.Overview); } GameObject? customInventory = _customInventory; if (customInventory != null) { customInventory.SetActive(_customTab == CustomTab.Inventory); } GameObject? customActivity = _customActivity; if (customActivity != null) { customActivity.SetActive(_customTab == CustomTab.Activity); } GameObject? customSettings = _customSettings; if (customSettings != null) { customSettings.SetActive(_customTab == CustomTab.Settings); } _tab = _customTab switch { CustomTab.Inventory => ActiveTab.Inventory, CustomTab.Activity => ActiveTab.Activity, CustomTab.Settings => ActiveTab.Settings, _ => ActiveTab.Overview, }; foreach (KeyValuePair<CustomTab, (Button, Sprite, Sprite)> item in _customNav) { Image component = ((Component)item.Value.Item1).GetComponent<Image>(); if (!((Object)(object)component == (Object)null)) { bool flag = item.Key == _customTab; component.sprite = (flag ? (item.Value.Item3 ?? item.Value.Item2) : item.Value.Item2); ((Graphic)component).color = (Color)(flag ? Color.white : new Color(0f, 0.886f, 1f, 1f)); } } _customChartSignature = -1; } private void FitCustomUi() { //IL_0023: 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_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_00a6: 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) if (!((Object)(object)_customRoot == (Object)null) && !((Object)(object)_customHost == (Object)null)) { Rect rect = _customHost.rect; float width = ((Rect)(ref rect)).width; rect = _customHost.rect; float height = ((Rect)(ref rect)).height; if (!(width <= 0f) && !(height <= 0f) && (!(Math.Abs(width - _customWidth) < 0.5f) || !(Math.Abs(height - _customHeight) < 0.5f))) { _customWidth = width; _customHeight = height; float num = Mathf.Min(width / 493f, height / 900f); ((Transform)_customRoot).localScale = Vector3.one * num; } } } private void RefreshCustomUi() { NightlyDealerReportsMod current = NightlyDealerReportsMod.Current; if (current == null) { return; } bool flag = ((PhoneApp)this).IsOpen(); if (flag && !_wasOpen) { current.PhoneVerifyOnOpen(); _customTab = CustomTab.Home; _dealerMenuExpanded = false; if (current.PhoneFirstUnreadDealer.Length > 0) { _selectedDealerKey = current.PhoneFirstUnreadDealer; } ApplyCustomTab(); } _wasOpen = flag; FitCustomUi(); List<DealerDashboardView> list = current.PhoneDealerDashboard(); if (list.Count > 0 && !list.Any((DealerDashboardView d) => d.Key == _selectedDealerKey)) { _selectedDealerKey = list[0].Key; } if (_customChartDealer != _selectedDealerKey) { _customHistoryOffset = 0; } if (flag) { if (_customTab == CustomTab.Activity) { current.PhoneMarkReportRead(_selectedDealerKey); } if (_customTab == CustomTab.Inventory) { current.PhoneMarkStockRead(_selectedDealerKey); } } if ((Object)(object)_customInventoryNew != (Object)null) { _customInventoryNew.text = ((current.PhoneUnreadLowStock > 0) ? "NEW" : ""); } if ((Object)(object)_customActivityNew != (Object)null) { _customActivityNew.text = ((current.PhoneUnreadReports > 0) ? "NEW" : ""); } _dealerKeys.Clear(); _dealerKeys.AddRange(list.Select((DealerDashboardView d) => d.Key)); int num = list.FindIndex((DealerDashboardView d) => d.Key == _selectedDealerKey); DealerDashboardView dealerDashboardView = ((num >= 0) ? list[num] : null); if ((Object)(object)_customDealerName != (Object)null) { _customDealerName.text = dealerDashboardView?.Name ?? "No dealer selected"; } if ((Object)(object)_customDealerIndex != (Object)null) { _customDealerIndex.text = ((dealerDashboardView == null) ? "No dealers" : $"Dealer {num + 1} of {list.Count}"); } if (dealerDashboardView != null && _portraitShownFor != dealerDashboardView.Name) { SetPortrait(_customHeroPortrait, dealerDashboardView.Name, selected: true); if (list.Count > 1) { SetPortrait(_customLeftPortrait, list[(num + list.Count - 1) % list.Count].Name, selected: false); SetPortrait(_customRightPortrait, list[(num + 1) % list.Count].Name, selected: false); } _portraitShownFor = dealerDashboardView.Name; } else if (dealerDashboardView == null) { SetPortrait(_customHeroPortrait, "", selected: true); SetPortrait(_customLeftPortrait, "", selected: false); SetPortrait(_customRightPortrait, "", selected: false); } DealerFinanceView dealerFinanceView = current.PhoneDealerFinance(_selectedDealerKey); if ((Object)(object)_customEarnings != (Object)null) { _customEarnings.text = AsMoney(dealerFinanceView.FinalResult) + (dealerFinanceView.PartialEarnings ? "*" : ""); } if ((Object)(object)_customUnits != (Object)null) { _customUnits.text = dealerFinanceView.Units.ToString("N0"); } if ((Object)(object)_customGross != (Object)null) { _customGross.text = AsMoney(dealerFinanceView.Gross) + (dealerFinanceView.PartialEarnings ? "*" : ""); } if ((Object)(object)_customCut != (Object)null) { _customCut.text = (dealerFinanceView.PartialEarnings ? "Partial" : AsMoney(dealerFinanceView.DealerCut)); } if ((Object)(object)_customLoss != (Object)null) { _customLoss.text = AsMoney(dealerFinanceView.Losses); } if ((Object)(object)_customNet != (Object)null) { _customNet.text = AsMoney(dealerFinanceView.FinalResult) + (dealerFinanceView.PartialEarnings ? "*" : ""); } RefreshInventoryTab(current, list); RefreshDealerDashboard(current, list); UpdateCustomSettings(current); if (_customTab == CustomTab.Overview) { RenderFinancialGraph(current); } _customLastRevision = current.DashboardRevision; _lastRenderedRevision = current.DashboardRevision; } private static string AsMoney(decimal value) { return ((value < 0m) ? "-$" : "$") + Math.Abs(value).ToString("#,##0.00", CultureInfo.InvariantCulture); } private void UpdateCustomSettings(NightlyDealerReportsMod mod) { //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) SetState("NDR.Tracking", mod.PhoneTrackingEnabled, mod.PhoneTrackingEnabled ? "ON" : "OFF"); SetState("NDR.Reports", mod.ClockReportsEnabled); SetState("NDR.Notifications", mod.AlertsEnabled); SetState("NDR.IncludeEmpty", mod.IncludeZeroSaleDealers); SetState("NDR.Customer", mod.IncludeCustomerSales); SetState("NDR.PhoneSound", mod.PhoneSoundEnabled); int[] array = new int[4] { 1, 6, 12, 24 }; for (int i = 0; i < array.Length; i++) { int num = array[i]; SetState("NDR.Cadence" + num, mod.SelectedCadence == num, ((mod.SelectedCadence == num) ? "✓ " : "") + num + "H", (mod.SelectedCadence == num) ? Gold : Off); } array = new int[4] { 7, 30, 100, 0 }; for (int i = 0; i < array.Length; i++) { int num2 = array[i]; bool flag = mod.GraphHistoryRetention == num2; SetState("NDR.History" + num2, flag, flag ? ("✓ " + ((num2 == 0) ? "ALL" : (num2 + "D"))) : ((num2 == 0) ? "ALL" : (num2 + "D")), flag ? Lime : Off); } if ((Object)(object)_timeText != (Object)null) { _timeText.text = mod.SelectedDailyTime; } if ((Object)(object)_stockThresholdText != (Object)null) { _stockThresholdText.text = mod.LowStockThreshold + " units"; } (string, string)[] array2 = new(string, string)[8] { ("NDR.StockMinus", "−"), ("NDR.StockPlus", "+"), ("NDR.StockMinusFive", "−5"), ("NDR.StockPlusFive", "+5"), ("NDR.HourMinus", "−"), ("NDR.HourPlus", "+"), ("NDR.MinuteMinus", "−"), ("NDR.MinutePlus", "+") }; for (int i = 0; i < array2.Length; i++) { (string, string) tuple = array2[i]; if (_buttons.TryGetValue(tuple.Item1, out (Button, Text) value)) { value.Item2.text = tuple.Item2; if (tuple.Item1.Contains("Hour") || tuple.Item1.Contains("Minute")) { ((Selectable)value.Item1).interactable = mod.SelectedCadence == 24; } } } if ((Object)(object)_summary != (Object)null) { _summary.text = mod.PhoneSummary; } if ((Object)(object)_tracking != (Object)null) { _tracking.text = Short(mod.PhoneTrackingStatus, 76); } if ((Object)(object)_callbacks != (Object)null) { _callbacks.text = Short(mod.PhoneDiagnosticCounts, 92); } if ((Object)(object)_schedule != (Object)null) { _schedule.text = Short(mod.PhoneScheduleStatus, 145); } if ((Object)(object)_notice != (Object)null) { _notice.text = Short(mod.PhoneNotice, 100); } if (_buttons.TryGetValue("NDR.Test", out (Button, Text) value2)) { value2.Item2.text = "REFRESH DASHBOARD NOW"; } } private void RenderFinancialGraph(NightlyDealerReportsMod mod) { //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: 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) //IL_0414: Unknown result type (might be due to invalid IL or missing references) //IL_0455: Unknown result type (might be due to invalid IL or missing references) //IL_0473: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_0491: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Unknown result type (might be due to invalid IL or missing references) //IL_072c: Unknown result type (might be due to invalid IL or missing references) //IL_074a: Unknown result type (might be due to invalid IL or missing references) //IL_0759: Unknown result type (might be due to invalid IL or missing references) //IL_0777: Unknown result type (might be due to invalid IL or missing references) //IL_0786: Unknown result type (might be due to invalid IL or missing references) //IL_0578: Unknown result type (might be due to invalid IL or missing references) //IL_055d: Unknown result type (might be due to invalid IL or missing references) //IL_05a5: Unknown result type (might be due to invalid IL or missing references) //IL_05b4: Unknown result type (might be due to invalid IL or missing references) //IL_05da: Unknown result type (might be due to invalid IL or missing references) //IL_05e3: Unknown result type (might be due to invalid IL or missing references) //IL_069e: Unknown result type (might be due to invalid IL or missing references) //IL_06bc: Unknown result type (might be due to invalid IL or missing references) //IL_06cb: Unknown result type (might be due to invalid IL or missing references) //IL_06d4: Unknown result type (might be due to invalid IL or missing references) //IL_06ee: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_customPlot == (Object)null) { return; } int num = mod.DashboardRevision ^ (_customDaily ? 74565 : 0) ^ (_customDailyRange << 19) ^ (_customHistoryOffset << 7); if (num == _customChartSignature && _customChartDealer == _selectedDealerKey) { return; } _customChartSignature = num; _customChartDealer = _selectedDealerKey; foreach (GameObject customChartObject in _customChartObjects) { if ((Object)(object)customChartObject != (Object)null) { Object.Destroy((Object)(object)customChartObject); } } _customChartObjects.Clear(); List<DealerFinancePoint> list = (_customDaily ? mod.PhoneDailyGraph(_selectedDealerKey, _customDailyRange, _customHistoryOffset) : mod.PhoneHourlyGraph(_selectedDealerKey)); if ((Object)(object)_customGraphNote != (Object)null) { _customGraphNote.text = (_customDaily ? $"COMPLETED DAYS • {_customDailyRange}D • NET AFTER LOSSES" : "TODAY • HOURLY • NET AFTER LOSSES"); } if ((Object)(object)_customGraphNote != (Object)null && list.Any((DealerFinancePoint p) => p.Partial)) { Text? customGraphNote = _customGraphNote; customGraphNote.text += " • PARTIAL AMOUNTS"; } if ((Object)(object)_customDailyRangeGroup != (Object)null) { _customDailyRangeGroup.SetActive(_customDaily); } if ((Object)(object)_customOlderButton != (Object)null) { ((Component)_customOlderButton).gameObject.SetActive(_customDaily); ((Selectable)_customOlderButton).interactable = mod.PhoneDailyHistoryCount(_selectedDealerKey) > _customHistoryOffset + _customDailyRange; } if ((Object)(object)_customNewerButton != (Object)null) { ((Component)_customNewerButton).gameObject.SetActive(_customDaily); ((Selectable)_customNewerButton).interactable = _customHistoryOffset > 0; } for (int num2 = 0; num2 < _customRangeButtons.Count; num2++) { Image component = ((Component)_customRangeButtons[num2]).GetComponent<Image>(); if ((Object)(object)component != (Object)null) { ((Graphic)component).color = (Color)(((new int[4] { 7, 14, 30, 100 })[num2] == _customDailyRange) ? new Color(0.55f, 1f, 0.48f, 1f) : Color.white); } } RectTransform customPlot = _customPlot; float num3 = 380f; float num4 = 137f; decimal num5 = ((list.Count > 0) ? list.Max((DealerFinancePoint p) => Math.Abs(p.Net)) : 0m); if (num5 < 1m) { num5 = 1m; } float num6 = (float)num5; float num7 = (0f - num3) / 2f + 28f; float num8 = num3 - 43f; bool flag = list.Any((DealerFinancePoint p) => p.Net < 0m); float num9 = (flag ? 61f : (num4 - 20f)); float num10 = (flag ? (-12f) : (-69f)); for (int num11 = 0; num11 <= 4; num11++) { float num12 = num10 + num9 * (float)num11 / 4f; GameObject val = UIFactory.Panel("DealerReports.Graph.Grid" + num11, (Transform)(object)customPlot, new Color(0.17f, 0.45f, 0.48f, 0.29f), (Vector2?)null, (Vector2?)null, false); CustomRect(val, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, num12), new Vector2(num8, 1f)); DisableBackgroundRaycast(val); _customChartObjects.Add(val); } if (list.Count == 0) { Text val2 = CustomText("DealerReports.Graph.NoHistory", "NO COMPLETED DAYS YET", (Transform)(object)customPlot, 15, Muted, (TextAnchor)4); CustomRect(((Component)val2).gameObject, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, 0f), new Vector2(300f, 40f)); _customChartObjects.Add(((Component)val2).gameObject); return; } float num13 = num8 / (float)list.Count; float num14 = Math.Max(3f, Math.Min(23f, num13 * 0.57f)); for (int num15 = 0; num15 < list.Count; num15++) { DealerFinancePoint dealerFinancePoint = list[num15]; float num16 = num7 + num13 * ((float)num15 + 0.5f); float num17 = (float)dealerFinancePoint.Net; float num18 = Math.Max((num17 == 0f) ? 1f : 3f, Math.Abs(num17) / num6 * num9); GameObject val3 = UIFactory.Panel("DealerReports.Graph.Bar" + num15, (Transform)(object)customPlot, (Color)((num17 < 0f) ? new Color(0.98f, 0.31f, 0.35f, 1f) : Lime), (Vector2?)null, (Vector2?)null, false); CustomRect(val3, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(num16, num10 + ((num17 < 0f) ? ((0f - num18) / 2f) : (num18 / 2f))), new Vector2(num14, num18)); DisableBackgroundRaycast(val3); _customChartObjects.Add(val3); int num19 = (_customDaily ? Math.Max(1, list.Count / 7) : 3); if (num15 % num19 == 0 || num15 == list.Count - 1) { float num20 = (flag ? (-81f) : (num10 - 12f)); string label = (_customDaily ? dealerFinancePoint.Label : ((num15 % 6 == 0) ? dealerFinancePoint.Label.Replace(":00", "") : ((num15 + 7) % 24).ToString())); Text val4 = CustomText("DealerReports.Graph.Tick" + num15, label, (Transform)(object)customPlot, 9, Muted, (TextAnchor)4); CustomRect(((Component)val4).gameObject, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(num16, num20), new Vector2(Math.Max(num13 * (float)num19, 38f), 19f)); _customChartObjects.Add(((Component)val4).gameObject); } } Text val5 = CustomText("DealerReports.Graph.Max", AsMoney(num5), (Transform)(object)customPlot, 11, BrightTeal, (TextAnchor)3); CustomRect(((Component)val5).gameObject, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2((0f - num3) / 2f + 12f, num10 + num9 + 9f), new Vector2(102f, 21f)); _customChartObjects.Add(((Component)val5).gameObject); } private void ClearCustomUi() { _customUiReady = false; _customRoot = null; _customHost = null; _customHome = null; _customOverview = null; _customInventory = null; _customActivity = null; _customSettings = null; _customDealerName = (_customDealerIndex = (_customEarnings = (_customUnits = null))); _customGross = (_customCut = (_customLoss = (_customNet = (_customGraphNote = null)))); _customInventoryNew = (_customActivityNew = null); _customHeroPortrait = (_customLeftPortrait = (_customRightPortrait = null)); _customPlot = null; _customDailyRangeGroup = null; _customObjects.Clear(); _customNav.Clear(); _customChartObjects.Clear(); _customRangeButtons.Clear(); _customChartDealer = ""; _customWidth = (_customHeight = -1f); _customOlderButton = (_customNewerButton = null); _customHistoryOffset = 0; _customLastRevision = -1; } private GameObject? Finished(string name) { if (!_finishedObjects.TryGetValue(name, out GameObject value)) { return null; } return value; } private RectTransform? FinishedRect(string name) { GameObject? obj = Finished(name); if (obj == null) { return null; } return obj.GetComponent<RectTransform>(); } private Image? FinishedImage(string name) { GameObject? obj = Finished(name); if (obj == null) { return null; } return obj.GetComponent<Image>(); } private Button? FinishedButton(string name) { GameObject? obj = Finished(name); if (obj == null) { return null; } return obj.GetComponent<Button>(); } private Text? FinishedText(string name) { GameObject? obj = Finished(name); if (obj == null) { return null; } return obj.GetComponentInChildren<Text>(true); } private bool TryCreateFinishedUi(GameObject container) { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Expected O, but got Unknown //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_05e2: Unknown result type (might be due to invalid IL or missing references) //IL_05e7: Unknown result type (might be due to invalid IL or missing references) //IL_05eb: Unknown result type (might be due to invalid IL or missing references) //IL_060b: Unknown result type (might be due to invalid IL or missing references) //IL_062b: Unknown result type (might be due to invalid IL or missing references) //IL_0641: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_0447: Unknown result type (might be due to invalid IL or missing references) //IL_0458: Unknown result type (might be due to invalid IL or missing references) //IL_0463: Unknown result type (might be due to invalid IL or missing references) //IL_046e: Unknown result type (might be due to invalid IL or missing references) //IL_0478: 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_0439: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_0675: Unknown result type (might be due to invalid IL or missing references) //IL_0747: Unknown result type (might be due to invalid IL or missing references) //IL_074c: Unknown result type (might be due to invalid IL or missing references) //IL_0764: Unknown result type (might be due to invalid IL or missing references) //IL_0784: Unknown result type (might be due to invalid IL or missing references) //IL_07a4: Unknown result type (might be due to invalid IL or missing references) //IL_07ae: Unknown result type (might be due to invalid IL or missing references) //IL_07de: Unknown result type (might be due to invalid IL or missing references) //IL_0a41: Unknown result type (might be due to invalid IL or missing references) bool flag; try { using Stream stream = typeof(DealerReportsPhoneApp).Assembly.GetManifestResourceStream("NightlyDealerReports.FinishedLayout"); if (stream == null) { throw new FileNotFoundException("Finished UI layout resource not embedded"); } UiStartupStage("FINISHED_SCENE_JSON_BEGIN"); SceneDocument sceneDocument = JsonSerializer.Deserialize<SceneDocument>(stream); if (sceneDocument?.nodes == null || sceneDocument.nodes.Count < 185) { throw new InvalidDataException("Incomplete finished Unity scene"); } _finishedObjects.Clear(); _finishedOriginalColors.Clear(); GameObject val = new GameObject("DealerReports.FinishedUnity6UI"); val.transform.SetParent(container.transform, false); RectTransform val2 = val.AddComponent<RectTransform>(); Vector2 anchorMin = (val2.anchorMax = new Vector2(0.5f, 0.5f)); val2.anchorMin = anchorMin; val2.pivot = new Vector2(0.5f, 0.5f); val2.sizeDelta = new Vector2(640f, 1138f); val2.anchoredPosition = Vector2.zero; ((Transform)val2).localScale = Vector3.one; _finishedRoot = val2; _finishedHost = container.GetComponent<RectTransform>(); List<GameObject> list = new List<GameObject>(sceneDocument.nodes.Count); UiStartupStage("FINISHED_SCENE_NODE_CREATION_BEGIN"); int num = 0; foreach (SceneNode node in sceneDocument.nodes) { if (++num % 32 == 0) { UiStartupStage("FINISHED_SCENE_NODES_" + num); } if (node.parentIndex < 0) { list.Add(val); continue; } GameObject val4 = new GameObject(node.name); val4.transform.SetParent(list[node.parentIndex].transform, false); RectTransform obj = val4.AddComponent<RectTransform>(); obj.anchorMin = new Vector2(node.anchorMin[0], node.anchorMin[1]); obj.anchorMax = new Vector2(node.anchorMax[0], node.anchorMax[1]); obj.pivot = new Vector2(node.pivot[0], node.pivot[1]); obj.anchoredPosition = new Vector2(node.anchoredPosition[0], node.anchoredPosition[1]); obj.sizeDelta = new Vector2(node.sizeDelta[0], node.sizeDelta[1]); ((Transform)obj).localScale = new Vector3(node.localScale[0], node.localScale[1], node.localScale[2]); ((Transform)obj).localRotation = Quaternion.Euler(0f, 0f, node.rotationZ); if (node.image != null) { Image obj2 = val4.AddComponent<Image>(); obj2.sprite = EmbeddedSprite(node.image.spritePath); obj2.type = (Type)0; Color val5 = SceneColor(node.image.color); if (node.name == "SettingsPanel" && string.IsNullOrEmpty(node.image.spritePath)) { val5 = Color.clear; } if (string.IsNullOrEmpty(node.image.spritePath) && (node.name == "ProductIcon" || node.name == "BaggieIcon" || node.name == "JarIcon" || node.name == "BrickIcon")) { val5 = Color.clear; } ((Graphic)obj2).color = val5; obj2.preserveAspect = node.image.preserveAspect; ((Graphic)obj2).raycastTarget = node.button != null || node.scrollbar != null || node.name == "Handle"; _finishedOriginalColors[node.name] = val5; } if (node.text != null) { string text = node.text.value ?? ""; Transform transform = val4.transform; int num2 = Mathf.Max(8, Mathf.RoundToInt(node.text.fontSize)); Text val6 = UIFactory.Text("LiveText", text, transform, num2, (TextAnchor)4, (FontStyle)((node.text.fontStyle & 3) switch { 3 => 3, 2 => 2, 1 => 1, _ => 0, })); RectTransform component = ((Component)val6).GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; ((Graphic)val6).color = SceneColor(node.text.color); ((Graphic)val6).raycastTarget = false; val6.resizeTextForBestFit = node.text.autoSize; val6.resizeTextMinSize = Mathf.Max(9, Mathf.RoundToInt(node.text.fontSizeMin)); val6.resizeTextMaxSize = Mathf.Max(val6.resizeTextMinSize, Mathf.RoundToInt(node.text.fontSizeMax)); val6.horizontalOverflow = (HorizontalWrapMode)1; val6.verticalOverflow = (VerticalWrapMode)1; int horizontalAlignment = node.text.horizontalAlignment; flag = ((horizontalAlignment == 1 || horizontalAlignment == 16) ? true : false); bool flag2 = flag; bool flag3 = node.text.horizontalAlignment == 4; bool flag4 = node.text.verticalAlignment == 256; bool flag5 = node.text.verticalAlignment == 1024; val6.alignment = (TextAnchor)((!flag4) ? ((!flag5) ? (flag2 ? 3 : (flag3 ? 5 : 4)) : (flag2 ? 6 : (flag3 ? 8 : 7))) : ((!flag2) ? ((!flag3) ? 1 : 2) : 0)); } if (node.button != null) { Button obj3 = val4.AddComponent<Button>(); ((Selectable)obj3).interactable = node.button.interactable; ((Selectable)obj3).targetGraphic = (Graphic)(object)val4.GetComponent<Image>(); ((Selectable)obj3).transition = (Transition)1; ColorBlock colors = ((Selectable)obj3).colors; ((ColorBlock)(ref colors)).normalColor = Color.white; ((ColorBlock)(ref colors)).highlightedColor = new Color(0.85f, 1f, 1f, 1f); ((ColorBlock)(ref colors)).pressedColor = new Color(0.55f, 0.9f, 0.99f, 1f); ((ColorBlock)(ref colors)).fadeDuration = 0.12f; ((Selectable)obj3).colors = colors; } if (node.rectMask) { val4.AddComponent<RectMask2D>(); } if (node.mask) { Image obj4 = val4.GetComponent<Image>() ?? val4.AddComponent<Image>(); ((Graphic)obj4).color = Color.white; ((Graphic)obj4).raycastTarget = true; val4.AddComponent<Mask>().showMaskGraphic = false; } if (node.scroll != null) { ScrollRect obj5 = val4.AddComponent<ScrollRect>(); obj5.horizontal = node.scroll.horizontal; obj5.vertical = node.scroll.vertical; obj5.scrollSensitivity = 22f; obj5.movementType = (MovementType)2; obj5.verticalScrollbarVisibility = (ScrollbarVisibility)1; obj5.horizontalScrollbarVisibility = (ScrollbarVisibility)1; } if (node.scrollbar != null) { Scrollbar obj6 = val4.AddComponent<Scrollbar>(); obj6.direction = (Direction)((node.scrollbar.direction != 0) ? ((node.scrollbar.direction == 1) ? 1 : ((node.scrollbar.direction == 3) ? 3 : 2)) : 0); obj6.value = node.scrollbar.value; ColorBlock colors2 = ((Selectable)obj6).colors; ((ColorBlock)(ref colors2)).normalColor = new Color(0f, 0.8862745f, 1f, 1f); ((ColorBlock)(ref colors2)).highlightedColor = new Color(0.35f, 1f, 1f, 1f); ((ColorBlock)(ref colors2)).pressedColor = new Color(0.06f, 0.78f, 0.87f, 1f); ((Selectable)obj6).colors = colors2; Image component2 = val4.GetComponent<Image>(); if ((Object)(object)component2 != (Object)null) { ((Graphic)component2).color = new Color(0f, 0.12f, 0.15f, 0.35f); } } val4.SetActive(node.active); list.Add(val4); if (!_finishedObjects.ContainsKey(node.name)) { _finishedObjects.Add(node.name, val4); } } UiStartupStage("FINISHED_SCENE_NODE_CREATION_DONE"); _finishedDealerName = FinishedText("DealerNameText"); _finishedDealerCount = FinishedText("DealerCountText"); _finishedHeroPortrait = FinishedImage("BenjiPortrait"); _finishedLeftPortrait = FinishedImage("MollyPortrait"); _finishedRightPortrait = FinishedImage("BradPortrait"); if ((Object)(object)Finished("HomeBackground") == (Object)null || (Object)(object)Finished("TabBackground") == (Object)null || (Object)(object)Finished("DealerHeaderGroup") == (Object)null || (Object)(object)Finished("HoldingCashValueText") == (Object)null || (Object)(object)Finished("SettingsPanel") == (Object)null || (Object)(object)Finished("GraphScrollView") == (Object)null || (Object)(object)Finished("InventoryProductEntry") == (Object)null || (Object)(object)Finished("ActivityTransactionHeader") == (Object)null) { throw new InvalidDataException("Finished scene is missing critical panels or templates"); } UiStartupStage("FINISHED_SCENE_SCROLL_SETUP_BEGIN"); SetupFinishedScroll("InventoryScrollView", "InventoryProductEntry", "InventoryScrollBar", out _finishedInventoryScroll, out _finishedInventoryContent); SetupFinishedScroll("ActivityScrollView", "ActivityEntry", "ActivityScrollBar", out _finishedActivityScroll, out _finishedActivityContent); SetupFinishedScroll("GraphScrollView", "Content", "GraphHorizontalScrollBar", out _finishedGraphScroll, out _finishedGraphContent); _finishedGraphBars = FinishedRect("GraphBars"); _finishedGraphLabels = FinishedRect("HourLabels"); _finishedBarTemplate = FinishedRect("GraphBar01"); _finishedTimeTemplate = FinishedRect("GraphTime01"); _finishedAuthoredTimeX.Clear(); for (int i = 0; i < 10; i++) { RectTransform val7 = FinishedRect("GraphTime" + (i + 1).ToString("00")); if ((Object)(object)val7 != (Object)null) { _finishedAuthoredTimeX[i] = val7.anchoredPosition; } } _finishedInventoryTemplate = Finished("ProductHeader"); _finishedActivityTemplate = Finished("ActivityTransactionHeader"); if ((Object)(object)_finishedInventoryTemplate == (Object)null || (Object)(object)_finishedActivityTemplate == (Object)null || (Object)(object)_finishedGraphBars == (Object)null || (Object)(object)_finishedGraphLabels == (Object)null || (Object)(object)_finishedBarTemplate == (Object)null || (Object)(object)_finishedTimeTemplate == (Object)null) { throw new InvalidDataException("Revised Inventory, Activity or Graph templates missing"); } _finishedInventoryTemplate.SetActive(false); _finishedActivityTemplate.SetActive(false); _finishedDaily = NightlyDealerReportsMod.Current?.GraphDailyMode ?? false; CreateFinishedEmptyState(_finishedInventoryContent, "DealerReports.InventoryEmptyState", "No products in this dealer's inventory"); CreateFinishedEmptyState(_finishedActivityContent, "DealerReports.ActivityEmptyState", "No sales recorded for this dealer today"); UiStartupStage("FINISHED_SCENE_WIRING_BEGIN"); WireFinishedButtons(); MakeUnreadDot(); MakeFinishedTabUnreadDots(); _finishedTab = CustomTab.Home; _finishedUiReady = true; UiStartupStage("FINISHED_SCENE_FIT_BEGIN"); FitFinishedUi(); ShowFinishedTab(); UiStartupStage("FINISHED_SCENE_READY"); MelonLogger.Msg($"DealerReports 2.8.5: loaded {sceneDocument.nodes.Count} finished Unity scene nodes and live controls after opening the app."); flag = true; } catch (Exception ex) { UiStartupStage("FINISHED_SCENE_MANAGED_EXCEPTION_" + ex.GetType().Name); MelonLogger.Error("Finished UI import failed; falling back to original UI: " + ex); ClearFinishedUi(); flag = false; } return flag; } private void SetupFinishedScroll(string owner, string content, string scrollbar, out ScrollRect? scroll, out RectTransform? contentRect) { //IL_00be: Unknown result type (might be due to invalid IL or missing references) GameObject? obj = Finished(owner); scroll = ((obj != null) ? obj.GetComponent<ScrollRect>() : null); contentRect = null; if ((Object)(object)scroll == (Object)null) { throw new InvalidDataException(owner + " has no ScrollRect"); } Transform obj2 = ((Component)scroll).transform.Find("Viewport"); RectTransform val = ((obj2 != null) ? ((Component)obj2).GetComponent<RectTransform>() : null); object obj3; if (val == null) { obj3 = null; } else { Transform obj4 = ((Transform)val).Find(content); obj3 = ((obj4 != null) ? ((Component)obj4).GetComponent<RectTransform>() : null); } RectTransform val2 = (RectTransform)obj3; if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null) { throw new InvalidDataException(owner + " has no valid viewport/content"); } scroll.viewport = val; scroll.content = val2; contentRect = val2; Image obj5 = ((Component)val).GetComponent<Image>() ?? ((Component)val).gameObject.AddComponent<Image>(); ((Graphic)obj5).color = Color.white; ((Graphic)obj5).raycastTarget = true; (((Component)val).GetComponent<Mask>() ?? ((Component)val).gameObject.AddComponent<Mask>()).showMaskGraphic = false; Transform obj6 = ((Component)scroll).transform.Find(scrollbar); Scrollbar val3 = ((obj6 != null) ? ((Component)obj6).GetComponent<Scrollbar>() : null); if ((Object)(object)val3 != (Object)null) { Transform obj7 = ((Component)val3).transform.Find("Sliding Area/Handle"); object obj8 = ((obj7 != null) ? ((Component)obj7).GetComponent<RectTransform>() : null); if (obj8 == null) { Transform obj9 = ((Component)scroll).transform.Find("Sliding Area/Handle"); obj8 = ((obj9 != null) ? ((Component)obj9).GetComponent<RectTransform>() : null); } RectTransform val4 = (RectTransform)obj8; if ((Object)(object)val4 == (Object)null) { throw new InvalidDataException(owner + " scrollbar handle missing"); } val3.handleRect = val4; ((Selectable)val3).targetGraphic = (Graphic)(object)((Component)val4).GetComponent<Image>(); if (scroll.horizontal) { scroll.horizontalScrollbar = val3; } else if (scroll.vertical) { scroll.verticalScrollbar = val3; } } } private static void ResetFinishedScrollTop(ScrollRect? sc, RectTransform? content) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)sc == (Object)null) && !((Object)(object)content == (Object)null)) { content.anchoredPosition = new Vector2(content.anchoredPosition.x, 0f); sc.verticalNormalizedPosition = 1f; } } private static void CreateFinishedEmptyState(RectTransform? parent, string name, string message) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)parent == (Object)null) && !((Object)(object)((Transform)parent).Find(name) != (Object)null)) { Text obj = UIFactory.Text(name, message, (Transform)(object)parent, 19, (TextAnchor)4, (FontStyle)0); GameObject gameObject = ((Component)obj).gameObject; RectTransform component = gameObject.GetComponent<RectTransform>(); Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0.5f, 1f); component.anchorMax = val; component.anchorMin = val; component.pivot = new Vector2(0.5f, 1f); component.anchoredPosition = new Vector2(0f, -38f); component.sizeDelta = new Vector2(420f, 70f); ((Graphic)obj).color = new Color(0.57f, 0.88f, 0.9f, 0.95f); obj.alignment = (TextAnchor)4; obj.horizontalOverflow = (HorizontalWrapMode)0; obj.verticalOverflow = (VerticalWrapMode)1; ((Graphic)obj).raycastTarget = false; gameObject.SetActive(false); } } private static void ToggleFinishedEmptyState(RectTransform? parent, string name, bool enabled) { Transform val = ((parent != null) ? ((Transform)parent).Find(name) : null); if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.SetActive(enabled); } } private void BindFinished(string name, Action action) { Button val = FinishedButton(name); if ((Object)(object)val == (Object)null) { Image val2 = FinishedImage(name); if (val2 != null) { val = ((Component)val2).gameObject.AddComponent<Button>(); ((Selectable)val).targetGraphic = (Graphic)(object)val2; ((Graphic)val2).raycastTarget = true; } } if ((Object)(object)val != (Object)null) { ButtonUtils.AddListener(val, (Action)delegate { action(); Refresh(); }); } else { MelonLogger.Warning("DealerReports UI missing button: " + name); } } private void WireFinishedButtons() { BindFinished("PreviousDealerButton", delegate { StepDealer(-1); }); BindFinished("NextDealerButton", delegate { StepDealer(1); }); (string, CustomTab)[] array = new(string, CustomTab)[4] { ("OverviewButton", CustomTab.Overview), ("InventoryButton", CustomTab.Inventory), ("ActivityButton", CustomTab.Activity), ("SettingsButton", CustomTab.Settings) }; for (int num = 0; num < array.Length; num++) { (string, CustomTab) tuple = array[num]; string item = tuple.Item1; CustomTab item2 = tuple.Item2; CustomTab selected = item2; BindFinished(item, delegate { _finishedTab = selected; ShowFinishedTab(); }); } GameObject val = Finished("IconDR"); if (val != null) { Image component = val.GetComponent<Image>(); if ((Object)(object)component != (Object)null) { ((Graphic)component).raycastTarget = true; } Button obj = val.GetComponent<Button>() ?? val.AddComponent<Button>(); ((Selectable)obj).targetGraphic = (Graphic)(object)component; ButtonUtils.AddListener(obj, (Action)delegate { _finishedTab = CustomTab.Home; ShowFinishedTab(); Refresh(); }); } BindFinished("GraphModeHourlyButton", delegate { _finishedDaily = false; NightlyDealerReportsMod.Current?.PhoneSetGraphDailyMode(daily: false); _finishedGraphRevision = -1; }); BindFinished("GraphModeDailyButton", delegate { _finishedDaily = true; NightlyDealerReportsMod.Current?.PhoneSetGraphDailyMode(daily: true); _finishedGraphRevision = -1; }); BindFinished("DealerReportsToggleOnButton", delegate { EnsureReports(on: true); }); BindFinished("DealerReportsToggleOffButton", delegate { EnsureReports(on: false); }); (int, string)[] array2 = new(int, string)[4] { (1, "ReportInterval1HButton"), (6, "ReportInterval6HButton"), (12, "ReportInterval12HRButton"), (24, "ReportInterval24HRButton") }; for (int num = 0; num < array2.Length; num++) { (int, string) tuple2 = array2[num]; int item3 = tuple2.Item1; string item4 = tuple2.Item2; int hrs = item3; BindFinished(item4, delegate { NightlyDealerReportsMod.Current?.PhoneSelectCadence(hrs); }); } BindFinished("ReportTimeButton+", delegate { NightlyDealerReportsMod.Current?.PhoneChangeTime(0, 30); }); BindFinished("ReportTimeButton-", delegate { NightlyDealerReportsMod.Current?.PhoneChangeTime(0, -30); }); BindFinished("LowStockAlertsButton", delegate { NightlyDealerReportsMod.Current?.PhoneToggleAlerts(); }); BindFinished("ThresholdButton+", delegate { NightlyDealerReportsMod.Current?.PhoneChangeLowStockThreshold(1); }); BindFinished("ThresholdButton-", delegate { NightlyDealerReportsMod.Current?.PhoneChangeLowStockThreshold(-1); }); array2 = new(int, string)[5] { (7, "HistoryRetention7D"), (14, "HistoryRetention14DButton"), (30, "HistoryRetention30DButton"), (100, "HistoryRetention100DButton"), (0, "HistoryRetentionInfiniteButton") }; for (int num = 0; num < array2.Length; num++) { (int, string) tuple3 = array2[num]; int item5 = tuple3.Item1; string item6 = tuple3.Item2; int days = item5; BindFinished(item6, delegate { NightlyDealerReportsMod.Current?.PhoneSetHistoryRetention(days); }); } BindFinished("ScaleModeAutoButton", delegate { NightlyDealerReportsMod.Current?.PhoneSetGraphScaleAuto(auto: true); }); BindFinished("ScaleModeManualButton", delegate { NightlyDealerReportsMod.Current?.PhoneSetGraphScaleAuto(auto: false); }); BindFinished("MaxValueButton+", delegate { ClickFinishedGraphMax(1); }); BindFinished("MaxValueButton-", delegate { ClickFinishedGraphMax(-1); }); } private void ClickFinishedGraphMax(int direction) { if ((_finishedMaxHoldRepeated && _finishedMaxHoldDirection == direction) || (_finishedMaxIgnoreClickDirection == direction && Time.unscaledTime <= _finishedMaxIgnoreClickUntil)) { _finishedMaxIgnoreClickDirection = 0; } else { NightlyDealerReportsMod.Current?.PhoneChangeGraphMaximum(direction * 1000); } } private void TickFinishedGraphMaxHold() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) NightlyDealerReportsMod current = NightlyDealerReportsMod.Current; if (!_finishedUiReady || !((PhoneApp)this).IsOpen() || _finishedTab != CustomTab.Settings || current == null || current.GraphScaleAuto) { _finishedMaxHoldDirection = 0; _finishedMaxHoldRepeated = false; return; } if (Input.GetMouseButtonDown(0)) { Vector3 mousePosition = Input.mousePosition; (string, int)[] array = new(string, int)[2] { ("MaxValueButton+", 1), ("MaxValueButton-", -1) }; for (int i = 0; i < array.Length; i++) { (string, int) tuple = array[i]; Button val = FinishedButton(tuple.Item1); RectTransform val2 = ((val != null) ? ((Component)val).GetComponent<RectTransform>() : null); if (!((Object)(object)val == (Object)null) && ((Selectable)val).interactable && !((Object)(object)val2 == (Object)null)) { Canvas componentInParent = ((Component)val2).GetComponentInParent<Canvas>(); Camera val3 = (((Object)(object)componentInParent != (Object)null && (int)componentInParent.renderMode != 0) ? componentInParent.worldCamera : null); if (RectTransformUtility.RectangleContainsScreenPoint(val2, new Vector2(mousePosition.x, mousePosition.y), val3)) { _finishedMaxHoldDirection = tuple.Item2; _finishedMaxHoldRepeated = false; _finishedMaxHoldStart = Time.unscaledTime; _finishedMaxNextRepeat = _finishedMaxHoldStart + 0.55f; break; } } } } if (_finishedMaxHoldDirection == 0) { return; } if (Input.GetMouseButton(0) && Time.unscaledTime >= _finishedMaxNextRepeat) { _finishedMaxHoldRepeated = true; current.PhoneChangeGraphMaximum(_finishedMaxHoldDirection * 1000); UpdateFinishedSettings(current); float num = Time.unscaledTime - _finishedMaxHoldStart; _finishedMaxNextRepeat = Time.unscaledTime + Mathf.Max(0.045f, 0.17f - num * 0.04f); } if (Input.GetMouseButtonUp(0) || !Input.GetMouseButton(0)) { if (_finishedMaxHoldRepeated) { _finishedMaxIgnoreClickDirection = _finishedMaxHoldDirection; _finishedMaxIgnoreClickUntil = Time.unscaledTime + 0.2f; } _finishedMaxHoldDirection = 0; } } private static void EnsureReports(bool on) { NightlyDealerReportsMod current = NightlyDealerReportsMod.Current; if (current != null && current.ClockReportsEnabled != on) { current.PhoneToggleReports(); } } private void MakeUnreadDot() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_004c: 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_0063: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) GameObject val = Finished("IconDR"); if (!((Object)(object)val == (Object)null)) { GameObject val2 = new GameObject("DealerReports.UnreadDot"); val2.transform.SetParent(val.transform, false); RectTransform obj = val2.AddComponent<RectTransform>(); Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(0f, 1f); obj.anchorMax = val3; obj.anchorMin = val3; obj.pivot = new Vector2(0.5f, 0.5f); obj.anchoredPosition = new Vector2(3f, -3f); obj.sizeDelta = new Vector2(13f, 13f); _finishedUnreadDot = val2.AddComponent<Image>(