Decompiled source of FactionSelectorPatch v1.1.0

FactionSelectorPatch.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using Landfall.TABS;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("MyTABSMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MyTABSMod")]
[assembly: AssemblyTitle("MyTABSMod")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
[BepInPlugin("com.NegativeZer0.factionselectorpatch", "FactionSelectorPatch", "1.1.0")]
public class FactionSelectorPatch : BaseUnityPlugin
{
	private void Start()
	{
		((MonoBehaviour)this).StartCoroutine(KeepUnitsUIUpdated());
	}

	private IEnumerator KeepUnitsUIUpdated()
	{
		while (true)
		{
			GameObject val = GameObject.Find("ConsoleGameUI/TitleSafe/TitleSafeScale/PlacementUI/UnitsUI");
			if ((Object)(object)val != (Object)null)
			{
				SimpleStateAnimation component = val.GetComponent<SimpleStateAnimation>();
				if ((Object)(object)component != (Object)null)
				{
					ApplyAnimationFix(component);
				}
			}
			yield return (object)new WaitForSeconds(1f);
		}
	}

	private void ApplyAnimationFix(SimpleStateAnimation anim)
	{
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		FieldInfo[] fields = ((object)anim).GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy);
		foreach (FieldInfo fieldInfo in fields)
		{
			if (fieldInfo.Name == "m_State01LocalPosistion")
			{
				fieldInfo.SetValue(anim, (object)new Vector3(0f, -490f, 0f));
				((BaseUnityPlugin)this).Logger.LogDebug((object)"Applied fix to m_State01LocalPosistion");
			}
			else if (fieldInfo.Name == "m_State02LocalPosistion")
			{
				fieldInfo.SetValue(anim, (object)new Vector3(0f, -1320f, 0f));
				((BaseUnityPlugin)this).Logger.LogDebug((object)"Applied fix to m_State02LocalPosistion");
			}
		}
	}
}
namespace Zer0sUnits
{
	public class Class1
	{
	}
}