From 7ebd14db2adf4cd933eb859462b20b9481e01c40 Mon Sep 17 00:00:00 2001 From: RMROC451 Date: Tue, 24 Dec 2024 22:11:22 -0600 Subject: [PATCH 1/6] adjusting railroader usage of namespace Model.OpsNew -> Model.Ops and some adjustments to the version files. --- Assembly.version | 7 +++++++ Directory.Build.props | 1 + Directory.Build.targets | 2 +- Paths.user.example | 6 ++++++ TweaksAndThings.sln | 1 + TweaksAndThings/Commands/CrewUpdateCommand.cs | 2 +- TweaksAndThings/Definition.json | 7 +++++-- TweaksAndThings/Extensions/Car_Extensions.cs | 2 +- TweaksAndThings/Patches/EngineRosterRow_Refresh_Patch.cs | 2 +- .../OpsController_AnnounceCoalescedPayments_Patch.cs | 2 +- TweaksAndThings/Patches/TagController_UpdateTag_Patch.cs | 2 +- 11 files changed, 26 insertions(+), 8 deletions(-) create mode 100644 Assembly.version create mode 100644 Paths.user.example diff --git a/Assembly.version b/Assembly.version new file mode 100644 index 0000000..889103d --- /dev/null +++ b/Assembly.version @@ -0,0 +1,7 @@ + + + 1 + 2 + 1 + + \ No newline at end of file diff --git a/Directory.Build.props b/Directory.Build.props index fe5e246..1d15827 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,5 +1,6 @@  + net48 latest diff --git a/Directory.Build.targets b/Directory.Build.targets index 920a7a7..c6e889f 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -39,7 +39,7 @@ ../bin - $(PublishPath)/$(AssemblyName)_$(AssemblyVersion).zip + $(PublishPath)/$(AssemblyName)_$(AssemblyVersion)_Experimental.zip diff --git a/Paths.user.example b/Paths.user.example new file mode 100644 index 0000000..f5786ad --- /dev/null +++ b/Paths.user.example @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/TweaksAndThings.sln b/TweaksAndThings.sln index da34e15..b4b596c 100644 --- a/TweaksAndThings.sln +++ b/TweaksAndThings.sln @@ -6,6 +6,7 @@ MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{452A23A6-81C8-49C6-A7EE-95FD9377F896}" ProjectSection(SolutionItems) = preProject .gitignore = .gitignore + Assembly.version = Assembly.version Directory.Build.props = Directory.Build.props Directory.Build.targets = Directory.Build.targets Paths.user = Paths.user diff --git a/TweaksAndThings/Commands/CrewUpdateCommand.cs b/TweaksAndThings/Commands/CrewUpdateCommand.cs index d204df2..b24bd0b 100644 --- a/TweaksAndThings/Commands/CrewUpdateCommand.cs +++ b/TweaksAndThings/Commands/CrewUpdateCommand.cs @@ -1,6 +1,6 @@ using Game.State; using Helpers; -using Model.OpsNew; +using Model.Ops; using Network; using RMROC451.TweaksAndThings.Extensions; using System.Linq; diff --git a/TweaksAndThings/Definition.json b/TweaksAndThings/Definition.json index 5d66ba7..a633033 100644 --- a/TweaksAndThings/Definition.json +++ b/TweaksAndThings/Definition.json @@ -6,9 +6,12 @@ "requires": [ { "id": "railloader", - "notBefore": "1.8.1" + "notBefore": "1.9.6.8" }, - "Zamu.StrangeCustoms" + { + "id": "Zamu.StrangeCustoms", + "notBefore": "1.10.24358.413" + } ], "assemblies": [ "RMROC451.TweaksAndThings" ], "mixintos": { diff --git a/TweaksAndThings/Extensions/Car_Extensions.cs b/TweaksAndThings/Extensions/Car_Extensions.cs index 5e70ad7..009bc87 100644 --- a/TweaksAndThings/Extensions/Car_Extensions.cs +++ b/TweaksAndThings/Extensions/Car_Extensions.cs @@ -3,7 +3,7 @@ using Game.State; using Helpers; using Model; using Model.Definition.Data; -using Model.OpsNew; +using Model.Ops; using Serilog; using System; using System.Collections.Generic; diff --git a/TweaksAndThings/Patches/EngineRosterRow_Refresh_Patch.cs b/TweaksAndThings/Patches/EngineRosterRow_Refresh_Patch.cs index 4b14fb2..7eacd0b 100644 --- a/TweaksAndThings/Patches/EngineRosterRow_Refresh_Patch.cs +++ b/TweaksAndThings/Patches/EngineRosterRow_Refresh_Patch.cs @@ -1,7 +1,7 @@ using HarmonyLib; using Model; using Model.Definition.Data; -using Model.OpsNew; +using Model.Ops; using Railloader; using RMROC451.TweaksAndThings.Extensions; using Serilog; diff --git a/TweaksAndThings/Patches/OpsController_AnnounceCoalescedPayments_Patch.cs b/TweaksAndThings/Patches/OpsController_AnnounceCoalescedPayments_Patch.cs index 19a22cc..1784d61 100644 --- a/TweaksAndThings/Patches/OpsController_AnnounceCoalescedPayments_Patch.cs +++ b/TweaksAndThings/Patches/OpsController_AnnounceCoalescedPayments_Patch.cs @@ -4,7 +4,7 @@ using HarmonyLib; using Model; using Model.Definition.Data; using Model.Ops.Definition; -using Model.OpsNew; +using Model.Ops; using Network; using Railloader; using RMROC451.TweaksAndThings.Extensions; diff --git a/TweaksAndThings/Patches/TagController_UpdateTag_Patch.cs b/TweaksAndThings/Patches/TagController_UpdateTag_Patch.cs index 5fda423..09d4e40 100644 --- a/TweaksAndThings/Patches/TagController_UpdateTag_Patch.cs +++ b/TweaksAndThings/Patches/TagController_UpdateTag_Patch.cs @@ -1,6 +1,6 @@ using HarmonyLib; using Model; -using Model.OpsNew; +using Model.Ops; using Railloader; using RMROC451.TweaksAndThings.Extensions; using System.Collections.Generic; From 58dc7efac012c113f5e51428b0c1723cdddb2860 Mon Sep 17 00:00:00 2001 From: RMROC451 Date: Sun, 16 Feb 2025 09:41:58 -0600 Subject: [PATCH 2/6] adjusting CarIdsInRect -> CarIdsInRadius --- Assembly.version | 2 +- TweaksAndThings/Definition.json | 8 ++++++-- TweaksAndThings/Extensions/Car_Extensions.cs | 3 +-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Assembly.version b/Assembly.version index 889103d..e57fa04 100644 --- a/Assembly.version +++ b/Assembly.version @@ -2,6 +2,6 @@ 1 2 - 1 + 2 \ No newline at end of file diff --git a/TweaksAndThings/Definition.json b/TweaksAndThings/Definition.json index a633033..a29b876 100644 --- a/TweaksAndThings/Definition.json +++ b/TweaksAndThings/Definition.json @@ -4,13 +4,17 @@ "name": "RMROC451's Tweaks and Things", "version": "$(AssemblyVersion)", "requires": [ + { + "id": "railroader", + "notBefore": "2024.6" + }, { "id": "railloader", - "notBefore": "1.9.6.8" + "notBefore": "1.9.6.14" }, { "id": "Zamu.StrangeCustoms", - "notBefore": "1.10.24358.413" + "notBefore": "1.10.25017.313" } ], "assemblies": [ "RMROC451.TweaksAndThings" ], diff --git a/TweaksAndThings/Extensions/Car_Extensions.cs b/TweaksAndThings/Extensions/Car_Extensions.cs index 009bc87..2fb2a63 100644 --- a/TweaksAndThings/Extensions/Car_Extensions.cs +++ b/TweaksAndThings/Extensions/Car_Extensions.cs @@ -109,8 +109,7 @@ public static class Car_Extensions { Vector3 position = car.GetMotionSnapshot().Position; Vector3 center = WorldTransformer.WorldToGame(position); - Rect rect = new Rect(new Vector2(center.x - 30f, center.z - 30f), Vector2.one * 30f * 2f); - var cars = tc.CarIdsInRect(rect); + var cars = tc.CarIdsInRadius(center, 60f); Log.Information($"{nameof(HuntingForCabeeseNearCar)} => {cars.Count()}"); List<(string carId, float distance)> source = cars From 7552422b6e9cf03ee10c49cf1b0014317dfd6cfa Mon Sep 17 00:00:00 2001 From: Ryan Mroczenski Date: Sat, 22 Feb 2025 23:43:00 -0600 Subject: [PATCH 3/6] disabling context menu dividers and expanding the context menu radius to 200f to help spread things out. --- Assembly.version | 2 +- ...CarPickable_HandleShowContextMenu_Patch.cs | 8 ++++---- ...troller_AnnounceCoalescedPayments_Patch.cs | 10 ++++++---- .../Patches/TagController_UpdateTag_Patch.cs | 2 +- .../Patches/WedgeImage_OnPopulateMesh.cs | 20 +++++++++++++++++++ 5 files changed, 32 insertions(+), 10 deletions(-) create mode 100644 TweaksAndThings/Patches/WedgeImage_OnPopulateMesh.cs diff --git a/Assembly.version b/Assembly.version index e57fa04..1e37924 100644 --- a/Assembly.version +++ b/Assembly.version @@ -2,6 +2,6 @@ 1 2 - 2 + 3 \ No newline at end of file diff --git a/TweaksAndThings/Patches/CarPickable_HandleShowContextMenu_Patch.cs b/TweaksAndThings/Patches/CarPickable_HandleShowContextMenu_Patch.cs index 69eee66..7a89fa8 100644 --- a/TweaksAndThings/Patches/CarPickable_HandleShowContextMenu_Patch.cs +++ b/TweaksAndThings/Patches/CarPickable_HandleShowContextMenu_Patch.cs @@ -22,20 +22,20 @@ internal class CarPickable_HandleShowContextMenu_Patch bool buttonsHaveCost = tweaksAndThings.EndGearHelpersRequirePayment(); ContextMenu shared = ContextMenu.Shared; - shared.AddButton(ContextMenuQuadrant.Unused2, $"{(car.EnumerateCoupled().Any(c => c.HandbrakeApplied()) ? "Release " : "Set ")} Consist", SpriteName.Handbrake, delegate + shared.AddButton(ContextMenuQuadrant.Unused1, $"{(car.EnumerateCoupled().Any(c => c.HandbrakeApplied()) ? "Release " : "Set ")} Consist", SpriteName.Handbrake, delegate { CarInspector_PopulateCarPanel_Patch.MrocConsistHelper(car, MrocHelperType.Handbrake, buttonsHaveCost); }); if (car.EnumerateCoupled().Any(c => c.EndAirSystemIssue())) { - shared.AddButton(ContextMenuQuadrant.Unused2, $"Air Up Consist", SpriteName.Select, delegate + shared.AddButton(ContextMenuQuadrant.Unused1, $"Air Up Consist", SpriteName.Select, delegate { CarInspector_PopulateCarPanel_Patch.MrocConsistHelper(car, MrocHelperType.GladhandAndAnglecock, buttonsHaveCost); }); } - if (car.EnumerateCoupled().Any(c => c.SupportsBleed())) + if (!car.EnumerateCoupled().Any(c => !c.SupportsBleed())) { shared.AddButton(ContextMenuQuadrant.Unused2, $"Bleed Consist", SpriteName.Bleed, delegate { @@ -47,7 +47,7 @@ internal class CarPickable_HandleShowContextMenu_Patch { CameraSelector.shared.FollowCar(car); }); - + shared.radius = 200f; shared.BuildItemAngles(); shared.StartCoroutine(shared.AnimateButtonsShown()); } diff --git a/TweaksAndThings/Patches/OpsController_AnnounceCoalescedPayments_Patch.cs b/TweaksAndThings/Patches/OpsController_AnnounceCoalescedPayments_Patch.cs index 1784d61..e35bca4 100644 --- a/TweaksAndThings/Patches/OpsController_AnnounceCoalescedPayments_Patch.cs +++ b/TweaksAndThings/Patches/OpsController_AnnounceCoalescedPayments_Patch.cs @@ -50,7 +50,8 @@ internal class CarPrototypeLibrary_LoadForId_Patch [HarmonyPatchCategory("RMROC451TweaksAndThings")] internal class OpsController_AnnounceCoalescedPayments_Patch { - static Dictionary CrewCarDict = []; + static Dictionary CrewCarDict = new(); + public static (bool spotted, bool filling) CrewCarStatus(Car car) { bool found = CrewCarDict.TryGetValue(car.id, out (bool spotted, bool filling) val); @@ -61,12 +62,13 @@ internal class OpsController_AnnounceCoalescedPayments_Patch } static GameDateTime dateTime = TimeWeather.Now; - static readonly IEnumerable refillLocations = [ + static readonly IEnumerable refillLocations = + new List() { typeof(PassengerStop), typeof(SimplePassengerStop), typeof(TeamTrack), typeof(RepairTrack) - ]; + }; public static Load CrewHoursLoad() { @@ -116,7 +118,7 @@ internal class OpsController_AnnounceCoalescedPayments_Patch //Log.Information($"{nameof(OpsController_AnnounceCoalescedPayments_Patch)} => Caboose Helper => PassengerStops => {string.Join(",", passengerStops)}"); var cabeese = passengerStops - .SelectMany(t => t.TrackSpans?.Select(s => (tc.CarsOnSpan(s) ?? []).Where(c => c.IsCaboose()))?.SelectMany(c => c?.Select(c2 => (t, c2)))); + .SelectMany(t => t.TrackSpans?.Select(s => (tc.CarsOnSpan(s) ?? Enumerable.Empty()).Where(c => c.IsCaboose()))?.SelectMany(c => c?.Select(c2 => (t, c2)))); //Log.Information($"{nameof(OpsController_AnnounceCoalescedPayments_Patch)} => Caboose Helper => PassengerStops Cabeese => {string.Join(",", cabeese?.Select(c => $"{c.t} : {c.c2}") ?? [])}"); CrewCarDict = CrewCarDict.Where(kvp => cabeese.Select(c => c.c2.id).Contains(kvp.Key)).ToDictionary(k => k.Key, v => v.Value); diff --git a/TweaksAndThings/Patches/TagController_UpdateTag_Patch.cs b/TweaksAndThings/Patches/TagController_UpdateTag_Patch.cs index 09d4e40..9e9ca89 100644 --- a/TweaksAndThings/Patches/TagController_UpdateTag_Patch.cs +++ b/TweaksAndThings/Patches/TagController_UpdateTag_Patch.cs @@ -34,7 +34,7 @@ internal class TagController_UpdateTag_Patch private static void ProceedWithPostFix(Car car, TagCallout tagCallout) { tagCallout.callout.Title = string.Format(tagTitleFormat, "{0}", car.DisplayName); - List tags = []; + List tags = new(); if (OpsController_AnnounceCoalescedPayments_Patch.CrewCarStatus(car).spotted) tags.Add("+"); if (car.HasHotbox) tags.Add(TextSprites.Hotbox); diff --git a/TweaksAndThings/Patches/WedgeImage_OnPopulateMesh.cs b/TweaksAndThings/Patches/WedgeImage_OnPopulateMesh.cs new file mode 100644 index 0000000..c9904c3 --- /dev/null +++ b/TweaksAndThings/Patches/WedgeImage_OnPopulateMesh.cs @@ -0,0 +1,20 @@ +using HarmonyLib; +using Railloader; +using UI.ContextMenu; +using UnityEngine.UI; + +namespace RMROC451.TweaksAndThings.Patches; + +[HarmonyPatch(typeof(WedgeImage))] +[HarmonyPatch(nameof(WedgeImage.OnPopulateMesh), typeof(VertexHelper))] +[HarmonyPatchCategory("RMROC451TweaksAndThings")] +internal class WedgeImage_OnPopulateMesh_Patch +{ + private static void Postfix(VertexHelper vh) + { + TweaksAndThingsPlugin tweaksAndThings = SingletonPluginBase.Shared; + if (!tweaksAndThings.IsEnabled) return; + + vh.Clear(); //clear the image backgrounds for now. + } +} From 80f0847587fe8dc4f1805a101224e5a698b5a26b Mon Sep 17 00:00:00 2001 From: RMROC451 Date: Sun, 2 Mar 2025 12:43:08 -0600 Subject: [PATCH 4/6] reverting updated context menu visualizations, and allowing the even spacing of items vs quadrant concept. Pesky double circle context menu borders still remain, but I'm working on it. --- Assembly.version | 2 +- ...CarPickable_HandleShowContextMenu_Patch.cs | 1 - .../ContextMenu_PositionForItem_Patch.cs | 25 ++++ .../Patches/ContextMenu_Show_Patch.cs | 127 ++++++++++++++++++ 4 files changed, 153 insertions(+), 2 deletions(-) create mode 100644 TweaksAndThings/Patches/ContextMenu_PositionForItem_Patch.cs create mode 100644 TweaksAndThings/Patches/ContextMenu_Show_Patch.cs diff --git a/Assembly.version b/Assembly.version index 1e37924..2bd9b67 100644 --- a/Assembly.version +++ b/Assembly.version @@ -2,6 +2,6 @@ 1 2 - 3 + 4 \ No newline at end of file diff --git a/TweaksAndThings/Patches/CarPickable_HandleShowContextMenu_Patch.cs b/TweaksAndThings/Patches/CarPickable_HandleShowContextMenu_Patch.cs index 7a89fa8..3a15345 100644 --- a/TweaksAndThings/Patches/CarPickable_HandleShowContextMenu_Patch.cs +++ b/TweaksAndThings/Patches/CarPickable_HandleShowContextMenu_Patch.cs @@ -47,7 +47,6 @@ internal class CarPickable_HandleShowContextMenu_Patch { CameraSelector.shared.FollowCar(car); }); - shared.radius = 200f; shared.BuildItemAngles(); shared.StartCoroutine(shared.AnimateButtonsShown()); } diff --git a/TweaksAndThings/Patches/ContextMenu_PositionForItem_Patch.cs b/TweaksAndThings/Patches/ContextMenu_PositionForItem_Patch.cs new file mode 100644 index 0000000..1bef1ed --- /dev/null +++ b/TweaksAndThings/Patches/ContextMenu_PositionForItem_Patch.cs @@ -0,0 +1,25 @@ +using HarmonyLib; +using Railloader; +using System; +using UI.ContextMenu; +using UnityEngine; + + +namespace RMROC451.TweaksAndThings.Patches; + +[HarmonyPatch(typeof(UI.ContextMenu.ContextMenu))] +//ContextMenuQuadrant quadrant, int index, float normalizedRadius = 1f +[HarmonyPatch(nameof(UI.ContextMenu.ContextMenu.PositionForItem), typeof(ContextMenuQuadrant), typeof(int), typeof(float))] +[HarmonyPatchCategory("RMROC451TweaksAndThings")] +internal class ContextMenu_PositionForItem_Patch +{ + static void Postfix(UI.ContextMenu.ContextMenu __instance, ref Vector2 __result, ContextMenuQuadrant quadrant, int index, float normalizedRadius = 1f) + { + TweaksAndThingsPlugin tweaksAndThings = SingletonPluginBase.Shared; + if (!tweaksAndThings.IsEnabled) return; + + float num = __instance._itemAngles[(quadrant, index)] * ((float)Math.PI / 180f); + float num2 = __instance.radius * normalizedRadius; + __result = new Vector2(1.3f * Mathf.Sin(num) * num2, Mathf.Cos(num) * num2); + } +} diff --git a/TweaksAndThings/Patches/ContextMenu_Show_Patch.cs b/TweaksAndThings/Patches/ContextMenu_Show_Patch.cs new file mode 100644 index 0000000..84ba16a --- /dev/null +++ b/TweaksAndThings/Patches/ContextMenu_Show_Patch.cs @@ -0,0 +1,127 @@ +using HarmonyLib; +using Helpers; +using Railloader; +using Serilog; +using System; +using System.Collections.Generic; +using UI; +using UI.ContextMenu; +using UnityEngine; +using UnityEngine.UI; + +namespace RMROC451.TweaksAndThings.Patches; + +[HarmonyPatch(typeof(UI.ContextMenu.ContextMenu))] +[HarmonyPatch(nameof(UI.ContextMenu.ContextMenu.Show), typeof(string))] +[HarmonyPatchCategory("RMROC451TweaksAndThings")] +internal class ContextMenu_Show_Patch +{ + static bool Prefix(UI.ContextMenu.ContextMenu __instance, string centerText) + { + TweaksAndThingsPlugin tweaksAndThings = SingletonPluginBase.Shared; + if (!tweaksAndThings.IsEnabled) return true; + + if (!__instance.GetRootCanvas(out var rootCanvas)) + { + Log.Warning("Couldn't get root canvas"); + return true; + } + __instance.CancelHideCoroutine(); + __instance.SetupTemplate(rootCanvas); + __instance.centerLabel.text = centerText; + Canvas componentInParent = ((Component)__instance.contentRectTransform).GetComponentInParent(); + Vector3 mousePosition = Input.mousePosition; + Vector2 val = componentInParent.ScreenToCanvasPosition(mousePosition).XY(); + Vector2 renderingDisplaySize = rootCanvas.renderingDisplaySize; + float num = __instance.radius + 50f; + if (val.x < num) + { + val.x = num; + } + if (val.x > renderingDisplaySize.x - num) + { + val.x = renderingDisplaySize.x - num; + } + if (val.y < num) + { + val.y = num; + } + if (val.y > renderingDisplaySize.y - num) + { + val.y = renderingDisplaySize.y - num; + } + __instance.contentRectTransform.anchoredPosition = val; + __instance.BuildItemAngles(); + + ((MonoBehaviour)__instance).StartCoroutine(__instance.AnimateButtonsShown()); + ((Component)__instance.contentRectTransform).gameObject.SetActive(true); + UI.ContextMenu.ContextMenu.IsShown = true; + __instance._blocker = __instance.CreateBlocker(rootCanvas); + GameInput.RegisterEscapeHandler(GameInput.EscapeHandler.Transient, delegate + { + __instance.Hide(); + return true; + }); + + return false; + } +} + + +[HarmonyPatch(typeof(UI.ContextMenu.ContextMenu))] +[HarmonyPatch(nameof(UI.ContextMenu.ContextMenu.DefaultAngleForItem), typeof(ContextMenuQuadrant), typeof(int), typeof(int))] +[HarmonyPatchCategory("RMROC451TweaksAndThings")] +internal class ContextMenu_DefaultAngleForItem_Patch +{ + static bool Prefix(UI.ContextMenu.ContextMenu __instance, ref float __result, ContextMenuQuadrant quadrant, int index, int quadrantItemCount) + { + TweaksAndThingsPlugin tweaksAndThings = SingletonPluginBase.Shared; + if (!tweaksAndThings.IsEnabled) return true; + + + int num = quadrant switch + { + ContextMenuQuadrant.General => 0, + ContextMenuQuadrant.Unused1 => 90, + ContextMenuQuadrant.Brakes => 180, + ContextMenuQuadrant.Unused2 => -90, + _ => throw new ArgumentOutOfRangeException("quadrant", quadrant, null), + }; + if (quadrantItemCount <= 1) + { + __result = num; + return false; + } + int num2 = ((quadrantItemCount <= 3) ? 30 : (90 / (quadrantItemCount - 1))); + __result = (float)num + -0.5f * (float)((quadrantItemCount - 1) * num2) + (float)(num2 * index); + return false; + } +} + + +[HarmonyPatch(typeof(UI.ContextMenu.ContextMenu))] +[HarmonyPatch(nameof(UI.ContextMenu.ContextMenu.AddButton), typeof(ContextMenuQuadrant), typeof(string), typeof(Sprite), typeof(Action))] +[HarmonyPatchCategory("RMROC451TweaksAndThings")] +internal class ContextMenu_AddButton_Patch +{ + static bool Prefix(UI.ContextMenu.ContextMenu __instance, ContextMenuQuadrant quadrant, string title, Sprite sprite, Action action) + { + TweaksAndThingsPlugin tweaksAndThings = SingletonPluginBase.Shared; + if (!tweaksAndThings.IsEnabled) return true; + + + List list = __instance._quadrants[(int)quadrant]; + int index = list.Count; + ContextMenuItem contextMenuItem = UnityEngine.Object.Instantiate(__instance.itemPrefab, (Transform)(object)__instance.contentRectTransform); + contextMenuItem.image.sprite = sprite; + contextMenuItem.label.text = title; + contextMenuItem.OnClick = delegate + { + action(); + __instance.Hide((quadrant, index)); + }; + ((Component)contextMenuItem).gameObject.AddComponent().preferredHeight = 30f; + list.Add(contextMenuItem); + return false; + } +} \ No newline at end of file From c25271ee2d57a37254a2738e4410bb079c316ee9 Mon Sep 17 00:00:00 2001 From: RMROC451 Date: Sun, 2 Mar 2025 13:23:15 -0600 Subject: [PATCH 5/6] begone concentric circles! --- Assembly.version | 2 +- TweaksAndThings/Patches/ContextMenu_Show_Patch.cs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Assembly.version b/Assembly.version index 2bd9b67..44c2825 100644 --- a/Assembly.version +++ b/Assembly.version @@ -2,6 +2,6 @@ 1 2 - 4 + 5 \ No newline at end of file diff --git a/TweaksAndThings/Patches/ContextMenu_Show_Patch.cs b/TweaksAndThings/Patches/ContextMenu_Show_Patch.cs index 84ba16a..94f4406 100644 --- a/TweaksAndThings/Patches/ContextMenu_Show_Patch.cs +++ b/TweaksAndThings/Patches/ContextMenu_Show_Patch.cs @@ -27,6 +27,7 @@ internal class ContextMenu_Show_Patch return true; } __instance.CancelHideCoroutine(); + if (__instance.contentRectTransform.childCount >= 1) __instance.contentRectTransform.GetChild(0).DestroyAllChildren(); //YOINK DEM CIRCLES! __instance.SetupTemplate(rootCanvas); __instance.centerLabel.text = centerText; Canvas componentInParent = ((Component)__instance.contentRectTransform).GetComponentInParent(); From bce1d8bd589705c37ab6aa4c09cfc31ad872515f Mon Sep 17 00:00:00 2001 From: RMROC451 Date: Sat, 8 Mar 2025 21:17:29 -0600 Subject: [PATCH 6/6] fixing issues with build angles on context menu for select/deselect on consists without an engine --- Assembly.version | 2 +- .../Patches/CarPickable_HandleShowContextMenu_Patch.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Assembly.version b/Assembly.version index 44c2825..691d1be 100644 --- a/Assembly.version +++ b/Assembly.version @@ -2,6 +2,6 @@ 1 2 - 5 + 6 \ No newline at end of file diff --git a/TweaksAndThings/Patches/CarPickable_HandleShowContextMenu_Patch.cs b/TweaksAndThings/Patches/CarPickable_HandleShowContextMenu_Patch.cs index 3a15345..5ceff11 100644 --- a/TweaksAndThings/Patches/CarPickable_HandleShowContextMenu_Patch.cs +++ b/TweaksAndThings/Patches/CarPickable_HandleShowContextMenu_Patch.cs @@ -43,7 +43,7 @@ internal class CarPickable_HandleShowContextMenu_Patch }); } - shared.AddButton(ContextMenuQuadrant.Unused2, $"Follow", SpriteName.Inspect, delegate + shared.AddButton(ContextMenuQuadrant.General, $"Follow", SpriteName.Inspect, delegate { CameraSelector.shared.FollowCar(car); });