remove SetActive call, which seems to be a performance gain when tags are displayed.

This commit is contained in:
2024-07-24 00:03:11 -05:00
parent ec21effd30
commit 80d064c950

View File

@@ -3,9 +3,7 @@ using Model;
using Model.OpsNew;
using Railloader;
using RMROC451.TweaksAndThings.Extensions;
using UI;
using UI.Tags;
using UnityEngine;
namespace RMROC451.TweaksAndThings.Patches;
@@ -19,7 +17,6 @@ internal class TagController_UpdateTag_Patch
private static void Postfix(Car car, TagCallout tagCallout)
{
TagController tagController = UnityEngine.Object.FindObjectOfType<TagController>();
TweaksAndThingsPlugin tweaksAndThings = SingletonPluginBase<TweaksAndThingsPlugin>.Shared;
if (!tweaksAndThings.IsEnabled || !tweaksAndThings.settings.HandBrakeAndAirTagModifiers)
@@ -27,24 +24,14 @@ internal class TagController_UpdateTag_Patch
return;
}
ProceedWithPostFix(car, tagCallout, tagController);
ProceedWithPostFix(car, tagCallout);
return;
}
private static void ProceedWithPostFix(Car car, TagCallout tagCallout, TagController tagController)
private static void ProceedWithPostFix(Car car, TagCallout tagCallout)
{
bool isAltDownWithCarIssue = GameInput.IsAltDown && car.CarOrEndGearIssue();
tagCallout.callout.Title = string.Format(tagTitleFormat, "{0}", car.DisplayName);
tagCallout.gameObject.SetActive(
tagCallout.gameObject.activeSelf &&
(!GameInput.IsAltDown || isAltDownWithCarIssue)
);
if (tagCallout.gameObject.activeSelf && isAltDownWithCarIssue)
{
tagController.ApplyImageColor(tagCallout, Color.black);
}
tagCallout.callout.Title =
(car.CarAndEndGearIssue(), car.EndAirSystemIssue(), car.HandbrakeApplied()) switch