Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of Call Vehicle Mod v1.1.2
Mods/CallVehicle_Mono.dll
Decompiled 2 weeks agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using CallVehicle; using CallVehicle.Phone; using CallVehicle.Utilities; using CallVehicle.VehicleController; using MelonLoader; using MelonLoader.Preferences; using MelonLoader.Utils; using Microsoft.CodeAnalysis; using ScheduleOne.DevUtilities; using ScheduleOne.Dialogue; using ScheduleOne.GameTime; using ScheduleOne.ItemFramework; using ScheduleOne.Money; using ScheduleOne.NPCs; using ScheduleOne.NPCs.CharacterClasses; using ScheduleOne.Persistence; using ScheduleOne.Persistence.Loaders; using ScheduleOne.PlayerScripts; using ScheduleOne.UI; using ScheduleOne.UI.Phone; using ScheduleOne.Vehicles; using ScheduleOne.Vehicles.AI; using ScheduleOne.Vehicles.Modification; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(Core), "CallVehicle", "1.1.2", "weedeej", null)] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("CallVehicle")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+949a18d6a531eb78e9b74af45e454eb8277d1e8d")] [assembly: AssemblyProduct("CallVehicle")] [assembly: AssemblyTitle("CallVehicle")] [assembly: NeutralResourcesLanguage("en-US")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public static class PreferenceFields { public const string PricePerKm = "price_per_km"; public const string UseCash = "use_cash"; public const string ServiceChargeDay = "service_charge_day"; public const string ServiceChargeNight = "service_charge_night"; public const string BypassCheckpoints = "bypass_checkpoints"; public const string AppPrice = "app_price"; } namespace CallVehicle { public class Core : MelonMod { [CompilerGenerated] private sealed class <>c__DisplayClass2_0 { public string choiceText; public MoneyManager moneyMan; public int appPrice; public Marco marco; public DialogueChoice choice3; internal bool <AppUICoro>b__0(DialogueChoice x) { return x.ChoiceText == choiceText; } internal void <AppUICoro>b__1() { CallVehicleAppSaveData data = default(CallVehicleAppSaveData); data.isPurchased = true; ModUtilities.SaveModData(data); moneyMan.ChangeCashBalance((float)(-appPrice), true, true); ((Component)((NPC)marco).dialogueHandler).GetComponent<DialogueController>().Choices.Remove(choice3); ((NPC)marco).SendTextMessage("Hey boss, Thank you for the purchase. If you need your vehicle FAST, use the app on your phone."); InitAppAndUI(); } } [CompilerGenerated] private sealed class <AppUICoro>d__2 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; private <>c__DisplayClass2_0 <>8__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <AppUICoro>d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_010f: 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_0125: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Expected O, but got Unknown int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; CallVehicleAppSaveData? latestSaveData = ModUtilities.GetLatestSaveData(); CallVehicleAppSaveData obj = ((!latestSaveData.HasValue) ? ModUtilities.SaveModData(default(CallVehicleAppSaveData)) : latestSaveData.Value); if (obj.isPurchased) { InitAppAndUI(); goto IL_01db; } <>8__1.appPrice = Preferences.GetPrefValue<int>("app_price"); <>8__1.moneyMan = NetworkSingleton<MoneyManager>.Instance; <>8__1.marco = Object.FindObjectOfType<Marco>(); <>8__1.choiceText = $"Purchase Call Vehicle App ${<>8__1.appPrice}"; DialogueChoice val = ((Component)((NPC)<>8__1.marco).dialogueHandler).GetComponent<DialogueController>().Choices.Find((DialogueChoice x) => x.ChoiceText == <>8__1.choiceText); <>8__1.choice3 = (DialogueChoice)(((object)val) ?? ((object)new DialogueChoice { ChoiceText = <>8__1.choiceText, Enabled = true })); if (<>8__1.moneyMan.cashBalance < (float)<>8__1.appPrice) { if (val != null) { ((Component)((NPC)<>8__1.marco).dialogueHandler).GetComponent<DialogueController>().Choices.Remove(val); } } else if (val == null) { <>8__1.choice3.onChoosen.AddListener((UnityAction)delegate { CallVehicleAppSaveData data = default(CallVehicleAppSaveData); data.isPurchased = true; ModUtilities.SaveModData(data); <>8__1.moneyMan.ChangeCashBalance((float)(-<>8__1.appPrice), true, true); ((Component)((NPC)<>8__1.marco).dialogueHandler).GetComponent<DialogueController>().Choices.Remove(<>8__1.choice3); ((NPC)<>8__1.marco).SendTextMessage("Hey boss, Thank you for the purchase. If you need your vehicle FAST, use the app on your phone."); InitAppAndUI(); }); ((Component)((NPC)<>8__1.marco).dialogueHandler).GetComponent<DialogueController>().Choices.Add(<>8__1.choice3); MelonLogger.Msg("CallVehicle: Postfix - Added purchase option to dialogue."); goto IL_01db; } } else { <>1__state = -1; } <>8__1 = new <>c__DisplayClass2_0(); <>2__current = (object)new WaitForSecondsRealtime(3f); <>1__state = 1; return true; IL_01db: return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public override void OnInitializeMelon() { Preferences.Setup(((MelonBase)this).LoggerInstance); ((MelonBase)this).LoggerInstance.Msg("CallVehicle mod initialized."); } public override void OnSceneWasLoaded(int buildIndex, string sceneName) { ((MelonMod)this).OnSceneWasLoaded(buildIndex, sceneName); if (!(sceneName != "Main")) { MelonCoroutines.Start(AppUICoro()); } } [IteratorStateMachine(typeof(<AppUICoro>d__2))] public IEnumerator AppUICoro() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <AppUICoro>d__2(0); } private static void InitAppAndUI() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (!PlayerSingleton<CallVehicleApp>.InstanceExists) { GameObject val = new GameObject("CallVehicleApp_Instance"); val.transform.SetParent(((Component)PlayerSingleton<AppsCanvas>.Instance).transform, false); val.AddComponent<CallVehicleApp>(); val.SetActive(true); } } } public static class Preferences { public struct PreferenceEntryDef { public string id; public string name; public string description; public object value; public Type type; } public struct DefaultPreferences { public PreferenceEntryDef price_per_km; public PreferenceEntryDef use_cash; public PreferenceEntryDef service_charge_day; public PreferenceEntryDef service_charge_night; public PreferenceEntryDef bypass_checkpoints; public PreferenceEntryDef app_price; } public static readonly DefaultPreferences defaultPreferences = new DefaultPreferences { price_per_km = new PreferenceEntryDef { id = "price_per_km", name = "Price per km", description = "The amount of cash/online balance to pay for the service per kilometer.", value = 13, type = typeof(int) }, use_cash = new PreferenceEntryDef { id = "use_cash", name = "Use Cash", description = "Use cash instead of online balance. (true/false)", value = false, type = typeof(bool) }, service_charge_day = new PreferenceEntryDef { id = "service_charge_day", name = "Service Charge (Day)", description = "Flat fee for the service during the day.", value = 500, type = typeof(int) }, service_charge_night = new PreferenceEntryDef { id = "service_charge_night", name = "Service Charge (Night)", description = "Flat fee for the service during the night.", value = 800, type = typeof(int) }, bypass_checkpoints = new PreferenceEntryDef { id = "bypass_checkpoints", name = "Bypass Checkpoints", description = "Should this mod bypasses the checkpoints?", value = true, type = typeof(bool) }, app_price = new PreferenceEntryDef { id = "app_price", name = "App Price", description = "The price of the app from Marco.", value = 5000, type = typeof(int) } }; private const string ConfigFileName = "ChauffeurPrefs.cfg"; private const string ConfigCategoryName = "CallVehicle"; private static MelonPreferences_Category category; private static Instance Logger; public static void Setup(Instance loggerInstance) { Logger = loggerInstance ?? throw new ArgumentNullException("loggerInstance"); Logger.Msg("Setting up 'CallVehicle' preferences..."); category = MelonPreferences.GetCategory("CallVehicle"); if (category == null) { category = MelonPreferences.CreateCategory("CallVehicle", "Call Vehicle Preferences"); } string text = Path.Combine(MelonEnvironment.UserDataDirectory, "ChauffeurPrefs.cfg"); category.SetFilePath(text, false); bool flag = false; if (!File.Exists(text)) { CreateDefaultEntries(); flag = true; } else { category.LoadFromFile(false); if (CheckAndCreateMissingEntries()) { flag = true; } } if (flag) { category.SaveToFile(false); } Logger.Msg("'CallVehicle' preferences setup complete."); } private static void CreateDefaultEntries() { if (category == null) { return; } FieldInfo[] fields = typeof(DefaultPreferences).GetFields(); for (int i = 0; i < fields.Length; i++) { if (fields[i].GetValue(defaultPreferences) is PreferenceEntryDef preference) { CreateEntryWithType(preference); } } } private static bool CheckAndCreateMissingEntries() { if (category == null) { return false; } bool result = false; FieldInfo[] fields = typeof(DefaultPreferences).GetFields(); for (int i = 0; i < fields.Length; i++) { if (fields[i].GetValue(defaultPreferences) is PreferenceEntryDef preference && !category.HasEntry(preference.id)) { CreateEntryWithType(preference); result = true; } } return result; } private static void CreateEntryWithType(PreferenceEntryDef preference) { if (preference.type == typeof(string)) { category.CreateEntry<string>(preference.id, (string)preference.value, preference.name, preference.description, false, false, (ValueValidator)null, (string)null); } else if (preference.type == typeof(int)) { category.CreateEntry<int>(preference.id, (int)preference.value, preference.name, preference.description, false, false, (ValueValidator)null, (string)null); } else if (preference.type == typeof(float)) { category.CreateEntry<float>(preference.id, (float)preference.value, preference.name, preference.description, false, false, (ValueValidator)null, (string)null); } else if (preference.type == typeof(bool)) { category.CreateEntry<bool>(preference.id, (bool)preference.value, preference.name, preference.description, false, false, (ValueValidator)null, (string)null); } else { category.CreateEntry<string>(preference.id, preference.value.ToString(), preference.name, preference.description, false, false, (ValueValidator)null, (string)null); } } public static T GetPrefValue<T>(string key) { if (category == null) { return default(T); } if (!category.HasEntry(key)) { return GetDefaultValue<T>(key); } MelonPreferences_Entry<T> entry = category.GetEntry<T>(key); if (entry == null) { MelonPreferences_Entry entry2 = category.GetEntry(key); if (entry2 != null) { try { return (T)Convert.ChangeType(entry2.BoxedValue, typeof(T)); } catch (Exception) { return GetDefaultValue<T>(key); } } return GetDefaultValue<T>(key); } return entry.Value; } public static bool SetPrefValue<T>(string key, T value) { if (category == null) { return false; } if (!category.HasEntry(key)) { return false; } MelonPreferences_Entry<T> entry = category.GetEntry<T>(key); if (entry == null) { return false; } try { entry.Value = value; category.SaveToFile(false); return true; } catch (Exception) { return false; } } private static T GetDefaultValue<T>(string key) { FieldInfo[] fields = typeof(DefaultPreferences).GetFields(); for (int i = 0; i < fields.Length; i++) { if (fields[i].GetValue(defaultPreferences) is PreferenceEntryDef preferenceEntryDef && preferenceEntryDef.id == key) { try { return (T)Convert.ChangeType(preferenceEntryDef.value, typeof(T)); } catch (Exception) { return default(T); } } } return default(T); } } } namespace CallVehicle.VehicleController { public class VehicleControl { public LandVehicle targetVehicle; private Player player; public List<LandVehicle> ownedVehicles; public VehicleControl(string id) { player = Player.Local; ownedVehicles = NetworkSingleton<VehicleManager>.Instance.PlayerOwnedVehicles; if (ownedVehicles.Count > 0) { targetVehicle = ownedVehicles.Find((LandVehicle veh) => veh.SaveFolderName == id); } } public VehicleControl() { player = Player.Local; ownedVehicles = NetworkSingleton<VehicleManager>.Instance.PlayerOwnedVehicles; } public void CallVehicle(string id, int cost) { //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: 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_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Expected O, but got Unknown //IL_0206: Expected O, but got Unknown //IL_0217: Unknown result type (might be due to invalid IL or missing references) LandVehicle targetVehicle = ownedVehicles.Find((LandVehicle veh) => veh.SaveFolderName == id); if ((Object)(object)targetVehicle == (Object)null) { return; } NPC npc = NPCManager.NPCRegistry.Find((NPC n) => n.FirstName == "Marco"); if (targetVehicle.Agent.AutoDriving) { npc.SendTextMessage("Sorry boss, I'm still driving your " + targetVehicle.VehicleName + "."); return; } MoneyManager moneyManager = NetworkSingleton<MoneyManager>.Instance; if (moneyManager.onlineBalance < (float)cost) { npc.SendTextMessage($"Sorry boss, You are poor as dirt. You need ${cost} for this service."); return; } Vector3 position = player.Avatar.MiddleSpine.position; targetVehicle.OverrideMaxSteerAngle(90f); VehicleAgent vehicleAgent = targetVehicle.Agent; if (!vehicleAgent.IsOnVehicleGraph()) { vehicleAgent.Teleporter.MoveToGraph(true); } vehicleAgent.StuckDistanceThreshold = 1f; vehicleAgent.StuckTimeThreshold = 5f; vehicleAgent.Flags.IgnoreTrafficLights = true; vehicleAgent.Flags.ObstacleMode = (EObstacleMode)1; targetVehicle.IsPlayerOwned = false; if (Preferences.GetPrefValue<bool>("bypass_checkpoints")) { npc.EnterVehicle(player.Connection, targetVehicle); } vehicleAgent.Flags.StuckDetection = true; targetVehicle.POI.AutoUpdatePosition = true; vehicleAgent.Navigate(position, new NavigationSettings { endAtRoad = true, teleportToGraphIfCalculationFails = true }, (NavigationCallback)delegate(ENavigationResult result) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Invalid comparison between Unknown and I4 vehicleAgent.Flags.ResetFlags(); if (Preferences.GetPrefValue<bool>("bypass_checkpoints")) { npc.ExitVehicle(); } targetVehicle.OverrideMaxSteerAngle(targetVehicle.ActualMaxSteeringAngle); targetVehicle.SetIsPlayerOwned(player.Connection, true); targetVehicle.POI.AutoUpdatePosition = false; if ((int)result == 0) { npc.SendTextMessage("Sorry boss, I couldn't find a route to you. You won't be charged for this."); vehicleAgent.StopNavigating(); } else if ((int)result == 1) { vehicleAgent.StopNavigating(); bool prefValue = Preferences.GetPrefValue<bool>("use_cash"); targetVehicle = null; if (prefValue) { moneyManager.ChangeCashBalance((float)(-cost), true, true); if (Preferences.GetPrefValue<bool>("bypass_checkpoints")) { ItemInstance cashInstance = (ItemInstance)(object)moneyManager.GetCashInstance((float)cost); npc.Inventory.InsertItem(cashInstance, true); } } else { moneyManager.CreateOnlineTransaction("Chauffeur services", (float)(-cost), 1f, "Non-refundable"); } string arg = (prefValue ? "cash" : "online balance"); npc.SendTextMessage($"Vehicle Arrived. I've deducted ${cost} from your {arg}. Thank you for using my service."); } }); npc.SendTextMessage($"Your ({targetVehicle.OwnedColor}) {targetVehicle.VehicleName} is on the way."); } public void SetTargetVehicle(LandVehicle veh) { targetVehicle = veh; } } } namespace CallVehicle.Utilities { public struct CallVehicleAppSaveData { public bool isPurchased; } public static class ModUtilities { public static Texture2D LoadCustomImage(string fileName) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_002d: Expected O, but got Unknown string path = Path.Combine(MelonEnvironment.UserDataDirectory, fileName); if (!File.Exists(path)) { return null; } byte[] array = File.ReadAllBytes(path); Texture2D val = new Texture2D(2, 2); ImageConversion.LoadImage(val, array); return val; } public static Sprite CreateSprite(Texture2D texture) { //IL_0019: 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) return Sprite.Create(texture, new Rect(0f, 0f, (float)((Texture)texture).width, (float)((Texture)texture).height), new Vector2(0.5f, 0.5f)); } public static Sprite SpriteFromImage(string fileName) { Texture2D val = LoadCustomImage(fileName); if ((Object)(object)val == (Object)null) { return null; } return CreateSprite(val); } public static string GetFullSavePath() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) new WaitUntil((Func<bool>)(() => Singleton<LoadManager>.Instance.LoadedGameFolderPath != null)); string loadedGameFolderPath = Singleton<LoadManager>.Instance.LoadedGameFolderPath; string text = "\\Saves\\"; int num = loadedGameFolderPath.IndexOf(text); if (num == -1) { return null; } int startIndex = num + text.Length; loadedGameFolderPath = Path.Combine(MelonEnvironment.UserDataDirectory, "Call Vehicle Data\\" + loadedGameFolderPath.Substring(startIndex)); if (!Directory.Exists(loadedGameFolderPath)) { Directory.CreateDirectory(loadedGameFolderPath); } return Path.Combine(loadedGameFolderPath, "CallVehicleAppStatus.json"); } public static CallVehicleAppSaveData? GetLatestSaveData() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) string fullSavePath = GetFullSavePath(); string text = default(string); if (((Loader)new VariablesLoader()).TryLoadFile(fullSavePath, ref text, false)) { return JsonUtility.FromJson<CallVehicleAppSaveData>(text); } return null; } public static CallVehicleAppSaveData SaveModData(CallVehicleAppSaveData data) { File.WriteAllText(GetFullSavePath(), JsonUtility.ToJson((object)data)); return data; } } } namespace CallVehicle.Phone { public class CallVehicleAppUI { private readonly Color bgColor = Color32.op_Implicit(new Color32((byte)45, (byte)55, (byte)72, byte.MaxValue)); private readonly Color panelColor = Color32.op_Implicit(new Color32((byte)55, (byte)65, (byte)82, byte.MaxValue)); private readonly Color textColor = Color32.op_Implicit(new Color32((byte)226, (byte)232, (byte)240, byte.MaxValue)); private readonly Color accentColor = Color32.op_Implicit(new Color32((byte)56, (byte)178, (byte)172, byte.MaxValue)); private readonly Color buttonTextColor = Color32.op_Implicit(new Color32((byte)226, (byte)232, (byte)240, byte.MaxValue)); private readonly Color fadedLineColor = Color32.op_Implicit(new Color32((byte)226, (byte)232, (byte)240, (byte)100)); private RectTransform parentContainer; private Action<EntryData?> entrySelectedCallback; private Action callVehicleCallback; private const float TOP_BAR_HEIGHT = 45f; private const float HORIZONTAL_PADDING = 10f; private const float VERTICAL_PADDING = 10f; public TextMeshProUGUI TimeText { get; private set; } public GameObject OverviewInitialPanel { get; private set; } public GameObject OverviewDetailPanel { get; private set; } public TextMeshProUGUI OverviewNameText { get; private set; } public TextMeshProUGUI OverviewIdText { get; private set; } public TextMeshProUGUI OverviewDistanceText { get; private set; } public TextMeshProUGUI OverviewColorText { get; private set; } public TextMeshProUGUI CostPricePerKmText { get; private set; } public TextMeshProUGUI CostServiceChargeText { get; private set; } public TextMeshProUGUI CostTotalCostText { get; private set; } public Button CallVehicleButton { get; private set; } public ScrollRect ListScrollRect { get; private set; } public Transform ListViewContent { get; private set; } public void InitializeUI(RectTransform container, Action<EntryData?> onEntrySelected, Action onCallVehicle) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)container == (Object)null)) { parentContainer = container; entrySelectedCallback = onEntrySelected; callVehicleCallback = onCallVehicle; Image val = ((Component)parentContainer).GetComponent<Image>(); if ((Object)(object)val == (Object)null) { val = ((Component)parentContainer).gameObject.AddComponent<Image>(); } ((Graphic)val).color = bgColor; ((Graphic)val).raycastTarget = true; CreateTopBar(); TimeManager instance = NetworkSingleton<TimeManager>.Instance; instance.onMinutePass = (Action)Delegate.Combine(instance.onMinutePass, new Action(MinPass)); CreateMainContentArea(); MelonLogger.Msg("AppUI: UI Initialization complete."); } } private void CreateTopBar() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0100: 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_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Expected O, but got Unknown //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("TopBarContainer"); val.transform.SetParent((Transform)(object)parentContainer, false); RectTransform val2 = val.AddComponent<RectTransform>(); val2.anchorMin = new Vector2(0f, 1f); val2.anchorMax = new Vector2(1f, 1f); val2.pivot = new Vector2(0.5f, 1f); val2.sizeDelta = new Vector2(-20f, 45f); val2.anchoredPosition = new Vector2(0f, 0f); ((Transform)val2).localScale = Vector3.one; GameObject val3 = new GameObject("TopBar"); val3.transform.SetParent((Transform)(object)val2, false); ((Graphic)val3.AddComponent<Image>()).color = panelColor; RectTransform component = val3.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.sizeDelta = Vector2.zero; component.anchoredPosition = Vector2.zero; ((Transform)component).localScale = Vector3.one; GameObject val4 = new GameObject("TitleText"); val4.transform.SetParent(val3.transform, false); TextMeshProUGUI obj = val4.AddComponent<TextMeshProUGUI>(); ((TMP_Text)obj).text = "Call Vehicle"; ((TMP_Text)obj).fontSize = 20f; ((Graphic)obj).color = textColor; ((TMP_Text)obj).alignment = (TextAlignmentOptions)4097; RectTransform component2 = val4.GetComponent<RectTransform>(); component2.anchorMin = new Vector2(0f, 0.5f); component2.anchorMax = new Vector2(0f, 0.5f); component2.pivot = new Vector2(0f, 0.5f); component2.sizeDelta = new Vector2(300f, 36f); component2.anchoredPosition = new Vector2(15f, 0f); GameObject val5 = new GameObject("TimeText"); val5.transform.SetParent(val3.transform, false); TimeText = val5.AddComponent<TextMeshProUGUI>(); ((TMP_Text)TimeText).fontSize = 18f; ((Graphic)TimeText).color = textColor; ((TMP_Text)TimeText).alignment = (TextAlignmentOptions)4100; RectTransform component3 = val5.GetComponent<RectTransform>(); component3.anchorMin = new Vector2(1f, 0.5f); component3.anchorMax = new Vector2(1f, 0.5f); component3.pivot = new Vector2(1f, 0.5f); component3.sizeDelta = new Vector2(110f, 36f); component3.anchoredPosition = new Vector2(-15f, 0f); } private void MinPass() { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) EDay currentDay; if (NetworkSingleton<GameManager>.Instance.IsTutorial) { int num = TimeManager.Get24HourTimeFromMinSum(Mathf.RoundToInt(Mathf.Round((float)NetworkSingleton<TimeManager>.Instance.DailyMinTotal / 60f) * 60f)); TextMeshProUGUI timeText = TimeText; string text = TimeManager.Get12HourTime((float)num, true); currentDay = NetworkSingleton<TimeManager>.Instance.CurrentDay; ((TMP_Text)timeText).text = text + " " + ((object)(EDay)(ref currentDay)).ToString(); } else { TextMeshProUGUI timeText2 = TimeText; string text2 = TimeManager.Get12HourTime((float)NetworkSingleton<TimeManager>.Instance.CurrentTime, true); currentDay = NetworkSingleton<TimeManager>.Instance.CurrentDay; ((TMP_Text)timeText2).text = text2 + " " + ((object)(EDay)(ref currentDay)).ToString(); } } private void CreateMainContentArea() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown GameObject val = new GameObject("MainContentArea"); val.transform.SetParent((Transform)(object)parentContainer, false); RectTransform obj = val.AddComponent<RectTransform>(); obj.anchorMin = Vector2.zero; obj.anchorMax = Vector2.one; obj.pivot = new Vector2(0.5f, 0.5f); obj.offsetMin = new Vector2(10f, 10f); obj.offsetMax = new Vector2(-10f, -55f); ((Transform)obj).localScale = Vector3.one; HorizontalLayoutGroup obj2 = val.AddComponent<HorizontalLayoutGroup>(); ((LayoutGroup)obj2).padding = new RectOffset(0, 0, 0, 0); ((HorizontalOrVerticalLayoutGroup)obj2).spacing = 15f; ((LayoutGroup)obj2).childAlignment = (TextAnchor)0; ((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)obj2).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandHeight = true; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandWidth = true; CreateLeftPanel(val.transform); CreateRightPanel(val.transform); } private void CreateLeftPanel(Transform parent) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Expected O, but got Unknown //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0123: 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_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Expected O, but got Unknown ListViewContent = null; GameObject val = null; RectTransform val2 = null; RectTransform val3 = null; try { GameObject val4 = new GameObject("ListViewScrollView"); if ((Object)(object)val4 == (Object)null) { return; } val3 = val4.GetComponent<RectTransform>(); if ((Object)(object)val3 == (Object)null) { val3 = val4.AddComponent<RectTransform>(); } if ((Object)(object)val3 == (Object)null) { return; } val4.transform.SetParent(parent, false); Image val5 = val4.AddComponent<Image>(); if ((Object)(object)val5 != (Object)null) { ((Graphic)val5).color = panelColor; } Mask val6 = val4.AddComponent<Mask>(); if ((Object)(object)val6 != (Object)null) { val6.showMaskGraphic = false; } LayoutElement val7 = val4.AddComponent<LayoutElement>(); if ((Object)(object)val7 != (Object)null) { val7.flexibleWidth = 1f; } val = new GameObject("ListViewContent"); if ((Object)(object)val == (Object)null) { return; } val2 = val.AddComponent<RectTransform>(); if ((Object)(object)val2 == (Object)null) { Object.Destroy((Object)(object)val); return; } val2.anchorMin = new Vector2(0f, 1f); val2.anchorMax = new Vector2(1f, 1f); val2.pivot = new Vector2(0.5f, 1f); val2.sizeDelta = Vector2.zero; ((Transform)val2).localScale = Vector3.one; ListViewContent = val.transform; val.transform.SetParent(val4.transform, false); VerticalLayoutGroup val8 = val.AddComponent<VerticalLayoutGroup>(); if ((Object)(object)val8 != (Object)null) { ((LayoutGroup)val8).padding = new RectOffset(8, 8, 8, 8); ((HorizontalOrVerticalLayoutGroup)val8).spacing = 8f; ((LayoutGroup)val8).childAlignment = (TextAnchor)1; ((HorizontalOrVerticalLayoutGroup)val8).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)val8).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)val8).childForceExpandHeight = false; ((HorizontalOrVerticalLayoutGroup)val8).childForceExpandWidth = true; } ContentSizeFitter val9 = val.AddComponent<ContentSizeFitter>(); if ((Object)(object)val9 != (Object)null) { val9.verticalFit = (FitMode)2; } if ((Object)(object)val2 != (Object)null && (Object)(object)val3 != (Object)null) { ListScrollRect = val4.AddComponent<ScrollRect>(); if ((Object)(object)ListScrollRect != (Object)null) { ListScrollRect.content = val2; ListScrollRect.viewport = val3; ListScrollRect.horizontal = false; ListScrollRect.vertical = true; ListScrollRect.movementType = (MovementType)2; } } } catch (Exception ex) { MelonLogger.Error("AppUI: CreateLeftPanel - EXCEPTION: " + ex.ToString()); ListViewContent = null; MelonLogger.Error("AppUI: CreateLeftPanel - ListViewContent set to null due to exception."); } } private void CreateRightPanel(Transform parent) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_0048: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Expected O, but got Unknown //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Expected O, but got Unknown //IL_0242: 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_0258: Unknown result type (might be due to invalid IL or missing references) //IL_0263: 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_0277: 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_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Unknown result type (might be due to invalid IL or missing references) //IL_03e2: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_040c: Unknown result type (might be due to invalid IL or missing references) //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_0435: Unknown result type (might be due to invalid IL or missing references) //IL_0486: Unknown result type (might be due to invalid IL or missing references) //IL_048d: Expected O, but got Unknown //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04cc: Unknown result type (might be due to invalid IL or missing references) //IL_04e1: Unknown result type (might be due to invalid IL or missing references) //IL_04f6: Unknown result type (might be due to invalid IL or missing references) //IL_050b: Unknown result type (might be due to invalid IL or missing references) //IL_0520: Unknown result type (might be due to invalid IL or missing references) //IL_052a: Unknown result type (might be due to invalid IL or missing references) //IL_0539: Unknown result type (might be due to invalid IL or missing references) //IL_053e: Unknown result type (might be due to invalid IL or missing references) //IL_0551: Unknown result type (might be due to invalid IL or missing references) //IL_0576: Unknown result type (might be due to invalid IL or missing references) //IL_0590: Unknown result type (might be due to invalid IL or missing references) //IL_059b: Unknown result type (might be due to invalid IL or missing references) //IL_05a6: Unknown result type (might be due to invalid IL or missing references) //IL_05b0: Unknown result type (might be due to invalid IL or missing references) //IL_05cc: Unknown result type (might be due to invalid IL or missing references) //IL_05d6: Expected O, but got Unknown GameObject val = new GameObject("OverviewPanel"); val.transform.SetParent(parent, false); ((Graphic)val.AddComponent<Image>()).color = panelColor; RectTransform component = val.GetComponent<RectTransform>(); val.AddComponent<LayoutElement>().flexibleWidth = 1f; GameObject val2 = new GameObject("OverviewContentContainer"); val2.transform.SetParent((Transform)(object)component, false); RectTransform val3 = val2.AddComponent<RectTransform>(); val3.anchorMin = Vector2.zero; val3.anchorMax = Vector2.one; val3.offsetMin = new Vector2(10f, 10f); val3.offsetMax = new Vector2(-10f, -10f); ((Transform)val3).localScale = Vector3.one; OverviewInitialPanel = new GameObject("OverviewInitialPanel"); OverviewInitialPanel.transform.SetParent((Transform)(object)val3, false); RectTransform obj = OverviewInitialPanel.AddComponent<RectTransform>(); obj.anchorMin = Vector2.zero; obj.anchorMax = Vector2.one; obj.offsetMin = Vector2.zero; obj.offsetMax = Vector2.zero; VerticalLayoutGroup val4 = OverviewInitialPanel.AddComponent<VerticalLayoutGroup>(); ((LayoutGroup)val4).padding = new RectOffset(5, 5, 5, 5); ((HorizontalOrVerticalLayoutGroup)val4).spacing = 8f; ((LayoutGroup)val4).childAlignment = (TextAnchor)1; ((HorizontalOrVerticalLayoutGroup)val4).childControlHeight = false; ((HorizontalOrVerticalLayoutGroup)val4).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)val4).childForceExpandHeight = false; ((HorizontalOrVerticalLayoutGroup)val4).childForceExpandWidth = true; GameObject val5 = new GameObject("InitialTitle"); val5.transform.SetParent(((Component)val4).transform, false); TextMeshProUGUI obj2 = val5.AddComponent<TextMeshProUGUI>(); ((TMP_Text)obj2).text = "Entry overview"; ((TMP_Text)obj2).fontSize = 18f; ((Graphic)obj2).color = textColor; ((TMP_Text)obj2).alignment = (TextAlignmentOptions)514; val5.AddComponent<LayoutElement>().minHeight = 30f; GameObject val6 = new GameObject("InitialText"); val6.transform.SetParent(((Component)val4).transform, false); TextMeshProUGUI obj3 = val6.AddComponent<TextMeshProUGUI>(); ((TMP_Text)obj3).text = "Select an entry.\n\nIf your vehicle isn't moving, Consider moving away from it."; ((TMP_Text)obj3).fontSize = 20f; ((Graphic)obj3).color = textColor; ((TMP_Text)obj3).alignment = (TextAlignmentOptions)514; ((TMP_Text)obj3).fontStyle = (FontStyles)2; LayoutElement obj4 = val6.AddComponent<LayoutElement>(); obj4.minHeight = 60f; obj4.flexibleHeight = 1f; OverviewDetailPanel = new GameObject("OverviewDetailPanel"); OverviewDetailPanel.transform.SetParent((Transform)(object)val3, false); RectTransform val7 = OverviewDetailPanel.AddComponent<RectTransform>(); val7.anchorMin = Vector2.zero; val7.anchorMax = Vector2.one; val7.offsetMin = Vector2.zero; val7.offsetMax = Vector2.zero; GameObject val8 = new GameObject("DetailTitle"); val8.transform.SetParent((Transform)(object)val7, false); TextMeshProUGUI obj5 = val8.AddComponent<TextMeshProUGUI>(); ((TMP_Text)obj5).text = "Entry overview"; ((TMP_Text)obj5).fontSize = 18f; ((Graphic)obj5).color = textColor; ((TMP_Text)obj5).alignment = (TextAlignmentOptions)514; RectTransform component2 = val8.GetComponent<RectTransform>(); component2.anchorMin = new Vector2(0f, 1f); component2.anchorMax = new Vector2(1f, 1f); component2.pivot = new Vector2(0.5f, 1f); component2.sizeDelta = new Vector2(0f, 30f); component2.anchoredPosition = new Vector2(0f, -5f); float startY = 35f; OverviewNameText = CreateDetailLine(val7, "Name", 0, startY); OverviewIdText = CreateDetailLine(val7, "ID", 1, startY); OverviewDistanceText = CreateDetailLine(val7, "Distance", 2, startY); OverviewColorText = CreateDetailLine(val7, "Color", 3, startY); float startY2 = 220f; GameObject val9 = new GameObject("CostBreakdownTitle"); val9.transform.SetParent((Transform)(object)val7, false); TextMeshProUGUI obj6 = val9.AddComponent<TextMeshProUGUI>(); ((TMP_Text)obj6).text = "Cost breakdown"; ((TMP_Text)obj6).fontSize = 18f; ((Graphic)obj6).color = textColor; ((TMP_Text)obj6).alignment = (TextAlignmentOptions)514; RectTransform component3 = val9.GetComponent<RectTransform>(); component3.anchorMin = new Vector2(0f, 1f); component3.anchorMax = new Vector2(1f, 1f); component3.pivot = new Vector2(0.5f, 1f); component3.sizeDelta = new Vector2(0f, 30f); component3.anchoredPosition = new Vector2(0f, -185f); CostPricePerKmText = CreateDetailLine(val7, "Price per km", 0, startY2); CostServiceChargeText = CreateDetailLine(val7, "Service charge", 1, startY2); CostTotalCostText = CreateDetailLine(val7, "Total Cost (rounded)", 2, startY2, boldValue: true); GameObject val10 = new GameObject("CallVehicleButton"); val10.transform.SetParent((Transform)(object)val7, false); ((Graphic)val10.AddComponent<Image>()).color = accentColor; CallVehicleButton = val10.AddComponent<Button>(); RectTransform component4 = val10.GetComponent<RectTransform>(); component4.anchorMin = new Vector2(1f, 0f); component4.anchorMax = new Vector2(1f, 0f); component4.pivot = new Vector2(1f, 0f); component4.sizeDelta = new Vector2(180f, 32f); component4.anchoredPosition = new Vector2(-5f, 5f); ((Transform)component4).localScale = Vector3.one; GameObject val11 = new GameObject("Text"); val11.transform.SetParent(val10.transform, false); TextMeshProUGUI obj7 = val11.AddComponent<TextMeshProUGUI>(); ((TMP_Text)obj7).text = "Call Vehicle >"; ((TMP_Text)obj7).fontSize = 20f; ((TMP_Text)obj7).fontStyle = (FontStyles)1; ((Graphic)obj7).color = buttonTextColor; ((TMP_Text)obj7).alignment = (TextAlignmentOptions)514; RectTransform component5 = val11.GetComponent<RectTransform>(); component5.anchorMin = Vector2.zero; component5.anchorMax = Vector2.one; component5.offsetMin = Vector2.zero; component5.offsetMax = Vector2.zero; ((UnityEvent)CallVehicleButton.onClick).AddListener((UnityAction)delegate { if (callVehicleCallback != null) { callVehicleCallback(); } }); OverviewDetailPanel.SetActive(false); } private TextMeshProUGUI CreateDetailLine(RectTransform parent, string label, int index, float startY, bool boldValue = false) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0131: 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_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) float num = 30f; float num2 = 8f; GameObject val = new GameObject(label.Replace(":", "") + "Line"); val.transform.SetParent((Transform)(object)parent, false); RectTransform obj = val.AddComponent<RectTransform>(); obj.anchorMin = new Vector2(0f, 1f); obj.anchorMax = new Vector2(1f, 1f); obj.pivot = new Vector2(0.5f, 1f); obj.anchoredPosition = new Vector2(0f, 0f - (startY + (float)index * (num + num2))); obj.sizeDelta = new Vector2(0f, num); ((Transform)obj).localScale = Vector3.one; HorizontalLayoutGroup val2 = val.AddComponent<HorizontalLayoutGroup>(); ((LayoutGroup)val2).padding = new RectOffset(0, 0, 0, 0); ((HorizontalOrVerticalLayoutGroup)val2).spacing = 8f; ((HorizontalOrVerticalLayoutGroup)val2).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)val2).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)val2).childForceExpandHeight = false; ((HorizontalOrVerticalLayoutGroup)val2).childForceExpandWidth = false; ((LayoutGroup)val2).childAlignment = (TextAnchor)4; GameObject val3 = new GameObject("Label"); val3.transform.SetParent(((Component)val2).transform, false); TextMeshProUGUI obj2 = val3.AddComponent<TextMeshProUGUI>(); ((TMP_Text)obj2).text = label; ((TMP_Text)obj2).fontSize = 18f; ((TMP_Text)obj2).fontStyle = (FontStyles)1; ((Graphic)obj2).color = textColor; ((TMP_Text)obj2).alignment = (TextAlignmentOptions)4097; GameObject val4 = new GameObject("StretchingLine"); val4.transform.SetParent(((Component)val2).transform, false); ((Graphic)val4.AddComponent<Image>()).color = fadedLineColor; LayoutElement obj3 = val4.AddComponent<LayoutElement>(); obj3.flexibleWidth = 1f; obj3.minHeight = 1f; obj3.preferredHeight = 1f; obj3.flexibleHeight = 0f; GameObject val5 = new GameObject("Value"); val5.transform.SetParent(((Component)val2).transform, false); TextMeshProUGUI obj4 = val5.AddComponent<TextMeshProUGUI>(); ((TMP_Text)obj4).text = "-"; ((TMP_Text)obj4).fontSize = 18f; ((Graphic)obj4).color = textColor; ((TMP_Text)obj4).alignment = (TextAlignmentOptions)4100; ((TMP_Text)obj4).fontStyle = (FontStyles)(boldValue ? 1 : 0); return obj4; } public void ClearListItems() { if ((Object)(object)ListViewContent == (Object)null) { return; } for (int num = ListViewContent.childCount - 1; num >= 0; num--) { Transform child = ListViewContent.GetChild(num); if ((Object)(object)child != (Object)null) { Object.Destroy((Object)(object)((Component)child).gameObject); } } } public void AddListItem(EntryData entryData) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Expected O, but got Unknown if ((Object)(object)ListViewContent == (Object)null) { return; } GameObject val = new GameObject("ListItem_" + entryData.Name); val.transform.SetParent(ListViewContent, false); ((Graphic)val.AddComponent<Image>()).color = bgColor; Button obj = val.AddComponent<Button>(); Navigation navigation = ((Selectable)obj).navigation; ((Navigation)(ref navigation)).mode = (Mode)0; ((Selectable)obj).navigation = navigation; val.AddComponent<LayoutElement>().minHeight = 35f; GameObject val2 = new GameObject("Text"); val2.transform.SetParent(val.transform, false); TextMeshProUGUI obj2 = val2.AddComponent<TextMeshProUGUI>(); ((TMP_Text)obj2).text = entryData.Name; ((TMP_Text)obj2).fontSize = 16f; ((Graphic)obj2).color = textColor; ((TMP_Text)obj2).alignment = (TextAlignmentOptions)4097; RectTransform component = val2.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = new Vector2(10f, 4f); component.offsetMax = new Vector2(-10f, -4f); ((UnityEvent)obj.onClick).AddListener((UnityAction)delegate { if (entrySelectedCallback != null) { entrySelectedCallback(entryData); } }); } } public struct EntryData { public string Name; public string ID; public float Distance; public string Color; } public class CallVehicleApp : App<CallVehicleApp> { [CompilerGenerated] private sealed class <UpdateEntries>d__9 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public CallVehicleApp <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <UpdateEntries>d__9(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown int num = <>1__state; CallVehicleApp CS$<>8__locals0 = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitUntil((Func<bool>)(() => CS$<>8__locals0.uiInitialized)); <>1__state = 1; return true; case 1: <>1__state = -1; break; case 2: <>1__state = -1; break; } CS$<>8__locals0.UpdateUIEntries(); <>2__current = (object)new WaitForSeconds(5f); <>1__state = 2; return true; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private CallVehicleAppUI appUI; private EntryData? currentSelectedEntry; private Coroutine entriesUpdater; private const float LIST_UPDATE_INTERVAL = 5f; private bool uiInitialized; private VehicleControl vehicleControl; private List<EntryData> vehicleEntries = new List<EntryData>(); private void DefineAppSettings() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) base.AppName = "Call Vehicle"; base.IconLabel = "Call Vehicle"; base.Orientation = (EOrientation<CallVehicleApp>)0; base.AvailableInTutorial = true; base.AppIcon = ModUtilities.SpriteFromImage("CallVehicleIcon.png"); } private void UpdateUIEntries() { if (!uiInitialized || appUI == null) { MelonLogger.Warning("CallVehicle: UpdateUIEntries called before UI was fully initialized."); } else { if ((Object)(object)appUI.ListViewContent == (Object)null) { return; } appUI.ClearListItems(); vehicleEntries.Clear(); vehicleControl.ownedVehicles.ForEach(delegate(LandVehicle veh) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)veh == (Object)null)) { EVehicleColor ownedColor = veh.OwnedColor; string text = ((object)(EVehicleColor)(ref ownedColor)).ToString(); string name = (veh.VehicleName ?? "Unknown Name") + " (" + text + ")"; float distanceToLocalCamera = veh.DistanceToLocalCamera; EntryData entryData = default(EntryData); entryData.Name = name; entryData.ID = veh.SaveFolderName ?? $"UnknownID_{Guid.NewGuid()}"; entryData.Distance = distanceToLocalCamera; entryData.Color = text; EntryData entryData2 = entryData; vehicleEntries.Add(entryData2); if (!((Object)(object)appUI.ListViewContent == (Object)null)) { appUI.AddListItem(entryData2); } } }); } } [IteratorStateMachine(typeof(<UpdateEntries>d__9))] private IEnumerator UpdateEntries() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <UpdateEntries>d__9(0) { <>4__this = this }; } protected override void Awake() { DefineAppSettings(); ((PlayerSingleton<CallVehicleApp>)(object)this).Awake(); CreateBaseContainer(); } private void CreateBaseContainer() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)PlayerSingleton<AppsCanvas>.Instance == (Object)null) { base.appContainer = null; return; } GameObject val = new GameObject(base.AppName + "_Container"); try { val.transform.SetParent(((Component)PlayerSingleton<AppsCanvas>.Instance).transform, false); } catch (Exception) { Object.Destroy((Object)(object)val); base.appContainer = null; return; } base.appContainer = val.AddComponent<RectTransform>(); if ((Object)(object)base.appContainer == (Object)null) { Object.Destroy((Object)(object)val); return; } base.appContainer.anchorMin = Vector2.zero; base.appContainer.anchorMax = Vector2.one; base.appContainer.offsetMin = Vector2.zero; base.appContainer.offsetMax = Vector2.zero; ((Transform)base.appContainer).localScale = Vector3.one; } private void ShowOverview(EntryData? entryData) { if (!uiInitialized || appUI == null) { return; } currentSelectedEntry = entryData; if ((Object)(object)appUI.OverviewInitialPanel == (Object)null || (Object)(object)appUI.OverviewDetailPanel == (Object)null) { return; } bool hasValue = entryData.HasValue; appUI.OverviewInitialPanel.SetActive(!hasValue); appUI.OverviewDetailPanel.SetActive(hasValue); if (hasValue) { EntryData value = entryData.Value; if ((Object)(object)appUI.OverviewNameText != (Object)null) { ((TMP_Text)appUI.OverviewNameText).text = value.Name; } if ((Object)(object)appUI.OverviewIdText != (Object)null) { ((TMP_Text)appUI.OverviewIdText).text = value.ID; } if ((Object)(object)appUI.OverviewDistanceText != (Object)null) { ((TMP_Text)appUI.OverviewDistanceText).text = value.Distance.ToString("F1") + "km"; } if ((Object)(object)appUI.OverviewColorText != (Object)null) { ((TMP_Text)appUI.OverviewColorText).text = value.Color; } string text = ((NetworkSingleton<TimeManager>.Instance.CurrentTime >= 1800) ? "Night" : "Day"); if ((Object)(object)appUI.CostPricePerKmText != (Object)null) { ((TMP_Text)appUI.CostPricePerKmText).text = "$" + Preferences.GetPrefValue<int>("price_per_km"); } if ((Object)(object)appUI.CostServiceChargeText != (Object)null) { int num = ((text == "Night") ? Preferences.GetPrefValue<int>("service_charge_night") : Preferences.GetPrefValue<int>("service_charge_day")); ((TMP_Text)appUI.CostServiceChargeText).text = "(" + text + ") $" + (float)num; } if ((Object)(object)appUI.CostTotalCostText != (Object)null) { int callCost = GetCallCost(value); ((TMP_Text)appUI.CostTotalCostText).text = "$" + callCost; } } } private void OnCallVehicleClicked() { if (currentSelectedEntry.HasValue) { EntryData value = currentSelectedEntry.Value; int callCost = GetCallCost(currentSelectedEntry.Value); vehicleControl.CallVehicle(value.ID, callCost); } else { MelonLogger.Warning("Call Vehicle clicked but no entry selected."); } } private static int GetCallCost(EntryData data) { string text = ((NetworkSingleton<TimeManager>.Instance.CurrentTime >= 1800) ? "Night" : "Day"); return (int)Math.Round(data.Distance * (float)Preferences.GetPrefValue<int>("price_per_km") + (float)((text == "Night") ? Preferences.GetPrefValue<int>("service_charge_night") : Preferences.GetPrefValue<int>("service_charge_day")), 0); } protected override void Start() { MelonLogger.Msg("CallVehicle: Start - Starting."); base.Start(); vehicleControl = new VehicleControl(); if ((Object)(object)base.appContainer != (Object)null && appUI == null) { appUI = new CallVehicleAppUI(); Action<EntryData?> onEntrySelected = ShowOverview; Action onCallVehicle = OnCallVehicleClicked; appUI.InitializeUI(base.appContainer, onEntrySelected, onCallVehicle); uiInitialized = true; } else if ((Object)(object)base.appContainer == (Object)null) { MelonLogger.Error("CallVehicle: Start - Cannot initialize UI because appContainer is null."); } } public override void SetOpen(bool open) { //IL_00ba: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)base.appContainer == (Object)null || (Object)(object)((Component)base.appContainer).gameObject == (Object)null) { return; } try { base.SetOpen(open); } catch (Exception ex) { MelonLogger.Error($"CallVehicle: Error occurred during base.SetOpen({open}): {ex.ToString()}"); if (open && !base.isOpen) { ((Component)base.appContainer).gameObject.SetActive(false); } return; } if (!uiInitialized || appUI == null) { return; } if (base.isOpen) { ShowOverview(null); if ((Object)(object)appUI.ListScrollRect != (Object)null) { appUI.ListScrollRect.normalizedPosition = new Vector2(0f, 1f); } UpdateUIEntries(); if (entriesUpdater == null) { entriesUpdater = ((MonoBehaviour)this).StartCoroutine(UpdateEntries()); } } else if (entriesUpdater != null) { ((MonoBehaviour)this).StopCoroutine(entriesUpdater); entriesUpdater = null; } } protected override void OnDestroy() { if (entriesUpdater != null) { ((MonoBehaviour)this).StopCoroutine(entriesUpdater); entriesUpdater = null; } ((PlayerSingleton<CallVehicleApp>)(object)this).OnDestroy(); if ((Object)(object)base.AppIcon != (Object)null && (Object)(object)base.AppIcon.texture != (Object)null && ((Texture)base.AppIcon.texture).width == 1 && ((Texture)base.AppIcon.texture).height == 1) { Object.Destroy((Object)(object)base.AppIcon.texture); } appUI = null; uiInitialized = false; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { internal IgnoresAccessChecksToAttribute(string assemblyName) { } } }