mirror of
https://github.com/rmroc451/TweaksAndThings.git
synced 2025-12-18 02:09:37 -06:00
work in progress attempts to resolve text overlapping on car tag titles.
This commit is contained in:
@@ -1,48 +1,35 @@
|
|||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using JetBrains.Annotations;
|
|
||||||
using Model;
|
using Model;
|
||||||
using Model.AI;
|
|
||||||
using Model.OpsNew;
|
using Model.OpsNew;
|
||||||
using Railloader;
|
using Railloader;
|
||||||
using Serilog;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Net.Sockets;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Track;
|
|
||||||
using TweaksAndThings;
|
|
||||||
using UI;
|
using UI;
|
||||||
using UI.Builder;
|
|
||||||
using UI.CarInspector;
|
|
||||||
using UI.Tags;
|
using UI.Tags;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using static Model.Car;
|
|
||||||
using tat = TweaksAndThings.TweaksAndThings;
|
|
||||||
|
|
||||||
namespace TweaksAndThings.Patches;
|
namespace TweaksAndThings.Patches;
|
||||||
|
|
||||||
[HarmonyPatch(typeof(TagController))]
|
[HarmonyPatch(typeof(TagController))]
|
||||||
[HarmonyPatch(nameof(TagController.UpdateTag), typeof(Car), typeof(TagCallout), typeof(OpsController))]
|
[HarmonyPatch(nameof(TagController.UpdateTag), typeof(Car), typeof(TagCallout), typeof(OpsController))]
|
||||||
[HarmonyPatchCategory("RMROC451TweaksAndThings")]
|
[HarmonyPatchCategory("RMROC451TweaksAndThings")]
|
||||||
public class TagConroller_UpdateTag_Patch
|
public class TagController_UpdateTag_Patch
|
||||||
{
|
{
|
||||||
private static void Postfix(Car car, TagCallout tagCallout)
|
private static void Postfix(Car car, TagCallout tagCallout)
|
||||||
{
|
{
|
||||||
TagController tagController = UnityEngine.Object.FindObjectOfType<TagController>();
|
TagController tagController = UnityEngine.Object.FindObjectOfType<TagController>();
|
||||||
TweaksAndThings tweaksAndThings = SingletonPluginBase<TweaksAndThings>.Shared;
|
TweaksAndThings tweaksAndThings = SingletonPluginBase<TweaksAndThings>.Shared;
|
||||||
tagCallout.callout.Title = $"<align=left>{car.DisplayName}<line-height=0>";
|
bool concatOnly = car.DisplayName.Length > 6;
|
||||||
|
string delimiter = concatOnly ? " " : "\n<align=\"right\">";
|
||||||
|
|
||||||
if (!tweaksAndThings.IsEnabled || !tweaksAndThings.settings.HandBrakeAndAirTagModifiers)
|
if (!tweaksAndThings.IsEnabled || !tweaksAndThings.settings.HandBrakeAndAirTagModifiers)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
tagCallout.callout.Title = concatOnly ? $"<align=left>{car.DisplayName} <space=.5em> " : $"<align=left>{car.DisplayName}<line-height=0>";
|
||||||
tagCallout.gameObject.SetActive(
|
tagCallout.gameObject.SetActive(
|
||||||
tagCallout.gameObject.activeSelf &&
|
tagCallout.gameObject.activeSelf &&
|
||||||
(!GameInput.IsShiftDown || (GameInput.IsShiftDown && car.CarOrEndGearIssue()))
|
(!GameInput.IsShiftDown || (GameInput.IsShiftDown && car.CarOrEndGearIssue()))
|
||||||
);
|
);
|
||||||
|
|
||||||
if (tagCallout.gameObject.activeSelf && GameInput.IsShiftDown && car.CarOrEndGearIssue()) {
|
if (tagCallout.gameObject.activeSelf && GameInput.IsShiftDown && car.CarOrEndGearIssue()) {
|
||||||
|
|
||||||
tagController.ApplyImageColor(tagCallout, Color.black);
|
tagController.ApplyImageColor(tagCallout, Color.black);
|
||||||
@@ -50,17 +37,17 @@ public class TagConroller_UpdateTag_Patch
|
|||||||
|
|
||||||
if (car.CarAndEndGearIssue())
|
if (car.CarAndEndGearIssue())
|
||||||
{
|
{
|
||||||
tagCallout.callout.Title =
|
tagCallout.callout.Title = $"{tagCallout.callout.Title}{delimiter}{TextSprites.CycleWaybills}{TextSprites.HandbrakeWheel}";
|
||||||
$"{tagCallout.callout.Title}\n<align=\"right\">{TextSprites.CycleWaybills}{TextSprites.HandbrakeWheel}";
|
|
||||||
}
|
}
|
||||||
else if (car.EndAirSystemIssue())
|
else if (car.EndAirSystemIssue())
|
||||||
tagCallout.callout.Title =
|
{
|
||||||
$"{tagCallout.callout.Title}\n<align=\"right\">{TextSprites.CycleWaybills}";
|
tagCallout.callout.Title = $"{tagCallout.callout.Title}{delimiter}{TextSprites.CycleWaybills}";
|
||||||
|
|
||||||
|
}
|
||||||
else if (car.HandbrakeApplied())
|
else if (car.HandbrakeApplied())
|
||||||
tagCallout.callout.Title =
|
{
|
||||||
$"{tagCallout.callout.Title}\n<align=\"right\">{TextSprites.HandbrakeWheel}";
|
tagCallout.callout.Title = $"{tagCallout.callout.Title}{delimiter}{TextSprites.HandbrakeWheel}";
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -13,6 +13,8 @@
|
|||||||
<GameAssembly Include="Definition" />
|
<GameAssembly Include="Definition" />
|
||||||
|
|
||||||
<GameAssembly Include="UnityEngine.CoreModule" />
|
<GameAssembly Include="UnityEngine.CoreModule" />
|
||||||
|
<GameAssembly Include="UnityEngine.UI" />
|
||||||
|
<GameAssembly Include="Unity.TextMeshPro" />
|
||||||
|
|
||||||
<GameAssembly Include="System.Net.Http" />
|
<GameAssembly Include="System.Net.Http" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
@@ -27,10 +29,4 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Publicize Include="Assembly-CSharp" />
|
<Publicize Include="Assembly-CSharp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="ForYourConvenience">
|
|
||||||
<HintPath>D:\SteamLibrary\steamapps\common\Railroader\Mods\ForYourConvenience\ForYourConvenience.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
Reference in New Issue
Block a user