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 Inject0rHUD v0.6.0
plugins\Inject0rHUD.dll
Decompiled 3 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Inject0rHUD.Config; using Inject0rHUD.Localization; using Inject0rHUD.Models; using Inject0rHUD.Profiles; using Inject0rHUD.Services; using Inject0rHUD.UI; using Inject0rHUD.Util; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Inject0rHUD")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+40e295c087083ea2a940e69875115ee9aee10cf7")] [assembly: AssemblyProduct("Inject0rHUD")] [assembly: AssemblyTitle("Inject0rHUD")] [assembly: AssemblyVersion("1.0.0.0")] [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 Inject0rHUD { [BepInPlugin("inject0r.Inject0rHUD", "Inject0r HUD", "0.6.0")] [BepInProcess("valheim.exe")] public sealed class Plugin : BaseUnityPlugin { public const string PluginGuid = "inject0r.Inject0rHUD"; public const string PluginName = "Inject0r HUD"; public const string PluginVersion = "0.6.0"; internal static ManualLogSource Log; private static Plugin Instance; private ModConfig _config; private ProfileService _profiles; private HudRenderer _renderer; private HudSnapshot _snapshot = HudSnapshot.Empty; private Harmony _harmony; private float _nextPoll; private float _fpsSmoothed; private readonly Dictionary<string, float> _nextErrorLog = new Dictionary<string, float>(); private static readonly HashSet<string> HoverErrorsLogged = new HashSet<string>(); internal static bool IsEditModeActive { get; private set; } internal static bool WorldHoverTimersEnabled { get { if ((Object)(object)Instance != (Object)null && Instance._config != null && Instance._config.Enabled.Value) { return Instance._config.ShowWorldHoverTimers.Value; } return false; } } internal static bool PickableHoverTimersEnabled { get { if (WorldHoverTimersEnabled) { return Instance._config.ShowPickableHoverTimers.Value; } return false; } } internal static bool PlantHoverTimersEnabled { get { if (WorldHoverTimersEnabled) { return Instance._config.ShowPlantHoverTimers.Value; } return false; } } internal static bool BeehiveHoverTimersEnabled { get { if (WorldHoverTimersEnabled) { return Instance._config.ShowBeehiveHoverTimers.Value; } return false; } } internal static bool FermenterHoverTimersEnabled { get { if (WorldHoverTimersEnabled) { return Instance._config.ShowFermenterHoverTimers.Value; } return false; } } internal static bool ProductionHoverTimersEnabled { get { if (WorldHoverTimersEnabled) { return Instance._config.ShowProductionHoverTimers.Value; } return false; } } internal static bool ProductionWholeStationHoverEnabled { get { if (ProductionHoverTimersEnabled) { return Instance._config.ShowProductionOnWholeStation.Value; } return false; } } internal static float BeehiveHoverOpacity { get { if (!((Object)(object)Instance != (Object)null) || Instance._config == null) { return 1f; } return Mathf.Clamp01(Instance._config.BeehiveHoverOpacity.Value); } } internal static float FermenterHoverOpacity { get { if (!((Object)(object)Instance != (Object)null) || Instance._config == null) { return 1f; } return Mathf.Clamp01(Instance._config.FermenterHoverOpacity.Value); } } internal static float ProductionHoverOpacity { get { if (!((Object)(object)Instance != (Object)null) || Instance._config == null) { return 1f; } return Mathf.Clamp01(Instance._config.ProductionHoverOpacity.Value); } } internal static float PickableHoverOpacity { get { if (!((Object)(object)Instance != (Object)null) || Instance._config == null) { return 1f; } return Mathf.Clamp01(Instance._config.PickableHoverOpacity.Value); } } internal static float PlantHoverOpacity { get { if (!((Object)(object)Instance != (Object)null) || Instance._config == null) { return 1f; } return Mathf.Clamp01(Instance._config.PlantHoverOpacity.Value); } } private void Awake() { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown Instance = this; Log = ((BaseUnityPlugin)this).Logger; _config = new ModConfig(((BaseUnityPlugin)this).Config); ModLocalization.Bind(_config.InterfaceLanguage); _profiles = new ProfileService(_config); _renderer = new HudRenderer(_profiles); try { _harmony = new Harmony("inject0r.Inject0rHUD"); _harmony.PatchAll(); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Failed to install local client patches: " + ex)); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"Inject0r HUD v0.6.0 loaded. Client-side only; no custom RPC, ServerSync, world writes, or character-save writes."); } private void Update() { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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_010b: Unknown result type (might be due to invalid IL or missing references) float unscaledDeltaTime = Time.unscaledDeltaTime; if (unscaledDeltaTime > 0.0001f && unscaledDeltaTime < 1f) { float num = 1f / unscaledDeltaTime; _fpsSmoothed = ((_fpsSmoothed <= 0f) ? num : Mathf.Lerp(_fpsSmoothed, num, 0.08f)); } if (_config == null || !_config.Enabled.Value) { LeaveEditMode(); _snapshot = HudSnapshot.Empty; return; } Player player = Player.m_localPlayer; if ((Object)(object)player == (Object)null) { LeaveEditMode(); _snapshot = HudSnapshot.Empty; return; } if ((int)_config.EditKey.Value != 0 && Input.GetKeyDown(_config.EditKey.Value)) { if (IsEditModeActive) { LeaveEditMode(); } else { EnterEditMode(); } } if (!IsEditModeActive && (int)_config.ToggleKey.Value != 0 && Input.GetKeyDown(_config.ToggleKey.Value)) { _config.Visible.Value = !_config.Visible.Value; } if (IsEditModeActive) { Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } float realtimeSinceStartup = Time.realtimeSinceStartup; if (realtimeSinceStartup < _nextPoll) { return; } _nextPoll = realtimeSinceStartup + Mathf.Clamp(_config.PollInterval.Value, 0.1f, 2f); List<TimerEntry> timers = new List<TimerEntry>(4); List<DurabilityEntry> durability = new List<DurabilityEntry>(12); bool inCombat = false; TryModule("CombatState", delegate { inCombat = CombatStateService.IsInCombat(player); }); bool compactCombat = _config.CompactInCombat.Value && inCombat; if (_config.ShowRestedTimer.Value) { TryModule("PositiveEffects", delegate { timers.AddRange(PositiveEffectTimerService.Read(player)); }); } if (_config.ShowDurability.Value) { TryModule("Durability", delegate { foreach (DurabilityEntry item in DurabilityService.Read(player)) { if (ShouldIncludeDurability(item, compactCombat)) { durability.Add(item); } } }); } int ping = 0; if (_config.ShowPingWidget.Value) { TryModule("Ping", delegate { ping = NetworkStatsService.GetPingMs(); }); } ShipContextEntry ship = ShipContextEntry.Empty; if (_config.ShowShipWidget.Value || IsEditModeActive) { TryModule("ShipContext", delegate { ship = ShipContextService.Read(player); }); } WorldTimeEntry worldTime = WorldTimeEntry.Empty; if (_config.ShowTimeWidget.Value || IsEditModeActive) { TryModule("WorldTime", delegate { worldTime = WorldTimeService.Read(); }); } _snapshot = new HudSnapshot(timers, durability, inCombat, Mathf.Max(0, Mathf.RoundToInt(_fpsSmoothed)), ping, ship, worldTime); } private bool ShouldIncludeDurability(DurabilityEntry entry, bool compactCombat) { if (entry == null) { return false; } if (compactCombat && entry.Slot.StartsWith("1 ", StringComparison.Ordinal)) { return false; } return _config.SmartDurability.Value switch { SmartDurabilityMode.BelowThreshold => entry.Fraction * 100f <= (float)_config.SmartDurabilityThreshold.Value, SmartDurabilityMode.CurrentItemOnly => entry.IsCurrentItem, _ => true, }; } private void LateUpdate() { if (IsEditModeActive) { Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } } private void OnGUI() { if (_config == null || _renderer == null || !_config.Enabled.Value || (!_config.Visible.Value && !IsEditModeActive) || (Object)(object)Player.m_localPlayer == (Object)null) { return; } try { _renderer.Draw(_snapshot, _config, IsEditModeActive); } catch (Exception ex) { ThrottledError("Renderer", ex); } } private void EnterEditMode() { if (!((Object)(object)Player.m_localPlayer == (Object)null) && _renderer != null) { IsEditModeActive = true; _config.Visible.Value = true; _renderer.BeginEdit(_config); Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } } private void LeaveEditMode() { if (IsEditModeActive) { try { _renderer?.EndEdit(_config); _config?.Save(); } catch (Exception ex) { ThrottledError("EditMode", ex); } IsEditModeActive = false; } } private void OnDestroy() { LeaveEditMode(); try { _renderer?.Dispose(); } catch { } try { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } catch { } _renderer = null; _snapshot = HudSnapshot.Empty; _harmony = null; if (Instance == this) { Instance = null; } } private void TryModule(string name, Action action) { try { action(); } catch (Exception ex) { ThrottledError(name, ex); } } private void ThrottledError(string module, Exception ex) { float realtimeSinceStartup = Time.realtimeSinceStartup; if (!_nextErrorLog.TryGetValue(module, out var value) || !(realtimeSinceStartup < value)) { _nextErrorLog[module] = realtimeSinceStartup + 15f; ((BaseUnityPlugin)this).Logger.LogWarning((object)("[" + module + "] non-fatal error: " + ex.GetType().Name + ": " + ex.Message)); } } internal static void LogHoverErrorOnce(string module, Exception ex) { if (Log == null) { return; } lock (HoverErrorsLogged) { if (!HoverErrorsLogged.Add(module + ":" + ex.GetType().FullName)) { return; } } Log.LogWarning((object)("[" + module + "] hover timer failed safely: " + ex.GetType().Name + ": " + ex.Message)); } } } namespace Inject0rHUD.Util { internal static class LocalizationUtil { private static bool _resolved; private static Type _localizationType; private static FieldInfo _instanceField; private static PropertyInfo _instanceProperty; private static MethodInfo _localizeMethod; private static MethodInfo _getSelectedLanguageMethod; internal static string Localize(string token, string fallback = null) { if (string.IsNullOrEmpty(token)) { return fallback ?? string.Empty; } try { object instance = GetInstance(); if (instance != null && _localizeMethod != null) { string text = _localizeMethod.Invoke(instance, new object[1] { token }) as string; if (!string.IsNullOrEmpty(text)) { return text; } } } catch { } string text2 = token.TrimStart('$'); if (!string.IsNullOrEmpty(text2)) { return text2; } return fallback ?? string.Empty; } internal static bool TryLocalize(string token, out string localized) { localized = string.Empty; if (string.IsNullOrEmpty(token)) { return false; } try { object instance = GetInstance(); if (instance == null || _localizeMethod == null) { return false; } string text = _localizeMethod.Invoke(instance, new object[1] { token }) as string; if (string.IsNullOrEmpty(text)) { return false; } string b = token.TrimStart('$'); if (string.Equals(text, token, StringComparison.Ordinal) || string.Equals(text, b, StringComparison.Ordinal)) { return false; } localized = text; return true; } catch { return false; } } internal static string GetSelectedLanguage() { try { object instance = GetInstance(); if (instance != null && _getSelectedLanguageMethod != null) { string text = _getSelectedLanguageMethod.Invoke(instance, null) as string; if (!string.IsNullOrEmpty(text)) { return text; } } } catch { } return "English"; } internal static bool IsRussian() { return string.Equals(GetSelectedLanguage(), "Russian", StringComparison.OrdinalIgnoreCase); } private static object GetInstance() { Resolve(); if (_localizationType == null) { return null; } if (_instanceField != null) { return _instanceField.GetValue(null); } if (_instanceProperty != null) { return _instanceProperty.GetValue(null, null); } return null; } private static void Resolve() { if (_resolved) { return; } _resolved = true; Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); for (int i = 0; i < assemblies.Length; i++) { if (!(_localizationType == null)) { break; } try { _localizationType = assemblies[i].GetType("Localization", throwOnError: false); } catch { } } if (!(_localizationType == null)) { _instanceField = _localizationType.GetField("instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic) ?? _localizationType.GetField("m_instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); _instanceProperty = _localizationType.GetProperty("instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic) ?? _localizationType.GetProperty("Instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); _localizeMethod = _localizationType.GetMethod("Localize", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { typeof(string) }, null); _getSelectedLanguageMethod = _localizationType.GetMethod("GetSelectedLanguage", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null); } } } internal static class ReflectionUtil { private const BindingFlags InstanceFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; private const BindingFlags StaticFlags = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; internal static FieldInfo FindInstanceField(Type type, string name) { Type type2 = type; while (type2 != null) { FieldInfo field = type2.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { return field; } type2 = type2.BaseType; } return null; } internal static FieldInfo FindStaticField(Type type, string name) { Type type2 = type; while (type2 != null) { FieldInfo field = type2.GetField(name, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { return field; } type2 = type2.BaseType; } return null; } internal static MethodInfo FindMethod(Type type, string name, params Type[] parameterTypes) { Type type2 = type; while (type2 != null) { MethodInfo method = type2.GetMethod(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, parameterTypes, null); if (method != null) { return method; } type2 = type2.BaseType; } return null; } internal static float ReadFloat(object instance, string fieldName, float fallback = 0f) { if (instance == null) { return fallback; } FieldInfo fieldInfo = FindInstanceField(instance.GetType(), fieldName); if (fieldInfo == null) { return fallback; } object value = fieldInfo.GetValue(instance); if (!(value is float)) { return fallback; } return (float)value; } internal static string ReadString(object instance, string fieldName, string fallback = "") { if (instance == null) { return fallback; } FieldInfo fieldInfo = FindInstanceField(instance.GetType(), fieldName); if (fieldInfo == null) { return fallback; } return (fieldInfo.GetValue(instance) as string) ?? fallback; } } } namespace Inject0rHUD.UI { internal sealed class HudRenderer : IDisposable { private enum EditTarget { None, Unified, Timers, Durability, Fps, Ping, Ship, Time } private enum ResizeMode { None, Move, Left, Right, Top, Bottom, TopLeft, TopRight, BottomLeft, BottomRight } private enum SettingsTab { Layout, Durability, Widgets, Profiles, Diagnostics, Language } private readonly ProfileService _profiles; private Texture2D _background; private Texture2D _barBack; private Texture2D _barGood; private Texture2D _barWarning; private Texture2D _barCritical; private Texture2D _accent; private Texture2D _editorBorder; private Texture2D _editorHandle; private GUIStyle _text; private GUIStyle _value; private GUIStyle _header; private GUIStyle _editorLabel; private GUIStyle _settingsText; private GUIStyle _settingsHeader; private GUIStyle _settingsSmall; private GUIStyle _settingsValue; private GUIStyle _widgetValue; private GUIStyle _widgetLabel; private GUIStyle _settingsToggle; private readonly Vector2[] _settingsScroll = (Vector2[])(object)new Vector2[6]; private bool _editSession; private SettingsTab _tab; private string _profileName = "My Profile"; private string _profileCode = string.Empty; private string _uiMessage = string.Empty; private EditTarget _target; private ResizeMode _resizeMode; private Vector2 _dragStart; private Rect _dragRectStart; private float _dragScaleStart; internal HudRenderer(ProfileService profiles) { _profiles = profiles; } internal void BeginEdit(ModConfig cfg) { _editSession = true; _target = EditTarget.None; _resizeMode = ResizeMode.None; } internal void EndEdit(ModConfig cfg) { _editSession = false; _target = EditTarget.None; _resizeMode = ResizeMode.None; cfg.Save(); } internal void Draw(HudSnapshot snapshot, ModConfig cfg, bool editMode) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_0038: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Invalid comparison between Unknown and I4 //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: 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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: 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_0150: 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_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0172: 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_017f: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_0334: 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_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0359: 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) if (snapshot == null || cfg == null || Event.current == null) { return; } if (editMode && !_editSession) { BeginEdit(cfg); } EnsureResources(cfg); Rect unified = BuildUnifiedRect(snapshot, cfg); Rect timers = BuildTimersRect(snapshot, cfg); Rect durability = BuildDurabilityRect(snapshot, cfg); Rect fps = BuildWidgetRect(cfg.FpsPosX.Value, cfg.FpsPosY.Value, cfg.Scale.Value); Rect ping = BuildWidgetRect(cfg.PingPosX.Value, cfg.PingPosY.Value, cfg.Scale.Value); Rect ship = BuildShipWidgetRect(cfg); Rect time = BuildTimeWidgetRect(cfg); Rect settings = (editMode ? BuildSettingsRect(cfg.SeparateBlocks.Value ? durability : unified) : Rect.zero); if (editMode) { HandleEditorInput(snapshot, cfg, settings, ref unified, ref timers, ref durability, ref fps, ref ping, ref ship, ref time); unified = BuildUnifiedRect(snapshot, cfg); timers = BuildTimersRect(snapshot, cfg); durability = BuildDurabilityRect(snapshot, cfg); fps = BuildWidgetRect(cfg.FpsPosX.Value, cfg.FpsPosY.Value, cfg.Scale.Value); ping = BuildWidgetRect(cfg.PingPosX.Value, cfg.PingPosY.Value, cfg.Scale.Value); ship = BuildShipWidgetRect(cfg); time = BuildTimeWidgetRect(cfg); settings = BuildSettingsRect(cfg.SeparateBlocks.Value ? durability : unified); DrawSettingsPanel(cfg, settings); } if ((int)Event.current.type != 7) { return; } if (cfg.SeparateBlocks.Value) { if (snapshot.Timers.Count > 0 || editMode) { DrawTimersPanel(snapshot, cfg, timers, editMode); } if (snapshot.Durability.Count > 0 || editMode) { DrawDurabilityPanel(snapshot, cfg, durability, editMode); } } else if (snapshot.Timers.Count > 0 || snapshot.Durability.Count > 0 || editMode) { DrawUnifiedPanel(snapshot, cfg, unified, editMode); } EnsureHudStyles(cfg, cfg.Scale.Value); if (cfg.ShowFpsWidget.Value || editMode) { DrawMetricWidget(fps, snapshot.Fps, "FPS", cfg.FpsShowValue.Value, cfg.FpsShowLabel.Value, cfg.FpsOpacity.Value, editMode); } if (cfg.ShowPingWidget.Value || editMode) { DrawMetricWidget(ping, snapshot.PingMs, "PING", cfg.PingShowValue.Value, cfg.PingShowLabel.Value, cfg.PingOpacity.Value, editMode); } if ((cfg.ShowShipWidget.Value && snapshot.Ship.Active) || editMode) { DrawShipWidget(ship, snapshot.Ship, cfg, editMode); } if ((cfg.ShowTimeWidget.Value && snapshot.WorldTime.Available) || editMode) { DrawTimeWidget(time, snapshot.WorldTime, cfg, editMode); } if (editMode) { if (cfg.SeparateBlocks.Value) { DrawEditorChrome(timers, ModLocalization.T("hud.timers")); DrawEditorChrome(durability, ModLocalization.T("hud.durability")); } else { DrawEditorChrome(unified, "HUD"); } DrawEditorChrome(fps, "FPS"); DrawEditorChrome(ping, "PING"); DrawEditorChrome(ship, ModLocalization.T("ship.title")); DrawEditorChrome(time, ModLocalization.T("time.title")); } } private void DrawUnifiedPanel(HudSnapshot snapshot, ModConfig cfg, Rect panel, bool editMode) { //IL_0013: 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) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) EnsureHudStyles(cfg, cfg.Scale.Value); DrawPanelBackground(panel, cfg.BackgroundOpacity.Value); float value = cfg.Scale.Value; float num = 8f * value; float num2 = 20f * value; float num3 = 23f * value; float barHeight = Mathf.Max(2f, 3f * value); float num4 = 5f * value; float num5 = ((Rect)(ref panel)).y + num; if (snapshot.Timers.Count == 0 && snapshot.Durability.Count == 0 && editMode) { GUI.Label(new Rect(((Rect)(ref panel)).x + num, num5, ((Rect)(ref panel)).width - num * 2f, 24f * value), "Inject0r HUD", _header); GUI.Label(new Rect(((Rect)(ref panel)).x + num, num5 + 24f * value, ((Rect)(ref panel)).width - num * 2f, 24f * value), ModLocalization.T("hud.drag_hint"), _text); return; } if (snapshot.Timers.Count > 0) { if (cfg.ShowSectionHeaders.Value) { DrawHeader(new Rect(((Rect)(ref panel)).x + num, num5, ((Rect)(ref panel)).width - num * 2f, num2), ModLocalization.T("hud.timers"), value); num5 += num2; } for (int i = 0; i < snapshot.Timers.Count; i++) { DrawTimerRow(((Rect)(ref panel)).x + num, num5, ((Rect)(ref panel)).width - num * 2f, num3, barHeight, snapshot.Timers[i], value); num5 += num3; } } if (snapshot.Timers.Count > 0 && snapshot.Durability.Count > 0) { num5 += num4; } if (snapshot.Durability.Count > 0) { if (cfg.ShowSectionHeaders.Value) { DrawHeader(new Rect(((Rect)(ref panel)).x + num, num5, ((Rect)(ref panel)).width - num * 2f, num2), ModLocalization.T("hud.durability"), value); num5 += num2; } for (int j = 0; j < snapshot.Durability.Count; j++) { DrawDurabilityRow(((Rect)(ref panel)).x + num, num5, ((Rect)(ref panel)).width - num * 2f, num3, barHeight, snapshot.Durability[j], value, cfg); num5 += num3; } } } private void DrawTimersPanel(HudSnapshot snapshot, ModConfig cfg, Rect panel, bool editMode) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) EnsureHudStyles(cfg, cfg.TimersScale.Value); DrawPanelBackground(panel, cfg.BackgroundOpacity.Value); float value = cfg.TimersScale.Value; float num = 8f * value; float num2 = 20f * value; float num3 = 23f * value; float barHeight = Mathf.Max(2f, 3f * value); float num4 = ((Rect)(ref panel)).y + num; if (cfg.ShowSectionHeaders.Value) { DrawHeader(new Rect(((Rect)(ref panel)).x + num, num4, ((Rect)(ref panel)).width - num * 2f, num2), ModLocalization.T("hud.timers"), value); num4 += num2; } if (snapshot.Timers.Count == 0 && editMode) { GUI.Label(new Rect(((Rect)(ref panel)).x + num, num4, ((Rect)(ref panel)).width - num * 2f, num3), ModLocalization.T("hud.no_timers"), _text); return; } for (int i = 0; i < snapshot.Timers.Count; i++) { DrawTimerRow(((Rect)(ref panel)).x + num, num4, ((Rect)(ref panel)).width - num * 2f, num3, barHeight, snapshot.Timers[i], value); num4 += num3; } } private void DrawDurabilityPanel(HudSnapshot snapshot, ModConfig cfg, Rect panel, bool editMode) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) EnsureHudStyles(cfg, cfg.DurabilityScale.Value); DrawPanelBackground(panel, cfg.BackgroundOpacity.Value); float value = cfg.DurabilityScale.Value; float num = 8f * value; float num2 = 20f * value; float num3 = 23f * value; float barHeight = Mathf.Max(2f, 3f * value); float num4 = ((Rect)(ref panel)).y + num; if (cfg.ShowSectionHeaders.Value) { DrawHeader(new Rect(((Rect)(ref panel)).x + num, num4, ((Rect)(ref panel)).width - num * 2f, num2), ModLocalization.T("hud.durability"), value); num4 += num2; } if (snapshot.Durability.Count == 0 && editMode) { GUI.Label(new Rect(((Rect)(ref panel)).x + num, num4, ((Rect)(ref panel)).width - num * 2f, num3), ModLocalization.T("hud.no_durability"), _text); return; } for (int i = 0; i < snapshot.Durability.Count; i++) { DrawDurabilityRow(((Rect)(ref panel)).x + num, num4, ((Rect)(ref panel)).width - num * 2f, num3, barHeight, snapshot.Durability[i], value, cfg); num4 += num3; } } private void DrawMetricWidget(Rect rect, int value, string label, bool showValue, bool showLabel, float opacity, bool editMode) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) if (showValue || showLabel || editMode) { DrawPanelBackground(rect, opacity); string text = ((!(label == "PING")) ? ((value > 0) ? value.ToString() : "—") : ((value > 0) ? (value + " ms") : "—")); if (showValue || editMode) { GUI.Label(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y + 7f, ((Rect)(ref rect)).width, 31f), text, _widgetValue); } if (showLabel || editMode) { GUI.Label(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y + ((Rect)(ref rect)).height - 25f, ((Rect)(ref rect)).width, 20f), label, _widgetLabel); } } } private void DrawShipWidget(Rect rect, ShipContextEntry ship, ModConfig cfg, bool editMode) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) EnsureHudStyles(cfg, cfg.Scale.Value); DrawPanelBackground(rect, cfg.ShipOpacity.Value); float value = cfg.Scale.Value; float num = 8f * value; float num2 = 20f * value; float num3 = ((Rect)(ref rect)).y + num; float num4 = ((Rect)(ref rect)).width - num * 2f; string text = ((ship != null && ship.Active && !string.IsNullOrEmpty(ship.Name)) ? ship.Name : ModLocalization.T("ship.title")); GUI.Label(new Rect(((Rect)(ref rect)).x + num, num3, num4, num2), FitText(_header, text, num4), _header); num3 += num2; if (ship == null || !ship.Active) { if (editMode) { GUI.Label(new Rect(((Rect)(ref rect)).x + num, num3, num4, num2), ModLocalization.T("ship.no_ship"), _text); } return; } if (cfg.ShipShowHealth.Value) { string value2 = ((ship.HealthFraction >= 0f) ? (Mathf.RoundToInt(ship.HealthFraction * 100f) + "%") : "—"); DrawContextLine(((Rect)(ref rect)).x + num, ref num3, num4, num2, ModLocalization.T("ship.health"), value2); } if (cfg.ShipShowSpeed.Value) { string value3 = (ship.SpeedMetersPerSecond * 1.9438446f).ToString("0.0") + " kn (" + ship.SpeedMetersPerSecond.ToString("0.0") + " m/s)"; DrawContextLine(((Rect)(ref rect)).x + num, ref num3, num4, num2, ModLocalization.T("ship.speed"), value3); } if (cfg.ShipShowWind.Value) { string value4 = Mathf.RoundToInt(ship.WindIntensity * 100f) + "% • " + FormatWindBearing(ship.WindAngleDegrees); DrawContextLine(((Rect)(ref rect)).x + num, ref num3, num4, num2, ModLocalization.T("ship.wind"), value4); } if (cfg.ShipShowSail.Value) { string text2 = FormatShipState(ship.Propulsion); if (ship.Propulsion == "Half" || ship.Propulsion == "Full") { text2 = text2 + " • " + Mathf.RoundToInt(ship.WindFactor * 100f) + "%"; } if (Mathf.Abs(ship.Rudder) >= 0.02f) { text2 = text2 + " • " + ModLocalization.T((ship.Rudder > 0f) ? "ship.rudder_right" : "ship.rudder_left", Mathf.RoundToInt(Mathf.Abs(ship.Rudder) * 100f)); } DrawContextLine(((Rect)(ref rect)).x + num, ref num3, num4, num2, ModLocalization.T("ship.state"), text2); } } private void DrawTimeWidget(Rect rect, WorldTimeEntry worldTime, ModConfig cfg, bool editMode) { //IL_0013: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_0141: 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) EnsureHudStyles(cfg, cfg.Scale.Value); DrawPanelBackground(rect, cfg.TimeOpacity.Value); float value = cfg.Scale.Value; float num = 8f * value; float num2 = 20f * value; float num3 = ((Rect)(ref rect)).y + num; float num4 = ((Rect)(ref rect)).width - num * 2f; GUI.Label(new Rect(((Rect)(ref rect)).x + num, num3, num4, num2), ModLocalization.T("time.title"), _header); num3 += num2; if (worldTime == null || !worldTime.Available) { if (editMode) { GUI.Label(new Rect(((Rect)(ref rect)).x + num, num3, num4, num2), ModLocalization.T("time.unavailable"), _text); } return; } string text = string.Empty; if (cfg.TimeShowDay.Value) { text = ModLocalization.T("time.day", worldTime.Day); } if (cfg.TimeShowClock.Value) { if (text.Length > 0) { text += " • "; } text += FormatWorldClock(worldTime.DayFraction); } if (text.Length > 0) { GUI.Label(new Rect(((Rect)(ref rect)).x + num, num3, num4, num2), FitText(_text, text, num4), _text); num3 += num2; } if (cfg.TimeShowSunEvent.Value) { bool num5 = string.Equals(worldTime.NextEvent, "sunrise", StringComparison.OrdinalIgnoreCase); string text2 = ModLocalization.T(num5 ? "time.sunrise" : "time.sunset"); string text3 = (num5 ? "06:00" : "18:00"); string text4 = text2 + " " + text3 + " • " + FormatTime(worldTime.SecondsToEvent); GUI.Label(new Rect(((Rect)(ref rect)).x + num, num3, num4, num2), FitText(_text, text4, num4), _text); } } private void DrawContextLine(float x, ref float y, float width, float lineHeight, string label, string value) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Min(width * 0.38f, Mathf.Max(58f, _text.CalcSize(new GUIContent(label)).x + 6f)); GUI.Label(new Rect(x, y, num, lineHeight), FitText(_text, label, num), _text); GUI.Label(new Rect(x + num, y, width - num, lineHeight), FitText(_value, value, width - num), _value); y += lineHeight; } private static string FormatWorldClock(float dayFraction) { int num = Mathf.FloorToInt(Mathf.Repeat(dayFraction, 1f) * 1440f + 0.5f) % 1440; int num2 = num / 60; int num3 = num % 60; return num2.ToString("00") + ":" + num3.ToString("00"); } private static string FormatShipState(string propulsion) { return propulsion switch { "Back" => ModLocalization.T("ship.state_reverse"), "Slow" => ModLocalization.T("ship.state_oars"), "Half" => ModLocalization.T("ship.state_half"), "Full" => ModLocalization.T("ship.state_full"), _ => ModLocalization.T("ship.state_idle"), }; } private static string FormatWindBearing(float angle) { float num = Mathf.Abs(angle); if (num < 7.5f) { return ModLocalization.T("ship.wind_astern"); } if (num > 172.5f) { return ModLocalization.T("ship.wind_ahead"); } string text = ModLocalization.T((angle > 0f) ? "ship.wind_starboard" : "ship.wind_port"); string text2 = ModLocalization.T((num < 67.5f) ? "ship.wind_quarter" : ((num <= 112.5f) ? "ship.wind_beam" : "ship.wind_bow")); return text + " " + text2; } private void DrawPanelBackground(Rect rect, float opacity) { //IL_0000: 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_0024: Unknown result type (might be due to invalid IL or missing references) Color color = GUI.color; GUI.color = new Color(1f, 1f, 1f, Mathf.Clamp01(opacity)); GUI.DrawTexture(rect, (Texture)(object)_background); GUI.color = color; } private void DrawHeader(Rect rect, string text, float scale) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) GUI.DrawTexture(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y + ((Rect)(ref rect)).height - 2f * scale, ((Rect)(ref rect)).width, Mathf.Max(1f, scale)), (Texture)(object)_accent); GUI.Label(rect, FitText(_header, text, ((Rect)(ref rect)).width), _header); } private void DrawTimerRow(float x, float y, float width, float rowHeight, float barHeight, TimerEntry entry, float scale) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) string text = FormatTime(entry.RemainingSeconds); float num = Mathf.Max(60f * scale, _value.CalcSize(new GUIContent(text)).x + 5f * scale); float num2 = 6f * scale; float num3 = Mathf.Max(1f, width - num - num2); GUI.Label(new Rect(x, y, num3, rowHeight - barHeight - 2f * scale), FitText(_text, entry.Name, num3), _text); GUI.Label(new Rect(x + width - num, y, num, rowHeight - barHeight - 2f * scale), text, _value); float fraction = entry.Fraction; if (fraction >= 0f) { Rect val = default(Rect); ((Rect)(ref val))..ctor(x, y + rowHeight - barHeight, width, barHeight); GUI.DrawTexture(val, (Texture)(object)_barBack); GUI.DrawTexture(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y, ((Rect)(ref val)).width * fraction, ((Rect)(ref val)).height), (Texture)(object)_accent); } } private void DrawDurabilityRow(float x, float y, float width, float rowHeight, float barHeight, DurabilityEntry entry, float scale, ModConfig cfg) { //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Expected O, but got Unknown //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) int num = Mathf.RoundToInt(entry.Fraction * 100f); string text = cfg.DurabilityDisplay.Value switch { DurabilityValueMode.Percent => num + "%", DurabilityValueMode.Both => num + "% (" + entry.Current.ToString("0") + "/" + entry.Maximum.ToString("0") + ")", _ => entry.Current.ToString("0") + "/" + entry.Maximum.ToString("0"), }; float num2 = ((cfg.ShowItemIcons.Value && (Object)(object)entry.Icon != (Object)null) ? Mathf.Min(18f * scale, rowHeight - barHeight - 3f * scale) : 0f); float num3 = ((num2 > 0f) ? (5f * scale) : 0f); float num4 = Mathf.Max((cfg.DurabilityDisplay.Value == DurabilityValueMode.Both) ? (110f * scale) : (62f * scale), _value.CalcSize(new GUIContent(text)).x + 5f * scale); float num5 = 6f * scale; float num6 = x + num2 + num3; float num7 = Mathf.Max(1f, width - num2 - num3 - num4 - num5); if (num2 > 0f) { DrawSprite(entry.Icon, new Rect(x, y + 1f * scale, num2, num2)); } GUI.Label(new Rect(num6, y, num7, rowHeight - barHeight - 2f * scale), FitText(_text, entry.Name, num7), _text); GUI.Label(new Rect(x + width - num4, y, num4, rowHeight - barHeight - 2f * scale), text, _value); Rect val = default(Rect); ((Rect)(ref val))..ctor(x, y + rowHeight - barHeight, width, barHeight); GUI.DrawTexture(val, (Texture)(object)_barBack); Texture2D val2 = _barGood; if (num <= cfg.CriticalPercent.Value) { val2 = _barCritical; } else if (num <= cfg.WarningPercent.Value) { val2 = _barWarning; } GUI.DrawTexture(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y, ((Rect)(ref val)).width * entry.Fraction, ((Rect)(ref val)).height), (Texture)(object)val2); } private static void DrawSprite(Sprite sprite, Rect rect) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)sprite == (Object)null || (Object)(object)sprite.texture == (Object)null) { return; } try { Rect textureRect = sprite.textureRect; Texture texture = (Texture)(object)sprite.texture; Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref textureRect)).x / (float)texture.width, ((Rect)(ref textureRect)).y / (float)texture.height, ((Rect)(ref textureRect)).width / (float)texture.width, ((Rect)(ref textureRect)).height / (float)texture.height); GUI.DrawTextureWithTexCoords(rect, texture, val, true); } catch { } } private Rect BuildUnifiedRect(HudSnapshot snapshot, ModConfig cfg) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) float value = cfg.Scale.Value; float num = Mathf.Max(120f, (float)cfg.PanelWidth.Value * value); float num2 = ComputePanelHeight(snapshot.Timers.Count, snapshot.Durability.Count, cfg.ShowSectionHeaders.Value, separate: false, value); return KeepOnScreen(new Rect((float)cfg.PosX.Value, (float)cfg.PosY.Value, num, num2)); } private Rect BuildTimersRect(HudSnapshot snapshot, ModConfig cfg) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) float value = cfg.TimersScale.Value; float num = Mathf.Max(120f, (float)cfg.TimersWidth.Value * value); float num2 = ComputePanelHeight(snapshot.Timers.Count, 0, cfg.ShowSectionHeaders.Value, separate: true, value); return KeepOnScreen(new Rect((float)cfg.TimersPosX.Value, (float)cfg.TimersPosY.Value, num, num2)); } private Rect BuildDurabilityRect(HudSnapshot snapshot, ModConfig cfg) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) float value = cfg.DurabilityScale.Value; float num = Mathf.Max(120f, (float)cfg.DurabilityWidth.Value * value); float num2 = ComputePanelHeight(0, snapshot.Durability.Count, cfg.ShowSectionHeaders.Value, separate: true, value); return KeepOnScreen(new Rect((float)cfg.DurabilityPosX.Value, (float)cfg.DurabilityPosY.Value, num, num2)); } private Rect BuildWidgetRect(int x, int y, float scale) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) float num = 72f * scale; float num2 = 64f * scale; return KeepOnScreen(new Rect((float)x, (float)y, num, num2)); } private Rect BuildShipWidgetRect(ModConfig cfg) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) float value = cfg.Scale.Value; return KeepOnScreen(new Rect((float)cfg.ShipPosX.Value, (float)cfg.ShipPosY.Value, 230f * value, 132f * value)); } private Rect BuildTimeWidgetRect(ModConfig cfg) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) float value = cfg.Scale.Value; return KeepOnScreen(new Rect((float)cfg.TimePosX.Value, (float)cfg.TimePosY.Value, 190f * value, 88f * value)); } private static float ComputePanelHeight(int timers, int durability, bool headers, bool separate, float scale) { float num = 8f * scale; float num2 = 20f * scale; float num3 = 23f * scale; float num4 = 5f * scale; int num5 = timers + durability; int num6 = 0; if (headers) { if (timers > 0 || separate) { num6++; } if (durability > 0 && !separate) { num6++; } } float num7 = num * 2f + (float)num5 * num3 + (float)num6 * num2; if (!separate && timers > 0 && durability > 0) { num7 += num4; } if (num5 == 0) { num7 = Mathf.Max(num7, 58f * scale); } return num7; } private Rect KeepOnScreen(Rect r) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) ((Rect)(ref r)).x = Mathf.Clamp(((Rect)(ref r)).x, 0f, Mathf.Max(0f, (float)Screen.width - ((Rect)(ref r)).width)); ((Rect)(ref r)).y = Mathf.Clamp(((Rect)(ref r)).y, 0f, Mathf.Max(0f, (float)Screen.height - ((Rect)(ref r)).height)); return r; } private Rect BuildSettingsRect(Rect anchor) { //IL_00a5: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Min(640f, (float)Screen.height - 24f); float num2 = ((Rect)(ref anchor)).xMax + 14f; if (num2 + 430f > (float)Screen.width - 12f) { num2 = ((Rect)(ref anchor)).xMin - 14f - 430f; } if (num2 < 12f) { num2 = Mathf.Max(12f, (float)Screen.width - 430f - 12f); } float num3 = Mathf.Clamp(((Rect)(ref anchor)).y, 12f, Mathf.Max(12f, (float)Screen.height - num - 12f)); return new Rect(num2, num3, 430f, num); } private void HandleEditorInput(HudSnapshot snapshot, ModConfig cfg, Rect settings, ref Rect unified, ref Rect timers, ref Rect durability, ref Rect fps, ref Rect ping, ref Rect ship, ref Rect time) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Invalid comparison between Unknown and I4 //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Invalid comparison between Unknown and I4 //IL_0023: 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_003a: 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_0048: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: 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_0135: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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_00b1: 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_0169: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_0191: 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_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_00e1: 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) Event current = Event.current; if (current == null) { return; } if ((int)current.type == 0 && current.button == 0) { if (!((Rect)(ref settings)).Contains(current.mousePosition)) { EditTarget editTarget = HitTarget(cfg, current.mousePosition, unified, timers, durability, fps, ping, ship, time); if (editTarget != EditTarget.None) { _target = editTarget; Rect rect = GetRect(editTarget, unified, timers, durability, fps, ping, ship, time); _resizeMode = (IsMetric(editTarget) ? ResizeMode.Move : HitResizeMode(rect, current.mousePosition, 8f)); _dragStart = current.mousePosition; _dragRectStart = rect; _dragScaleStart = GetTargetScale(editTarget, cfg); current.Use(); } } } else if ((int)current.type == 3 && current.button == 0 && _target != EditTarget.None) { Vector2 val = current.mousePosition - _dragStart; Rect r = _dragRectStart; if (_resizeMode == ResizeMode.Move || IsMetric(_target)) { ((Rect)(ref r)).x = ((Rect)(ref r)).x + val.x; ((Rect)(ref r)).y = ((Rect)(ref r)).y + val.y; SnapMove(ref r, cfg); } else { ApplyResize(ref r, val, cfg); } ApplyRectToConfig(_target, r, cfg); current.Use(); } else if ((int)current.type == 1 && current.button == 0 && _target != EditTarget.None) { _target = EditTarget.None; _resizeMode = ResizeMode.None; cfg.Save(); current.Use(); } } private static bool IsMetric(EditTarget target) { if (target != EditTarget.Fps && target != EditTarget.Ping && target != EditTarget.Ship) { return target == EditTarget.Time; } return true; } private EditTarget HitTarget(ModConfig cfg, Vector2 mouse, Rect unified, Rect timers, Rect durability, Rect fps, Rect ping, Rect ship, Rect time) { //IL_0000: 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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //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) //IL_0028: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_00ae: 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_0071: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) Rect val = Expanded(time, 7f); if (((Rect)(ref val)).Contains(mouse)) { return EditTarget.Time; } val = Expanded(ship, 7f); if (((Rect)(ref val)).Contains(mouse)) { return EditTarget.Ship; } val = Expanded(ping, 7f); if (((Rect)(ref val)).Contains(mouse)) { return EditTarget.Ping; } val = Expanded(fps, 7f); if (((Rect)(ref val)).Contains(mouse)) { return EditTarget.Fps; } if (cfg.SeparateBlocks.Value) { val = Expanded(durability, 7f); if (((Rect)(ref val)).Contains(mouse)) { return EditTarget.Durability; } val = Expanded(timers, 7f); if (((Rect)(ref val)).Contains(mouse)) { return EditTarget.Timers; } } else { val = Expanded(unified, 7f); if (((Rect)(ref val)).Contains(mouse)) { return EditTarget.Unified; } } return EditTarget.None; } private static Rect GetRect(EditTarget target, Rect unified, Rect timers, Rect durability, Rect fps, Rect ping, Rect ship, Rect time) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_0029: 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_002f: 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) return (Rect)(target switch { EditTarget.Timers => timers, EditTarget.Durability => durability, EditTarget.Fps => fps, EditTarget.Ping => ping, EditTarget.Ship => ship, EditTarget.Time => time, _ => unified, }); } private void ApplyResize(ref Rect rect, Vector2 delta, ModConfig cfg) { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_00d2: Unknown result type (might be due to invalid IL or missing references) bool num = _resizeMode == ResizeMode.Left || _resizeMode == ResizeMode.TopLeft || _resizeMode == ResizeMode.BottomLeft; bool flag = _resizeMode == ResizeMode.Right || _resizeMode == ResizeMode.TopRight || _resizeMode == ResizeMode.BottomRight; bool flag2 = _resizeMode == ResizeMode.Top || _resizeMode == ResizeMode.TopLeft || _resizeMode == ResizeMode.TopRight; bool flag3 = _resizeMode == ResizeMode.Bottom || _resizeMode == ResizeMode.BottomLeft || _resizeMode == ResizeMode.BottomRight; if (num) { ((Rect)(ref rect)).x = ((Rect)(ref rect)).x + delta.x; ((Rect)(ref rect)).width = ((Rect)(ref rect)).width - delta.x; } if (flag) { ((Rect)(ref rect)).width = ((Rect)(ref rect)).width + delta.x; } if (flag2 || flag3) { float num2 = (((Rect)(ref _dragRectStart)).height + (flag3 ? delta.y : (0f - delta.y))) / Mathf.Max(1f, ((Rect)(ref _dragRectStart)).height); float num3 = Mathf.Clamp(_dragScaleStart * num2, 0.7f, 1.6f); SetTargetScale(_target, cfg, num3); if (flag2) { ((Rect)(ref rect)).y = ((Rect)(ref _dragRectStart)).yMax - ((Rect)(ref _dragRectStart)).height * (num3 / Mathf.Max(0.01f, _dragScaleStart)); } } ((Rect)(ref rect)).width = Mathf.Clamp(((Rect)(ref rect)).width, 120f, Mathf.Min(900f, (float)Screen.width)); if (num) { ((Rect)(ref rect)).x = Mathf.Clamp(((Rect)(ref rect)).x, 0f, Mathf.Max(0f, (float)Screen.width - ((Rect)(ref rect)).width)); } ((Rect)(ref rect)).y = Mathf.Clamp(((Rect)(ref rect)).y, 0f, Mathf.Max(0f, (float)Screen.height - ((Rect)(ref rect)).height)); } private void ApplyRectToConfig(EditTarget target, Rect rect, ModConfig cfg) { switch (target) { case EditTarget.Timers: cfg.TimersPosX.Value = Mathf.RoundToInt(((Rect)(ref rect)).x); cfg.TimersPosY.Value = Mathf.RoundToInt(((Rect)(ref rect)).y); cfg.TimersWidth.Value = Mathf.Clamp(Mathf.RoundToInt(((Rect)(ref rect)).width / Mathf.Max(0.01f, cfg.TimersScale.Value)), 120, 720); break; case EditTarget.Durability: cfg.DurabilityPosX.Value = Mathf.RoundToInt(((Rect)(ref rect)).x); cfg.DurabilityPosY.Value = Mathf.RoundToInt(((Rect)(ref rect)).y); cfg.DurabilityWidth.Value = Mathf.Clamp(Mathf.RoundToInt(((Rect)(ref rect)).width / Mathf.Max(0.01f, cfg.DurabilityScale.Value)), 120, 720); break; case EditTarget.Fps: cfg.FpsPosX.Value = Mathf.RoundToInt(((Rect)(ref rect)).x); cfg.FpsPosY.Value = Mathf.RoundToInt(((Rect)(ref rect)).y); break; case EditTarget.Ping: cfg.PingPosX.Value = Mathf.RoundToInt(((Rect)(ref rect)).x); cfg.PingPosY.Value = Mathf.RoundToInt(((Rect)(ref rect)).y); break; case EditTarget.Ship: cfg.ShipPosX.Value = Mathf.RoundToInt(((Rect)(ref rect)).x); cfg.ShipPosY.Value = Mathf.RoundToInt(((Rect)(ref rect)).y); break; case EditTarget.Time: cfg.TimePosX.Value = Mathf.RoundToInt(((Rect)(ref rect)).x); cfg.TimePosY.Value = Mathf.RoundToInt(((Rect)(ref rect)).y); break; default: cfg.PosX.Value = Mathf.RoundToInt(((Rect)(ref rect)).x); cfg.PosY.Value = Mathf.RoundToInt(((Rect)(ref rect)).y); cfg.PanelWidth.Value = Mathf.Clamp(Mathf.RoundToInt(((Rect)(ref rect)).width / Mathf.Max(0.01f, cfg.Scale.Value)), 120, 720); break; } } private static float GetTargetScale(EditTarget target, ModConfig cfg) { return target switch { EditTarget.Timers => cfg.TimersScale.Value, EditTarget.Durability => cfg.DurabilityScale.Value, _ => cfg.Scale.Value, }; } private static void SetTargetScale(EditTarget target, ModConfig cfg, float value) { value = Mathf.Clamp(value, 0.7f, 1.6f); switch (target) { case EditTarget.Timers: cfg.TimersScale.Value = value; break; case EditTarget.Durability: cfg.DurabilityScale.Value = value; break; default: cfg.Scale.Value = value; break; } } private void SnapMove(ref Rect r, ModConfig cfg) { //IL_0010: 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_0089: 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_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) if (!cfg.SnapEnabled.Value) { r = KeepOnScreen(r); return; } float num = cfg.SnapDistance.Value; float num2 = (float)Screen.width * 0.5f; float num3 = (float)Screen.height * 0.5f; if (Mathf.Abs(((Rect)(ref r)).xMin) <= num) { ((Rect)(ref r)).x = 0f; } if (Mathf.Abs((float)Screen.width - ((Rect)(ref r)).xMax) <= num) { ((Rect)(ref r)).x = (float)Screen.width - ((Rect)(ref r)).width; } if (Mathf.Abs(((Rect)(ref r)).center.x - num2) <= num) { ((Rect)(ref r)).x = num2 - ((Rect)(ref r)).width * 0.5f; } if (Mathf.Abs(((Rect)(ref r)).yMin) <= num) { ((Rect)(ref r)).y = 0f; } if (Mathf.Abs((float)Screen.height - ((Rect)(ref r)).yMax) <= num) { ((Rect)(ref r)).y = (float)Screen.height - ((Rect)(ref r)).height; } if (Mathf.Abs(((Rect)(ref r)).center.y - num3) <= num) { ((Rect)(ref r)).y = num3 - ((Rect)(ref r)).height * 0.5f; } r = KeepOnScreen(r); } private static ResizeMode HitResizeMode(Rect r, Vector2 mouse, float edge) { //IL_0000: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) bool flag = Mathf.Abs(mouse.x - ((Rect)(ref r)).xMin) <= edge; bool flag2 = Mathf.Abs(mouse.x - ((Rect)(ref r)).xMax) <= edge; bool flag3 = Mathf.Abs(mouse.y - ((Rect)(ref r)).yMin) <= edge; bool flag4 = Mathf.Abs(mouse.y - ((Rect)(ref r)).yMax) <= edge; if (flag && flag3) { return ResizeMode.TopLeft; } if (flag2 && flag3) { return ResizeMode.TopRight; } if (flag && flag4) { return ResizeMode.BottomLeft; } if (flag2 && flag4) { return ResizeMode.BottomRight; } if (flag) { return ResizeMode.Left; } if (flag2) { return ResizeMode.Right; } if (flag3) { return ResizeMode.Top; } if (flag4) { return ResizeMode.Bottom; } return ResizeMode.Move; } private void DrawEditorChrome(Rect r, string title) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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) //IL_0119: Expected O, but got Unknown //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) float num = 2f; GUI.DrawTexture(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width, num), (Texture)(object)_editorBorder); GUI.DrawTexture(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).yMax - num, ((Rect)(ref r)).width, num), (Texture)(object)_editorBorder); GUI.DrawTexture(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, num, ((Rect)(ref r)).height), (Texture)(object)_editorBorder); GUI.DrawTexture(new Rect(((Rect)(ref r)).xMax - num, ((Rect)(ref r)).y, num, ((Rect)(ref r)).height), (Texture)(object)_editorBorder); float size = 7f; DrawHandle(((Rect)(ref r)).xMin, ((Rect)(ref r)).yMin, size); DrawHandle(((Rect)(ref r)).xMax, ((Rect)(ref r)).yMin, size); DrawHandle(((Rect)(ref r)).xMin, ((Rect)(ref r)).yMax, size); DrawHandle(((Rect)(ref r)).xMax, ((Rect)(ref r)).yMax, size); string text = title + " • F10"; Vector2 val = _editorLabel.CalcSize(new GUIContent(text)); float num2 = val.x + 12f; float num3 = val.y + 4f; float num4 = Mathf.Clamp(((Rect)(ref r)).xMax - num2, 0f, Mathf.Max(0f, (float)Screen.width - num2)); float num5 = ((((Rect)(ref r)).y >= num3 + 4f) ? (((Rect)(ref r)).y - num3 - 4f) : (((Rect)(ref r)).y + 4f)); GUI.DrawTexture(new Rect(num4, num5, num2, num3), (Texture)(object)_background); GUI.Label(new Rect(num4 + 6f, num5 + 2f, num2 - 12f, num3 - 4f), text, _editorLabel); } private void DrawHandle(float x, float y, float size) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) GUI.DrawTexture(new Rect(x - size * 0.5f, y - size * 0.5f, size, size), (Texture)(object)_editorHandle); } private void DiagLine(ref float y, float x, float w, string left, string right) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) GUI.Label(new Rect(x, y, w * 0.62f, 19f), left, _settingsText); GUI.Label(new Rect(x + w * 0.62f, y, w * 0.38f, 19f), right, _settingsValue); y += 21f; } private string ReadValheimVersion() { try { Type type = typeof(Player).Assembly.GetType("Version", throwOnError: false); if (type != null) { MethodInfo method = type.GetMethod("GetVersionString", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null); if (method != null) { object obj = method.Invoke(null, null); if (obj != null) { return obj.ToString(); } } } } catch { } return "Unknown"; } private void SyncAfterProfile(ModConfig cfg) { _uiMessage = ((_profiles != null) ? _profiles.LastMessage : string.Empty); cfg.Save(); } private static void ResetLayout(ModConfig c) { c.PosX.Value = 20; c.PosY.Value = 220; c.Scale.Value = 0.9f; c.FontSize.Value = 12; c.PanelWidth.Value = 280; c.BackgroundOpacity.Value = 0.6f; c.ShowSectionHeaders.Value = true; c.SeparateBlocks.Value = false; c.SnapEnabled.Value = true; c.SnapDistance.Value = 12; c.TimersPosX.Value = 20; c.TimersPosY.Value = 220; c.TimersWidth.Value = 250; c.TimersScale.Value = c.Scale.Value; c.DurabilityPosX.Value = 20; c.DurabilityPosY.Value = 330; c.DurabilityWidth.Value = 280; c.DurabilityScale.Value = c.Scale.Value; } private static void ResetTimers(ModConfig c) { c.ShowRestedTimer.Value = true; c.ShowPowerCooldown.Value = false; c.TimersPosX.Value = 20; c.TimersPosY.Value = 220; c.TimersWidth.Value = 250; c.TimersScale.Value = c.Scale.Value; } private static void ResetDurability(ModConfig c) { c.ShowDurability.Value = true; c.ShowItemIcons.Value = true; c.DurabilityDisplay.Value = DurabilityValueMode.Units; c.SmartDurability.Value = SmartDurabilityMode.Off; c.SmartDurabilityThreshold.Value = 35; c.WarningPercent.Value = 25; c.CriticalPercent.Value = 10; c.DurabilityScale.Value = c.Scale.Value; } private static void ResetFps(ModConfig c) { c.ShowFpsWidget.Value = false; c.FpsShowValue.Value = true; c.FpsShowLabel.Value = true; c.FpsOpacity.Value = 0.72f; c.FpsPosX.Value = 20; c.FpsPosY.Value = 80; } private static void ResetPing(ModConfig c) { c.ShowPingWidget.Value = false; c.PingShowValue.Value = true; c.PingShowLabel.Value = true; c.PingOpacity.Value = 0.72f; c.PingPosX.Value = 100; c.PingPosY.Value = 80; } private static void ResetShip(ModConfig c) { c.ShowShipWidget.Value = true; c.ShipShowHealth.Value = true; c.ShipShowSpeed.Value = true; c.ShipShowWind.Value = true; c.ShipShowSail.Value = true; c.ShipOpacity.Value = 0.72f; c.ShipPosX.Value = 20; c.ShipPosY.Value = 155; } private static void ResetTime(ModConfig c) { c.ShowTimeWidget.Value = true; c.TimeShowDay.Value = true; c.TimeShowClock.Value = true; c.TimeShowSunEvent.Value = true; c.TimeOpacity.Value = 0.72f; c.TimePosX.Value = 180; c.TimePosY.Value = 80; } private static void ResetWorldTimers(ModConfig c) { c.ShowWorldHoverTimers.Value = true; c.ShowPickableHoverTimers.Value = true; c.ShowPlantHoverTimers.Value = true; c.ShowBeehiveHoverTimers.Value = true; c.ShowFermenterHoverTimers.Value = true; c.ShowProductionHoverTimers.Value = true; c.ShowProductionOnWholeStation.Value = true; c.PickableHoverOpacity.Value = 0.95f; c.PlantHoverOpacity.Value = 0.95f; c.BeehiveHoverOpacity.Value = 0.95f; c.FermenterHoverOpacity.Value = 0.95f; c.ProductionHoverOpacity.Value = 0.95f; } private void DrawSection(ref float y, float x, float w, string text) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) GUI.Label(new Rect(x, y, w, 18f), text, _settingsHeader); y += 22f; } private float Slider(ref float y, float x, float w, string label, float value, float min, float max, string valueText) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_0044: 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_00a2: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Max(40f, w - 70f - 6f); float num2 = Mathf.Max(18f, _settingsText.CalcHeight(new GUIContent(label ?? string.Empty), num)); GUI.Label(new Rect(x, y, num, num2), label ?? string.Empty, _settingsText); GUI.Label(new Rect(x + w - 70f, y, 70f, 18f), valueText ?? string.Empty, _settingsValue); float num3 = y + num2 + 4f; float num4 = GUI.HorizontalSlider(new Rect(x, num3, w, 16f), value, min, max); y = num3 + 20f; return Mathf.Clamp(num4, min, max); } private bool Toggle(ref float y, float x, float w, bool value, string label) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) GUIStyle val = _settingsToggle ?? GUI.skin.toggle; float num = Mathf.Max(24f, val.CalcHeight(new GUIContent(label ?? string.Empty), Mathf.Max(40f, w))); bool result = GUI.Toggle(new Rect(x, y, w, num), value, label ?? string.Empty, val); y += num + 4f; return result; } private bool Button(ref float y, float x, float w, string label) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) bool result = GUI.Button(new Rect(x, y, w, 26f), label); y += 31f; return result; } private static DurabilityValueMode NextDurabilityMode(DurabilityValueMode value) { return value switch { DurabilityValueMode.Units => DurabilityValueMode.Percent, DurabilityValueMode.Percent => DurabilityValueMode.Both, _ => DurabilityValueMode.Units, }; } private static SmartDurabilityMode NextSmartMode(SmartDurabilityMode value) { return value switch { SmartDurabilityMode.Off => SmartDurabilityMode.BelowThreshold, SmartDurabilityMode.BelowThreshold => SmartDurabilityMode.CurrentItemOnly, _ => SmartDurabilityMode.Off, }; } private void EnsureHudStyles(ModConfig cfg, float scale) { //IL_003d: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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_005e: 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_0087: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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_00c3: Expected O, but got Unknown //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0132: 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_0140: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Expected O, but got Unknown //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018c: 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_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Expected O, but got Unknown //IL_01af: 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_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: 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_01f4: Expected O, but got Unknown int num = Mathf.Max(10, Mathf.RoundToInt((float)cfg.FontSize.Value * scale)); if (_text == null || _text.fontSize != num) { GUIStyle val = new GUIStyle(GUI.skin.label) { fontSize = num, alignment = (TextAnchor)3, clipping = (TextClipping)1, wordWrap = false }; val.normal.textColor = new Color(0.93f, 0.94f, 0.94f, 1f); _text = val; GUIStyle val2 = new GUIStyle(_text) { alignment = (TextAnchor)5 }; val2.normal.textColor = new Color(0.79f, 0.86f, 0.81f, 1f); _value = val2; GUIStyle val3 = new GUIStyle(_text) { fontSize = Mathf.Max(num - 1, 9), fontStyle = (FontStyle)1, alignment = (TextAnchor)3 }; val3.normal.textColor = new Color(0.55f, 0.88f, 0.61f, 1f); _header = val3; GUIStyle val4 = new GUIStyle(_text) { fontSize = Mathf.Max(num - 2, 9), fontStyle = (FontStyle)1, alignment = (TextAnchor)4 }; val4.normal.textColor = new Color(0.72f, 1f, 0.78f, 1f); _editorLabel = val4; GUIStyle val5 = new GUIStyle(_text) { fontSize = Mathf.Max(num + 4, 14), fontStyle = (FontStyle)1, alignment = (TextAnchor)4 }; val5.normal.textColor = Color.white; _widgetValue = val5; GUIStyle val6 = new GUIStyle(_text) { fontSize = Mathf.Max(num - 1, 9), alignment = (TextAnchor)4 }; val6.normal.textColor = new Color(0.55f, 0.88f, 0.61f, 1f); _widgetLabel = val6; } } private void EnsureResources(ModConfig cfg) { //IL_0026: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: 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_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0159: 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_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0174: 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_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Expected O, but got Unknown //IL_01ab: 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_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Expected O, but got Unknown //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_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Expected O, but got Unknown //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Expected O, but got Unknown //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Expected O, but got Unknown //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_background == (Object)null) { _background = MakeTexture(new Color(0.035f, 0.04f, 0.045f, 1f)); _barBack = MakeTexture(new Color(0.12f, 0.13f, 0.14f, 1f)); _barGood = MakeTexture(new Color(0.35f, 0.72f, 0.42f, 1f)); _barWarning = MakeTexture(new Color(0.95f, 0.68f, 0.18f, 1f)); _barCritical = MakeTexture(new Color(0.88f, 0.25f, 0.22f, 1f)); _accent = MakeTexture(new Color(0.48f, 0.82f, 0.55f, 1f)); _editorBorder = MakeTexture(new Color(0.65f, 0.95f, 0.7f, 1f)); _editorHandle = MakeTexture(new Color(0.88f, 1f, 0.9f, 1f)); } EnsureHudStyles(cfg, cfg.Scale.Value); if (_settingsText == null) { GUIStyle val = new GUIStyle(GUI.skin.label) { fontSize = 13, alignment = (TextAnchor)3, clipping = (TextClipping)1, wordWrap = true }; val.normal.textColor = new Color(0.93f, 0.94f, 0.94f, 1f); _settingsText = val; GUIStyle val2 = new GUIStyle(_settingsText) { fontSize = 14, fontStyle = (FontStyle)1 }; val2.normal.textColor = new Color(0.55f, 0.88f, 0.61f, 1f); _settingsHeader = val2; GUIStyle val3 = new GUIStyle(_settingsText) { fontSize = 11, wordWrap = true }; val3.normal.textColor = new Color(0.78f, 0.82f, 0.8f, 1f); _settingsSmall = val3; GUIStyle val4 = new GUIStyle(_settingsText) { alignment = (TextAnchor)5 }; val4.normal.textColor = new Color(0.72f, 1f, 0.78f, 1f); _settingsValue = val4; _settingsToggle = new GUIStyle(GUI.skin.toggle) { fontSize = 13, wordWrap = true, alignment = (TextAnchor)3 }; _settingsToggle.normal.textColor = new Color(0.93f, 0.94f, 0.94f, 1f); _settingsToggle.hover.textColor = Color.white; _settingsToggle.active.textColor = Color.white; _settingsToggle.focused.textColor = Color.white; } } private static string FitText(GUIStyle style, string text, float maxWidth) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0020: 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_003f: Expected O, but got Unknown //IL_003a: 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_007f: Expected O, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) if (style == null || string.IsNullOrEmpty(text) || maxWidth <= 2f) { return string.Empty; } if (style.CalcSize(new GUIContent(text)).x <= maxWidth) { return text; } if (style.CalcSize(new GUIContent("…")).x > maxWidth) { return string.Empty; } int num = 0; int num2 = text.Length; while (num < num2) { int num3 = (num + num2 + 1) / 2; string text2 = text.Substring(0, num3) + "…"; if (style.CalcSize(new GUIContent(text2)).x <= maxWidth) { num = num3; } else { num2 = num3 - 1; } } return text.Substring(0, num) + "…"; } private static string FormatTime(float seconds) { if (seconds < 0f) { seconds = 0f; } int num = Mathf.CeilToInt(seconds); int num2 = num / 3600; int num3 = num % 3600 / 60; int num4 = num % 60; if (num2 <= 0) { return num3 + ":" + num4.ToString("00"); } return num2 + ":" + num3.ToString("00") + ":" + num4.ToString("00"); } private static Rect Expanded(Rect r, float amount) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) return new Rect(((Rect)(ref r)).x - amount, ((Rect)(ref r)).y - amount, ((Rect)(ref r)).width + amount * 2f, ((Rect)(ref r)).height + amount * 2f); } private static Texture2D MakeTexture(Color color) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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) //IL_002e: Expected O, but got Unknown Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false) { name = "Inject0rHUD_RuntimeTexture", hideFlags = (HideFlags)61 }; val.SetPixel(0, 0, color); val.Apply(false, true); return val; } public void Dispose() { DestroyTexture(_background); DestroyTexture(_barBack); DestroyTexture(_barGood); DestroyTexture(_barWarning); DestroyTexture(_barCritical); DestroyTexture(_accent); DestroyTexture(_editorBorder); DestroyTexture(_editorHandle); } private static void DestroyTexture(Texture2D texture) { if ((Object)(object)texture != (Object)null) { Object.Destroy((Object)(object)texture); } } private void DrawSettingsPanel(ModConfig cfg, Rect rect) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015a: 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_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) Color color = GUI.color; GUI.color = new Color(1f, 1f, 1f, 0.96f); GUI.DrawTexture(rect, (Texture)(object)_background); GUI.color = color; GUI.DrawTexture(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width, 2f), (Texture)(object)_editorBorder); float num = ((Rect)(ref rect)).x + 14f; float num2 = ((Rect)(ref rect)).y + 10f; float num3 = ((Rect)(ref rect)).width - 28f; GUI.Label(new Rect(num, num2, num3, 24f), ModLocalization.T("settings.title"), _settingsHeader); num2 += 31f; DrawTabs(ref num2, num, num3); float num4 = 52f; Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref rect)).x + 8f, num2, ((Rect)(ref rect)).width - 16f, Mathf.Max(80f, ((Rect)(ref rect)).yMax - num4 - num2)); int num5 = Mathf.Clamp((int)_tab, 0, _settingsScroll.Length - 1); float settingsContentHeight = GetSettingsContentHeight(_tab); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(0f, 0f, Mathf.Max(100f, ((Rect)(ref val)).width - 20f), settingsContentHeight); _settingsScroll[num5] = GUI.BeginScrollView(val, _settingsScroll[num5], val2); float x = 8f; float y = 5f; float w = Mathf.Max(80f, ((Rect)(ref val2)).width - 16f); switch (_tab) { case SettingsTab.Durability: DrawDurabilitySettings(ref y, x, w, cfg); break; case SettingsTab.Widgets: DrawWidgetSettings(ref y, x, w, cfg); break; case SettingsTab.Profiles: DrawProfileSettings(ref y, x, w, cfg); break; case SettingsTab.Diagnostics: DrawDiagnostics(ref y, x, w, cfg); break; case SettingsTab.Language: DrawLanguageSettings(ref y, x, w, cfg); break; default: DrawLayoutSettings(ref y, x, w, cfg); break; } GUI.EndScrollView(); string text = ((!string.IsNullOrEmpty(_uiMessage)) ? _uiMessage : ((_profiles != null) ? _profiles.LastMessage : string.Empty)); if (!string.IsNullOrEmpty(text)) { GUI.Label(new Rect(num, ((Rect)(ref rect)).yMax - 46f, num3, 18f), FitText(_settingsSmall, text, num3), _settingsSmall); } GUI.Label(new Rect(num, ((Rect)(ref rect)).yMax - 25f, num3, 18f), ModLocalization.T("settings.footer"), _settingsSmall); } private static float GetSettingsContentHeight(SettingsTab tab) { return tab switch { SettingsTab.Durability => 650f, SettingsTab.Widgets => 1900f, SettingsTab.Profiles => 650f, SettingsTab.Diagnostics => 560f, SettingsTab.Language => 430f, _ => 760f, }; } private void DrawTabs(ref float y, float x, float width) { //IL_009a: Unknown result type (might be due to invalid IL or missing references) string[] array = new string[6] { ModLocalization.T("tab.layout"), ModLocalization.T("tab.durability"), ModLocalization.T("tab.widgets"), ModLocalization.T("tab.profiles"), ModLocalization.T("tab.diagnostics"), ModLocalization.T("tab.language") }; float num = 3f; float num2 = (width - num * (float)(array.Length - 1)) / (float)array.Length; for (int i = 0; i < array.Length; i++) { string text = FitText(GUI.skin.button, array[i], num2 - 6f); if (GUI.Button(new Rect(x + (float)i * (num2 + num), y, num2, 25f), text)) { _tab = (SettingsTab)i; } } y += 32f; } private void DrawLayoutSettings(ref float y, float x, float w, ModConfig cfg) { DrawSection(ref y, x, w, ModLocalization.T("section.layout")); cfg.BackgroundOpacity.Value = Slider(ref y, x, w, ModLocalization.T("layout.background_opacity"), cfg.BackgroundOpacity.Value, 0f, 1f, Mathf.RoundToInt(cfg.BackgroundOpacity.Value * 100f) + "%"); cfg.Scale.Value = Slider(ref y, x, w, ModLocalization.T("layout.scale"), cfg.Scale.Value, 0.7f, 1.6f, Mathf.RoundToInt(cfg.Scale.Value * 100f) + "%"); float num = Slider(ref y, x, w, ModLocalization.T("layout.text_size"), cfg.FontSize.Value, 10f, 24f, cfg.FontSize.Value.ToString()); cfg.FontSize.Value = Mathf.Clamp(Mathf.RoundToInt(num), 10, 24); cfg.ShowSectionHeaders.Value = Toggle(ref y, x, w, cfg.ShowSectionHeaders.Value, ModLocalization.T("layout.section_headers")); cfg.SeparateBlocks.Value = Toggle(ref y, x, w, cfg.SeparateBlocks.Value, ModLocalization.T("layout.separate_blocks")); if (cfg.SeparateBlocks.Value) { cfg.TimersScale.Value = Slider(ref y, x, w, ModLocalization.T("layout.timers_scale"), cfg.TimersScale.Value, 0.7f, 1.6f, Mathf.RoundToInt(cfg.TimersScale.Value * 100f) + "%"); cfg.DurabilityScale.Value = Slider(ref y, x, w, ModLocalization.T("layout.durability_scale"), cfg.DurabilityScale.Value, 0.7f, 1.6f, Mathf.RoundToInt(cfg.DurabilityScale.Value * 100f) + "%"); } cfg.SnapEnabled.Value = Toggle(ref y, x, w, cfg.SnapEnabled.Value, ModLocalization.T("layout.snap")); GUI.enabled = cfg.SnapEnabled.Value; float num2 = Slider(ref y, x, w, ModLocalization.T("layout.snap_distance"), cfg.SnapDistance.Value, 4f, 40f, cfg.SnapDistance.Value + " px"); cfg.SnapDistance.Value = Mathf.RoundToInt(num2); GUI.enabled = true; cfg.CompactInCombat.Value = Toggle(ref y, x, w, cfg.CompactInCombat.Value, ModLocalization.T("layout.compact_combat")); y += 6f; if (Button(ref y, x, w, ModLocalization.T("layout.reset"))) { ResetLayout(cfg); } } private void DrawDurabilitySettings(ref float y, float x, float w, ModConfig cfg) { DrawSection(ref y, x, w, ModLocalization.T("section.durability")); cfg.ShowDurability.Value = Toggle(ref y, x, w, cfg.ShowDurability.Value, ModLocalization.T("durability.show")); GUI.enabled = cfg.ShowDurability.Value; cfg.ShowItemIcons.Value = Toggle(ref y, x, w, cfg.ShowItemIcons.Value, ModLocalization.T("durability.icons")); string text = cfg.DurabilityDisplay.Value switch { DurabilityValueMode.Percent => ModLocalization.T("durability.percent"), DurabilityValueMode.Both => ModLocalization.T("durability.both"), _ => ModLocalization.T("durability.units"), }; if (Button(ref y, x, w, ModLocalization.T("durability.format", text))) { cfg.DurabilityDisplay.Value = NextDurabilityMode(cfg.DurabilityDisplay.Value); } string text2 = cfg.SmartDurability.Value switch { SmartDurabilityMode.BelowThreshold => ModLocalization.T("durability.smart_below"), SmartDurabilityMode.CurrentItemOnly => ModLocalization.T("durability.smart_current"), _ => ModLocalization.T("durability.smart_off"), }; if (Button(ref y, x, w, ModLocalization.T("durability.smart", text2))) { cfg.SmartDurability.Value = NextSmartMode(cfg.SmartDurability.Value); } if (cfg.SmartDurability.Value == SmartDurabilityMode.BelowThreshold) { float num = Slider(ref y, x, w, ModLocalization.T("durability.show_below"), cfg.SmartDurabilityThreshold.Value, 1f, 99f, cfg.SmartDurabilityThreshold.Value + "%"); cfg.SmartDurabilityThreshold.Value = Mathf.RoundToInt(num); } float num2 = Slider(ref y, x, w, ModLocalization.T("durability.warning"), cfg.WarningPercent.Value, 1f, 99f, cfg.WarningPercent.Value + "%"); float num3 = Slider(ref y, x, w, ModLocalization.T("durability.critical"), cfg.CriticalPercent.Value, 1f, 99f, cfg.CriticalPercent.Value + "%"); cfg.WarningPercent.Value = Mathf.RoundToInt(num2); cfg.CriticalPercent.Value = Mathf.RoundToInt(num3); GUI.enabled = true; y += 6f; if (Button(ref y, x, w, ModLocalization.T("durability.reset"))) { ResetDurability(cfg); } } private void DrawWidgetSettings(ref float y, float x, float w, ModConfig cfg) { DrawSection(ref y, x, w, ModLocalization.T("section.hud_timers")); cfg.ShowRestedTimer.Value = Toggle(ref y, x, w, cfg.ShowRestedTimer.Value, ModLocalization.T("timers.positive")); if (Button(ref y, x, w, ModLocalization.T("timers.reset"))) { ResetTimers(cfg); } y += 4f; DrawSection(ref y, x, w, "FPS"); cfg.ShowFpsWidget.Value = Toggle(ref y, x, w, cfg.ShowFpsWidget.Value, ModLocalization.T("fps.show")); GUI.enabled = cfg.ShowFpsWidget.Value; cfg.FpsShowValue.Value = Toggle(ref y, x, w, cfg.FpsShowValue.Value, ModLocalization.T("fps.value")); cfg.FpsShowLabel.Value = Toggle(ref y, x, w, cfg.FpsShowLabel.Value, ModLocalization.T("fps.label")); cfg.FpsOpacity.Value = Slider(ref y, x, w, ModLocalization.T("fps.opacity"), cfg.FpsOpacity.Value, 0.1f, 1f, Mathf.RoundToInt(cfg.FpsOpacity.Value * 100f) + "%"); GUI.enabled = true; if (Button(ref y, x, w, ModLocalization.T("fps.reset"))) { ResetFps(cfg); } y += 5f; DrawSection(ref y, x, w, "PING"); cfg.ShowPingWidget.Value = Toggle(ref y, x, w, cfg.ShowPingWidget.Value, ModLocalization.T("ping.show")); GUI.enabled = cfg.ShowPingWidget.Value; cfg.PingShowValue.Value = Toggle(ref y, x, w, cfg.PingShowValue.Value, ModLocalization.T("ping.value")); cfg.PingShowLabel.Value = Toggle(ref y, x, w, cfg.PingShowLabel.Value, ModLocalization.T("ping.label")); cfg.PingOpacity.Value = Slider(ref y, x, w, ModLocalization.T("ping.opacity"), cfg.PingOpacity.Value, 0.1f, 1f, Mathf.RoundToInt(cfg.PingOpacity.Value * 100f) + "%"); GUI.enabled = true; if (Button(ref y, x, w, ModLocalization.T("ping.reset"))) { ResetPing(cfg); } y += 5f; DrawSection(ref y, x, w, ModLocalization.T("section.ship_widget")); cfg.ShowShipWidget.Value = Toggle(ref y, x, w, cfg.ShowShipWidget.Value, ModLocalization.T("ship.show")); GUI.enabled = cfg.ShowShipWidget.Value; cfg.ShipShowHealth.Value = Toggle(ref y, x, w, cfg.ShipShowHealth.Value, ModLocalization.T("ship.show_health")); cfg.ShipShowSpeed.Value = Toggle(ref y, x, w, cfg.ShipShowSpeed.Value, ModLocalization.T("ship.show_speed")); cfg.ShipShowWind.Value = Toggle(ref y, x, w, cfg.ShipShowWind.Value, ModLocalization.T("ship.show_wind")); cfg.ShipShowSail.Value = Toggle(ref y, x, w, cfg.ShipShowSail.Value, ModLocalization.T("ship.show_sail")); cfg.ShipOpacity.Value = Slider(ref y, x, w, ModLocalization.T("ship.opacity"), cfg.ShipOpacity.Value, 0.1f, 1f, Mathf.RoundToInt(cfg.ShipOpacity.Value * 100f) + "%"); GUI.enabled = true; if (Button(ref y, x, w, ModLocalization.T("ship.reset"))) { ResetShip(cfg); } y += 5f; DrawSection(ref y, x, w, ModLocalization.T("section.time_widget")); cfg.ShowTimeWidget.Value = Toggle(ref y, x, w, cfg.ShowTimeWidget.Value, ModLocalization.T("time.show")); GUI.enabled = cfg.ShowTimeWidget.Value; cfg.TimeShowDay.Value = Toggle(ref y, x, w, cfg.TimeShowDay.Value, ModLocalization.T("time.show_day")); cfg.TimeShowClock.Value = Toggle(ref y, x, w, cfg.TimeShowClock.Value, ModLocalization.T("time.show_clock")); cfg.TimeShowSunEvent.Value = Toggle(ref y, x, w, cfg.TimeShowSunEvent.Value, ModLocalization.T("time.show_sun")); cfg.TimeOpacity.Value = Slider(ref y, x, w, ModLocalization.T("time.opacity"), cfg.TimeOpacity.Value, 0.1f, 1f, Mathf.RoundToInt(cfg.TimeOpacity.Value * 100f) + "%"); GUI.enabled = true; if (Button(ref y, x, w, ModLocalization.T("time.reset"))) { ResetTime(cfg); } y += 5f; DrawSection(ref y, x, w, ModLocalization.T("section.world_timers")); cfg.ShowWorldHoverTimers.Value = Toggle(ref y, x, w,