using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using SettingsExtender;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.SceneManagement;
using Zorro.Settings;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("UltrawideHUD")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+e694432ad83a4922c99caac6a786d0e7b29e70e6")]
[assembly: AssemblyProduct("Ultrawide HUD")]
[assembly: AssemblyTitle("UltrawideHUD")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
[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;
}
}
}
namespace Ayzax.UltrawideHUD
{
[BepInProcess("PEAK.exe")]
[BepInPlugin("Ayzax.UltrawideHUD", "Ultrawide HUD", "1.0.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class UltrawideHUDPlugin : BaseUnityPlugin
{
internal static ManualLogSource Logger;
private bool _active;
private RectTransform _barGroup;
private RectTransform _inventory;
private RectTransform _prompts;
private UltrawideAnchorSetting _anchorSetting;
private UltrawideOffsetSetting _squishSetting;
public const string SettingsCategory = "HUD";
private const float HalfScreenWidth = 960f;
private const float BarsDefaultX = 70f;
private const float BarsFixedX = -890f;
private const float BarsSquish = 250f;
private const float InventoryDefaultX = 0f;
private const float InventoryFixedX = 960f;
private const float InventorySquish = 490f;
private const float PromptDefaultX = -52.7703f;
private const float PromptFixedX = 907.2297f;
private const float PromptSquish = 490f;
private void Start()
{
Logger = ((BaseUnityPlugin)this).Logger;
Logger.LogInfo((object)"Ultrawide HUD is loaded!");
SettingsRegistry.Register("HUD");
_anchorSetting = new UltrawideAnchorSetting();
((Setting)_anchorSetting).RegisterListener((Action<Setting>)HandleSettingChange);
SettingsHandler.Instance.AddSetting((Setting)(object)_anchorSetting);
_squishSetting = new UltrawideOffsetSetting();
((Setting)_squishSetting).RegisterListener((Action<Setting>)HandleSettingChange);
SettingsHandler.Instance.AddSetting((Setting)(object)_squishSetting);
SceneManager.sceneLoaded += HandleLevelLoad;
}
private void HandleLevelLoad(Scene scene, LoadSceneMode loadMode)
{
_active = ((Scene)(ref scene)).name != "Title" && ((Scene)(ref scene)).name != "Pretitle";
if (_active)
{
_barGroup = GameObject.Find("/GAME/GUIManager/Canvas_HUD/BarGroup").GetComponent<RectTransform>();
_inventory = GameObject.Find("/GAME/GUIManager/Canvas_HUD/Inventory").GetComponent<RectTransform>();
_prompts = GameObject.Find("/GAME/GUIManager/Canvas_HUD/Prompts/ItemPromptLayout").GetComponent<RectTransform>();
((Transform)_prompts).SetParent(((Transform)_prompts).parent.parent);
AdjustUltrawideHUD();
}
}
private void HandleSettingChange(Setting setting)
{
AdjustUltrawideHUD();
}
public void AdjustUltrawideHUD()
{
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
if (_active)
{
float value = ((FloatSetting)_anchorSetting).Value;
float num = 0.5f + (1f - value) * 0.5f;
float num2 = value * 0.5f;
float value2 = ((FloatSetting)_squishSetting).Value;
_barGroup.anchorMin = new Vector2(num2, 0f);
_barGroup.anchorMax = new Vector2(num2, 0f);
_barGroup.anchoredPosition = new Vector2(Mathf.Lerp(70f, -890f, value) + value2 * 250f, _barGroup.anchoredPosition.y);
_inventory.anchorMin = new Vector2(num, 0f);
_inventory.anchorMax = new Vector2(num, 0f);
_inventory.anchoredPosition = new Vector2(Mathf.Lerp(0f, 960f, value) - value2 * 490f, _inventory.anchoredPosition.y);
_prompts.anchorMin = new Vector2(num, 0f);
_prompts.anchorMax = new Vector2(num, 1f);
_prompts.anchoredPosition = new Vector2(Mathf.Lerp(-52.7703f, 907.2297f, value) - value2 * 490f, _prompts.anchoredPosition.y);
}
}
}
public class UltrawideAnchorSetting : FloatSetting, IExposedSetting
{
public string GetDisplayName()
{
return "HUD Anchoring";
}
public string GetCategory()
{
return SettingsRegistry.GetPageId("HUD");
}
protected override float GetDefaultValue()
{
return 1f;
}
protected override float2 GetMinMaxValue()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
return new float2(0f, 1f);
}
public override void ApplyValue()
{
}
}
public class UltrawideOffsetSetting : FloatSetting, IExposedSetting
{
public string GetDisplayName()
{
return "HUD Squish";
}
public string GetCategory()
{
return SettingsRegistry.GetPageId("HUD");
}
protected override float GetDefaultValue()
{
return 0f;
}
protected override float2 GetMinMaxValue()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
return new float2(0f, 1f);
}
public override void ApplyValue()
{
}
}
}