using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using AlmanacClasses.UI;
using BepInEx;
using HarmonyLib;
using UnityEngine;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("SpellBar-LeftAlign")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SpellBar-LeftAlign")]
[assembly: AssemblyTitle("SpellBar-LeftAlign")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LeftAlignPatch;
[BepInPlugin("com.yourname.LeftAlignPatch", "SpellBar Left Align Patch", "1.0.0")]
public class LeftAlignPatchPlugin : BaseUnityPlugin
{
private void Awake()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
new Harmony("com.yourname.LeftAlignPatch").PatchAll();
}
}
[HarmonyPatch(typeof(SpellBook), "LoadElements")]
[HarmonyPatch(new Type[] { typeof(Font) })]
public static class Patch_LeftAlignSpellBar
{
[HarmonyPostfix]
public static void Postfix()
{
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
FieldInfo fieldInfo = AccessTools.Field(typeof(SpellBook), "m_spellBar");
if (fieldInfo == null)
{
Debug.LogWarning((object)"[LeftAlignPatch] Could not find 'm_spellBar' field!");
return;
}
object? value = fieldInfo.GetValue(null);
GameObject val = (GameObject)((value is GameObject) ? value : null);
if (!Object.op_Implicit((Object)(object)val))
{
Debug.LogWarning((object)"[LeftAlignPatch] 'm_spellBar' is null!");
return;
}
RectTransform component = val.GetComponent<RectTransform>();
if (!Object.op_Implicit((Object)(object)component))
{
Debug.LogWarning((object)"[LeftAlignPatch] SpellBar GameObject has no RectTransform!");
return;
}
component.anchorMin = new Vector2(0f, 0.5f);
component.anchorMax = new Vector2(0f, 0.5f);
component.pivot = new Vector2(0f, 0.5f);
component.anchoredPosition = new Vector2(50f, 0f);
Transform val2 = val.transform.Find("$part_content");
if (Object.op_Implicit((Object)(object)val2))
{
RectTransform component2 = ((Component)val2).GetComponent<RectTransform>();
if (Object.op_Implicit((Object)(object)component2))
{
component2.anchorMin = new Vector2(0f, 0.5f);
component2.anchorMax = new Vector2(0f, 0.5f);
component2.pivot = new Vector2(0f, 0.5f);
component2.anchoredPosition = Vector2.zero;
}
HorizontalLayoutGroup component3 = ((Component)val2).GetComponent<HorizontalLayoutGroup>();
if (Object.op_Implicit((Object)(object)component3))
{
((LayoutGroup)component3).childAlignment = (TextAnchor)3;
((HorizontalOrVerticalLayoutGroup)component3).childForceExpandWidth = false;
((HorizontalOrVerticalLayoutGroup)component3).childForceExpandHeight = false;
}
}
Debug.Log((object)"[LeftAlignPatch] Aligned spell bar to the left!");
}
}