mirror of
https://github.com/rmroc451/TweaksAndThings.git
synced 2025-12-16 17:29:37 -06:00
Merge remote-tracking branch 'origin/main' into 3-tags-now-overlap-with-icons-when-titles-are-long
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
<PropertyGroup Condition="'$(AssemblyVersion)' == '' OR '$(MajorVersion)' != '' OR '$(MinorVersion)' != ''">
|
||||
<MajorVersion Condition="'$(MajorVersion)' == ''">0</MajorVersion>
|
||||
<MinorVersion Condition="'$(MinorVersion)' == ''">1</MinorVersion>
|
||||
<PatchVersion Condition="'$(PatchVersion)' == ''">1</PatchVersion>
|
||||
<PatchVersion Condition="'$(PatchVersion)' == ''">2</PatchVersion>
|
||||
<AssemblyVersion>$(MajorVersion).$(MinorVersion).$(PatchVersion)</AssemblyVersion>
|
||||
<FileVersion>$(AssemblyVersion)</FileVersion>
|
||||
<ProductVersion>$(AssemblyVersion)</ProductVersion>
|
||||
|
||||
@@ -1,27 +1,16 @@
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using Game;
|
||||
using Game.Events;
|
||||
using Game.Messages;
|
||||
using Game.Messages;
|
||||
using Game.State;
|
||||
using HarmonyLib;
|
||||
using KeyValue.Runtime;
|
||||
using Network;
|
||||
using Network.Messages;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Railloader;
|
||||
using Serilog;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Remoting.Messaging;
|
||||
using TweaksAndThings.Enums;
|
||||
using UI.Builder;
|
||||
using UI.CarInspector;
|
||||
using WorldStreamer2;
|
||||
using static Model.Car;
|
||||
using static Unity.IO.LowLevel.Unsafe.AsyncReadManagerMetrics;
|
||||
|
||||
namespace TweaksAndThings.Patches;
|
||||
|
||||
@@ -44,10 +33,11 @@ public class CarInspector_PopulateCarPanel_Patch
|
||||
TweaksAndThings tweaksAndThings = SingletonPluginBase<TweaksAndThings>.Shared;
|
||||
if (!tweaksAndThings.IsEnabled) return true;
|
||||
|
||||
var consist = __instance._car.EnumerateCoupled(LogicalEnd.A);
|
||||
builder = AddCarConsistRebuildObservers(builder, consist);
|
||||
|
||||
builder.HStack(delegate (UIPanelBuilder hstack)
|
||||
{
|
||||
var consist = __instance._car.EnumerateCoupled(LogicalEnd.A);
|
||||
|
||||
var buttonName = $"{(consist.Any(c => c.HandbrakeApplied()) ? "Release " : "Set ")} {TextSprites.HandbrakeWheel}";
|
||||
hstack.AddButtonCompact(buttonName, delegate
|
||||
{
|
||||
@@ -63,12 +53,27 @@ public class CarInspector_PopulateCarPanel_Patch
|
||||
hstack.Rebuild();
|
||||
}).Tooltip("Connect Consist Air Lines", "Iterates over each car in this consist and connects gladhands and opens anglecocks.");
|
||||
}
|
||||
hstack.RebuildOnInterval(1f);
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static UIPanelBuilder AddCarConsistRebuildObservers(UIPanelBuilder builder, IEnumerable<Model.Car> consist)
|
||||
{
|
||||
foreach (Model.Car car in consist)
|
||||
{
|
||||
builder.AddObserver(car.KeyValueObject.Observe(PropertyChange.KeyForControl(PropertyChange.Control.Handbrake), delegate (Value value) { builder.Rebuild(); }, false));
|
||||
foreach (LogicalEnd logicalEnd in ends)
|
||||
{
|
||||
builder.AddObserver(car.KeyValueObject.Observe(KeyValueKeyFor(EndGearStateKey.IsCoupled, car.LogicalToEnd(logicalEnd)), delegate (Value value) { builder.Rebuild(); }, false));
|
||||
builder.AddObserver(car.KeyValueObject.Observe(KeyValueKeyFor(EndGearStateKey.IsAirConnected, car.LogicalToEnd(logicalEnd)), delegate (Value value) { builder.Rebuild(); }, false));
|
||||
builder.AddObserver(car.KeyValueObject.Observe(KeyValueKeyFor(EndGearStateKey.Anglecock, car.LogicalToEnd(logicalEnd)), delegate (Value value) { builder.Rebuild(); }, false));
|
||||
}
|
||||
}
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
public static void MrocConsistHelper(Model.Car car, MrocHelperType mrocHelperType)
|
||||
{
|
||||
IEnumerable<Model.Car> consist = car.EnumerateCoupled(LogicalEnd.A);
|
||||
|
||||
@@ -102,7 +102,6 @@ public class ExpandedConsole_Add_Patch
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex, ex.Message);
|
||||
entry.Text += ex.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,10 +12,11 @@ public class Settings
|
||||
{
|
||||
|
||||
public Settings()
|
||||
{}
|
||||
{
|
||||
WebhookSettingsList = new[] { new WebhookSettings() }.ToList();
|
||||
}
|
||||
|
||||
public Settings(
|
||||
WebhookSettings webhookSettings,
|
||||
public Settings(
|
||||
List<WebhookSettings> webhookSettingsList,
|
||||
bool handBrakeAndAirTagModifiers
|
||||
)
|
||||
@@ -29,7 +30,11 @@ public class Settings
|
||||
|
||||
internal void AddAnotherRow()
|
||||
{
|
||||
//if (!string.IsNullOrEmpty(WebhookSettingsList.Last().WebhookUrl)) WebhookSettingsList.Add(new());
|
||||
if (!string.IsNullOrEmpty(WebhookSettingsList.Last().WebhookUrl))
|
||||
{
|
||||
WebhookSettingsList.Add(new());
|
||||
Log.Information($"Adding another {nameof(WebhookSettings)} list entry, last one was filled in");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using Game.Messages;
|
||||
using Game.State;
|
||||
using HarmonyLib;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Railloader;
|
||||
using Serilog;
|
||||
using Serilog.Debugging;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using TweaksAndThings.Commands;
|
||||
using UI.Builder;
|
||||
using UI.CarInspector;
|
||||
|
||||
namespace TweaksAndThings
|
||||
{
|
||||
@@ -48,6 +43,11 @@ namespace TweaksAndThings
|
||||
//moddingContext.RegisterConsoleCommand(new EchoCommand());
|
||||
|
||||
settings = moddingContext.LoadSettingsData<Settings>(self.Id);
|
||||
if (settings.WebhookSettingsList?.Any() ?? false)
|
||||
{
|
||||
settings.WebhookSettingsList = new[] { new WebhookSettings() }.ToList();
|
||||
this.moddingContext.SaveSettingsData(this.modDefinition.Id, settings ?? new());
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnEnable()
|
||||
|
||||
Reference in New Issue
Block a user