Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of ConcernedTeamster v1.0.1
plugins/TheConcernedCat.ConcernedTeamster.dll
Decompiled 2 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.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using Jotunn; using Jotunn.Managers; using Microsoft.CodeAnalysis; using TheConcernedCat.ConcernedTeamster.Adapters; using TheConcernedCat.ConcernedTeamster.Domain; using TheConcernedCat.ConcernedTeamster.Domain.Authority; using TheConcernedCat.ConcernedTeamster.Domain.Brake; using TheConcernedCat.ConcernedTeamster.Domain.Capabilities; using TheConcernedCat.ConcernedTeamster.Domain.Cargo; using TheConcernedCat.ConcernedTeamster.Domain.Cartographer; using TheConcernedCat.ConcernedTeamster.Domain.Carts; using TheConcernedCat.ConcernedTeamster.Domain.Compatibility; using TheConcernedCat.ConcernedTeamster.Domain.Config; using TheConcernedCat.ConcernedTeamster.Domain.Diagnostics; using TheConcernedCat.ConcernedTeamster.Domain.Load; using TheConcernedCat.ConcernedTeamster.Domain.Localization; using TheConcernedCat.ConcernedTeamster.Domain.Net; using TheConcernedCat.ConcernedTeamster.Domain.Onboarding; using TheConcernedCat.ConcernedTeamster.Domain.Profiles; using TheConcernedCat.ConcernedTeamster.Domain.Risk; using TheConcernedCat.ConcernedTeamster.Domain.RoadQuality; using TheConcernedCat.ConcernedTeamster.Domain.Routes; using TheConcernedCat.ConcernedTeamster.Domain.Support; using TheConcernedCat.ConcernedTeamster.Domain.Terrain; using TheConcernedCat.ConcernedTeamster.Domain.Trips; using TheConcernedCat.ConcernedTeamster.Domain.Ui; using TheConcernedCat.ConcernedTeamster.Domain.Warnings; using TheConcernedCat.ConcernedTeamster.Ui; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("The Concerned Cat")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyCopyright("Copyright © 2026 Eren Cansunar")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1+0575bf436e7a4914371658c2e700c7cc93063d43")] [assembly: AssemblyProduct("Concerned Teamster")] [assembly: AssemblyTitle("TheConcernedCat.ConcernedTeamster")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/Weakened/ConcernedCatMods")] [assembly: AssemblyVersion("1.0.1.0")] 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; } } } namespace TheConcernedCat.ConcernedTeamster { [BepInPlugin("com.theconcernedcat.valheim.concernedteamster", "Concerned Teamster", "1.0.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class Plugin : BaseUnityPlugin { public const string PluginGuid = "com.theconcernedcat.valheim.concernedteamster"; public const string PluginName = "Concerned Teamster"; public const string PluginVersion = "1.0.1"; private bool _cartographerProbePending; private bool _compatibilityProbePending; private readonly LogTailRecorder _logTail = new LogTailRecorder(); private void Awake() { _logTail.Attach(((BaseUnityPlugin)this).Logger); TeamsterSettings teamsterSettings = TeamsterSettings.Bind(((BaseUnityPlugin)this).Config); ApplyConfigSchemaMigrationIfNeeded(teamsterSettings); ApplyProfileIfChanged(teamsterSettings); LocalizationFiles.Initialize(((BaseUnityPlugin)this).Logger); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Concerned Teamster 1.0.1 loaded"); LogEnvironmentBanner(); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Effective config: " + $"Enabled={teamsterSettings.Enabled.Value}, " + $"DebugLogging={teamsterSettings.DebugLogging.Value}.")); LogCartCapability(teamsterSettings); ArmTelemetry(teamsterSettings); _cartographerProbePending = teamsterSettings.Enabled.Value; _compatibilityProbePending = true; } private void Update() { if (_cartographerProbePending) { _cartographerProbePending = false; CartographerCapability.EnsureProbed(((BaseUnityPlugin)this).Logger); } if (_compatibilityProbePending) { _compatibilityProbePending = false; CompatibilityAdapter.EnsureProbed(((BaseUnityPlugin)this).Logger); } } private void ApplyConfigSchemaMigrationIfNeeded(TeamsterSettings settings) { ConfigSchemaMigration.Plan plan = ConfigSchemaMigration.Decide(settings.SchemaVersion.Value); if (plan.LogMessage != null) { if (plan.IsFromANewerVersion) { ((BaseUnityPlugin)this).Logger.LogWarning((object)plan.LogMessage); } else { ((BaseUnityPlugin)this).Logger.LogInfo((object)plan.LogMessage); } } if (plan.NeedsMigration) { settings.SchemaVersion.Value = 1; } } private void ApplyProfileIfChanged(TeamsterSettings settings) { ConfigProfile value = settings.ActiveProfile.Value; ConfigProfile value2 = settings.LastAppliedProfile.Value; if (ProfileTransition.ShouldApply(value, value2)) { ProfileValues profileValues = ConfigProfileCatalog.Resolve(value); settings.PanelWarningsEnabled.Value = profileValues.PanelWarningsEnabled; settings.HudWarningHintsEnabled.Value = profileValues.HudWarningHintsEnabled; settings.TripsEnabled.Value = profileValues.TripsEnabled; settings.RiskLookaheadPoints.Value = profileValues.RiskLookaheadPoints; settings.LastAppliedProfile.Value = value; ((BaseUnityPlugin)this).Logger.LogInfo((object)($"Config profile '{value}' applied (was '{value2}'): " + $"warnings={profileValues.PanelWarningsEnabled}, HUD hint={profileValues.HudWarningHintsEnabled}, " + $"trips={profileValues.TripsEnabled}, risk lookahead={profileValues.RiskLookaheadPoints}. " + "Brake.Enabled is never changed by a profile switch — it stays opt-in.")); } } private void ArmTelemetry(TeamsterSettings settings) { if (!settings.Enabled.Value) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Concerned Teamster is disabled by config; no cart observation runs."); } else if (CartAdapter.CapabilityEnabled) { LoadModel loadModel = LoadCalibratedModel(); RiskModel riskModel = LoadDescentModel(); CartTelemetryPump cartTelemetryPump = ((Component)this).gameObject.AddComponent<CartTelemetryPump>(); TelemetrySamplerOptions telemetrySamplerOptions = cartTelemetryPump.Initialize(settings, ((BaseUnityPlugin)this).Logger, loadModel, riskModel); ((BaseUnityPlugin)this).Logger.LogInfo((object)($"Cart telemetry sampler armed: interval {telemetrySamplerOptions.SampleIntervalSeconds:0.##} s, " + $"radius {telemetrySamplerOptions.SearchRadiusMeters:0.#} m, {telemetrySamplerOptions.MaxCartsPerTick} carts/tick, " + $"{telemetrySamplerOptions.MaxTrackedCarts} tracked max, evict after {telemetrySamplerOptions.EvictAfterSeconds:0.#} s.")); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Warnings: panel " + (settings.PanelWarningsEnabled.Value ? "on" : "off") + ", HUD hint " + (settings.HudWarningHintsEnabled.Value ? "on" : "off") + $", steep-climb caution at {settings.SteepGradeCautionPercent.Value:0.#}% " + $"(exit −{3f:0.#}%, " + $"fall hold {4.0:0.#} s).")); ((Component)this).gameObject.AddComponent<CartStatusHudController>().Initialize(settings, ((BaseUnityPlugin)this).Logger, cartTelemetryPump, ResolveInformationalVersion(), _logTail); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Cart Status panel armed: visible Cart button at the right screen edge while in a world, " + $"UI scale {UiScaleOptions.Clamp(settings.UiScale.Value):0.##}.")); } } private LoadModel? LoadCalibratedModel() { LoadCalibrationData loadCalibrationData = LoadCalibrationSource.TryLoadEmbedded(); if (loadCalibrationData == null || loadCalibrationData.DataVersion <= 0) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Load calibration data missing or unreadable; load advice stays off, all telemetry keeps working."); return null; } ((BaseUnityPlugin)this).Logger.LogInfo((object)($"Load calibration v{loadCalibrationData.DataVersion} loaded: {loadCalibrationData.Rows.Count} rows " + $"({loadCalibrationData.MeasuredRowCount} measured) for game {loadCalibrationData.GameVersion}; " + ((loadCalibrationData.Errors.Count == 0) ? "no parse errors." : $"{loadCalibrationData.Errors.Count} malformed line(s) skipped."))); return new LoadModel(loadCalibrationData); } private RiskModel? LoadDescentModel() { DescentCalibrationData descentCalibrationData = DescentCalibrationSource.TryLoadEmbedded(); if (descentCalibrationData == null || descentCalibrationData.DataVersion <= 0) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Descent calibration data missing or unreadable; descent risk stays Unknown, all telemetry keeps working."); return null; } ((BaseUnityPlugin)this).Logger.LogInfo((object)($"Descent calibration v{descentCalibrationData.DataVersion} loaded: {descentCalibrationData.Rows.Count} rows " + $"({descentCalibrationData.MeasuredRowCount} measured) for game {descentCalibrationData.GameVersion}; " + ((descentCalibrationData.Errors.Count == 0) ? "no parse errors." : $"{descentCalibrationData.Errors.Count} malformed line(s) skipped."))); return new RiskModel(descentCalibrationData); } private void LogCartCapability(TeamsterSettings settings) { GameCapabilityReport gameCapabilityReport = CartAdapter.ProbeCapability(); if (gameCapabilityReport.Enabled) { ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Cart telemetry capability ENABLED: {gameCapabilityReport.VerifiedMembers.Count} game members verified."); if (settings.DebugLogging.Value) { ((BaseUnityPlugin)this).Logger.LogDebug((object)("Verified cart members: " + string.Join(", ", gameCapabilityReport.VerifiedMembers))); } } else { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Cart telemetry capability DISABLED: missing " + string.Join(", ", gameCapabilityReport.MissingMembers) + ". A Valheim update likely changed cart internals; cart features stay off until a Concerned Teamster update, and everything else keeps working.")); } } private void LogEnvironmentBanner() { string bepInExVersion = "unknown"; string jotunnVersion = "unknown"; string unityVersion = "unknown"; try { bepInExVersion = typeof(BaseUnityPlugin).Assembly.GetName().Version?.ToString() ?? "unknown"; jotunnVersion = typeof(Main).Assembly.GetName().Version?.ToString() ?? "unknown"; unityVersion = Application.unityVersion; } catch { } ((BaseUnityPlugin)this).Logger.LogInfo((object)EnvironmentBanner.Compose("ConcernedTeamster@" + ResolveInformationalVersion(), GameVersionResolver.Resolve(), unityVersion, bepInExVersion, jotunnVersion)); } private static string ResolveInformationalVersion() { try { return typeof(Plugin).Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion ?? "1.0.1"; } catch { return "1.0.1"; } } } internal sealed class TeamsterSettings { public ConfigEntry<bool> Enabled { get; } public ConfigEntry<bool> DebugLogging { get; } public ConfigEntry<float> SampleIntervalSeconds { get; } public ConfigEntry<float> SearchRadiusMeters { get; } public ConfigEntry<int> MaxCartsPerTick { get; } public ConfigEntry<int> MaxTrackedCarts { get; } public ConfigEntry<KeyboardShortcut> PanelShortcut { get; } public ConfigEntry<bool> PanelWarningsEnabled { get; } public ConfigEntry<bool> HudWarningHintsEnabled { get; } public ConfigEntry<float> SteepGradeCautionPercent { get; } public ConfigEntry<int> RiskLookaheadPoints { get; } public ConfigEntry<bool> BrakeEnabled { get; } public ConfigEntry<bool> TripsEnabled { get; } public ConfigEntry<float> TripRecordSpacingSeconds { get; } public ConfigEntry<int> TripMaxSamplesPerTrip { get; } public ConfigEntry<int> TripMaxTripsRetained { get; } public ConfigEntry<float> UiScale { get; } public ConfigEntry<bool> OnboardingDismissed { get; } public ConfigEntry<ConfigProfile> ActiveProfile { get; } public ConfigEntry<ConfigProfile> LastAppliedProfile { get; } public ConfigEntry<int> SchemaVersion { get; } private TeamsterSettings(ConfigEntry<bool> enabled, ConfigEntry<bool> debugLogging, ConfigEntry<float> sampleIntervalSeconds, ConfigEntry<float> searchRadiusMeters, ConfigEntry<int> maxCartsPerTick, ConfigEntry<int> maxTrackedCarts, ConfigEntry<KeyboardShortcut> panelShortcut, ConfigEntry<bool> panelWarningsEnabled, ConfigEntry<bool> hudWarningHintsEnabled, ConfigEntry<float> steepGradeCautionPercent, ConfigEntry<int> riskLookaheadPoints, ConfigEntry<bool> brakeEnabled, ConfigEntry<bool> tripsEnabled, ConfigEntry<float> tripRecordSpacingSeconds, ConfigEntry<int> tripMaxSamplesPerTrip, ConfigEntry<int> tripMaxTripsRetained, ConfigEntry<float> uiScale, ConfigEntry<bool> onboardingDismissed, ConfigEntry<ConfigProfile> activeProfile, ConfigEntry<ConfigProfile> lastAppliedProfile, ConfigEntry<int> schemaVersion) { Enabled = enabled; DebugLogging = debugLogging; SampleIntervalSeconds = sampleIntervalSeconds; SearchRadiusMeters = searchRadiusMeters; MaxCartsPerTick = maxCartsPerTick; MaxTrackedCarts = maxTrackedCarts; PanelShortcut = panelShortcut; PanelWarningsEnabled = panelWarningsEnabled; HudWarningHintsEnabled = hudWarningHintsEnabled; SteepGradeCautionPercent = steepGradeCautionPercent; RiskLookaheadPoints = riskLookaheadPoints; BrakeEnabled = brakeEnabled; TripsEnabled = tripsEnabled; TripRecordSpacingSeconds = tripRecordSpacingSeconds; TripMaxSamplesPerTrip = tripMaxSamplesPerTrip; TripMaxTripsRetained = tripMaxTripsRetained; UiScale = uiScale; OnboardingDismissed = onboardingDismissed; ActiveProfile = activeProfile; LastAppliedProfile = lastAppliedProfile; SchemaVersion = schemaVersion; } public static TeamsterSettings Bind(ConfigFile config) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Expected O, but got Unknown //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Expected O, but got Unknown //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Expected O, but got Unknown //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Expected O, but got Unknown //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Expected O, but got Unknown //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Expected O, but got Unknown return new TeamsterSettings(config.Bind<bool>("General", "Enabled", true, "Master switch for Concerned Teamster cart telemetry features. Disabling leaves carts fully vanilla; the mod never changes cart physics by default either way."), config.Bind<bool>("Diagnostics", "DebugLogging", false, "Write diagnostic messages for Teamster feature development. Never enables per-frame logging."), config.Bind<float>("Telemetry", "SampleIntervalSeconds", 0.5f, new ConfigDescription("Seconds between cart telemetry samples. Read-only observation of nearby carts; between samples the cost is one comparison per frame.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>())), config.Bind<float>("Telemetry", "SearchRadiusMeters", 30f, new ConfigDescription("Carts farther than this from you are not observed.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 100f), Array.Empty<object>())), config.Bind<int>("Telemetry", "MaxCartsPerTick", 2, new ConfigDescription("Hard budget of carts examined per telemetry tick.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 8), Array.Empty<object>())), config.Bind<int>("Telemetry", "MaxTrackedCarts", 8, new ConfigDescription("Hard cap of carts kept in the telemetry table at once.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 32), Array.Empty<object>())), config.Bind<KeyboardShortcut>("Ui", "PanelShortcut", KeyboardShortcut.Empty, "Optional keyboard accelerator that toggles the Cart Status panel. The visible Cart button is always the primary path; leave empty for no shortcut."), config.Bind<bool>("Warnings", "PanelWarningsEnabled", true, "Show load/grade warnings in the Cart Status panel."), config.Bind<bool>("Warnings", "HudWarningHintsEnabled", false, "Also show the current warning as a small HUD hint under the Cart button while pulling. Off by default: the panel is the primary surface and HUD space is precious; enable if you haul with the panel closed."), config.Bind<float>("Warnings", "SteepGradeCautionPercent", 18f, new ConfigDescription("Smoothed climbing grade (percent) that raises the steep-climb caution. Exit hysteresis and anti-flicker hold are fixed so no configuration can make warnings spam.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 60f), Array.Empty<object>())), config.Bind<int>("Risk", "LookaheadPoints", 3, new ConfigDescription("Terrain samples taken ahead of the pulled cart (4 m apart) to rate the upcoming descent. 0 disables lookahead. Each sample is one bounded ground-height read per telemetry tick.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 5), Array.Empty<object>())), config.Bind<bool>("Brake", "Enabled", true, "The parking brake feature: a visible button that freezes a parked cart you control until you release it. Explicit per-use, always reversible, never saved into the world, and it releases itself on detach distance, world exit, shutdown, or any capability loss. Disable to remove the button entirely."), config.Bind<bool>("Trips", "Enabled", true, "Record hauling trips (position, grade, speed, load while you pull) into Teamster's own per-world sidecar file under BepInEx/config. Never touches Valheim saves; delete the sidecar folder to erase all history."), config.Bind<float>("Trips", "RecordSpacingSeconds", 1f, new ConfigDescription("Seconds between recorded trip samples while pulling.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.25f, 10f), Array.Empty<object>())), config.Bind<int>("Trips", "MaxSamplesPerTrip", 600, new ConfigDescription("Hard cap of samples in one trip; longer hauls split into segments.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(50, 5000), Array.Empty<object>())), config.Bind<int>("Trips", "MaxTripsRetained", 50, new ConfigDescription("Retention: how many trips each world's sidecar keeps; the oldest are pruned first.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(5, 500), Array.Empty<object>())), config.Bind<float>("Ui", "Scale", 1f, new ConfigDescription("Uniform size of every Teamster panel, button, and font. 1.0 is the default size; takes effect the next time a panel opens (or on world enter for the always-visible Cart button), not live on an already-open panel.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.8f, 1.3f), Array.Empty<object>())), config.Bind<bool>("Onboarding", "Dismissed", false, "Set automatically once you dismiss the first-run hint pointing at the Cart button. Set back to false to see the hint again."), config.Bind<ConfigProfile>("General", "Profile", ConfigProfile.Standard, "A documented settings preset: Minimal (telemetry only, warnings/HUD hints/trips off), Standard (Teamster's normal defaults), or EverythingObservational (every read-only feature on). The parking brake stays off in every profile — enable Brake.Enabled yourself if you want it. Changing this re-applies the preset's values once, on the next load; your own edits to individual settings are never overwritten again until you change this value to something else."), config.Bind<ConfigProfile>("General", "LastAppliedProfile", ConfigProfile.Standard, "Internal bookkeeping — do not edit. Records which profile was last applied so a restart with no Profile change never re-applies it."), config.Bind<int>("Internal", "ConfigSchemaVersion", 0, "Internal bookkeeping — do not edit. Tracks which version of Teamster's config schema this file was last written by, so a future update can migrate safely.")); } } } namespace TheConcernedCat.ConcernedTeamster.Ui { internal sealed class CargoManifestPanel { private const float PanelWidth = 420f; private const float PanelHeight = 470f; private const float RowHeight = 24f; private const int VisibleRowCount = 12; private const double ViewTickSeconds = 1.0; private readonly ManualLogSource _log; private readonly Func<float> _uiScale; private readonly CargoManifestTracker _tracker = new CargoManifestTracker(); private bool _failed; private GameObject? _panel; private InputField? _filter; private Text?[] _rows = Array.Empty<Text>(); private Text? _message; private Text? _overflow; private Text? _total; private Text? _freshness; private Button? _sortNameButton; private Button? _sortCountButton; private Button? _sortUnitButton; private Button? _sortLineButton; private CargoSortColumn _sortColumn = CargoSortColumn.LineWeight; private bool _sortDescending = true; private string _lastAppliedFilter = string.Empty; private CargoManifest? _lastAppliedManifest; private bool _viewDirty = true; private double _nextViewTick; public bool IsVisible { get { if ((Object)(object)_panel != (Object)null) { return _panel.activeSelf; } return false; } } public CargoManifestPanel(ManualLogSource log, Func<float> uiScale) { _log = log; _uiScale = uiScale; } public void Toggle() { if (_failed) { return; } try { if (!((Object)(object)_panel == (Object)null) || Build()) { bool flag = !_panel.activeSelf; _panel.SetActive(flag); if (flag) { _viewDirty = true; _nextViewTick = 0.0; } } } catch (Exception exception) { Fail(exception); } } public void Hide() { if ((Object)(object)_panel != (Object)null && _panel.activeSelf) { _panel.SetActive(false); } } public void Reset() { _tracker.Reset(); _lastAppliedManifest = null; _viewDirty = true; Hide(); } public void HandleFrame(double nowSeconds, string? selectedCartId) { if (_failed || !IsVisible) { return; } try { if (Input.GetKeyDown((KeyCode)27)) { Hide(); } else { if (!_viewDirty && nowSeconds < _nextViewTick) { return; } _nextViewTick = nowSeconds + 1.0; CargoManifest orRefresh = _tracker.GetOrRefresh(nowSeconds, (double captureTime) => CartAdapter.TryReadManifest(CartAdapter.TryFindCartById(selectedCartId), captureTime)); string text = (((Object)(object)_filter != (Object)null) ? _filter.text : string.Empty); if (!_viewDirty && orRefresh == _lastAppliedManifest && string.Equals(text, _lastAppliedFilter, StringComparison.Ordinal)) { if (orRefresh != null && (Object)(object)_freshness != (Object)null) { CargoManifestViewModel cargoManifestViewModel = CargoManifestPresenter.Present(orRefresh, _sortColumn, _sortDescending, text, nowSeconds, GameLocalization.LocalizeOrRaw); _freshness.text = cargoManifestViewModel.FreshnessLine; } } else { _lastAppliedManifest = orRefresh; _lastAppliedFilter = text; _viewDirty = false; Render(CargoManifestPresenter.Present(orRefresh, _sortColumn, _sortDescending, text, nowSeconds, GameLocalization.LocalizeOrRaw)); } } } catch (Exception exception) { Fail(exception); } } private void Render(CargoManifestViewModel viewModel) { if ((Object)(object)_message != (Object)null) { _message.text = viewModel.Message; } int num = Math.Min(viewModel.Rows.Count, 12); for (int i = 0; i < _rows.Length; i++) { Text val = _rows[i]; if (!((Object)(object)val == (Object)null)) { if (i < num) { CargoRowViewModel cargoRowViewModel = viewModel.Rows[i]; val.text = TeamsterStrings.Format("manifest.row", cargoRowViewModel.Name, cargoRowViewModel.CountText, cargoRowViewModel.UnitWeightText, cargoRowViewModel.LineWeightText); } else { val.text = string.Empty; } } } if ((Object)(object)_overflow != (Object)null) { int num2 = viewModel.Rows.Count - num; _overflow.text = ((num2 > 0) ? TeamsterStrings.Format("manifest.overflow", num2.ToString(CultureInfo.InvariantCulture)) : string.Empty); } if ((Object)(object)_total != (Object)null) { _total.text = viewModel.TotalLine; } if ((Object)(object)_freshness != (Object)null) { _freshness.text = viewModel.FreshnessLine; } UpdateSortButtonLabels(); } private void SetSort(CargoSortColumn column) { if (_sortColumn == column) { _sortDescending = !_sortDescending; } else { _sortColumn = column; _sortDescending = column != CargoSortColumn.Name; } _viewDirty = true; UpdateSortButtonLabels(); } private void UpdateSortButtonLabels() { string text = (_sortDescending ? " ▼" : " ▲"); SetButtonLabel(_sortNameButton, TeamsterStrings.Get("manifest.colItem") + ((_sortColumn == CargoSortColumn.Name) ? text : string.Empty)); SetButtonLabel(_sortCountButton, TeamsterStrings.Get("manifest.colCount") + ((_sortColumn == CargoSortColumn.Count) ? text : string.Empty)); SetButtonLabel(_sortUnitButton, TeamsterStrings.Get("manifest.colUnit") + ((_sortColumn == CargoSortColumn.UnitWeight) ? text : string.Empty)); SetButtonLabel(_sortLineButton, TeamsterStrings.Get("manifest.colLine") + ((_sortColumn == CargoSortColumn.LineWeight) ? text : string.Empty)); } private static void SetButtonLabel(Button? button, string label) { if (!((Object)(object)button == (Object)null)) { Text componentInChildren = ((Component)button).GetComponentInChildren<Text>(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.text = label; } } } private bool Build() { //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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_0063: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0226: 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_0287: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Expected O, but got Unknown if (GUIManager.Instance == null || (Object)(object)GUIManager.CustomGUIFront == (Object)null) { return false; } GUIManager instance = GUIManager.Instance; Font averiaSerifBold = instance.AveriaSerifBold; Color header = PanelStyle.Header; Color body = PanelStyle.Body; _panel = PanelStyle.CreateScaledWoodpanel(instance, GUIManager.CustomGUIFront.transform, new Vector2(1f, 0.5f), new Vector2(1f, 0.5f), new Vector2(-590f, 0f), 420f, 470f, _uiScale()); instance.CreateText(TeamsterStrings.Get("manifest.title"), _panel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -28f), averiaSerifBold, 19, header, true, Color.black, 380f, 30f, false); GameObject val = instance.CreateInputField(_panel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -62f), (ContentType)0, TeamsterStrings.Get("manifest.filterPlaceholder"), 15, 360f, 28f); _filter = val.GetComponent<InputField>(); if ((Object)(object)_filter != (Object)null) { ((UnityEvent<string>)(object)_filter.onValueChanged).AddListener((UnityAction<string>)delegate { _viewDirty = true; }); } float num = 90f; float num2 = -180f + num / 2f; _sortNameButton = CreateSortButton(instance, num2 + 0f * num, num, delegate { SetSort(CargoSortColumn.Name); }); _sortCountButton = CreateSortButton(instance, num2 + 1f * num, num, delegate { SetSort(CargoSortColumn.Count); }); _sortUnitButton = CreateSortButton(instance, num2 + 2f * num, num, delegate { SetSort(CargoSortColumn.UnitWeight); }); _sortLineButton = CreateSortButton(instance, num2 + 3f * num, num, delegate { SetSort(CargoSortColumn.LineWeight); }); _message = CreateBodyText(instance, averiaSerifBold, body, -128f, 24f); _rows = (Text?[])(object)new Text[12]; float num3 = -152f; for (int num4 = 0; num4 < 12; num4++) { _rows[num4] = CreateBodyText(instance, averiaSerifBold, body, num3, 24f); num3 -= 24f; } _overflow = CreateBodyText(instance, averiaSerifBold, body, num3, 24f); _total = CreateBodyText(instance, averiaSerifBold, header, num3 - 24f, 24f); _freshness = CreateBodyText(instance, averiaSerifBold, body, num3 - 48f, 24f); ((UnityEvent)instance.CreateButton(TeamsterStrings.Get("ui.close"), _panel.transform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(0f, 26f), 110f, 28f).GetComponent<Button>().onClick).AddListener(new UnityAction(Hide)); UpdateSortButtonLabels(); _panel.SetActive(false); return true; } private Button? CreateSortButton(GUIManager gui, float centerX, float width, Action onClick) { //IL_0029: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown Button component = gui.CreateButton(string.Empty, _panel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(centerX, -98f), width - 4f, 26f).GetComponent<Button>(); if (component != null) { ((UnityEvent)component.onClick).AddListener((UnityAction)delegate { onClick(); }); return component; } return component; } private Text? CreateBodyText(GUIManager gui, Font font, Color color, float y, float height) { //IL_001b: 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) Text component = gui.CreateText(string.Empty, _panel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, y - height / 2f), font, 15, color, true, Color.black, 380f, height, false).GetComponent<Text>(); if ((Object)(object)component != (Object)null) { component.alignment = (TextAnchor)0; component.verticalOverflow = (VerticalWrapMode)0; component.horizontalOverflow = (HorizontalWrapMode)1; } return component; } private void Fail(Exception exception) { _failed = true; try { Hide(); } catch { } _log.LogError((object)("Cargo Manifest UI failed and was disabled for this session (telemetry keeps running): " + exception.GetType().Name + ": " + exception.Message)); } } internal sealed class CartStatusHudController : MonoBehaviour { private const float PanelWidth = 320f; private const float PanelHeight = 450f; private const float RowHeight = 26f; private const float RefreshPeriodSeconds = 0.25f; private const int RowCount = 9; private TeamsterSettings? _settings; private ManualLogSource? _log; private CartTelemetryPump? _pump; private CargoManifestPanel? _manifestPanel; private RecoveryGuidancePanel? _guidancePanel; private TripHistoryPanel? _tripPanel; private RoutePickerPanel? _routePanel; private CompatibilityPanel? _compatPanel; private SupportBundlePanel? _supportPanel; private bool _failed; private GameObject? _button; private GameObject? _panel; private Text? _hudHint; private GameObject? _onboardingHint; private GameObject? _brakeButton; private Text? _brakeButtonText; private Text[] _rows = Array.Empty<Text>(); private string? _selectedCartId; private double _nextRefreshTime; private double _nextSelectionRefreshTime; internal void Initialize(TeamsterSettings settings, ManualLogSource log, CartTelemetryPump? pump, string pluginVersion, LogTailRecorder logTail) { _settings = settings; _log = log; _pump = pump; _manifestPanel = new CargoManifestPanel(log, CurrentUiScale); _guidancePanel = new RecoveryGuidancePanel(log, CurrentUiScale); _tripPanel = new TripHistoryPanel(log, CurrentUiScale); _tripPanel.BindPump(pump); _compatPanel = new CompatibilityPanel(log, CurrentUiScale); _supportPanel = new SupportBundlePanel(log, CurrentUiScale, pluginVersion, settings, logTail, () => _pump?.Trips); } private float CurrentUiScale() { return UiScaleOptions.Clamp(_settings?.UiScale.Value ?? 1f); } private void Update() { //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) if (_failed || _settings == null) { return; } try { bool flag = CartAdapter.HasLocalPlayer(); EnsureButton(flag); if (!flag) { if ((Object)(object)_panel != (Object)null && _panel.activeSelf) { _panel.SetActive(false); } _manifestPanel?.Reset(); _guidancePanel?.Hide(); _tripPanel?.Hide(); _routePanel?.Hide(); _compatPanel?.Hide(); _supportPanel?.Hide(); _selectedCartId = null; if ((Object)(object)_hudHint != (Object)null && ((Component)_hudHint).gameObject.activeSelf) { ((Component)_hudHint).gameObject.SetActive(false); } if ((Object)(object)_onboardingHint != (Object)null && _onboardingHint.activeSelf) { _onboardingHint.SetActive(false); } return; } KeyboardShortcut value = _settings.PanelShortcut.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { TogglePanel(); } double unscaledTimeAsDouble = Time.unscaledTimeAsDouble; if ((Object)(object)_panel != (Object)null && _panel.activeSelf) { if (Input.GetKeyDown((KeyCode)27)) { _panel.SetActive(false); } else if (unscaledTimeAsDouble >= _nextRefreshTime) { _nextRefreshTime = unscaledTimeAsDouble + 0.25; RefreshPanel(unscaledTimeAsDouble); } } else if (unscaledTimeAsDouble >= _nextSelectionRefreshTime) { CargoManifestPanel manifestPanel = _manifestPanel; if ((manifestPanel != null && manifestPanel.IsVisible) || _settings.HudWarningHintsEnabled.Value) { _nextSelectionRefreshTime = unscaledTimeAsDouble + 1.0; CartStatusViewModel cartStatusViewModel = CartStatusPresenter.Present(_pump?.Telemetry, _selectedCartId, unscaledTimeAsDouble, _pump != null); _selectedCartId = ((cartStatusViewModel.SelectedCartId.Length > 0) ? cartStatusViewModel.SelectedCartId : null); } } _manifestPanel?.HandleFrame(unscaledTimeAsDouble, _selectedCartId); _guidancePanel?.HandleFrame(unscaledTimeAsDouble, _pump); _tripPanel?.HandleFrame(unscaledTimeAsDouble, _pump); _routePanel?.HandleFrame(unscaledTimeAsDouble); _compatPanel?.HandleFrame(); _supportPanel?.HandleFrame(); UpdateHudHint(); UpdateOnboardingHint(); } catch (Exception exception) { Fail(exception); } } private float? SelectedCartTotalMass() { IReadOnlyDictionary<string, CartTelemetry> readOnlyDictionary = _pump?.Telemetry; if (readOnlyDictionary == null || _selectedCartId == null || !readOnlyDictionary.TryGetValue(_selectedCartId, out var value) || value == null) { return null; } return value.TotalMass; } private void EnsureButton(bool inWorld) { //IL_004d: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Expected O, but got Unknown if ((Object)(object)_button == (Object)null) { if (!inWorld || GUIManager.Instance == null || (Object)(object)GUIManager.CustomGUIFront == (Object)null) { return; } _button = GUIManager.Instance.CreateButton(TeamsterStrings.Get("status.cartButton"), GUIManager.CustomGUIFront.transform, new Vector2(1f, 0.5f), new Vector2(1f, 0.5f), new Vector2(-70f, 170f), 80f, 32f); ((UnityEvent)_button.GetComponent<Button>().onClick).AddListener(new UnityAction(TogglePanel)); PanelStyle.ApplyScale(_button, CurrentUiScale()); _hudHint = GUIManager.Instance.CreateText(string.Empty, GUIManager.CustomGUIFront.transform, new Vector2(1f, 0.5f), new Vector2(1f, 0.5f), new Vector2(-160f, 140f), GUIManager.Instance.AveriaSerifBold, 14, PanelStyle.HudHint, true, Color.black, 300f, 40f, false).GetComponent<Text>(); _hudHint.alignment = (TextAnchor)5; ((Component)_hudHint).gameObject.SetActive(false); PanelStyle.ApplyScale(((Component)_hudHint).gameObject, CurrentUiScale()); _onboardingHint = GUIManager.Instance.CreateButton(TeamsterStrings.Get("onboarding.hint"), GUIManager.CustomGUIFront.transform, new Vector2(1f, 0.5f), new Vector2(1f, 0.5f), new Vector2(-150f, 225f), 280f, 44f); ((UnityEvent)_onboardingHint.GetComponent<Button>().onClick).AddListener(new UnityAction(DismissOnboarding)); Text componentInChildren = _onboardingHint.GetComponentInChildren<Text>(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.fontSize = 13; componentInChildren.alignment = (TextAnchor)4; componentInChildren.horizontalOverflow = (HorizontalWrapMode)0; componentInChildren.verticalOverflow = (VerticalWrapMode)0; } _onboardingHint.SetActive(false); PanelStyle.ApplyScale(_onboardingHint, CurrentUiScale()); } if (_button.activeSelf != inWorld) { _button.SetActive(inWorld); } } private void TogglePanel() { try { if (!((Object)(object)_panel == (Object)null) || EnsurePanel()) { bool flag = !_panel.activeSelf; _panel.SetActive(flag); if (flag) { _nextRefreshTime = 0.0; RefreshPanel(Time.unscaledTimeAsDouble); } } } catch (Exception exception) { Fail(exception); } } private bool EnsurePanel() { //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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_0063: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Expected O, but got Unknown //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Expected O, but got Unknown //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Expected O, but got Unknown //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03de: 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_042e: Unknown result type (might be due to invalid IL or missing references) //IL_0438: Expected O, but got Unknown //IL_0464: 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_04a7: Unknown result type (might be due to invalid IL or missing references) //IL_04b1: Expected O, but got Unknown //IL_04d1: Unknown result type (might be due to invalid IL or missing references) //IL_04e0: Unknown result type (might be due to invalid IL or missing references) //IL_04ef: Unknown result type (might be due to invalid IL or missing references) //IL_0514: Unknown result type (might be due to invalid IL or missing references) //IL_051e: Expected O, but got Unknown //IL_053e: Unknown result type (might be due to invalid IL or missing references) //IL_054d: Unknown result type (might be due to invalid IL or missing references) //IL_055c: Unknown result type (might be due to invalid IL or missing references) //IL_0581: Unknown result type (might be due to invalid IL or missing references) //IL_058b: Expected O, but got Unknown //IL_0361: 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_037f: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Expected O, but got Unknown if (GUIManager.Instance == null || (Object)(object)GUIManager.CustomGUIFront == (Object)null) { return false; } GUIManager instance = GUIManager.Instance; Font averiaSerifBold = instance.AveriaSerifBold; Color header = PanelStyle.Header; Color body = PanelStyle.Body; _panel = PanelStyle.CreateScaledWoodpanel(instance, GUIManager.CustomGUIFront.transform, new Vector2(1f, 0.5f), new Vector2(1f, 0.5f), new Vector2(-190f, 0f), 320f, 450f, CurrentUiScale()); instance.CreateText(TeamsterStrings.Get("status.title"), _panel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -28f), averiaSerifBold, 19, header, true, Color.black, 280f, 30f, false); _rows = (Text[])(object)new Text[9]; float num = -58f; for (int i = 0; i < _rows.Length; i++) { _rows[i] = instance.CreateText(string.Empty, _panel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, num - 13f), averiaSerifBold, 16, body, true, Color.black, 280f, 26f, false).GetComponent<Text>(); _rows[i].alignment = (TextAnchor)0; _rows[i].verticalOverflow = (VerticalWrapMode)0; num -= 26f; } ((UnityEvent)instance.CreateButton(TeamsterStrings.Get("status.tripsButton"), _panel.transform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(90f, 62f), 110f, 30f).GetComponent<Button>().onClick).AddListener((UnityAction)delegate { _tripPanel?.Toggle(_pump); }); ((UnityEvent)instance.CreateButton(TeamsterStrings.Get("status.compatButton"), _panel.transform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(-90f, 96f), 110f, 30f).GetComponent<Button>().onClick).AddListener((UnityAction)delegate { _compatPanel?.Toggle(); }); ((UnityEvent)instance.CreateButton(TeamsterStrings.Get("status.supportButton"), _panel.transform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(-90f, 130f), 110f, 30f).GetComponent<Button>().onClick).AddListener((UnityAction)delegate { _supportPanel?.Toggle(); }); if (CartographerCapability.IsAvailable && _log != null) { if (_routePanel == null) { _routePanel = new RoutePickerPanel(_log, _pump?.LoadModel, SelectedCartTotalMass, CurrentUiScale); } ((UnityEvent)instance.CreateButton(TeamsterStrings.Get("status.routesButton"), _panel.transform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(90f, 96f), 110f, 30f).GetComponent<Button>().onClick).AddListener((UnityAction)delegate { _routePanel?.Toggle(); }); } _brakeButton = instance.CreateButton(TeamsterStrings.Get("status.engageBrake"), _panel.transform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(-70f, 62f), 150f, 30f); _brakeButtonText = _brakeButton.GetComponentInChildren<Text>(); ((UnityEvent)_brakeButton.GetComponent<Button>().onClick).AddListener((UnityAction)delegate { _pump?.Brake?.RequestToggle(_selectedCartId); RefreshPanel(Time.unscaledTimeAsDouble); }); _brakeButton.SetActive(false); ((UnityEvent)instance.CreateButton(TeamsterStrings.Get("status.manifestButton"), _panel.transform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(-102f, 28f), 96f, 30f).GetComponent<Button>().onClick).AddListener((UnityAction)delegate { _manifestPanel?.Toggle(); }); ((UnityEvent)instance.CreateButton(TeamsterStrings.Get("status.guidanceButton"), _panel.transform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(0f, 28f), 96f, 30f).GetComponent<Button>().onClick).AddListener((UnityAction)delegate { _guidancePanel?.Toggle(); }); ((UnityEvent)instance.CreateButton(TeamsterStrings.Get("ui.close"), _panel.transform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(102f, 28f), 96f, 30f).GetComponent<Button>().onClick).AddListener((UnityAction)delegate { _panel.SetActive(false); }); _panel.SetActive(false); return true; } private void RefreshPanel(double nowSeconds) { CartStatusViewModel cartStatusViewModel = CartStatusPresenter.Present(_pump?.Telemetry, _selectedCartId, nowSeconds, _pump != null); _selectedCartId = ((cartStatusViewModel.SelectedCartId.Length > 0) ? cartStatusViewModel.SelectedCartId : null); if (_rows.Length != 9 || (Object)(object)_rows[0] == (Object)null) { return; } _rows[0].text = cartStatusViewModel.SourceLine; _rows[1].text = cartStatusViewModel.MassLine; _rows[2].text = cartStatusViewModel.BreakdownLine; _rows[3].text = cartStatusViewModel.GradeLine; _rows[4].text = cartStatusViewModel.SurfaceLine; _rows[5].text = cartStatusViewModel.PullLine; _rows[6].text = cartStatusViewModel.FreshnessLine; string text = string.Empty; if (_pump != null && _settings != null && _settings.PanelWarningsEnabled.Value && cartStatusViewModel.SelectedCartId.Length > 0) { CartWarning cartWarning = _pump.TryGetWarning(cartStatusViewModel.SelectedCartId); if (cartWarning != null) { text = cartWarning.ComposeLine(); } } _rows[7].text = text; string text2 = string.Empty; CartDiagnostic cartDiagnostic = _pump?.LatestDiagnostic; if (cartDiagnostic != null && cartStatusViewModel.SelectedCartId.Length > 0 && _pump.LatestDescentRisk?.CartId == cartStatusViewModel.SelectedCartId) { text2 = cartDiagnostic.ComposeLine(); } _rows[8].text = text2; RefreshBrakeButton(cartStatusViewModel.SelectedCartId); } private void RefreshBrakeButton(string selectedCartId) { if ((Object)(object)_brakeButton == (Object)null) { return; } BrakeService brakeService = _pump?.Brake; bool flag = false; string text = TeamsterStrings.Get("status.engageBrake"); if (brakeService != null && selectedCartId.Length > 0) { if (brakeService.EngagedCartId == selectedCartId) { flag = true; text = TeamsterStrings.Get("status.releaseBrake"); } else if (!brakeService.IsEngaged) { BrakeFacts brakeFacts = CartBrakeAdapter.ReadFacts(selectedCartId); flag = brakeFacts.CartExists && brakeFacts.IsLocalAuthority && !brakeFacts.IsAttached && brakeFacts.DistanceMeters <= 5f; } } if (_brakeButton.activeSelf != flag) { _brakeButton.SetActive(flag); } if (flag && (Object)(object)_brakeButtonText != (Object)null && _brakeButtonText.text != text) { _brakeButtonText.text = text; } } private void UpdateHudHint() { if ((Object)(object)_hudHint == (Object)null) { return; } string text = string.Empty; if (_settings != null && _settings.HudWarningHintsEnabled.Value && _pump != null && _selectedCartId != null) { IReadOnlyDictionary<string, CartTelemetry> telemetry = _pump.Telemetry; if (telemetry != null && telemetry.TryGetValue(_selectedCartId, out var value) && value.IsPulledByLocalPlayer) { CartWarning cartWarning = _pump.TryGetWarning(_selectedCartId); if (cartWarning != null) { text = cartWarning.ComposeLine(); } } } bool flag = text.Length > 0; if (((Component)_hudHint).gameObject.activeSelf != flag) { ((Component)_hudHint).gameObject.SetActive(flag); } if (flag && _hudHint.text != text) { _hudHint.text = text; } } private void UpdateOnboardingHint() { if (!((Object)(object)_onboardingHint == (Object)null) && _settings != null) { GameObject panel = _panel; bool num = panel != null && panel.activeSelf; IReadOnlyDictionary<string, CartTelemetry> readOnlyDictionary = _pump?.Telemetry; OnboardingVisibility onboardingVisibility = OnboardingPresenter.Evaluate(isNearCart: readOnlyDictionary != null && readOnlyDictionary.Count > 0, dismissedForever: _settings.OnboardingDismissed.Value); bool flag = !num && onboardingVisibility == OnboardingVisibility.Visible; if (_onboardingHint.activeSelf != flag) { _onboardingHint.SetActive(flag); } } } private void DismissOnboarding() { if (_settings != null) { _settings.OnboardingDismissed.Value = true; } if ((Object)(object)_onboardingHint != (Object)null) { _onboardingHint.SetActive(false); } } private void Fail(Exception exception) { _failed = true; try { if ((Object)(object)_panel != (Object)null) { _panel.SetActive(false); } if ((Object)(object)_button != (Object)null) { _button.SetActive(false); } if ((Object)(object)_hudHint != (Object)null) { ((Component)_hudHint).gameObject.SetActive(false); } if ((Object)(object)_onboardingHint != (Object)null) { _onboardingHint.SetActive(false); } _manifestPanel?.Hide(); _guidancePanel?.Hide(); _tripPanel?.Hide(); _routePanel?.Hide(); _compatPanel?.Hide(); _supportPanel?.Hide(); } catch { } ManualLogSource? log = _log; if (log != null) { log.LogError((object)("Cart Status UI failed and was disabled for this session (telemetry keeps running): " + exception.GetType().Name + ": " + exception.Message)); } } } internal sealed class CompatibilityPanel { private const float PanelWidth = 380f; private const float PanelHeight = 360f; private const float RowHeight = 26f; private const int MaxLines = 8; private readonly ManualLogSource _log; private readonly Func<float> _uiScale; private bool _failed; private GameObject? _panel; private Text[] _lines = Array.Empty<Text>(); private Text? _overflow; public bool IsVisible { get { if ((Object)(object)_panel != (Object)null) { return _panel.activeSelf; } return false; } } public CompatibilityPanel(ManualLogSource log, Func<float> uiScale) { _log = log; _uiScale = uiScale; } public void Toggle() { if (_failed) { return; } try { if (!((Object)(object)_panel == (Object)null) || EnsurePanel()) { bool flag = !_panel.activeSelf; _panel.SetActive(flag); if (flag) { Render(); } } } catch (Exception exception) { Fail(exception); } } public void Hide() { if ((Object)(object)_panel != (Object)null && _panel.activeSelf) { _panel.SetActive(false); } } public void HandleFrame() { if (_failed || !IsVisible) { return; } try { if (Input.GetKeyDown((KeyCode)27)) { Hide(); } } catch (Exception exception) { Fail(exception); } } private void Render() { IReadOnlyList<ModDetectionResult> results = CompatibilityAdapter.Results; if (results == null) { _lines[0].text = TeamsterStrings.Get("compat.notYetChecked"); for (int i = 1; i < _lines.Length; i++) { _lines[i].text = string.Empty; } if ((Object)(object)_overflow != (Object)null) { _overflow.text = string.Empty; } return; } IReadOnlyList<string> readOnlyList = CompatibilityStatusPresenter.ComposeDetectedLines(results); if (readOnlyList.Count == 0) { _lines[0].text = CompatibilityStatusPresenter.ComposeNoneDetectedLine(); for (int j = 1; j < _lines.Length; j++) { _lines[j].text = string.Empty; } if ((Object)(object)_overflow != (Object)null) { _overflow.text = string.Empty; } return; } int num = Math.Min(readOnlyList.Count, _lines.Length); for (int k = 0; k < _lines.Length; k++) { _lines[k].text = ((k < num) ? readOnlyList[k] : string.Empty); } if ((Object)(object)_overflow != (Object)null) { int num2 = readOnlyList.Count - num; _overflow.text = ((num2 > 0) ? TeamsterStrings.Format("compat.overflow", num2.ToString(CultureInfo.InvariantCulture)) : string.Empty); } } private bool EnsurePanel() { //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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_0063: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Expected O, but got Unknown if (GUIManager.Instance == null || (Object)(object)GUIManager.CustomGUIFront == (Object)null) { return false; } GUIManager instance = GUIManager.Instance; Font averiaSerifBold = instance.AveriaSerifBold; Color header = PanelStyle.Header; Color body = PanelStyle.Body; _panel = PanelStyle.CreateScaledWoodpanel(instance, GUIManager.CustomGUIFront.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, 120f), 380f, 360f, _uiScale()); instance.CreateText(TeamsterStrings.Get("compat.title"), _panel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -28f), averiaSerifBold, 19, header, true, Color.black, 340f, 30f, false); _lines = (Text[])(object)new Text[8]; float num = -66f; for (int i = 0; i < 8; i++) { _lines[i] = instance.CreateText(string.Empty, _panel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, num - 13f), averiaSerifBold, 14, body, true, Color.black, 340f, 26f, false).GetComponent<Text>(); _lines[i].alignment = (TextAnchor)0; _lines[i].verticalOverflow = (VerticalWrapMode)0; _lines[i].horizontalOverflow = (HorizontalWrapMode)1; num -= 26f; } _overflow = instance.CreateText(string.Empty, _panel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, num - 13f), averiaSerifBold, 13, body, true, Color.black, 340f, 26f, false).GetComponent<Text>(); _overflow.alignment = (TextAnchor)0; _overflow.horizontalOverflow = (HorizontalWrapMode)1; ((UnityEvent)instance.CreateButton(TeamsterStrings.Get("ui.close"), _panel.transform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(0f, 26f), 110f, 28f).GetComponent<Button>().onClick).AddListener(new UnityAction(Hide)); _panel.SetActive(false); return true; } private void Fail(Exception exception) { _failed = true; try { Hide(); } catch { } _log.LogError((object)("Compatibility panel UI failed and was disabled for this session: " + exception.GetType().Name + ": " + exception.Message)); } } internal static class PanelStyle { public static Color Header => ToColor(PanelPalette.Header); public static Color Body => ToColor(PanelPalette.Body); public static Color HudHint => ToColor(PanelPalette.HudHint); public static void ApplyScale(GameObject gameObject, float scale) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) gameObject.transform.localScale = new Vector3(scale, scale, scale); } public static GameObject CreateScaledWoodpanel(GUIManager gui, Transform parent, Vector2 anchorMin, Vector2 anchorMax, Vector2 position, float width, float height, float scale) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) GameObject obj = gui.CreateWoodpanel(parent, anchorMin, anchorMax, position, width, height, true); ApplyScale(obj, scale); return obj; } private static Color ToColor((float R, float G, float B) rgb) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) return new Color(rgb.R, rgb.G, rgb.B, 1f); } } internal sealed class RecoveryGuidancePanel { private const float PanelWidth = 380f; private const float PanelHeight = 360f; private const float RowHeight = 34f; private const int StepRowCount = 6; private const double RefreshPeriodSeconds = 1.0; private readonly ManualLogSource _log; private readonly Func<float> _uiScale; private bool _failed; private GameObject? _panel; private Text? _title; private Text?[] _steps = Array.Empty<Text>(); private double _nextRefreshTime; public bool IsVisible { get { if ((Object)(object)_panel != (Object)null) { return _panel.activeSelf; } return false; } } public RecoveryGuidancePanel(ManualLogSource log, Func<float> uiScale) { _log = log; _uiScale = uiScale; } public void Toggle() { if (_failed) { return; } try { if (!((Object)(object)_panel == (Object)null) || Build()) { bool flag = !_panel.activeSelf; _panel.SetActive(flag); if (flag) { _nextRefreshTime = 0.0; } } } catch (Exception exception) { Fail(exception); } } public void Hide() { if ((Object)(object)_panel != (Object)null && _panel.activeSelf) { _panel.SetActive(false); } } public void HandleFrame(double nowSeconds, CartTelemetryPump? pump) { if (_failed || !IsVisible) { return; } try { if (Input.GetKeyDown((KeyCode)27)) { Hide(); } else { if (nowSeconds < _nextRefreshTime) { return; } _nextRefreshTime = nowSeconds + 1.0; CartTelemetry telemetry = null; string text = pump?.LatestDescentRisk?.CartId; if (text != null) { IReadOnlyDictionary<string, CartTelemetry> readOnlyDictionary = pump?.Telemetry; if (readOnlyDictionary != null && readOnlyDictionary.TryGetValue(text, out var value)) { telemetry = value; } } RecoveryGuidanceViewModel viewModel = RecoveryGuidancePresenter.Present(pump?.LatestDiagnostic, telemetry, pump?.LoadModel, pump?.Brake != null); Render(viewModel); } } catch (Exception exception) { Fail(exception); } } private void Render(RecoveryGuidanceViewModel viewModel) { if ((Object)(object)_title != (Object)null) { _title.text = viewModel.Title; } for (int i = 0; i < _steps.Length; i++) { Text val = _steps[i]; if (!((Object)(object)val == (Object)null)) { val.text = ((i < viewModel.Steps.Count) ? ((i + 1).ToString(CultureInfo.InvariantCulture) + ". " + viewModel.Steps[i]) : string.Empty); } } } private bool Build() { //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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_0063: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Expected O, but got Unknown if (GUIManager.Instance == null || (Object)(object)GUIManager.CustomGUIFront == (Object)null) { return false; } GUIManager instance = GUIManager.Instance; Font averiaSerifBold = instance.AveriaSerifBold; Color header = PanelStyle.Header; Color body = PanelStyle.Body; _panel = PanelStyle.CreateScaledWoodpanel(instance, GUIManager.CustomGUIFront.transform, new Vector2(1f, 0.5f), new Vector2(1f, 0.5f), new Vector2(-570f, -120f), 380f, 360f, _uiScale()); instance.CreateText(TeamsterStrings.Get("recovery.title"), _panel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -28f), averiaSerifBold, 19, header, true, Color.black, 340f, 30f, false); _title = instance.CreateText(string.Empty, _panel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -66f), averiaSerifBold, 15, header, true, Color.black, 340f, 40f, false).GetComponent<Text>(); if ((Object)(object)_title != (Object)null) { _title.alignment = (TextAnchor)0; _title.verticalOverflow = (VerticalWrapMode)0; } _steps = (Text?[])(object)new Text[6]; float num = -104f; for (int i = 0; i < 6; i++) { Text component = instance.CreateText(string.Empty, _panel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, num - 17f), averiaSerifBold, 14, body, true, Color.black, 340f, 34f, false).GetComponent<Text>(); if ((Object)(object)component != (Object)null) { component.alignment = (TextAnchor)0; component.verticalOverflow = (VerticalWrapMode)0; } _steps[i] = component; num -= 34f; } ((UnityEvent)instance.CreateButton(TeamsterStrings.Get("ui.close"), _panel.transform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(0f, 26f), 110f, 28f).GetComponent<Button>().onClick).AddListener(new UnityAction(Hide)); _panel.SetActive(false); return true; } private void Fail(Exception exception) { _failed = true; try { Hide(); } catch { } _log.LogError((object)("Recovery Guidance UI failed and was disabled for this session (telemetry keeps running): " + exception.GetType().Name + ": " + exception.Message)); } } internal sealed class RoutePickerPanel { private const float PanelWidth = 380f; private const float PanelHeight = 570f; private const float RowHeight = 26f; private const int RowCount = 11; private const double RefreshPeriodSeconds = 1.0; private const int ProfileSamplesPerFrame = 24; private readonly ManualLogSource _log; private readonly LoadModel? _loadModel; private readonly Func<float?> _cartMassProvider; private readonly Func<float> _uiScale; private readonly RouteProfileCache _profileCache = new RouteProfileCache(); private readonly RouteReportPanel _reportPanel; private string _selectedRouteName = ""; private RouteProfiler? _profiler; private Guid? _profileRouteId; private ulong _profileFingerprint; private RouteProfile? _shownProfile; private RouteLoadBottleneck.Result? _shownBottleneck; private Text[] _profileLines = Array.Empty<Text>(); private bool _failed; private GameObject? _panel; private Text? _statusLine; private Text? _overflowLine; private GameObject[] _rowButtons = Array.Empty<GameObject>(); private Text[] _rowTexts = Array.Empty<Text>(); private readonly Guid?[] _rowRouteIds = new Guid?[11]; private Guid? _selectedRouteId; private long _lastChangeStamp = long.MinValue; private double _nextRefreshTime; internal Guid? SelectedRouteId => _selectedRouteId; internal bool IsVisible { get { if ((Object)(object)_panel != (Object)null) { return _panel.activeSelf; } return false; } } internal RoutePickerPanel(ManualLogSource log, LoadModel? loadModel, Func<float?> cartMassProvider, Func<float> uiScale) { _log = log; _loadModel = loadModel; _cartMassProvider = cartMassProvider; _uiScale = uiScale; _reportPanel = new RouteReportPanel(log, uiScale); } internal void Toggle() { if (_failed) { return; } try { if (!((Object)(object)_panel == (Object)null) || EnsurePanel()) { bool flag = !_panel.activeSelf; _panel.SetActive(flag); if (flag) { ForceRefresh(); } else { _reportPanel.Hide(); } } } catch (Exception exception) { Fail(exception); } } internal void Hide() { if ((Object)(object)_panel != (Object)null && _panel.activeSelf) { _panel.SetActive(false); } _selectedRouteId = null; _lastChangeStamp = long.MinValue; _profiler?.Cancel(); _profiler = null; _profileRouteId = null; _shownProfile = null; _shownBottleneck = null; _selectedRouteName = ""; _profileCache.Clear(); _reportPanel.Hide(); } internal void HandleFrame(double nowSeconds) { if (_failed || !IsVisible) { return; } try { if (nowSeconds >= _nextRefreshTime) { _nextRefreshTime = nowSeconds + 1.0; long changeStamp; bool flag = CartographerCapability.TryReadRouteChangeStamp(out changeStamp); if (!flag || changeStamp != _lastChangeStamp) { _lastChangeStamp = (flag ? changeStamp : long.MinValue); Refresh(); } else { RecomputeBottleneck(); RenderProfileLines(); } } AdvanceProfiling(); } catch (Exception exception) { Fail(exception); } } private void ForceRefresh() { _nextRefreshTime = 0.0; _lastChangeStamp = long.MinValue; Refresh(); } private void Refresh() { IReadOnlyList<CartographerRouteSnapshot> routes; bool flag = CartographerCapability.TryReadRoutes(out routes); RoutePickerPresenter.ViewModel viewModel = RoutePickerPresenter.Present(flag, flag ? routes : null, _selectedRouteId); _selectedRouteId = viewModel.EffectiveSelectedId; object route; if (flag) { Guid? selectedRouteId = _selectedRouteId; if (selectedRouteId.HasValue) { route = FindRoute(routeId: selectedRouteId.GetValueOrDefault(), routes: routes); goto IL_0051; } } route = null; goto IL_0051; IL_0051: SyncProfileTarget((CartographerRouteSnapshot?)route); RecomputeBottleneck(); if ((Object)(object)_statusLine == (Object)null || _rowTexts.Length != 11) { return; } _statusLine.text = viewModel.StatusLine; int num = Math.Min(11, viewModel.Rows.Count); for (int i = 0; i < 11; i++) { bool flag2 = i < num; RoutePickerPresenter.Row row = (flag2 ? viewModel.Rows[i] : null); _rowRouteIds[i] = ((row != null && row.Eligible) ? new Guid?(row.RouteId) : ((Guid?)null)); _rowTexts[i].text = row?.Text ?? string.Empty; if (_rowButtons[i].activeSelf != flag2) { _rowButtons[i].SetActive(flag2); } } int num2 = viewModel.Rows.Count - num; if ((Object)(object)_overflowLine != (Object)null) { _overflowLine.text = ((num2 > 0) ? TeamsterStrings.Format("routes.overflow", num2.ToString(CultureInfo.InvariantCulture)) : string.Empty); } RenderProfileLines(); } private static CartographerRouteSnapshot? FindRoute(IReadOnlyList<CartographerRouteSnapshot> routes, Guid routeId) { for (int i = 0; i < routes.Count; i++) { if (routes[i].Id == routeId) { return routes[i]; } } return null; } private void SyncProfileTarget(CartographerRouteSnapshot? route) { if (route == null) { _profiler?.Cancel(); _profiler = null; _profileRouteId = null; _shownProfile = null; _shownBottleneck = null; _selectedRouteName = ""; return; } _selectedRouteName = route.Name; ulong num = RouteGeometry.Fingerprint(route.Points); Guid? profileRouteId = _profileRouteId; Guid id = route.Id; if (!profileRouteId.HasValue || !(profileRouteId.GetValueOrDefault() == id) || _profileFingerprint != num || (_shownProfile == null && _profiler == null)) { _profiler?.Cancel(); _profiler = null; _profileRouteId = route.Id; _profileFingerprint = num; _shownProfile = null; _shownBottleneck = null; if (_profileCache.TryGet(route.Id, num, out RouteProfile profile)) { _shownProfile = profile; } else { _profiler = new RouteProfiler(route.Points, TerrainAdapter.TrySamplePoint); } } } private void AdvanceProfiling() { if (_profiler == null) { return; } _profiler.Advance(24); if (_profiler.IsComplete) { RouteProfile routeProfile = _profiler.TryBuildProfile(); _profiler = null; if (routeProfile != null) { Guid? profileRouteId = _profileRouteId; if (profileRouteId.HasValue) { Guid valueOrDefault = profileRouteId.GetValueOrDefault(); _profileCache.Store(valueOrDefault, _profileFingerprint, routeProfile); _shownProfile = routeProfile; RecomputeBottleneck(); } } } RenderProfileLines(); } private void RecomputeBottleneck() { _shownBottleneck = ((_loadModel != null && _shownProfile != null) ? RouteLoadBottleneck.Evaluate(_shownProfile, _loadModel, _cartMassProvider(), CompatibilityAdapter.CartMassAdviceReliable) : null); } private void RenderProfileLines() { if (_profileLines.Length == 5 && !((Object)(object)_profileLines[0] == (Object)null)) { Guid? selectedRouteId = _selectedRouteId; IReadOnlyList<string> readOnlyList = RouteProfilePresenter.Present(selectedRouteId.HasValue, _profiler != null, _profiler?.PositionsProbed ?? 0, _profiler?.PositionCount ?? 0, _shownProfile, _shownBottleneck); for (int i = 0; i < _profileLines.Length; i++) { _profileLines[i].text = readOnlyList[i]; } if (_reportPanel.IsVisible) { _reportPanel.Render(BuildReportViewModel()); } } } private RouteReportPresenter.ViewModel BuildReportViewModel() { return RouteReportPresenter.Present(_selectedRouteName, _shownProfile, _loadModel, _cartMassProvider(), CompatibilityAdapter.CartMassAdviceReliable); } private void SelectRow(int index) { try { Guid? selectedRouteId = _rowRouteIds[index]; if (selectedRouteId.HasValue) { _selectedRouteId = selectedRouteId; ForceRefresh(); } } catch (Exception exception) { Fail(exception); } } private bool EnsurePanel() { //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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_0063: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: 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_0205: Expected O, but got Unknown //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03c2: Unknown result type (might be due to invalid IL or missing references) //IL_03e7: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Expected O, but got Unknown //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_0420: 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_0454: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Expected O, but got Unknown //IL_047e: Unknown result type (might be due to invalid IL or missing references) //IL_048d: Unknown result type (might be due to invalid IL or missing references) //IL_049c: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04cb: Expected O, but got Unknown if (GUIManager.Instance == null || (Object)(object)GUIManager.CustomGUIFront == (Object)null) { return false; } GUIManager instance = GUIManager.Instance; Font averiaSerifBold = instance.AveriaSerifBold; Color header = PanelStyle.Header; Color body = PanelStyle.Body; _panel = PanelStyle.CreateScaledWoodpanel(instance, GUIManager.CustomGUIFront.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, 0f), 380f, 570f, _uiScale()); instance.CreateText(TeamsterStrings.Get("routes.title"), _panel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -28f), averiaSerifBold, 19, header, true, Color.black, 340f, 30f, false); _statusLine = instance.CreateText(string.Empty, _panel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -56f), averiaSerifBold, 15, body, true, Color.black, 340f, 24f, false).GetComponent<Text>(); _statusLine.alignment = (TextAnchor)0; _rowButtons = (GameObject[])(object)new GameObject[11]; _rowTexts = (Text[])(object)new Text[11]; float num = -86f; for (int i = 0; i < 11; i++) { int captured = i; GameObject val = instance.CreateButton(string.Empty, _panel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, num - 13f), 340f, 24f); ((UnityEvent)val.GetComponent<Button>().onClick).AddListener((UnityAction)delegate { SelectRow(captured); }); _rowButtons[i] = val; _rowTexts[i] = val.GetComponentInChildren<Text>(); _rowTexts[i].fontSize = 14; _rowTexts[i].alignment = (TextAnchor)3; val.SetActive(false); num -= 26f; } _overflowLine = instance.CreateText(string.Empty, _panel.transform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(0f, 48f), averiaSerifBold, 13, body, true, Color.black, 340f, 22f, false).GetComponent<Text>(); _profileLines = (Text[])(object)new Text[5]; float num2 = -388f; for (int num3 = 0; num3 < _profileLines.Length; num3++) { _profileLines[num3] = instance.CreateText(string.Empty, _panel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, num2 - 10f), averiaSerifBold, 13, body, true, Color.black, 340f, 20f, false).GetComponent<Text>(); _profileLines[num3].alignment = (TextAnchor)0; _profileLines[num3].verticalOverflow = (VerticalWrapMode)0; num2 -= 21f; } ((UnityEvent)instance.CreateButton(TeamsterStrings.Get("routes.clearButton"), _panel.transform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(-120f, 30f), 100f, 30f).GetComponent<Button>().onClick).AddListener((UnityAction)delegate { _selectedRouteId = null; ForceRefresh(); }); ((UnityEvent)instance.CreateButton(TeamsterStrings.Get("routes.reportButton"), _panel.transform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(0f, 30f), 100f, 30f).GetComponent<Button>().onClick).AddListener((UnityAction)delegate { _reportPanel.Toggle(BuildReportViewModel()); }); ((UnityEvent)instance.CreateButton(TeamsterStrings.Get("ui.close"), _panel.transform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(120f, 30f), 100f, 30f).GetComponent<Button>().onClick).AddListener((UnityAction)delegate { _panel.SetActive(false); _reportPanel.Hide(); }); _panel.SetActive(false); return true; } private void Fail(Exception exception) { _failed = true; _selectedRouteId = null; _profiler?.Cancel(); _profiler = null; _profileRouteId = null; _shownProfile = null; _shownBottleneck = null; _selectedRouteName = ""; _profileCache.Clear(); _reportPanel.Hide(); if ((Object)(object)_panel != (Object)null) { _panel.SetActive(false); } _log.LogError((object)("Route picker disabled for this session after a UI exception; everything else keeps working: " + exception)); } } internal sealed class RouteReportPanel { private const float PanelWidth = 460f; private const float PanelHeight = 500f; private const float LineHeight = 21f; internal const int MaxLines = 18; private readonly ManualLogSource _log; private readonly Func<float> _uiScale; private bool _failed; private GameObject? _panel; private Text? _title; private Text[] _lines = Array.Empty<Text>(); internal bool IsVisible { get { if ((Object)(object)_panel != (Object)null) { return _panel.activeSelf; } return false; } } internal RouteReportPanel(ManualLogSource log, Func<float> uiScale) { _log = log; _uiScale = uiScale; } internal void Toggle(RouteReportPresenter.ViewModel viewModel) { if (_failed) { return; } try { if (!((Object)(object)_panel == (Object)null) || EnsurePanel()) { bool flag = !_panel.activeSelf; _panel.SetActive(flag); if (flag) { Render(viewModel); } } } catch (Exception exception) { Fail(exception); } } internal void Hide() { if ((Object)(object)_panel != (Object)null && _panel.activeSelf) { _panel.SetActive(false); } } internal void Render(RouteReportPresenter.ViewModel viewModel) { if (_failed || !IsVisible || (Object)(object)_title == (Object)null || _lines.Length != 18) { return; } try { _title.text = viewModel.Title; for (int i = 0; i < 18; i++) { _lines[i].text = ((i < viewModel.Lines.Count) ? viewModel.Lines[i] : string.Empty); } } catch (Exception exception) { Fail(exception); } } private bool EnsurePanel() { //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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Expected O, but got Unknown if (GUIManager.Instance == null || (Object)(object)GUIManager.CustomGUIFront == (Object)null) { return false; } GUIManager instance = GUIManager.Instance; Font averiaSerifBold = instance.AveriaSerifBold; Color header = PanelStyle.Header; Color body = PanelStyle.Body; _panel = PanelStyle.CreateScaledWoodpanel(instance, GUIManager.CustomGUIFront.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(120f, 0f), 460f, 500f, _uiScale()); _title = instance.CreateText(string.Empty, _panel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -28f), averiaSerifBold, 18, header, true, Color.black, 420f, 30f, false).GetComponent<Text>(); _lines = (Text[])(object)new Text[18]; float num = -56f; for (int i = 0; i < 18; i++) { _lines[i] = instance.CreateText(string.Empty, _panel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, num - 10.5f), averiaSerifBold, 14, body, true, Color.black, 420f, 21f, false).GetComponent<Text>(); _lines[i].alignment = (TextAnchor)0; _lines[i].verticalOverflow = (VerticalWrapMode)0; num -= 21f; } ((UnityEvent)instance.CreateButton(TeamsterStrings.Get("ui.close"), _panel.transform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(0f, 26f), 110f, 28f).GetComponent<Button>().onClick).AddListener((UnityAction)delegate { _panel.SetActive(false); }); _panel.SetActive(false); return true; } private void Fail(Exception exception) { _failed = true; if ((Object)(object)_panel != (Object)null) { _panel.SetActive(false); } _log.LogError((object)("Route report disabled for this session after a UI exception; everything else keeps working: " + exception)); } } internal sealed class SupportBundlePanel { private const float PanelWidth = 420f; private const float PanelHeight = 320f; private readonly ManualLogSource _log; private readonly Func<float> _uiScale; private readonly string _pluginVersion; private readonly TeamsterSettings _settings; private readonly LogTailRecorder _logTail; private readonly Func<TripRecordingService?> _tripsProvider; private bool _failed; private GameObject? _panel; private Text? _statusText; public bool IsVisible { get { if ((Object)(object)_panel != (Object)null) { return _panel.activeSelf; } return false; } } public SupportBundlePanel(ManualLogSource log, Func<float> uiScale, string pluginVersion, TeamsterSettings settings, LogTailRecorder logTail, Func<TripRecordingService?> tripsProvider) { _log = log; _uiScale = uiScale; _pluginVersion = pluginVersion; _settings = settings; _logTail = logTail; _tripsProvider = tripsProvider; } public void Toggle() { if (_failed) { return; } try { if (!((Object)(object)_panel == (Object)null) || EnsurePanel()) { bool flag = !_panel.activeSelf; _panel.SetActive(flag); if (flag && (Object)(object)_statusText != (Object)null) { _statusText.text = TeamsterStrings.Get("support.readyToExport"); } } } catch (Exception exception) { Fail(exception); } } public void Hide() { if ((Object)(object)_panel != (Object)null && _panel.activeSelf) { _panel.SetActive(false); } } public void HandleFrame() { if (_failed || !IsVisible) { return; } try { if (Input.GetKeyDown((KeyCode)27)) { Hide(); } } catch (Exception exception) { Fail(exception); } } private void HandleExportClicked() { if (_failed || (Object)(object)_statusText == (Object)null) { return; } try { var (flag, text, text2) = SupportBundleExporter.Export(_pluginVersion, _settings, _tripsProvider(), _logTail, DateTime.UtcNow); _statusText.text = (flag ? TeamsterStrings.Format("support.exported", text) : TeamsterStrings.Format("support.exportFailed", text2 ?? TeamsterStrings.Get("support.unknownError"))); } catch (Exception exception) { Fail(exception); } } private void HandleReportBugClicked() { if (_failed) { return; } try { Application.OpenURL("https://github.com/Weakened/ConcernedCatMods/issues"); } catch (Exception exception) { Fail(exception); } } private bool EnsurePanel() { //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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_0063: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020b: 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_0284: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Expected O, but got Unknown //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Expected O, but got Unknown //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Expected O, but got Unknown if (GUIManager.Instance == null || (Object)(object)GUIManager.CustomGUIFront == (Object)null) { return false; } GUIManager instance = GUIManager.Instance; Font averiaSerifBold = instance.AveriaSerifBold; Color header = PanelStyle.Header; Color body = PanelStyle.Body; _panel = PanelStyle.CreateScaledWoodpanel(instance, GUIManager.CustomGUIFront.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, 120f), 420f, 320f, _uiScale()); instance.CreateText(TeamsterStrings.Get("support.title"), _panel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -28f), averiaSerifBold, 19, header, true, Color.black, 380f, 30f, false); instance.CreateText(TeamsterStrings.Get("support.explainer"), _panel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -66f), averiaSerifBold, 13, body, true, Color.black, 380f, 60f, false); _statusText = instance.CreateText(TeamsterStrings.Get("support.readyToExport"), _panel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -128f), averiaSerifBold, 13, body, true, Color.black, 380f, 40f, false).GetComponent<Text>(); _statusText.alignment = (TextAnchor)0; _statusText.horizontalOverflow = (HorizontalWrapMode)0; instance.CreateText(TeamsterStrings.Get("support.feedbackExplainer"), _panel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -172f), averiaSerifBold, 13, body, true, Color.black, 380f, 70f, false); ((UnityEvent)instance.CreateButton(TeamsterStrings.Get("support.reportBugButton"), _panel.transform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(0f, 64f), 150f, 28f).GetComponent<Button>().onClick).AddListener(new UnityAction(HandleReportBugClicked)); ((UnityEvent)instance.CreateButton(TeamsterStrings.Get("support.exportButton"), _panel.transform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(-60f, 26f), 110f, 28f).GetComponent<Button>().onClick).AddListener(new UnityAction(HandleExportClicked)); ((UnityEvent)instance.CreateButton(TeamsterStrings.Get("ui.close"), _panel.transform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(60f, 26f), 110f, 28f).GetComponent<Button>().onClick).AddListener(new UnityAction(Hide)); _panel.SetActive(false); return true; } private void Fail(Exception exception) { _failed = true; try { Hide(); } catch { } _log.LogError((object)("Support Bundle panel UI failed and was disabled for this session: " + exception.GetType().Name + ": " + exception.Message)); } } internal sealed class TripHistoryPanel { private const float PanelWidth = 470f; private const float PanelHeight = 760f; private const float RowHeight = 26f; private const int VisibleRowCount = 10; private const double ConfirmWindowSeconds = 3.0; private readonly ManualLogSource _log; private readonly Func<float> _uiScale; private bool _failed; private GameObject? _panel; private Text?[] _rowTexts = Array.Empty<Text>(); private