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 CompactStatusSquares v0.2.3
CompactStatusSquares.dll
Decompiled a week agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.2.3")] [assembly: AssemblyInformationalVersion("0.2.3+bf4adb4956af910070c7099b49de6d9fafc48927")] [assembly: AssemblyVersion("0.2.3.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 CompactStatusSquares { [BepInPlugin("cjayride.CompactStatusSquares", "Compact Status Squares", "0.2.3")] [BepInProcess("valheim.exe")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string Guid = "cjayride.CompactStatusSquares"; public const string Name = "Compact Status Squares"; public const string Version = "0.2.3"; public static ManualLogSource Log; public static ConfigEntry<bool> EnabledIcons; public static ConfigEntry<ScreenCorner> Corner; public static ConfigEntry<float> OffsetX; public static ConfigEntry<float> OffsetY; public static ConfigEntry<float> IconSize; public static ConfigEntry<int> Columns; public static ConfigEntry<float> Spacing; public static ConfigEntry<bool> ShowTimer; public static ConfigEntry<float> TextScale; public static ConfigEntry<StatusNameSide> ShowName; public static ConfigEntry<float> NameGap; public static ConfigEntry<bool> FillPreview; public static ConfigEntry<bool> UseVanillaFont; public static ConfigEntry<bool> CrispPixels; public static ConfigEntry<Color> Background; private readonly Harmony _harmony = new Harmony("cjayride.CompactStatusSquares"); public static Plugin Instance { get; private set; } public void Awake() { //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Expected O, but got Unknown //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Expected O, but got Unknown //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Expected O, but got Unknown //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Expected O, but got Unknown //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Expected O, but got Unknown //IL_0283: Unknown result type (might be due to invalid IL or missing references) Instance = this; Log = ((BaseUnityPlugin)this).Logger; EnabledIcons = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Draw the small status squares and keep SeneaL UI from drawing its status pills."); Corner = ((BaseUnityPlugin)this).Config.Bind<ScreenCorner>("Layout", "Corner", ScreenCorner.TopRight, "Screen corner the first icon sits in. Extra icons flow away from that corner."); OffsetX = ((BaseUnityPlugin)this).Config.Bind<float>("Layout", "OffsetX", -18f, "Horizontal distance from the chosen corner, in pixels. Negative moves left."); OffsetY = ((BaseUnityPlugin)this).Config.Bind<float>("Layout", "OffsetY", -18f, "Vertical distance from the chosen corner, in pixels. Negative moves down."); IconSize = ((BaseUnityPlugin)this).Config.Bind<float>("Layout", "IconSize", 50f, new ConfigDescription("Width and height of each square.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(16f, 96f), Array.Empty<object>())); Columns = ((BaseUnityPlugin)this).Config.Bind<int>("Layout", "Columns", 1, new ConfigDescription("Icons per row before wrapping. 1 is a vertical stack.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 16), Array.Empty<object>())); Spacing = ((BaseUnityPlugin)this).Config.Bind<float>("Layout", "Spacing", 5.616f, new ConfigDescription("Gap between squares.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 32f), Array.Empty<object>())); ShowTimer = ((BaseUnityPlugin)this).Config.Bind<bool>("Layout", "ShowTimer", true, "Draw the remaining time or comfort number on the square."); TextScale = ((BaseUnityPlugin)this).Config.Bind<float>("Layout", "TextScale", 0.83f, new ConfigDescription("Size of timers, comfort numbers, and optional status names. 1 is the original size.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.4f, 3f), Array.Empty<object>())); ShowName = ((BaseUnityPlugin)this).Config.Bind<StatusNameSide>("Layout", "ShowName", StatusNameSide.Bottom, "Draw the localized status name next to the icon: Off, Left, Right, Top, or Bottom."); NameGap = ((BaseUnityPlugin)this).Config.Bind<float>("Layout", "NameGap", 1.731f, new ConfigDescription("Pixels between the icon edge and the status name. Raise this if a name covers the comfort number on the square.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 120f), Array.Empty<object>())); FillPreview = ((BaseUnityPlugin)this).Config.Bind<bool>("Layout", "FillPreview", false, "Fill the bar with sample squares, including a comfort number, so the layout can be checked with no status effects. Turn this off when you are done testing."); UseVanillaFont = ((BaseUnityPlugin)this).Config.Bind<bool>("Layout", "UseVanillaFont", false, "Use Valheim's Norse font for timers and names. Off uses the compact UI font."); CrispPixels = ((BaseUnityPlugin)this).Config.Bind<bool>("Layout", "CrispPixels", true, "Point-filter the vanilla icon art so the squares stay sharp instead of soft and blurry."); Background = ((BaseUnityPlugin)this).Config.Bind<Color>("Layout", "Background", new Color(2f / 51f, 3f / 85f, 0.03137255f, 0.81960785f), "Color of the square behind each icon."); _harmony.PatchAll(typeof(VanillaStatusListGuard)); SenealStatusGuard.Patch(_harmony); ((Component)this).gameObject.AddComponent<StatusSquaresHud>(); Log.LogInfo((object)"Compact Status Squares 0.2.3 loaded."); } public void OnDestroy() { _harmony.UnpatchAll("cjayride.CompactStatusSquares"); StatusSquaresHud.RestoreFilteredTextures(); } } public enum StatusNameSide { Off, Left, Right, Top, Bottom } public enum ScreenCorner { TopRight, TopLeft, BottomRight, BottomLeft } [HarmonyPatch(typeof(Hud), "UpdateStatusEffects")] internal static class VanillaStatusListGuard { private static bool Prefix() { return !Plugin.EnabledIcons.Value; } } internal static class SenealStatusGuard { private static FieldInfo _statusField; private static FieldInfo _boxField; private static GameObject _box; private static float _nextScan; public static bool Installed { get; private set; } public static void Patch(Harmony harmony) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown Type type = AccessTools.TypeByName("SeneaLUI.Hud.StatusEffectsView"); MethodInfo methodInfo = ((type == null) ? null : AccessTools.Method(type, "Tick", (Type[])null, (Type[])null)); if (methodInfo == null) { Plugin.Log.LogInfo((object)"SeneaL UI status panel was not found. Squares will still replace the vanilla list."); return; } Installed = true; harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(SenealStatusGuard), "BlockTick", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); _statusField = AccessTools.Field(AccessTools.TypeByName("SeneaLUI.Hud.HudRoot"), "_status"); Plugin.Log.LogInfo((object)"SeneaL UI status pills blocked. Compact Status Squares owns that slot."); } private static bool BlockTick() { return !Plugin.EnabledIcons.Value; } public static void HideLeftoverPanel() { if (!Plugin.EnabledIcons.Value || _statusField == null || (Object)(object)Hud.instance == (Object)null) { return; } if (Object.op_Implicit((Object)(object)_box)) { if (_box.activeSelf) { _box.SetActive(false); } } else { if (Time.unscaledTime < _nextScan) { return; } _nextScan = Time.unscaledTime + 2f; object value = _statusField.GetValue(null); if (value == null) { return; } Object val = (Object)((value is Object) ? value : null); if (val != null && !Object.op_Implicit(val)) { return; } if (_boxField == null) { _boxField = AccessTools.Field(value.GetType(), "_box"); } object? obj = _boxField?.GetValue(value); Component val2 = (Component)((obj is Component) ? obj : null); if (Object.op_Implicit((Object)(object)val2)) { _box = val2.gameObject; if ((Object)(object)_box != (Object)null && _box.activeSelf) { _box.SetActive(false); } } } } public static void ForgetBox() { _box = null; _nextScan = 0f; } } public class StatusSquaresHud : MonoBehaviour { private struct DrawItem { public string Name; public string Time; public Sprite Icon; public Color Tint; } private static readonly Dictionary<Texture, FilterMode> Filtered = new Dictionary<Texture, FilterMode>(); private static readonly Dictionary<string, string> Localized = new Dictionary<string, string>(); private static readonly string[] PreviewNames = new string[5] { "Megingjord", "Fire", "Shelter", "Resting Comfort", "Rested" }; private static readonly string[] PreviewTimes = new string[5] { "", "", "", "16", "" }; private static readonly Color[] PreviewTints = (Color[])(object)new Color[5] { new Color(0.75f, 0.62f, 0.28f), new Color(0.85f, 0.35f, 0.2f), new Color(0.45f, 0.7f, 0.4f), new Color(0.85f, 0.75f, 0.45f), new Color(0.55f, 0.7f, 0.85f) }; private readonly List<StatusEffect> _effects = new List<StatusEffect>(16); private readonly List<DrawItem> _draw = new List<DrawItem>(16); private Texture2D _pixel; private GUIStyle _label; private GUIStyle _tipStyle; private bool _hidVanilla; private bool _vanillaWasActive; private bool _loggedDraw; private string _skip; private string _lastSkip; private string _hover; private float _size; private int _columns; private float _stepX; private float _stepY; private bool _right; private bool _top; private Color _backColor; private void Awake() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) _pixel = new Texture2D(1, 1, (TextureFormat)4, false); _pixel.SetPixel(0, 0, Color.white); _pixel.Apply(); ((Object)_pixel).hideFlags = (HideFlags)61; if ((Object)(object)Plugin.Instance != (Object)null) { ((BaseUnityPlugin)Plugin.Instance).Config.SettingChanged += OnConfigChanged; } } private void OnDestroy() { if ((Object)(object)Plugin.Instance != (Object)null) { ((BaseUnityPlugin)Plugin.Instance).Config.SettingChanged -= OnConfigChanged; } } private void OnConfigChanged(object sender, EventArgs e) { Localized.Clear(); _loggedDraw = false; _lastSkip = null; SenealStatusGuard.ForgetBox(); } private void LateUpdate() { //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) ApplyVanillaRoot(); if (SenealStatusGuard.Installed) { SenealStatusGuard.HideLeftoverPanel(); } _draw.Clear(); _skip = WhyHidden(); if (_skip != null) { LogSkip(_skip); return; } RefreshLayoutCache(); bool flag = ((int)(Time.unscaledTime * 5f) & 1) == 1; _effects.Clear(); ((Character)Player.m_localPlayer).GetSEMan().GetHUDStatusEffects(_effects); for (int i = 0; i < _effects.Count; i++) { StatusEffect val = _effects[i]; if (!((Object)(object)val == (Object)null) && !((Object)(object)val.m_icon == (Object)null)) { _draw.Add(new DrawItem { Name = LocalName(val.m_name), Time = (Plugin.ShowTimer.Value ? val.GetIconText() : null), Icon = val.m_icon, Tint = (Color)((val.m_flashIcon && flag) ? new Color(1f, 0.45f, 0.45f, 1f) : Color.white) }); ApplyFilter(val.m_icon); } } if (Plugin.FillPreview.Value) { int num = Mathf.Max(PreviewNames.Length, _columns); int num2 = num % _columns; if (num2 != 0) { num += _columns - num2; } for (int j = 0; j < num; j++) { int num3 = j % PreviewNames.Length; _draw.Add(new DrawItem { Name = PreviewNames[num3], Time = PreviewTimes[num3], Icon = null, Tint = PreviewTints[num3] }); } } if (_draw.Count == 0) { LogSkip((_effects.Count == 0) ? "no HUD status effects on the player" : (_effects.Count + " HUD effect(s) had no icons")); } else if (!_loggedDraw) { _loggedDraw = true; _lastSkip = null; Plugin.Log.LogInfo((object)("Drawing " + _draw.Count + " status square(s) with OnGUI.")); } } private string WhyHidden() { if (!Plugin.EnabledIcons.Value) { return "Enabled is false"; } if ((Object)(object)Player.m_localPlayer == (Object)null) { return "no local player yet"; } if ((Object)(object)Hud.instance == (Object)null) { return "Hud is not ready"; } if (!Hud.instance.IsVisible()) { return "vanilla HUD is hidden"; } if (((Character)Player.m_localPlayer).IsDead()) { return "player is dead"; } if (((Character)Player.m_localPlayer).IsTeleporting()) { return "player is teleporting"; } return null; } private void LogSkip(string reason) { if (!(_lastSkip == reason)) { _lastSkip = reason; Plugin.Log.LogInfo((object)("Status squares not drawn: " + reason + ".")); } } private void OnGUI() { //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_0251: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Expected O, but got Unknown //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_027f: 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) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0144: 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_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) if (_draw.Count == 0) { return; } EnsureStyles(); _hover = null; Vector2 mousePosition = Event.current.mousePosition; StatusNameSide value = Plugin.ShowName.Value; Rect val = default(Rect); for (int i = 0; i < _draw.Count; i++) { int num = i % _columns; int num2 = i / _columns; float num3 = (_right ? ((float)Screen.width - _size + Plugin.OffsetX.Value - (float)num * _stepX) : (Plugin.OffsetX.Value + (float)num * _stepX)); float num4 = (_top ? (0f - Plugin.OffsetY.Value + (float)num2 * _stepY) : ((float)Screen.height - _size + Plugin.OffsetY.Value - (float)num2 * _stepY)); ((Rect)(ref val))..ctor(num3, num4, _size, _size); DrawItem drawItem = _draw[i]; GUI.color = _backColor; GUI.DrawTexture(val, (Texture)(object)_pixel); GUI.color = drawItem.Tint; if ((Object)(object)drawItem.Icon != (Object)null) { DrawSprite(Inset(val, 3f), drawItem.Icon); } else { GUI.DrawTexture(Inset(val, 3f), (Texture)(object)_pixel); } GUI.color = Color.white; if (Plugin.ShowTimer.Value && !string.IsNullOrEmpty(drawItem.Time)) { GUI.Label(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).yMax - 16f, ((Rect)(ref val)).width, 16f), drawItem.Time, _label); } if (value != StatusNameSide.Off && !string.IsNullOrEmpty(drawItem.Name)) { GUI.Label(NameRect(val, value), drawItem.Name, _label); } if (((Rect)(ref val)).Contains(mousePosition)) { _hover = (string.IsNullOrEmpty(drawItem.Time) ? drawItem.Name : (drawItem.Name + " " + drawItem.Time)); } } if (!string.IsNullOrEmpty(_hover)) { Vector2 val2 = _tipStyle.CalcSize(new GUIContent(_hover)); Rect val3 = default(Rect); ((Rect)(ref val3))..ctor(mousePosition.x - val2.x - 12f, mousePosition.y + 16f, val2.x + 16f, val2.y + 8f); GUI.color = new Color(0.05f, 0.04f, 0.035f, 0.92f); GUI.DrawTexture(val3, (Texture)(object)_pixel); GUI.color = Color.white; GUI.Label(new Rect(((Rect)(ref val3)).x + 8f, ((Rect)(ref val3)).y, ((Rect)(ref val3)).width - 8f, ((Rect)(ref val3)).height), _hover, _tipStyle); } } private void EnsureStyles() { //IL_0014: 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_0043: 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_0056: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown //IL_00c6: Unknown result type (might be due to invalid IL or missing references) if (_label == null) { _label = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)7, fontSize = Mathf.Clamp(Mathf.RoundToInt(12f * Plugin.TextScale.Value), 8, 36), fontStyle = (FontStyle)1, clipping = (TextClipping)0 }; _label.normal.textColor = Color.white; _tipStyle = new GUIStyle(_label) { alignment = (TextAnchor)3, fontSize = Mathf.Clamp(Mathf.RoundToInt(14f * Plugin.TextScale.Value), 10, 40) }; _tipStyle.normal.textColor = new Color(0.95f, 0.9f, 0.78f, 1f); } } private void RefreshLayoutCache() { //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) _size = Mathf.Clamp(Plugin.IconSize.Value, 16f, 96f); _columns = Mathf.Clamp(Plugin.Columns.Value, 1, 16); float num = Mathf.Max(0f, Plugin.Spacing.Value); _stepX = _size + num; StatusNameSide value = Plugin.ShowName.Value; float num2 = 0f; if (value == StatusNameSide.Top || value == StatusNameSide.Bottom) { num2 = Mathf.Max(10f, 14f * Plugin.TextScale.Value) + Mathf.Max(0f, Plugin.NameGap.Value); } _stepY = _stepX + num2; ScreenCorner value2 = Plugin.Corner.Value; _right = value2 == ScreenCorner.TopRight || value2 == ScreenCorner.BottomRight; _top = value2 == ScreenCorner.TopRight || value2 == ScreenCorner.TopLeft; _backColor = Plugin.Background.Value; } private static Rect NameRect(Rect box, StatusNameSide side) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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_00d1: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Max(0f, Plugin.NameGap.Value); return (Rect)(side switch { StatusNameSide.Left => new Rect(((Rect)(ref box)).x - 260f - num, ((Rect)(ref box)).y, 260f, ((Rect)(ref box)).height), StatusNameSide.Right => new Rect(((Rect)(ref box)).xMax + num, ((Rect)(ref box)).y, 260f, ((Rect)(ref box)).height), StatusNameSide.Top => new Rect(((Rect)(ref box)).x - 80f, ((Rect)(ref box)).y - 18f - num, ((Rect)(ref box)).width + 160f, 18f), _ => new Rect(((Rect)(ref box)).x - 80f, ((Rect)(ref box)).yMax + num, ((Rect)(ref box)).width + 160f, 18f), }); } private static Rect Inset(Rect box, float pad) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) return new Rect(((Rect)(ref box)).x + pad, ((Rect)(ref box)).y + pad, ((Rect)(ref box)).width - pad * 2f, ((Rect)(ref box)).height - pad * 2f); } private static void DrawSprite(Rect box, Sprite sprite) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) Texture2D texture = sprite.texture; if (!((Object)(object)texture == (Object)null)) { Rect textureRect = sprite.textureRect; Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref textureRect)).x / (float)((Texture)texture).width, ((Rect)(ref textureRect)).y / (float)((Texture)texture).height, ((Rect)(ref textureRect)).width / (float)((Texture)texture).width, ((Rect)(ref textureRect)).height / (float)((Texture)texture).height); GUI.DrawTextureWithTexCoords(box, (Texture)(object)texture, val); } } private void ApplyVanillaRoot() { Hud instance = Hud.instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance.m_statusEffectListRoot == (Object)null) { return; } GameObject gameObject = ((Component)instance.m_statusEffectListRoot).gameObject; if (Plugin.EnabledIcons.Value) { if (!_hidVanilla) { _vanillaWasActive = gameObject.activeSelf; _hidVanilla = true; } if (gameObject.activeSelf) { gameObject.SetActive(false); } } else if (_hidVanilla) { gameObject.SetActive(_vanillaWasActive); _hidVanilla = false; } } private static void ApplyFilter(Sprite sprite) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) if (Plugin.CrispPixels.Value && !((Object)(object)sprite == (Object)null) && !((Object)(object)sprite.texture == (Object)null)) { Texture2D texture = sprite.texture; if (!Filtered.ContainsKey((Texture)(object)texture)) { Filtered[(Texture)(object)texture] = ((Texture)texture).filterMode; ((Texture)texture).filterMode = (FilterMode)0; } } } public static void RestoreFilteredTextures() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) foreach (KeyValuePair<Texture, FilterMode> item in Filtered) { if ((Object)(object)item.Key != (Object)null) { item.Key.filterMode = item.Value; } } Filtered.Clear(); } private static string LocalName(string key) { if (string.IsNullOrEmpty(key)) { return key; } if (Localized.TryGetValue(key, out var value)) { return value; } string text = ((Localization.instance != null) ? Localization.instance.Localize(key) : key); Localized[key] = text; return text; } } }