disabling context menu dividers and expanding the context menu radius to 200f to help spread things out.

This commit is contained in:
2025-02-22 23:43:00 -06:00
parent 58dc7efac0
commit 7552422b6e
5 changed files with 32 additions and 10 deletions

View File

@@ -2,6 +2,6 @@
<PropertyGroup>
<MajorVersion>1</MajorVersion>
<MinorVersion>2</MinorVersion>
<PatchVersion>2</PatchVersion>
<PatchVersion>3</PatchVersion>
</PropertyGroup>
</Project>

View File

@@ -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());
}

View File

@@ -50,7 +50,8 @@ internal class CarPrototypeLibrary_LoadForId_Patch
[HarmonyPatchCategory("RMROC451TweaksAndThings")]
internal class OpsController_AnnounceCoalescedPayments_Patch
{
static Dictionary<string, (bool spotted, bool filling)> CrewCarDict = [];
static Dictionary<string, (bool spotted, bool filling)> 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<Type> refillLocations = [
static readonly IEnumerable<Type> refillLocations =
new List<Type>() {
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<Car>()).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);

View File

@@ -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<string> tags = [];
List<string> tags = new();
if (OpsController_AnnounceCoalescedPayments_Patch.CrewCarStatus(car).spotted) tags.Add("+");
if (car.HasHotbox) tags.Add(TextSprites.Hotbox);

View File

@@ -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<TweaksAndThingsPlugin>.Shared;
if (!tweaksAndThings.IsEnabled) return;
vh.Clear(); //clear the image backgrounds for now.
}
}