Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of InfectionBar v1.2.0
BepInEx/plugins/InfectionBar/InfectionBar.dll
Decompiled a week ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using Microsoft.CodeAnalysis; using TMPro; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("UnityEngine.AnimationModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.CoreModule")] [assembly: IgnoresAccessChecksTo("UnityEngine")] [assembly: IgnoresAccessChecksTo("UnityEngine.TextRenderingModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("UnityEngine.UIModule")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 IndependentCadaverInfectionBar { internal static class ModConfig { internal static ConfigTextCatalog Texts { get; private set; } internal static ConfigEntry<bool> InfectionBarEnabled { get; private set; } internal static ConfigEntry<bool> InfectionBarAlwaysVisible { get; private set; } internal static ConfigEntry<bool> DebugLogging { get; private set; } internal static ConfigEntry<bool> DebugVanillaHudLiveLayoutRefresh { get; private set; } internal static ConfigEntry<string> DebugHudPreviewMode { get; private set; } internal static ConfigEntry<float> DebugHudPreviewCycleSeconds { get; private set; } internal static ConfigEntry<string> HudStyleMode { get; private set; } internal static ConfigEntry<float> UiWidth { get; private set; } internal static ConfigEntry<float> UiHeight { get; private set; } internal static ConfigEntry<string> AnchorPreset { get; private set; } internal static ConfigEntry<float> PositionOffsetX { get; private set; } internal static ConfigEntry<float> PositionOffsetY { get; private set; } internal static ConfigEntry<float> TextOffsetX { get; private set; } internal static ConfigEntry<float> TextOffsetY { get; private set; } internal static ConfigEntry<int> TextFontSize { get; private set; } internal static ConfigEntry<bool> ShowPanelBackground { get; private set; } internal static ConfigEntry<float> PanelBackgroundAlpha { get; private set; } internal static ConfigEntry<float> TerminalFadeAlpha { get; private set; } internal static ConfigEntry<bool> ReduceAliasing { get; private set; } internal static ConfigEntry<int> SortingOrder { get; private set; } internal static ConfigEntry<bool> VanillaReuseNativePosition { get; private set; } internal static ConfigEntry<bool> VanillaArcTextEnabled { get; private set; } internal static ConfigEntry<float> VanillaRingScale { get; private set; } internal static ConfigEntry<float> VanillaRingOffsetX { get; private set; } internal static ConfigEntry<float> VanillaRingOffsetY { get; private set; } internal static ConfigEntry<bool> VanillaWarningTextOffsetEnabled { get; private set; } internal static ConfigEntry<float> VanillaWarningTextOffsetX { get; private set; } internal static ConfigEntry<float> VanillaWarningTextOffsetY { get; private set; } internal static ConfigEntry<string> LabelLanguageMode { get; private set; } internal static void Bind(ConfigFile config, bool useChineseText) { Texts = ConfigTextCatalog.Create(useChineseText); InfectionBarEnabled = Bind(config, "General", "InfectionBarEnabled", defaultValue: true); InfectionBarAlwaysVisible = Bind(config, "General", "InfectionBarAlwaysVisible", defaultValue: false); DebugLogging = Bind(config, "General", "DebugLogging", defaultValue: false); DebugVanillaHudLiveLayoutRefresh = Bind(config, "Debug", "DebugVanillaHudLiveLayoutRefresh", defaultValue: false); DebugHudPreviewMode = Bind(config, "Debug", "HudPreviewMode", "Off"); DebugHudPreviewCycleSeconds = Bind(config, "Debug", "HudPreviewCycleSeconds", 5f); HudStyleMode = Bind(config, "General", "HudStyleMode", "Auto"); UiWidth = Bind(config, "Layout", "UiWidth", 215f); UiHeight = Bind(config, "Layout", "UiHeight", 34f); AnchorPreset = Bind(config, "Layout", "AnchorPreset", "TopLeft"); PositionOffsetX = Bind(config, "Layout", "PositionOffsetX", 30f); PositionOffsetY = Bind(config, "Layout", "PositionOffsetY", -135f); TextOffsetX = Bind(config, "Layout", "TextOffsetX", 9f); TextOffsetY = Bind(config, "Layout", "TextOffsetY", 1f); TextFontSize = Bind(config, "Layout", "TextFontSize", 13); ShowPanelBackground = Bind(config, "Layout", "ShowPanelBackground", defaultValue: false); PanelBackgroundAlpha = Bind(config, "Layout", "PanelBackgroundAlpha", 0.22f); TerminalFadeAlpha = Bind(config, "Layout", "TerminalFadeAlpha", 0.25f); ReduceAliasing = Bind(config, "Layout", "ReduceAliasing", defaultValue: true); SortingOrder = Bind(config, "Layout", "SortingOrder", 5); VanillaReuseNativePosition = Bind(config, "VanillaHud", "VanillaReuseNativePosition", defaultValue: false); VanillaArcTextEnabled = Bind(config, "VanillaHud", "VanillaArcTextEnabled", defaultValue: false); VanillaRingScale = Bind(config, "VanillaHud", "VanillaRingScale", 1.3f); VanillaRingOffsetX = Bind(config, "VanillaHud", "VanillaRingOffsetX", -32.5f); VanillaRingOffsetY = Bind(config, "VanillaHud", "VanillaRingOffsetY", 16f); VanillaWarningTextOffsetEnabled = Bind(config, "VanillaHud", "VanillaWarningTextOffsetEnabled", defaultValue: true); VanillaWarningTextOffsetX = Bind(config, "VanillaHud", "VanillaWarningTextOffsetX", 60f); VanillaWarningTextOffsetY = Bind(config, "VanillaHud", "VanillaWarningTextOffsetY", 0f); LabelLanguageMode = Bind(config, "Language", "LabelLanguageMode", "Auto"); config.Save(); } private static ConfigEntry<T> Bind<T>(ConfigFile config, string section, string key, T defaultValue) { return config.Bind<T>(section, key, defaultValue, Texts.Description(key)); } } internal static class LethalConfigIntegration { internal const string PluginGuid = "ainavt.lc.lethalconfig"; internal static void Register(ManualLogSource logger) { try { ConfigTextCatalog texts = ModConfig.Texts; LethalConfigManager.SetModDescription(texts.ModDescription); AddBool(ModConfig.InfectionBarEnabled, "General", "InfectionBarEnabled", texts); AddBool(ModConfig.InfectionBarAlwaysVisible, "General", "InfectionBarAlwaysVisible", texts); AddBool(ModConfig.DebugLogging, "General", "DebugLogging", texts); AddTextDropDown(ModConfig.HudStyleMode, "General", "HudStyleMode", texts, "Auto", "CurrentStyle", "VanillaStaminaRingStyle"); AddBool(ModConfig.DebugVanillaHudLiveLayoutRefresh, "Debug", "DebugVanillaHudLiveLayoutRefresh", texts); AddTextDropDown(ModConfig.DebugHudPreviewMode, "Debug", "HudPreviewMode", texts, "Off", "Visible", "Empty", "Half", "Full", "Growing", "Decreasing"); AddFloat(ModConfig.DebugHudPreviewCycleSeconds, "Debug", "HudPreviewCycleSeconds", texts); AddFloat(ModConfig.UiWidth, "Layout", "UiWidth", texts); AddFloat(ModConfig.UiHeight, "Layout", "UiHeight", texts); AddTextDropDown(ModConfig.AnchorPreset, "Layout", "AnchorPreset", texts, "BottomLeft", "BottomCenter", "BottomRight", "Center", "TopLeft", "TopCenter", "TopRight"); AddFloat(ModConfig.PositionOffsetX, "Layout", "PositionOffsetX", texts); AddFloat(ModConfig.PositionOffsetY, "Layout", "PositionOffsetY", texts); AddFloat(ModConfig.TextOffsetX, "Layout", "TextOffsetX", texts); AddFloat(ModConfig.TextOffsetY, "Layout", "TextOffsetY", texts); AddInt(ModConfig.TextFontSize, "Layout", "TextFontSize", texts); AddBool(ModConfig.ShowPanelBackground, "Layout", "ShowPanelBackground", texts); AddFloat(ModConfig.PanelBackgroundAlpha, "Layout", "PanelBackgroundAlpha", texts); AddFloat(ModConfig.TerminalFadeAlpha, "Layout", "TerminalFadeAlpha", texts); AddBool(ModConfig.ReduceAliasing, "Layout", "ReduceAliasing", texts); AddBool(ModConfig.VanillaReuseNativePosition, "VanillaHud", "VanillaReuseNativePosition", texts); AddBool(ModConfig.VanillaArcTextEnabled, "VanillaHud", "VanillaArcTextEnabled", texts); AddFloat(ModConfig.VanillaRingScale, "VanillaHud", "VanillaRingScale", texts); AddFloat(ModConfig.VanillaRingOffsetX, "VanillaHud", "VanillaRingOffsetX", texts); AddFloat(ModConfig.VanillaRingOffsetY, "VanillaHud", "VanillaRingOffsetY", texts); AddBool(ModConfig.VanillaWarningTextOffsetEnabled, "VanillaHud", "VanillaWarningTextOffsetEnabled", texts); AddFloat(ModConfig.VanillaWarningTextOffsetX, "VanillaHud", "VanillaWarningTextOffsetX", texts); AddFloat(ModConfig.VanillaWarningTextOffsetY, "VanillaHud", "VanillaWarningTextOffsetY", texts); AddTextDropDown(ModConfig.LabelLanguageMode, "Language", "LabelLanguageMode", texts, "Auto", "Chinese", "English"); logger.LogInfo((object)"Registered live localized LethalConfig entries."); } catch (Exception ex) { logger.LogWarning((object)("Could not register LethalConfig entries: " + ex.Message)); } } private static TOptions CreateOptions<TOptions>(string section, string key, ConfigTextCatalog texts) where TOptions : BaseOptions, new() { TOptions val = new TOptions(); ((BaseOptions)val).Name = texts.Name(key); ((BaseOptions)val).Section = texts.Section(section); ((BaseOptions)val).Description = texts.Description(key); ((BaseOptions)val).RequiresRestart = false; return val; } private static void AddBool(ConfigEntry<bool> entry, string section, string key, ConfigTextCatalog texts) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown LethalConfigManager.SkipAutoGenFor((ConfigEntryBase)(object)entry); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(entry, CreateOptions<BoolCheckBoxOptions>(section, key, texts))); } private static void AddFloat(ConfigEntry<float> entry, string section, string key, ConfigTextCatalog texts) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown LethalConfigManager.SkipAutoGenFor((ConfigEntryBase)(object)entry); LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(entry, CreateOptions<FloatInputFieldOptions>(section, key, texts))); } private static void AddInt(ConfigEntry<int> entry, string section, string key, ConfigTextCatalog texts) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown LethalConfigManager.SkipAutoGenFor((ConfigEntryBase)(object)entry); LethalConfigManager.AddConfigItem((BaseConfigItem)new IntInputFieldConfigItem(entry, CreateOptions<IntInputFieldOptions>(section, key, texts))); } private static void AddTextDropDown(ConfigEntry<string> entry, string section, string key, ConfigTextCatalog texts, params string[] values) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown LethalConfigManager.SkipAutoGenFor((ConfigEntryBase)(object)entry); LethalConfigManager.AddConfigItem((BaseConfigItem)new TextDropDownConfigItem(entry, new TextDropDownOptions(values) { Name = texts.Name(key), Section = texts.Section(section), Description = texts.Description(key), RequiresRestart = false })); } } [BepInPlugin("InfectionBar", "InfectionBar", "1.2.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class Plugin : BaseUnityPlugin { public const string PluginGuid = "InfectionBar"; public const string PluginName = "InfectionBar"; public const string PluginVersion = "1.2.0"; private static GameObject controllerHost; private static InfectionBarController controller; private static ManualLogSource runtimeLogger; private static bool applicationQuitting; private static bool callbacksSubscribed; private void Awake() { Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); runtimeLogger = ((BaseUnityPlugin)this).Logger; applicationQuitting = false; InfectionBarCompatibility.Initialize(((BaseUnityPlugin)this).Logger); bool useChineseText = ChineseConfigDetector.IsInstalled(((BaseUnityPlugin)this).Logger); ModConfig.Bind(((BaseUnityPlugin)this).Config, useChineseText); if (Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig")) { LethalConfigIntegration.Register(((BaseUnityPlugin)this).Logger); } if (!callbacksSubscribed) { SceneManager.sceneLoaded += OnSceneLoaded; Application.quitting += OnApplicationQuitting; callbacksSubscribed = true; } EnsureController(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"InfectionBar loaded."); } private static void OnSceneLoaded(Scene scene, LoadSceneMode mode) { if (!applicationQuitting) { EnsureController(); } } private static void EnsureController() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown if (!applicationQuitting && runtimeLogger != null) { if ((Object)(object)controllerHost == (Object)null) { controllerHost = new GameObject("InfectionBarControllerHost"); Object.DontDestroyOnLoad((Object)(object)controllerHost); } if (!controllerHost.activeSelf) { controllerHost.SetActive(true); } controller = controllerHost.GetComponent<InfectionBarController>(); if ((Object)(object)controller == (Object)null) { controller = controllerHost.AddComponent<InfectionBarController>(); controller.Initialize(runtimeLogger, new InfectionDataProvider(runtimeLogger), new InfectionLayout(), new LanguageHelper()); runtimeLogger.LogInfo((object)"HUD controller created/recovered by persistent runtime owner."); } if (!((Behaviour)controller).enabled) { ((Behaviour)controller).enabled = true; } } } private static void OnApplicationQuitting() { applicationQuitting = true; if (callbacksSubscribed) { SceneManager.sceneLoaded -= OnSceneLoaded; Application.quitting -= OnApplicationQuitting; callbacksSubscribed = false; } InfectionBarCompatibility.Shutdown(); if ((Object)(object)controller != (Object)null) { controller.Shutdown(); } controller = null; if ((Object)(object)controllerHost != (Object)null) { Object.Destroy((Object)(object)controllerHost); } controllerHost = null; } private void OnDestroy() { if (!applicationQuitting) { ManualLogSource obj = runtimeLogger; if (obj != null) { obj.LogWarning((object)"Plugin destroyed before application quit; scene-load recovery remains subscribed."); } } } } internal sealed class InfectionDataProvider { private const float SuccessfulCadaverGrowthLookupIntervalSeconds = 0.25f; private const float MissingCadaverGrowthLookupIntervalSeconds = 2f; private readonly ManualLogSource logger; private CadaverGrowthAI cachedCadaverGrowth; private float nextCadaverGrowthLookupTime; internal InfectionDataProvider(ManualLogSource logger) { this.logger = logger; } internal PlayerControllerB GetLocalPlayer() { return GameNetworkManager.Instance?.localPlayerController; } internal bool TryGetInfectionNormalized(PlayerControllerB player, out float infectionNormalized) { infectionNormalized = 0f; if ((Object)(object)player == (Object)null) { return false; } int playerId = (int)player.playerClientId; if (!TryReadInfectionMeter(ResolveCadaverGrowth(playerId), playerId, out infectionNormalized)) { return false; } return true; } private CadaverGrowthAI ResolveCadaverGrowth(int playerId) { if (CanReadInfectionMeter(cachedCadaverGrowth, playerId)) { return cachedCadaverGrowth; } if (Time.unscaledTime < nextCadaverGrowthLookupTime) { return cachedCadaverGrowth; } float unscaledTime = Time.unscaledTime; CadaverGrowthAI val = null; List<EnemyAI> list = RoundManager.Instance?.SpawnedEnemies; if (list != null) { for (int i = 0; i < list.Count; i++) { EnemyAI obj = list[i]; CadaverGrowthAI val2 = (CadaverGrowthAI)(object)((obj is CadaverGrowthAI) ? obj : null); if (!((Object)(object)val2 == (Object)null)) { if ((Object)(object)val == (Object)null) { val = val2; } if (CanReadInfectionMeter(val2, playerId)) { cachedCadaverGrowth = val2; nextCadaverGrowthLookupTime = unscaledTime + 0.25f; return cachedCadaverGrowth; } } } } cachedCadaverGrowth = val; nextCadaverGrowthLookupTime = unscaledTime + (((Object)(object)val != (Object)null) ? 0.25f : 2f); return cachedCadaverGrowth; } private static bool TryReadInfectionMeter(CadaverGrowthAI cadaverGrowth, int playerId, out float infectionNormalized) { infectionNormalized = 0f; if (!CanReadInfectionMeter(cadaverGrowth, playerId)) { return false; } infectionNormalized = Mathf.Clamp01(cadaverGrowth.playerInfections[playerId].infectionMeter); return true; } private static bool CanReadInfectionMeter(CadaverGrowthAI cadaverGrowth, int playerId) { if ((Object)(object)cadaverGrowth != (Object)null && cadaverGrowth.playerInfections != null && playerId >= 0) { return playerId < cadaverGrowth.playerInfections.Length; } return false; } internal void ResetCadaverGrowthCache() { if (!((Object)(object)cachedCadaverGrowth == (Object)null)) { if (ModConfig.DebugLogging.Value) { logger.LogDebug((object)"Resetting cached CadaverGrowthAI reference."); } cachedCadaverGrowth = null; nextCadaverGrowthLookupTime = 0f; } } } internal enum InfectionBarDebugPreviewMode { Off, Visible, Empty, Half, Full, Growing, Decreasing } internal readonly struct InfectionBarDebugPreviewFrame { internal float InfectionNormalized { get; } internal bool ForceVisible { get; } internal InfectionBarDebugPreviewFrame(float infectionNormalized, bool forceVisible) { InfectionNormalized = infectionNormalized; ForceVisible = forceVisible; } } internal static class InfectionBarDebugPreview { internal const float MinimumCycleSeconds = 0.5f; internal const float DefaultCycleSeconds = 5f; internal static InfectionBarDebugPreviewMode ParseMode(string value) { if (!Enum.TryParse<InfectionBarDebugPreviewMode>((value ?? string.Empty).Trim(), ignoreCase: true, out var result)) { return InfectionBarDebugPreviewMode.Off; } return result; } internal static bool RefreshSettings(string modeValue, float cycleSecondsValue, ref string currentModeValue, ref InfectionBarDebugPreviewMode currentMode, ref float currentCycleSeconds) { float num = NormalizeCycleSeconds(cycleSecondsValue); bool flag = !string.Equals(currentModeValue, modeValue, StringComparison.Ordinal); if (!flag && Math.Abs(currentCycleSeconds - num) <= 0.0001f) { return false; } InfectionBarDebugPreviewMode infectionBarDebugPreviewMode = (flag ? ParseMode(modeValue) : currentMode); bool result = currentMode != infectionBarDebugPreviewMode || Math.Abs(currentCycleSeconds - num) > 0.0001f; currentModeValue = modeValue; currentMode = infectionBarDebugPreviewMode; currentCycleSeconds = num; return result; } internal static InfectionBarDebugPreviewFrame Evaluate(InfectionBarDebugPreviewMode mode, float realInfectionNormalized, float elapsedSeconds, float cycleSeconds) { float infectionNormalized = Clamp01(realInfectionNormalized); return mode switch { InfectionBarDebugPreviewMode.Visible => new InfectionBarDebugPreviewFrame(infectionNormalized, forceVisible: true), InfectionBarDebugPreviewMode.Empty => new InfectionBarDebugPreviewFrame(0f, forceVisible: true), InfectionBarDebugPreviewMode.Half => new InfectionBarDebugPreviewFrame(0.5f, forceVisible: true), InfectionBarDebugPreviewMode.Full => new InfectionBarDebugPreviewFrame(1f, forceVisible: true), InfectionBarDebugPreviewMode.Growing => new InfectionBarDebugPreviewFrame(GetCycleProgress(elapsedSeconds, cycleSeconds), forceVisible: true), InfectionBarDebugPreviewMode.Decreasing => new InfectionBarDebugPreviewFrame(1f - GetCycleProgress(elapsedSeconds, cycleSeconds), forceVisible: true), _ => new InfectionBarDebugPreviewFrame(infectionNormalized, forceVisible: false), }; } private static float GetCycleProgress(float elapsedSeconds, float cycleSeconds) { float num = Math.Max(0f, elapsedSeconds); float num2 = NormalizeCycleSeconds(cycleSeconds); float num3 = num / num2; return num3 - (float)Math.Floor(num3); } private static float NormalizeCycleSeconds(float cycleSeconds) { if (float.IsNaN(cycleSeconds) || float.IsInfinity(cycleSeconds)) { return 5f; } return Math.Max(0.5f, cycleSeconds); } private static float Clamp01(float value) { if (value <= 0f) { return 0f; } return Math.Min(value, 1f); } } internal sealed class InfectionBarController : MonoBehaviour { private enum HudStyle { Current, VanillaStaminaRing } private enum VanillaArcTextSlot { WeightStaminaUpper, WeightInfectionInner, InfectionOuter } private enum VanillaArcRadiusBand { Inner, Middle, Outer } private readonly struct NativeHudState { internal float Alpha { get; } internal bool IsValid { get; } internal NativeHudState(float alpha, bool isValid) { Alpha = alpha; IsValid = isValid; } } private const string EladsHudPluginGuid = "me.eladnlg.customhud"; private const string VanillaWarningRootPathSuffix = "IngamePlayerHUD/SpecialHUDGraphics/RadiationIncrease"; private const float ControllerUpdateIntervalSeconds = 1f / 30f; private const float LayoutPollIntervalSeconds = 0.1f; private const float NativeHudStateRefreshIntervalSeconds = 0.1f; private const float HudIntroAlphaSampleSeconds = 4f; private static Sprite pixelSprite; private static float nextTerminalLookupTime; private static float nextNativeHudElementLookupTime; private static float nextNativeHudParentFallbackLookupTime; private static float nextVanillaWarningRootLookupTime; private static float nextNativeHudStateRefreshTime; private static HUDManager cachedHudManagerInstance; private static StartOfRound cachedStartOfRoundInstance; private static Terminal cachedTerminal; private static NativeHudState cachedNativeHudState; private static Transform cachedNativeHudElementTransform; private static RectTransform cachedNativeHudParentFallback; private static RectTransform cachedVanillaWarningRoot; private static bool cachedEladsHudInstalled; private static bool hasCachedEladsHudInstalled; private bool loggedFirstControllerUpdate; private float nextRuntimeDiagnosticTime; private int lastRuntimeDiagnosticFlags = -1; private float lastRuntimeDiagnosticAlpha; private string lastRuntimeDiagnosticReason; private InfectionBarDebugPreviewMode lastRuntimeDiagnosticPreview; private bool horizontalLayoutCached; private Matrix4x4 lastHorizontalSprintMatrix; private Matrix4x4 lastHorizontalRingMatrix; private Rect lastHorizontalSprintRect; private Rect lastHorizontalRingRect; private Vector3 lastHorizontalNativePosition; private Vector3 lastHorizontalNativeScale; private Rect lastHorizontalNativeRect; private float lastHorizontalFontSize; private ManualLogSource logger; private InfectionDataProvider dataProvider; private InfectionLayout layout; private LanguageHelper languageHelper; private CanvasGroup canvasGroup; private RectTransform infectionRoot; private Image panelBackground; private Image topLine; private Image infectionBackground; private Image infectionBar; private Text infectionText; private Image vanillaSprintMeterReference; private RectTransform vanillaWeightTextRoot; private CanvasGroup vanillaWeightTextCanvasGroup; private RectTransform vanillaInfectionTextRoot; private CanvasGroup vanillaInfectionTextCanvasGroup; private RectTransform vanillaInfectionValueTextRoot; private CanvasGroup vanillaInfectionValueTextCanvasGroup; private TextMeshProUGUI hiddenWeightCounter; private bool hiddenWeightCounterWasEnabled; private string lastVanillaWeightText = string.Empty; private string lastVanillaInfectionText = string.Empty; private string lastAppliedVanillaWeightText = string.Empty; private string lastAppliedVanillaInfectionText = string.Empty; private bool hasAppliedVanillaWeightText; private bool hasAppliedVanillaInfectionText; private bool hasClearedVanillaInfectionValueText; private VanillaArcTextSlot lastAppliedVanillaWeightSlot; private Vector2 lastAppliedVanillaWeightRootSize; private Vector2 lastAppliedVanillaInfectionRootSize; private bool hasVanillaLayoutSignature; private Vector2 lastVanillaAnchorMin; private Vector2 lastVanillaAnchorMax; private Vector2 lastVanillaPivot; private Vector2 lastVanillaSizeDelta; private Vector2 lastVanillaAnchoredPosition; private Quaternion lastVanillaLocalRotation; private Vector3 lastVanillaLocalScale; private bool lastVanillaArcTextEnabled; private bool lastVanillaReuseNativePosition; private float lastVanillaRingScale; private float lastVanillaRingOffsetX; private float lastVanillaRingOffsetY; private RectTransform shiftedVanillaWarningRoot; private Vector2 originalVanillaWarningAnchoredPosition; private bool hasOriginalVanillaWarningAnchoredPosition; private bool loggedMissingVanillaWarningRoot; private string cachedInfectionLabel = "Infection"; private float nextInfectionLabelRefreshTime; private string lastLabelLanguageMode; private float lastRenderedInfectionFillAmount = -1f; private int lastRenderedInfectionPercent = -1; private string lastRenderedInfectionLabel = string.Empty; private bool lastVisibleState; private bool loggedMissingNativeHudParent; private bool loggedNativeHudParentFallback; private float currentHudAlpha = 1f; private float lastAppliedHudAlpha = -1f; private float nextControllerUpdateTime; private float lastControllerUpdateTime; private float nextVanillaLayoutPollTime; private float nextVanillaTextRefreshTime; private float nextCurrentStyleRotationRefreshTime; private bool compatibilityStateKnown; private bool lastCompatibilityHudAllowed; private RectTransform hudIntroAlphaSampleSource; private float hudIntroAlphaSampleUntilTime; private bool hudIntroAlphaSamplingActive; private bool layoutDirty = true; private bool hudStyleDirty = true; private bool layoutConfigEventsSubscribed; private string debugPreviewModeValue; private InfectionBarDebugPreviewMode debugPreviewMode; private float debugPreviewCycleSeconds = 5f; private float debugPreviewStartTime; private bool hasActiveHudStyle; private HudStyle activeHudStyle; private bool loggedMissingSprintMeter; private bool loggedVanillaSprintMeterDiagnostics; private const string VanillaArcCharacterPrefix = "VanillaArcChar_"; private const float SprintMeterSpriteSize = 326f; private static readonly float[] SprintMeterArcAngles = new float[43] { -162.5f, -157.5f, -152.5f, -147.5f, -142.5f, -137.5f, -132.5f, -127.5f, -122.5f, -117.5f, -112.5f, -107.5f, -102.5f, -97.5f, -92.5f, -87.5f, -82.5f, -77.5f, -72.5f, -67.5f, -62.5f, -57.5f, -52.5f, -47.5f, -42.5f, -37.5f, -32.5f, -27.5f, -22.5f, -17.5f, -12.5f, -7.5f, -2.5f, 2.5f, 7.5f, 17.5f, 22.5f, 27.5f, 32.5f, 37.5f, 42.5f, 47.5f, 52.5f }; private static readonly float[] SprintMeterArcInnerRadii = new float[43] { 148.3f, 146.4f, 155.9f, 153.8f, 159.1f, 157.7f, 154.7f, 144.9f, 145.9f, 140.7f, 134f, 125.9f, 122.8f, 118f, 115.8f, 108.8f, 106.8f, 104f, 97.1f, 100.4f, 98.6f, 97.8f, 97.4f, 97.7f, 98.4f, 96.5f, 100.6f, 102.2f, 104.1f, 107.9f, 111.2f, 114.8f, 119.9f, 125.5f, 129f, 144f, 150.1f, 155.9f, 158f, 165f, 165.2f, 166.8f, 164.5f }; private static readonly float[] SprintMeterArcMiddleRadii = new float[43] { 150.5f, 154.2f, 158.1f, 160.2f, 162.2f, 162f, 159.6f, 155.3f, 151.6f, 145.6f, 139.5f, 133.8f, 128.2f, 123.1f, 120.7f, 113.6f, 111f, 108.3f, 105.6f, 104.3f, 102.6f, 101.6f, 101.5f, 101.5f, 102.1f, 103f, 104.5f, 106.4f, 108.7f, 112.3f, 116.1f, 120.3f, 125.5f, 130.5f, 134.2f, 149.4f, 155.7f, 161.2f, 165.2f, 168.4f, 169.4f, 168.7f, 166.4f }; private static readonly float[] SprintMeterArcOuterRadii = new float[43] { 152.1f, 158.5f, 161.1f, 165.2f, 165.5f, 165.5f, 164.1f, 160.9f, 163.2f, 150.6f, 145.2f, 140.9f, 133.5f, 128.2f, 123.9f, 117.6f, 115.1f, 112.2f, 110.8f, 112.3f, 106.7f, 105.3f, 105.1f, 105.4f, 106.2f, 109.9f, 108.1f, 110.3f, 113f, 116.4f, 120.8f, 127.6f, 130.5f, 135.8f, 139.3f, 154.7f, 161f, 167.2f, 169.6f, 171.7f, 173.9f, 171.2f, 168.6f }; internal void Initialize(ManualLogSource logger, InfectionDataProvider dataProvider, InfectionLayout layout, LanguageHelper languageHelper) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) this.logger = logger; this.dataProvider = dataProvider; this.layout = layout; this.languageHelper = languageHelper; SubscribeLayoutConfigEvents(); RefreshDebugPreviewSettings(forceReset: true); layoutDirty = true; hudStyleDirty = true; nextControllerUpdateTime = 0f; lastControllerUpdateTime = 0f; compatibilityStateKnown = false; Scene scene = ((Component)this).gameObject.scene; logger.LogInfo((object)$"HUD controller initialized: scene={((Scene)(ref scene)).name}, active={((Component)this).gameObject.activeInHierarchy}, enabled={((Behaviour)this).enabled}."); } private void Update() { float unscaledTime = Time.unscaledTime; if (unscaledTime < nextControllerUpdateTime) { return; } nextControllerUpdateTime = unscaledTime + 1f / 30f; if (!loggedFirstControllerUpdate) { loggedFirstControllerUpdate = true; ManualLogSource obj = logger; if (obj != null) { obj.LogInfo((object)"HUD controller received its first Unity Update."); } } LogRuntimeDiagnosticState(unscaledTime); InfectionBarCompatibility.Tick(unscaledTime); bool hudAllowed = InfectionBarCompatibility.HudAllowed; if (!compatibilityStateKnown || lastCompatibilityHudAllowed != hudAllowed) { compatibilityStateKnown = true; lastCompatibilityHudAllowed = hudAllowed; if (!hudAllowed) { HideForCompatibility(); return; } layoutDirty = true; hudStyleDirty = true; } if (hudAllowed) { float updateDeltaTime = ((lastControllerUpdateTime > 0f) ? Mathf.Clamp(unscaledTime - lastControllerUpdateTime, 0f, 0.25f) : Time.unscaledDeltaTime); lastControllerUpdateTime = unscaledTime; nextControllerUpdateTime = unscaledTime + 1f / 30f; Tick(updateDeltaTime); } } private void LogRuntimeDiagnosticState(float now) { //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) if (!ShouldLogDiagnostics() || now < nextRuntimeDiagnosticTime || dataProvider == null) { return; } nextRuntimeDiagnosticTime = now + 2f; PlayerControllerB localPlayer = dataProvider.GetLocalPlayer(); int num = (int)((InfectionBarCompatibility.HudAllowed ? 1u : 0u) | (uint)(((Object)(object)localPlayer != (Object)null) ? 2 : 0) | (uint)(((Object)(object)localPlayer != (Object)null && localPlayer.isPlayerControlled) ? 4 : 0) | (uint)(((Object)(object)localPlayer != (Object)null && localPlayer.isPlayerDead) ? 8 : 0) | (uint)(((Object)(object)HUDManager.Instance != (Object)null) ? 16 : 0) | (uint)(((Object)(object)localPlayer != (Object)null && (Object)(object)localPlayer.sprintMeterUI != (Object)null) ? 32 : 0) | (uint)(((Object)(object)infectionRoot != (Object)null) ? 64 : 0) | (uint)(((Object)(object)infectionRoot != (Object)null && ((Component)infectionRoot).gameObject.activeSelf) ? 128 : 0) | (uint)(((Object)(object)infectionRoot != (Object)null && ((Component)infectionRoot).gameObject.activeInHierarchy) ? 256 : 0) | (uint)(lastVisibleState ? 512 : 0) | (uint)(ModConfig.InfectionBarEnabled.Value ? 1024 : 0)) | (ModConfig.InfectionBarAlwaysVisible.Value ? 2048 : 0); float num2 = (((Object)(object)canvasGroup != (Object)null) ? canvasGroup.alpha : (-1f)); string disableReason = InfectionBarCompatibility.DisableReason; if (num != lastRuntimeDiagnosticFlags || !(Mathf.Abs(num2 - lastRuntimeDiagnosticAlpha) < 0.001f) || debugPreviewMode != lastRuntimeDiagnosticPreview || !string.Equals(disableReason, lastRuntimeDiagnosticReason, StringComparison.Ordinal)) { lastRuntimeDiagnosticFlags = num; lastRuntimeDiagnosticAlpha = num2; lastRuntimeDiagnosticReason = disableReason; lastRuntimeDiagnosticPreview = debugPreviewMode; string arg = $"allowed={InfectionBarCompatibility.HudAllowed}, reason={InfectionBarCompatibility.DisableReason}" + $", player={(Object)(object)localPlayer != (Object)null}, controlled={(Object)(object)localPlayer != (Object)null && localPlayer.isPlayerControlled}, dead={(Object)(object)localPlayer != (Object)null && localPlayer.isPlayerDead}" + $", hud={(Object)(object)HUDManager.Instance != (Object)null}, sprint={(Object)(object)localPlayer != (Object)null && (Object)(object)localPlayer.sprintMeterUI != (Object)null}" + $", root={(Object)(object)infectionRoot != (Object)null}, selfActive={(Object)(object)infectionRoot != (Object)null && ((Component)infectionRoot).gameObject.activeSelf}, hierarchyActive={(Object)(object)infectionRoot != (Object)null && ((Component)infectionRoot).gameObject.activeInHierarchy}" + $", shown={lastVisibleState}, alpha={(((Object)(object)canvasGroup != (Object)null) ? canvasGroup.alpha : (-1f)):0.###}" + $", enabled={ModConfig.InfectionBarEnabled.Value}, always={ModConfig.InfectionBarAlwaysVisible.Value}, preview={debugPreviewMode}"; logger.LogInfo((object)$"HUD state at {now:0.0}s: {arg}"); if ((Object)(object)infectionRoot != (Object)null) { logger.LogInfo((object)("HUD parent chain: " + GetHierarchyPath((Transform)(object)infectionRoot) + $"; rect={infectionRoot.rect}, position={((Transform)infectionRoot).position}, scale={((Transform)infectionRoot).lossyScale}")); } } } private void Tick(float updateDeltaTime) { RefreshDebugPreviewSettings(forceReset: false); ResetSceneCachesIfHudManagerChanged(); if (!ModConfig.InfectionBarEnabled.Value) { SetInfectionVisible(shouldShow: false); RestoreOriginalWeightCounter(); RestoreVanillaWarningTextOffset(); } else { PlayerControllerB localPlayer = dataProvider.GetLocalPlayer(); EnsureInfectionUI(localPlayer, updateDeltaTime); UpdateInfection(localPlayer); } } internal void Shutdown() { DestroyInfectionUI(); ClearCachedSceneReferences(); cachedHudManagerInstance = null; cachedStartOfRoundInstance = null; UnsubscribeLayoutConfigEvents(); } private void OnDisable() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) ManualLogSource obj = logger; if (obj != null) { object arg = Time.unscaledTime; Scene scene = ((Component)this).gameObject.scene; obj.LogInfo((object)$"HUD controller disabled: time={arg:0.0}, scene={((Scene)(ref scene)).name}."); } } private void OnDestroy() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) ManualLogSource obj = logger; if (obj != null) { object arg = Time.unscaledTime; Scene scene = ((Component)this).gameObject.scene; obj.LogInfo((object)$"HUD controller destroyed: time={arg:0.0}, scene={((Scene)(ref scene)).name}."); } Shutdown(); } private void EnsureInfectionUI(PlayerControllerB player, float updateDeltaTime) { //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_0426: Unknown result type (might be due to invalid IL or missing references) //IL_0432: Unknown result type (might be due to invalid IL or missing references) //IL_0441: Unknown result type (might be due to invalid IL or missing references) //IL_0450: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_046a: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_04fc: Unknown result type (might be due to invalid IL or missing references) //IL_0511: Unknown result type (might be due to invalid IL or missing references) //IL_0523: Unknown result type (might be due to invalid IL or missing references) //IL_0532: Unknown result type (might be due to invalid IL or missing references) //IL_0541: Unknown result type (might be due to invalid IL or missing references) //IL_0550: Unknown result type (might be due to invalid IL or missing references) //IL_0572: Unknown result type (might be due to invalid IL or missing references) //IL_0577: Unknown result type (might be due to invalid IL or missing references) //IL_0583: Unknown result type (might be due to invalid IL or missing references) //IL_0607: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)infectionRoot != (Object)null && hasActiveHudStyle && !hudStyleDirty) { RefreshLayoutIfNeeded(player, updateDeltaTime); return; } HudStyle hudStyle = ResolveHudStyle(); hudStyleDirty = false; if ((Object)(object)infectionRoot != (Object)null) { if (hasActiveHudStyle && activeHudStyle == hudStyle) { RefreshLayoutIfNeeded(player, updateDeltaTime); return; } DestroyInfectionUI(); } if (hudStyle == HudStyle.VanillaStaminaRing) { TryCreateVanillaStaminaRingUI(player); return; } RectTransform nativeHudParentTransform = GetNativeHudParentTransform(); if ((Object)(object)nativeHudParentTransform == (Object)null) { if (ShouldLogDiagnostics() && !loggedMissingNativeHudParent) { logger.LogWarning((object)"Waiting for native HUD parent before creating infection bar UI."); loggedMissingNativeHudParent = true; } return; } loggedMissingNativeHudParent = false; GameObject val = new GameObject("IndependentCadaverInfectionBarRoot", new Type[2] { typeof(RectTransform), typeof(CanvasGroup) }); val.transform.SetParent((Transform)(object)nativeHudParentTransform, false); NativeHudState nativeHudState = GetNativeHudState(); lastVisibleState = false; lastRenderedInfectionFillAmount = -1f; lastRenderedInfectionPercent = -1; lastRenderedInfectionLabel = string.Empty; currentHudAlpha = (nativeHudState.IsValid ? nativeHudState.Alpha : 1f); lastAppliedHudAlpha = -1f; canvasGroup = val.GetComponent<CanvasGroup>(); canvasGroup.alpha = currentHudAlpha; canvasGroup.ignoreParentGroups = true; canvasGroup.interactable = false; canvasGroup.blocksRaycasts = false; Vector2 effectiveRootSize = GetEffectiveRootSize(); Vector2 effectiveBarSize = GetEffectiveBarSize(); infectionRoot = val.GetComponent<RectTransform>(); infectionRoot.anchorMin = layout.GetAnchorMin(); infectionRoot.anchorMax = layout.GetAnchorMax(); infectionRoot.pivot = layout.GetPivot(); infectionRoot.sizeDelta = effectiveRootSize; infectionRoot.anchoredPosition = AlignVector2(layout.GetAnchoredPosition()); ApplyNativeHudElementRotation(); RectTransform val2 = CreateRect("Panel", (Transform)(object)infectionRoot, effectiveRootSize, new Vector2(0f, 0f), new Vector2(0f, 0f), new Vector2(0f, 0f)); panelBackground = ((Component)val2).gameObject.AddComponent<Image>(); panelBackground.sprite = GetPixelSprite(); ((Graphic)panelBackground).color = new Color(0.1f, 0.02f, 0.02f, Mathf.Clamp01(ModConfig.PanelBackgroundAlpha.Value)); ((Behaviour)panelBackground).enabled = ModConfig.ShowPanelBackground.Value; RectTransform val3 = CreateRect("TopLine", (Transform)(object)infectionRoot, new Vector2(effectiveBarSize.x, effectiveBarSize.y), new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(0f, 1f)); val3.anchoredPosition = AlignVector2(new Vector2(8f, -6f)); topLine = ((Component)val3).gameObject.AddComponent<Image>(); topLine.sprite = GetPixelSprite(); ((Graphic)topLine).color = new Color(0.84f, 0.18f, 0.16f, 0.72f); RectTransform val4 = CreateRect("Background", (Transform)(object)infectionRoot, new Vector2(effectiveBarSize.x, effectiveBarSize.y), new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(0f, 1f)); val4.anchoredPosition = AlignVector2(new Vector2(8f, -6f)); infectionBackground = ((Component)val4).gameObject.AddComponent<Image>(); infectionBackground.sprite = GetPixelSprite(); infectionBackground.type = (Type)1; ((Graphic)infectionBackground).color = new Color(0.24f, 0.05f, 0.05f, 0.42f); RectTransform val5 = CreateRect("Fill", (Transform)(object)val4, effectiveBarSize, new Vector2(0f, 0f), new Vector2(1f, 1f), new Vector2(0f, 0f)); val5.anchoredPosition = Vector2.zero; val5.sizeDelta = Vector2.zero; val5.offsetMin = Vector2.zero; val5.offsetMax = Vector2.zero; infectionBar = ((Component)val5).gameObject.AddComponent<Image>(); infectionBar.sprite = GetPixelSprite(); infectionBar.type = (Type)3; infectionBar.fillMethod = (FillMethod)0; infectionBar.fillOrigin = 0; infectionBar.fillAmount = 0f; ((Graphic)infectionBar).color = new Color(0.91f, 0.23f, 0.19f, 0.98f); RectTransform val6 = CreateRect("Text", (Transform)(object)infectionRoot, new Vector2(effectiveRootSize.x - 16f, 18f), new Vector2(0f, 0f), new Vector2(0f, 0f), new Vector2(0f, 0f)); val6.anchoredPosition = AlignVector2(new Vector2(ModConfig.TextOffsetX.Value, ModConfig.TextOffsetY.Value)); ((Transform)val6).localRotation = Quaternion.identity; infectionText = ((Component)val6).gameObject.AddComponent<Text>(); infectionText.font = Resources.GetBuiltinResource<Font>("Arial.ttf"); infectionText.fontSize = ModConfig.TextFontSize.Value; infectionText.alignment = (TextAnchor)3; infectionText.horizontalOverflow = (HorizontalWrapMode)1; infectionText.verticalOverflow = (VerticalWrapMode)1; ((Graphic)infectionText).color = new Color(0.97f, 0.95f, 0.92f, 0.94f); cachedInfectionLabel = DetermineInfectionLabel(); nextInfectionLabelRefreshTime = Time.unscaledTime + 5f; infectionText.text = cachedInfectionLabel + " 0%"; ((Component)infectionRoot).gameObject.SetActive(false); if (ShouldLogDiagnostics()) { logger.LogInfo((object)"Standalone infection bar UI created. style=Current"); } activeHudStyle = HudStyle.Current; hasActiveHudStyle = true; hudStyleDirty = false; Transform obj = ResolveNativeHudElementTransform(); StartHudIntroAlphaSampling((RectTransform)(((object)((obj is RectTransform) ? obj : null)) ?? ((object)nativeHudParentTransform))); ApplyHudAlpha(currentHudAlpha * GetHudIntroAlphaMultiplier(nativeHudState)); } private HudStyle ResolveHudStyle() { string a = (ModConfig.HudStyleMode?.Value ?? "Auto").Trim(); if (string.Equals(a, "Current", StringComparison.OrdinalIgnoreCase) || string.Equals(a, "CurrentStyle", StringComparison.OrdinalIgnoreCase)) { return HudStyle.Current; } if (string.Equals(a, "Vanilla", StringComparison.OrdinalIgnoreCase) || string.Equals(a, "VanillaStamina", StringComparison.OrdinalIgnoreCase) || string.Equals(a, "VanillaStaminaRing", StringComparison.OrdinalIgnoreCase) || string.Equals(a, "VanillaStaminaRingStyle", StringComparison.OrdinalIgnoreCase)) { return HudStyle.VanillaStaminaRing; } if (!IsEladsHudInstalled()) { return HudStyle.VanillaStaminaRing; } return HudStyle.Current; } private static bool IsEladsHudInstalled() { if (hasCachedEladsHudInstalled) { return cachedEladsHudInstalled; } cachedEladsHudInstalled = DetectEladsHudInstalled(); hasCachedEladsHudInstalled = true; return cachedEladsHudInstalled; } private static bool DetectEladsHudInstalled() { if (Chainloader.PluginInfos.ContainsKey("me.eladnlg.customhud")) { return true; } foreach (PluginInfo value in Chainloader.PluginInfos.Values) { object obj; if (value == null) { obj = null; } else { BepInPlugin metadata = value.Metadata; obj = ((metadata != null) ? metadata.GUID : null); } if (obj == null) { obj = string.Empty; } string text = (string)obj; object obj2; if (value == null) { obj2 = null; } else { BepInPlugin metadata2 = value.Metadata; obj2 = ((metadata2 != null) ? metadata2.Name : null); } if (obj2 == null) { obj2 = string.Empty; } string text2 = (string)obj2; bool flag = text.IndexOf("Elads", StringComparison.OrdinalIgnoreCase) >= 0 || text2.IndexOf("Elads", StringComparison.OrdinalIgnoreCase) >= 0; bool flag2 = text.IndexOf("HUD", StringComparison.OrdinalIgnoreCase) >= 0 || text2.IndexOf("HUD", StringComparison.OrdinalIgnoreCase) >= 0; if (flag && flag2) { return true; } } return false; } private bool TryCreateVanillaStaminaRingUI(PlayerControllerB player) { //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) if (!TryGetSprintMeter(player, out var sprintMeterImage, out var sprintMeterRect)) { if (ShouldLogDiagnostics() && !loggedMissingSprintMeter) { logger.LogWarning((object)"Waiting for original sprint meter UI before creating vanilla infection ring."); loggedMissingSprintMeter = true; } return false; } Transform parent = ((Transform)sprintMeterRect).parent; RectTransform val = (RectTransform)(object)((parent is RectTransform) ? parent : null); if ((Object)(object)val == (Object)null) { if (ShouldLogDiagnostics() && !loggedMissingSprintMeter) { logger.LogWarning((object)"Original sprint meter UI has no RectTransform parent."); loggedMissingSprintMeter = true; } return false; } loggedMissingSprintMeter = false; LogVanillaSprintMeterDiagnostics(sprintMeterImage, sprintMeterRect); GameObject val2 = new GameObject("IndependentCadaverInfectionBarVanillaStaminaRingRoot", new Type[2] { typeof(RectTransform), typeof(CanvasGroup) }); val2.transform.SetParent((Transform)(object)val, false); NativeHudState nativeHudState = GetNativeHudState(); lastVisibleState = false; lastRenderedInfectionFillAmount = -1f; lastRenderedInfectionPercent = -1; lastRenderedInfectionLabel = string.Empty; currentHudAlpha = (nativeHudState.IsValid ? nativeHudState.Alpha : 1f); lastAppliedHudAlpha = -1f; canvasGroup = val2.GetComponent<CanvasGroup>(); canvasGroup.alpha = currentHudAlpha; canvasGroup.ignoreParentGroups = true; canvasGroup.interactable = false; canvasGroup.blocksRaycasts = false; infectionRoot = val2.GetComponent<RectTransform>(); vanillaSprintMeterReference = sprintMeterImage; ApplyVanillaStaminaRingTransform(sprintMeterRect); RectTransform val3 = CreateRect("VanillaRingBackground", (Transform)(object)infectionRoot, Vector2.zero, Vector2.zero, Vector2.one, new Vector2(0.5f, 0.5f)); StretchToParent(val3); infectionBackground = ((Component)val3).gameObject.AddComponent<Image>(); CopySprintMeterImageStyle(sprintMeterImage, infectionBackground, new Color(0.34f, 0.05f, 0.04f, 0.42f)); ApplyVanillaRingFillAmount(infectionBackground, 1f); RectTransform val4 = CreateRect("VanillaRingFill", (Transform)(object)infectionRoot, Vector2.zero, Vector2.zero, Vector2.one, new Vector2(0.5f, 0.5f)); StretchToParent(val4); infectionBar = ((Component)val4).gameObject.AddComponent<Image>(); CopySprintMeterImageStyle(sprintMeterImage, infectionBar, new Color(0.91f, 0.18f, 0.13f, 0.95f)); ApplyVanillaRingFillAmount(infectionBar, 0f); CreateVanillaArcTexts(sprintMeterRect); cachedInfectionLabel = DetermineInfectionLabel(); nextInfectionLabelRefreshTime = Time.unscaledTime + 5f; SetInfectionText(FormatInfectionText(cachedInfectionLabel, 0)); ((Component)infectionRoot).gameObject.SetActive(false); if ((Object)(object)vanillaWeightTextRoot != (Object)null) { ((Component)vanillaWeightTextRoot).gameObject.SetActive(false); } if ((Object)(object)vanillaInfectionTextRoot != (Object)null) { ((Component)vanillaInfectionTextRoot).gameObject.SetActive(false); } if ((Object)(object)vanillaInfectionValueTextRoot != (Object)null) { ((Component)vanillaInfectionValueTextRoot).gameObject.SetActive(false); } activeHudStyle = HudStyle.VanillaStaminaRing; hasActiveHudStyle = true; hudStyleDirty = false; layoutDirty = false; StartHudIntroAlphaSampling(sprintMeterRect); ApplyHudAlpha(currentHudAlpha * GetHudIntroAlphaMultiplier(nativeHudState)); if (ShouldLogDiagnostics()) { logger.LogInfo((object)"Standalone infection bar UI created. style=VanillaStaminaRing"); } return true; } private static bool TryGetSprintMeter(PlayerControllerB player, out Image sprintMeterImage, out RectTransform sprintMeterRect) { sprintMeterImage = player?.sprintMeterUI; sprintMeterRect = (((Object)(object)sprintMeterImage != (Object)null) ? ((Graphic)sprintMeterImage).rectTransform : null); if ((Object)(object)sprintMeterImage != (Object)null) { return (Object)(object)sprintMeterRect != (Object)null; } return false; } private void RefreshVanillaStaminaRingLayout(PlayerControllerB player) { //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) Image sprintMeterImage; RectTransform sprintMeterRect; if (!lastVisibleState) { RestoreOriginalWeightCounter(); } else if (TryGetSprintMeter(player, out sprintMeterImage, out sprintMeterRect)) { Transform parent = ((Transform)sprintMeterRect).parent; RectTransform val = (RectTransform)(object)((parent is RectTransform) ? parent : null); bool flag = (Object)(object)val != (Object)null && (Object)(object)((Transform)infectionRoot).parent != (Object)(object)val; if (flag) { ((Transform)infectionRoot).SetParent((Transform)(object)val, false); } vanillaSprintMeterReference = sprintMeterImage; float unscaledTime = Time.unscaledTime; bool flag2 = ShouldForceVanillaHudLiveLayoutRefresh(); bool num = flag || flag2 || layoutDirty || unscaledTime >= nextVanillaLayoutPollTime; bool flag3 = flag || flag2 || layoutDirty; if (num) { nextVanillaLayoutPollTime = unscaledTime + 0.1f; flag3 = flag3 || HasVanillaSprintMeterLayoutChanged(sprintMeterRect); } if (num && (!ModConfig.VanillaArcTextEnabled.Value || ModConfig.VanillaReuseNativePosition.Value) && !flag3) { RefreshVanillaHorizontalTextLayout(sprintMeterRect); } if (flag3) { ApplyVanillaStaminaRingTransform(sprintMeterRect); RefreshVanillaArcTextLayout(sprintMeterRect, forceTextRefresh: true); CopySprintMeterImageStyle(sprintMeterImage, infectionBackground, new Color(0.34f, 0.05f, 0.04f, 0.42f)); CopySprintMeterImageStyle(sprintMeterImage, infectionBar, new Color(0.91f, 0.18f, 0.13f, 0.95f)); ApplyVanillaRingFillAmount(infectionBackground, 1f); ApplyVanillaRingFillAmount(infectionBar, (lastRenderedInfectionFillAmount >= 0f) ? VanillaRingFillMapping.MapInfectionToVisibleFill(lastRenderedInfectionFillAmount) : infectionBar.fillAmount); CaptureVanillaSprintMeterLayoutSignature(sprintMeterRect); layoutDirty = false; nextVanillaTextRefreshTime = unscaledTime + 0.1f; SetOriginalWeightCounterHidden(ModConfig.InfectionBarEnabled.Value && lastVisibleState && !ModConfig.VanillaReuseNativePosition.Value); } else if (unscaledTime >= nextVanillaTextRefreshTime) { nextVanillaTextRefreshTime = unscaledTime + 0.1f; SetOriginalWeightCounterHidden(ModConfig.InfectionBarEnabled.Value && lastVisibleState && !ModConfig.VanillaReuseNativePosition.Value); UpdateVanillaWeightText(); ApplyVanillaInfectionTextSegments(); } } } private void CreateVanillaArcTexts(RectTransform sprintMeterRect) { Transform parent = ((Transform)sprintMeterRect).parent; RectTransform val = (RectTransform)(object)((parent is RectTransform) ? parent : null); if (!((Object)(object)val == (Object)null)) { CreateVanillaArcTextRoot("IndependentCadaverInfectionBarVanillaWeightText", val, out vanillaWeightTextRoot, out vanillaWeightTextCanvasGroup); CreateVanillaArcTextRoot("IndependentCadaverInfectionBarVanillaInfectionText", val, out vanillaInfectionTextRoot, out vanillaInfectionTextCanvasGroup); CreateVanillaArcTextRoot("IndependentCadaverInfectionBarVanillaInfectionValueText", val, out vanillaInfectionValueTextRoot, out vanillaInfectionValueTextCanvasGroup); UpdateVanillaWeightText(force: true); RefreshVanillaArcTextLayout(sprintMeterRect, forceTextRefresh: true); } } private void CreateVanillaArcTextRoot(string name, RectTransform parent, out RectTransform root, out CanvasGroup group) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown GameObject val = new GameObject(name, new Type[2] { typeof(RectTransform), typeof(CanvasGroup) }); val.transform.SetParent((Transform)(object)parent, false); root = val.GetComponent<RectTransform>(); group = val.GetComponent<CanvasGroup>(); group.alpha = currentHudAlpha; group.ignoreParentGroups = true; group.interactable = false; group.blocksRaycasts = false; ((Component)root).gameObject.SetActive(false); } private void RefreshVanillaArcTextLayout(RectTransform sprintMeterRect, bool forceTextRefresh) { //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0154: 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) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) if (!lastVisibleState || (Object)(object)vanillaWeightTextRoot == (Object)null || (Object)(object)vanillaInfectionTextRoot == (Object)null || (Object)(object)vanillaInfectionValueTextRoot == (Object)null) { return; } if (!ModConfig.VanillaArcTextEnabled.Value || ModConfig.VanillaReuseNativePosition.Value) { RefreshVanillaHorizontalTextLayout(sprintMeterRect); UpdateVanillaWeightText(forceTextRefresh); ApplyVanillaInfectionTextSegments(forceTextRefresh); return; } Transform parent = ((Transform)sprintMeterRect).parent; RectTransform val = (RectTransform)(object)((parent is RectTransform) ? parent : null); if ((Object)(object)val != (Object)null && (Object)(object)((Transform)vanillaWeightTextRoot).parent != (Object)(object)val) { ((Transform)vanillaWeightTextRoot).SetParent((Transform)(object)val, false); ((Transform)vanillaInfectionTextRoot).SetParent((Transform)(object)val, false); ((Transform)vanillaInfectionValueTextRoot).SetParent((Transform)(object)val, false); } Vector2 val2 = sprintMeterRect.anchoredPosition + GetVanillaOuterRingOffset(sprintMeterRect) + new Vector2(ModConfig.VanillaRingOffsetX.Value, ModConfig.VanillaRingOffsetY.Value); Vector2 rectReferenceSize = GetRectReferenceSize(sprintMeterRect); float num = Mathf.Max(0.1f, ModConfig.VanillaRingScale.Value); Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(Mathf.Abs(rectReferenceSize.x) * num, Mathf.Abs(rectReferenceSize.y) * num); bool num2 = lastVisibleState; ApplyVanillaTextRect(position: num2 ? val2 : sprintMeterRect.anchoredPosition, size: (Vector2)(num2 ? val3 : new Vector2(Mathf.Abs(rectReferenceSize.x), Mathf.Abs(rectReferenceSize.y))), rect: vanillaWeightTextRoot, anchorMin: sprintMeterRect.anchorMin, anchorMax: sprintMeterRect.anchorMax, pivot: new Vector2(0.5f, 0.5f), rotation: ((Transform)sprintMeterRect).localRotation, scale: ((Transform)sprintMeterRect).localScale); ApplyVanillaTextRect(vanillaInfectionTextRoot, sprintMeterRect.anchorMin, sprintMeterRect.anchorMax, new Vector2(0.5f, 0.5f), val3, val2, ((Transform)sprintMeterRect).localRotation, ((Transform)sprintMeterRect).localScale); ApplyVanillaTextRect(vanillaInfectionValueTextRoot, sprintMeterRect.anchorMin, sprintMeterRect.anchorMax, new Vector2(0.5f, 0.5f), val3, val2, ((Transform)sprintMeterRect).localRotation, ((Transform)sprintMeterRect).localScale); UpdateVanillaWeightText(forceTextRefresh); ApplyVanillaInfectionTextSegments(forceTextRefresh); } private void RefreshVanillaHorizontalTextLayout(RectTransform sprintMeterRect) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI val = HUDManager.Instance?.weightCounter; if ((Object)(object)val == (Object)null || (Object)(object)vanillaWeightTextRoot == (Object)null || (Object)(object)vanillaInfectionTextRoot == (Object)null) { return; } RectTransform rectTransform = ((TMP_Text)val).rectTransform; Transform parent = ((Transform)rectTransform).parent; RectTransform val2 = (RectTransform)(object)((parent is RectTransform) ? parent : null); if (!((Object)(object)val2 == (Object)null)) { Matrix4x4 val3 = ((Transform)val2).worldToLocalMatrix * ((Transform)sprintMeterRect).localToWorldMatrix; Matrix4x4 val4 = (((Object)(object)infectionRoot != (Object)null) ? (((Transform)val2).worldToLocalMatrix * ((Transform)infectionRoot).localToWorldMatrix) : val3); Rect val5 = (((Object)(object)infectionRoot != (Object)null) ? infectionRoot.rect : sprintMeterRect.rect); if (!horizontalLayoutCached || !((Object)(object)((Transform)vanillaWeightTextRoot).parent == (Object)(object)val2) || !(lastHorizontalSprintMatrix == val3) || !(lastHorizontalRingMatrix == val4) || !(lastHorizontalSprintRect == sprintMeterRect.rect) || !(lastHorizontalRingRect == val5) || !(lastHorizontalNativePosition == ((Transform)rectTransform).localPosition) || !(lastHorizontalNativeScale == ((Transform)rectTransform).localScale) || !(lastHorizontalNativeRect == rectTransform.rect) || lastHorizontalFontSize != ((TMP_Text)val).fontSize || lastVanillaReuseNativePosition != ModConfig.VanillaReuseNativePosition.Value) { horizontalLayoutCached = true; lastHorizontalSprintMatrix = val3; lastHorizontalRingMatrix = val4; lastHorizontalSprintRect = sprintMeterRect.rect; lastHorizontalRingRect = val5; lastHorizontalNativePosition = ((Transform)rectTransform).localPosition; lastHorizontalNativeScale = ((Transform)rectTransform).localScale; lastHorizontalNativeRect = rectTransform.rect; lastHorizontalFontSize = ((TMP_Text)val).fontSize; float num = ((TMP_Text)val).fontSize * Mathf.Abs(((Transform)rectTransform).localScale.y); float num2 = Mathf.Max(20f, num * 1.4f); float minY = ((Transform)rectTransform).localPosition.y - (lastVisibleState ? num2 : 0f) - num * 0.7f; float maxY = ((Transform)rectTransform).localPosition.y + num * 0.7f - (ModConfig.VanillaReuseNativePosition.Value ? num2 : 0f); float rightEdgeInTextFrame = GetRightEdgeInTextFrame(sprintMeterRect, val2, minY, maxY); float infectionRight = (((Object)(object)infectionRoot != (Object)null) ? GetRightEdgeInTextFrame(infectionRoot, val2, minY, maxY) : rightEdgeInTextFrame); float x = ((Transform)rectTransform).localPosition.x; Rect rect = rectTransform.rect; VanillaHorizontalTextLayout.Calculate(x + ((Rect)(ref rect)).xMin * ((Transform)rectTransform).localScale.x, fontHeight: ((TMP_Text)val).fontSize * Mathf.Abs(((Transform)rectTransform).localScale.y), nativeY: ((Transform)rectTransform).localPosition.y, staminaRight: rightEdgeInTextFrame, infectionRight: infectionRight, infectionVisible: lastVisibleState, left: out var left, weightY: out var weightY, infectionY: out var infectionY, rowHeight: out var rowHeight); float height = rowHeight / Mathf.Max(0.01f, Mathf.Abs(((Transform)rectTransform).localScale.y)); ApplyHorizontalTextRect(vanillaWeightTextRoot, val2, rectTransform, left, weightY, height); ApplyHorizontalTextRect(vanillaInfectionTextRoot, val2, rectTransform, left, infectionY, height); ApplyHorizontalTextRect(vanillaInfectionValueTextRoot, val2, rectTransform, left, infectionY, height); } } } private static float GetRightEdgeInTextFrame(RectTransform rect, RectTransform textFrame, float minY, float maxY) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) Matrix4x4 val = ((Transform)textFrame).worldToLocalMatrix * ((Transform)rect).localToWorldMatrix; Rect rect2 = rect.rect; Vector3 val2 = ((Matrix4x4)(ref val)).MultiplyPoint3x4(Vector2.op_Implicit(((Rect)(ref rect2)).center)); rect2 = rect.rect; float width = ((Rect)(ref rect2)).width; rect2 = rect.rect; return VanillaRingTextClearance.RightEdge(width, ((Rect)(ref rect2)).height, val.m00, val.m01, val2.x, val.m10, val.m11, val2.y, minY, maxY); } private static void ApplyHorizontalTextRect(RectTransform root, RectTransform parent, RectTransform nativeRect, float left, float y, float height) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)root == (Object)null)) { if ((Object)(object)((Transform)root).parent != (Object)(object)parent) { ((Transform)root).SetParent((Transform)(object)parent, false); } Rect rect = nativeRect.rect; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(Mathf.Max(160f, ((Rect)(ref rect)).width), height); if (root.pivot != new Vector2(0f, 0.5f)) { root.pivot = new Vector2(0f, 0.5f); } if (root.sizeDelta != val) { root.sizeDelta = val; } if (((Transform)root).localScale != ((Transform)nativeRect).localScale) { ((Transform)root).localScale = ((Transform)nativeRect).localScale; } if (((Transform)root).localRotation != Quaternion.identity) { ((Transform)root).localRotation = Quaternion.identity; } Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(left, y, ((Transform)nativeRect).localPosition.z); if (((Transform)root).localPosition != val2) { ((Transform)root).localPosition = val2; } } } private bool HasVanillaSprintMeterLayoutChanged(RectTransform sprintMeterRect) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) if (!hasVanillaLayoutSignature) { return true; } Vector2 val = lastVanillaAnchorMin - sprintMeterRect.anchorMin; if (!(((Vector2)(ref val)).sqrMagnitude > 0.0001f)) { val = lastVanillaAnchorMax - sprintMeterRect.anchorMax; if (!(((Vector2)(ref val)).sqrMagnitude > 0.0001f)) { val = lastVanillaPivot - sprintMeterRect.pivot; if (!(((Vector2)(ref val)).sqrMagnitude > 0.0001f)) { val = lastVanillaSizeDelta - sprintMeterRect.sizeDelta; if (!(((Vector2)(ref val)).sqrMagnitude > 0.0001f)) { val = lastVanillaAnchoredPosition - sprintMeterRect.anchoredPosition; if (!(((Vector2)(ref val)).sqrMagnitude > 0.0001f) && !(Quaternion.Angle(lastVanillaLocalRotation, ((Transform)sprintMeterRect).localRotation) > 0.01f)) { Vector3 val2 = lastVanillaLocalScale - ((Transform)sprintMeterRect).localScale; if (!(((Vector3)(ref val2)).sqrMagnitude > 0.0001f) && lastVanillaReuseNativePosition == ModConfig.VanillaReuseNativePosition.Value && lastVanillaArcTextEnabled == ModConfig.VanillaArcTextEnabled.Value && !(Mathf.Abs(lastVanillaRingScale - ModConfig.VanillaRingScale.Value) > 0.0001f) && !(Mathf.Abs(lastVanillaRingOffsetX - ModConfig.VanillaRingOffsetX.Value) > 0.0001f)) { return Mathf.Abs(lastVanillaRingOffsetY - ModConfig.VanillaRingOffsetY.Value) > 0.0001f; } } } } } } return true; } private void CaptureVanillaSprintMeterLayoutSignature(RectTransform sprintMeterRect) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) hasVanillaLayoutSignature = true; lastVanillaAnchorMin = sprintMeterRect.anchorMin; lastVanillaAnchorMax = sprintMeterRect.anchorMax; lastVanillaPivot = sprintMeterRect.pivot; lastVanillaSizeDelta = sprintMeterRect.sizeDelta; lastVanillaAnchoredPosition = sprintMeterRect.anchoredPosition; lastVanillaLocalRotation = ((Transform)sprintMeterRect).localRotation; lastVanillaLocalScale = ((Transform)sprintMeterRect).localScale; lastVanillaReuseNativePosition = ModConfig.VanillaReuseNativePosition.Value; lastVanillaArcTextEnabled = ModConfig.VanillaArcTextEnabled.Value; lastVanillaRingScale = ModConfig.VanillaRingScale.Value; lastVanillaRingOffsetX = ModConfig.VanillaRingOffsetX.Value; lastVanillaRingOffsetY = ModConfig.VanillaRingOffsetY.Value; } private static bool ShouldForceVanillaHudLiveLayoutRefresh() { return ModConfig.DebugVanillaHudLiveLayoutRefresh?.Value ?? false; } private void ApplyOrRestoreVanillaWarningTextOffset(bool infectionRingVisible) { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_010f: Unknown result type (might be due to invalid IL or missing references) if (!(activeHudStyle == HudStyle.VanillaStaminaRing && infectionRingVisible) || !ModConfig.InfectionBarEnabled.Value || !ModConfig.VanillaWarningTextOffsetEnabled.Value) { RestoreVanillaWarningTextOffset(); return; } RectTransform val = ResolveVanillaWarningRoot(); if ((Object)(object)val == (Object)null) { if (ShouldLogDiagnostics() && !loggedMissingVanillaWarningRoot) { logger.LogWarning((object)"Waiting for original warning text root before applying vanilla HUD warning text offset."); loggedMissingVanillaWarningRoot = true; } return; } loggedMissingVanillaWarningRoot = false; if ((Object)(object)shiftedVanillaWarningRoot != (Object)(object)val) { RestoreVanillaWarningTextOffset(); shiftedVanillaWarningRoot = val; originalVanillaWarningAnchoredPosition = val.anchoredPosition; hasOriginalVanillaWarningAnchoredPosition = true; } if (!hasOriginalVanillaWarningAnchoredPosition) { originalVanillaWarningAnchoredPosition = val.anchoredPosition; hasOriginalVanillaWarningAnchoredPosition = true; } VanillaWarningTextOffsetCalculator.CalculateShiftedPosition(enabled: true, originalVanillaWarningAnchoredPosition.x, originalVanillaWarningAnchoredPosition.y, ModConfig.VanillaWarningTextOffsetX.Value, ModConfig.VanillaWarningTextOffsetY.Value, out var shiftedX, out var shiftedY); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(shiftedX, shiftedY); Vector2 val3 = val.anchoredPosition - val2; if (((Vector2)(ref val3)).sqrMagnitude > 0.0001f) { val.anchoredPosition = val2; } } private void RestoreVanillaWarningTextOffset() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)shiftedVanillaWarningRoot != (Object)null && hasOriginalVanillaWarningAnchoredPosition) { shiftedVanillaWarningRoot.anchoredPosition = originalVanillaWarningAnchoredPosition; } shiftedVanillaWarningRoot = null; originalVanillaWarningAnchoredPosition = Vector2.zero; hasOriginalVanillaWarningAnchoredPosition = false; loggedMissingVanillaWarningRoot = false; } private static RectTransform ResolveVanillaWarningRoot() { if ((Object)(object)cachedVanillaWarningRoot != (Object)null) { return cachedVanillaWarningRoot; } if (Time.unscaledTime < nextVanillaWarningRootLookupTime) { return null; } nextVanillaWarningRootLookupTime = Time.unscaledTime + 1f; HUDManager instance = HUDManager.Instance; if ((Object)(object)instance == (Object)null) { return null; } if ((Object)(object)instance.statusEffectText != (Object)null) { cachedVanillaWarningRoot = ((TMP_Text)instance.statusEffectText).rectTransform; return cachedVanillaWarningRoot; } Component radiationGraphicAnimator = (Component)(object)instance.radiationGraphicAnimator; if (radiationGraphicAnimator != null) { Transform transform = radiationGraphicAnimator.transform; RectTransform val = (RectTransform)(object)((transform is RectTransform) ? transform : null); if (val != null) { cachedVanillaWarningRoot = val; return cachedVanillaWarningRoot; } } Transform[] componentsInChildren = ((Component)instance).GetComponentsInChildren<Transform>(true); foreach (Transform val2 in componentsInChildren) { RectTransform val3 = (RectTransform)(object)((val2 is RectTransform) ? val2 : null); if (val3 != null && IsVanillaWarningRoot(val2)) { cachedVanillaWarningRoot = val3; return cachedVanillaWarningRoot; } } nextVanillaWarningRootLookupTime = Time.unscaledTime + 10f; return null; } private static bool IsVanillaWarningRoot(Transform transform) { if ((Object)(object)transform != (Object)null && string.Equals(((Object)transform).name, "RadiationIncrease", StringComparison.OrdinalIgnoreCase)) { return GetHierarchyPath(transform).EndsWith("IngamePlayerHUD/SpecialHUDGraphics/RadiationIncrease", StringComparison.OrdinalIgnoreCase); } return false; } private static void GetVanillaArcParameters(VanillaArcTextSlot slot, int textLength, out float startAngle, out float endAngle, out VanillaArcRadiusBand radiusBand, out float radiusOffsetPixels) { float num; float num2; float num3; switch (slot) { case VanillaArcTextSlot.WeightInfectionInner: num = 24f; num2 = 16f; num3 = 4.8f; radiusBand = VanillaArcRadiusBand.Outer; radiusOffsetPixels = 86f; break; case VanillaArcTextSlot.InfectionOuter: num = 42f; num2 = 22f; num3 = 4.4f; radiusBand = VanillaArcRadiusBand.Outer; radiusOffsetPixels = 150f; break; default: num = 43f; num2 = 16f; num3 = 4.8f; radiusBand = VanillaArcRadiusBand.Outer; radiusOffsetPixels = 92f; break; } float num4 = ((textLength <= 1) ? 0f : Mathf.Min(num2, num3 * (float)(textLength - 1))); startAngle = num + num4 * 0.5f; endAngle = num - num4 * 0.5f; } private static float GetVanillaArcCharacterRotation(float angle, VanillaArcTextSlot slot) { return slot switch { VanillaArcTextSlot.WeightInfectionInner => Mathf.Clamp(angle - 56f, -42f, -10f), VanillaArcTextSlot.InfectionOuter => Mathf.Clamp(angle - 58f, -48f, -10f), _ => Mathf.Clamp(angle - 54f, -36f, -8f), }; } private static float GetVanillaArcFontScale(VanillaArcTextSlot slot) { return slot switch { VanillaArcTextSlot.InfectionOuter => 0.62f, VanillaArcTextSlot.WeightInfectionInner => 0.6f, _ => 0.66f, }; } private static float GetVanillaArcCharacterClearancePixels(VanillaArcTextSlot slot) { return slot switch { VanillaArcTextSlot.WeightInfectionInner => 78f, VanillaArcTextSlot.InfectionOuter => 118f, _ => 70f, }; } private static float GetSprintMeterArcRadius(float angle, VanillaArcRadiusBand band) { float[] array = band switch { VanillaArcRadiusBand.Outer => SprintMeterArcOuterRadii, VanillaArcRadiusBand.Inner => SprintMeterArcInnerRadii, _ => SprintMeterArcMiddleRadii, }; if (angle <= SprintMeterArcAngles[0]) { return array[0]; } int num = SprintMeterArcAngles.Length - 1; if (angle >= SprintMeterArcAngles[num]) { return array[num]; } for (int i = 0; i < num; i++) { float num2 = SprintMeterArcAngles[i]; float num3 = SprintMeterArcAngles[i + 1]; if (!(angle < num2) && !(angle > num3)) { float num4 = Mathf.InverseLerp(num2, num3, angle); return Mathf.Lerp(array[i], array[i + 1], num4); } } return array[num]; } private static float ApplyVanillaArcTextClearance(float angle, float radius, VanillaArcTextSlot slot, VanillaArcRadiusBand band) { float vanillaArcCharacterClearancePixels = GetVanillaArcCharacterClearancePixels(slot); GetSprintMeterArcRadius(angle, VanillaArcRadiusBand.Inner); float sprintMeterArcRadius = GetSprintMeterArcRadius(angle, VanillaArcRadiusBand.Outer); return slot switch { VanillaArcTextSlot.WeightInfectionInner => Mathf.Max(radius, sprintMeterArcRadius + vanillaArcCharacterClearancePixels), VanillaArcTextSlot.InfectionOuter => Mathf.Max(radius, sprintMeterArcRadius + vanillaArcCharacterClearancePixels), _ => Mathf.Max(radius, sprintMeterArcRadius + vanillaArcCharacterClearancePixels), }; } private static void ApplyVanillaTextRect(RectTransform rect, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot, Vector2 size, Vector2 position, Quaternion rotation, Vector3 scale) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) rect.anchorMin = anchorMin; rect.anchorMax = anchorMax; rect.pivot = pivot; rect.sizeDelta = size; rect.anchoredPosition = position; ((Transform)rect).localRotation = rotation; ((Transform)rect).localScale = scale; } private static void ApplyVanillaArcText(RectTransform root, string text, Color color, VanillaArcTextSlot slot) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0139: 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) //IL_0193: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)root == (Object)null) { return; } string text2 = text ?? string.Empty; if (!ModConfig.VanillaArcTextEnabled.Value || ModConfig.VanillaReuseNativePosition.Value) { SetUnusedVanillaArcCharactersInactive(root, 0); TextMeshProUGUI val = ((Component)root).GetComponent<TextMeshProUGUI>(); if ((Object)(object)val == (Object)null) { val = ((Component)root).gameObject.AddComponent<TextMeshProUGUI>(); } CopyWeightCounterTextStyle(val, color); ((Behaviour)val).enabled = true; ((TMP_Text)val).text = text2; ((TMP_Text)val).alignment = (TextAlignmentOptions)513; ((TMP_Text)val).margin = Vector4.zero; ((TMP_Text)val).enableAutoSizing = false; ((TMP_Text)val).enableWordWrapping = false; ((TMP_Text)val).overflowMode = (TextOverflowModes)0; ((Graphic)val).raycastTarget = false; return; } DisableRootText(root); SetUnusedVanillaArcCharactersInactive(root, text2.Length); if (text2.Length == 0) { return; } Vector2 sizeDelta = root.sizeDelta; if (((Vector2)(ref sizeDelta)).sqrMagnitude < 0.0001f) { ((Vector2)(ref sizeDelta))..ctor(80f, 80f); } VanillaArcGlyphLayout[] array = VanillaArcTextLayout.Build(text2, GetVanillaArcTextTrack(slot), Mathf.Abs(sizeDelta.x), Mathf.Abs(sizeDelta.y)); for (int i = 0; i < array.Length; i++) { VanillaArcGlyphLayout vanillaArcGlyphLayout = array[i]; RectTransform orCreateVanillaArcCharacter = GetOrCreateVanillaArcCharacter(root, i); TextMeshProUGUI component = ((Component)orCreateVanillaArcCharacter).GetComponent<TextMeshProUGUI>(); ((Component)orCreateVanillaArcCharacter).gameObject.SetActive(true); orCreateVanillaArcCharacter.anchoredPosition = new Vector2(vanillaArcGlyphLayout.LocalX, vanillaArcGlyphLayout.LocalY); ((Transform)orCreateVanillaArcCharacter).localRotation = Quaternion.Euler(0f, 0f, vanillaArcGlyphLayout.RotationZ); ((Transform)orCreateVanillaArcCharacter).localScale = Vector3.one; string text3 = vanillaArcGlyphLayout.Character.ToString(); if (!string.Equals(((TMP_Text)component).text, text3, StringComparison.Ordinal)) { ((TMP_Text)component).text = text3; } CopyWeightCounterTextStyle(component, color); ((TMP_Text)component).fontSize = ((TMP_Text)component).fontSize * vanillaArcGlyphLayout.FontScale; ((TMP_Text)component).alignment = (TextAlignmentOptions)514; ((Graphic)component).raycastTarget = false; ((TMP_Text)component).enableWordWrapping = false; ((TMP_Text)component).overflowMode = (TextOverflowModes)0; } } private static VanillaArcTextTrack GetVanillaArcTextTrack(VanillaArcTextSlot slot) { return slot switch { VanillaArcTextSlot.WeightInfectionInner => VanillaArcTextTrack.InfectionWeightInner, VanillaArcTextSlot.InfectionOuter => VanillaArcTextTrack.InfectionLabelOuter, _ => VanillaArcTextTrack.StaminaWeightUpper, }; } private static void DisableRootText(RectTransform root) { TextMeshProUGUI component = ((Component)root).GetComponent<TextMeshProUGUI>(); if (!((Object)(object)component == (Object)null)) { ((Behaviour)component).enabled = false; ((TMP_Text)component).text = string.Empty; } } private static RectTransform GetOrCreateVanillaArcCharacter(RectTransform root, int index) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) string text = "VanillaArcChar_" + index.ToString("00"); Transform val = ((Transform)root).Find(text); if ((Object)(object)val != (Object)null) { return (RectTransform)(object)((val is RectTransform) ? val : null); } GameObject val2 = new GameObject(text, new Type[2] { typeof(RectTransform), typeof(TextMeshProUGUI) }); val2.transform.SetParent((Transform)(object)root, false); RectTransform component = val2.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0.5f, 0.5f); component.anchorMax = new Vector2(0.5f, 0.5f); component.pivot = new Vector2(0.5f, 0.5f); component.sizeDelta = new Vector2(36f, 36f); TextMeshProUGUI component2 = val2.GetComponent<TextMeshProUGUI>(); ((Graphic)component2).raycastTarget = false; ((TMP_Text)component2).enableWordWrapping = false; ((TMP_Text)component2).overflowMode = (TextOverflowModes)0; ((TMP_Text)component2).alignment = (TextAlignmentOptions)514; return component; } private static void SetUnusedVanillaArcCharactersInactive(RectTransform root, int activeCount) { for (int i = 0; i < ((Transform)root).childCount; i++) { Transform child = ((Transform)root).GetChild(i); if (((Object)child).name.StartsWith("VanillaArcChar_", StringComparison.Ordinal) && int.TryParse(((Object)child).name.Substring("VanillaArcChar_".Length), out var result)) { ((Component)child).gameObject.SetActive(result < activeCount); } } } private static void CopyWeightCounterTextStyle(TextMeshProUGUI target, Color color) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)target == (Object)null)) { TextMeshProUGUI val = HUDManager.Instance?.weightCounter; if ((Object)(object)val != (Object)null) { ((TMP_Text)target).font = ((TMP_Text)val).font; ((TMP_Text)target).fontSharedMaterial = ((TMP_Text)val).fontSharedMaterial; ((TMP_Text)target).fontSize = ((TMP_Text)val).fontSize; ((TMP_Text)target).fontStyle = ((TMP_Text)val).fontStyle; ((TMP_Text)target).alignment = ((TMP_Text)val).alignment; ((TMP_Text)target).characterSpacing = ((TMP_Text)val).characterSpacing; ((TMP_Text)target).wordSpacing = ((TMP_Text)val).wordSpacing; ((TMP_Text)target).lineSpacing = ((TMP_Text)val).lineSpacing; } else { ((TMP_Text)target).fontSize = 16f; ((TMP_Text)target).alignment = (TextAlignmentOptions)514; } ((Graphic)target).color = color; } } private void UpdateVanillaWeightText(bool force = false) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing