using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;
using UnityEngine.Localization;
using UnityEngine.Rendering;
using Zorro.Settings;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("PeakPyrophobia")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+7237c60a94975f8ce252f39e0e3af731e32e4170")]
[assembly: AssemblyProduct("PeakPyrophobia")]
[assembly: AssemblyTitle("PeakPyrophobia")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
}
namespace PeakPyrophobia
{
public class Patches
{
[HarmonyPostfix]
[HarmonyPatch(typeof(GameHandler), "Awake")]
internal static void GameHandlerAwakePatch(GameHandler __instance)
{
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Invalid comparison between Unknown and I4
if (SettingsHandler.Instance == null)
{
return;
}
PyrophobiaSetting setting = __instance.SettingsHandler.GetSetting<PyrophobiaSetting>();
if (setting == null)
{
int num = 14;
List<string> list = new List<string>();
for (int i = 0; i < num; i++)
{
list.Add("Pyrophobia Mode");
}
if (!LocalizedText.mainTable.TryGetValue("PYROPHOBIAMODE", out var _))
{
LocalizedText.mainTable.Add("PYROPHOBIAMODE", list);
}
SettingsHandler.Instance.AddSetting((Setting)(object)new PyrophobiaSetting());
PyrophobiaSetting setting2 = SettingsHandler.Instance.GetSetting<PyrophobiaSetting>();
if (setting2 == null || (int)((EnumSetting<OffOnMode>)(object)setting2).Value == 0)
{
ThemeManager.RestoreAll();
}
else
{
ThemeManager.ApplyTheme((Plugin.Instance._themeConfig.Value == "Blue") ? ThemeId.Blue : ThemeId.Green);
}
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(PlayerTrackParticles), "Start")]
internal static void PlayerTrackParticlesStartPatch(PlayerTrackParticles __instance)
{
if (!(((Object)__instance).name != "Lava ash"))
{
ThemeManager.RegisterIfRenderer((Component)(object)__instance, new Dictionary<string, Func<object, ThemeId, object>> { ["_Color"] = delegate(object t, ThemeId theme)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
Material val = (Material)((t is Material) ? t : null);
return theme switch
{
ThemeId.Blue => (object)new Color(0.01f, 0.01f, 5f, 1f),
ThemeId.Green => (object)new Color(0f, 1f, 0f, 1f),
_ => val.GetColor("_Color"),
};
} });
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(Lava), "Start")]
internal static void LavaStartPatch(Lava __instance)
{
ThemeManager.RegisterIfRenderer((Component)(object)__instance);
}
[HarmonyPostfix]
[HarmonyPatch(typeof(LavaPost), "Start")]
internal static void LavaPostStartPatch(LavaPost __instance)
{
ThemeManager.RegisterIfRenderer((Component)(object)__instance);
}
[HarmonyPostfix]
[HarmonyPatch(typeof(EruptionSpawner), "Start")]
internal static void EruptionSpawnerStartPatch(EruptionSpawner __instance)
{
Transform comp = __instance.eruption.transform.Find("VFX");
ThemeManager.RegisterIfRenderer((Component)(object)comp);
Transform comp2 = __instance.eruption.transform.Find("Particle System");
ThemeManager.RegisterIfRenderer((Component)(object)comp2, new Dictionary<string, Func<object, ThemeId, object>>
{
["_A_Remap"] = (object m, ThemeId t) => (object)new Color(0f, 0f, 0f, 0f),
["_C_Remap"] = (object m, ThemeId t) => (object)new Color(0f, 0f, 0f, 0f),
["_C_Remap2"] = (object m, ThemeId t) => (object)new Color(0f, 0f, 0f, 0f),
["_Color2"] = delegate(object t, ThemeId theme)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
Material val = (Material)((t is Material) ? t : null);
return theme switch
{
ThemeId.Blue => (object)new Color(0.2275f, 0.6825f, 2.2751f, 0.05f),
ThemeId.Green => (object)new Color(0.2275f, 2.2751f, 0.6825f, 0.05f),
_ => val.GetColor("_Color2"),
};
}
});
}
[HarmonyPostfix]
[HarmonyPatch(typeof(MapHandler), "Start")]
internal static void MapHandlerStartPatch(MapHandler __instance)
{
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Expected O, but got Unknown
MapSegment val = ((IEnumerable<MapSegment>)__instance.segments).FirstOrDefault((Func<MapSegment, bool>)((MapSegment s) => ((Object)s.segmentParent).name.Contains("Volcano")));
if (val != null)
{
Transform val2 = val._segmentParent.transform.Find("Middle/Magma");
if ((Object)(object)val2 != (Object)null)
{
foreach (Transform item in ((Component)val2).transform)
{
Transform val3 = item;
if (((Object)val3).name.Contains("MagmaRock"))
{
Transform val4 = val3.Find("Rock");
if ((Object)(object)val4 != (Object)null)
{
ThemeManager.RegisterIfRenderer((Component)(object)val4);
}
Transform val5 = val3.Find("Sphere");
if ((Object)(object)val5 != (Object)null)
{
ThemeManager.RegisterIfRenderer((Component)(object)val5);
}
}
}
}
}
LavaRiver[] array = Object.FindObjectsByType<LavaRiver>((FindObjectsInactive)1, (FindObjectsSortMode)0);
LavaRiver[] array2 = array;
foreach (LavaRiver val6 in array2)
{
Renderer componentInChildren = ((Component)val6).GetComponentInChildren<Renderer>();
if ((Object)(object)componentInChildren != (Object)null)
{
ThemeManager.Register(componentInChildren.material);
}
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(Campfire), "Awake")]
internal static void CampfireAwakePatch(Campfire __instance)
{
ThemeManager.RegisterIfRenderer((Component)(object)__instance.fireParticles, new Dictionary<string, Func<object, ThemeId, object>>
{
["_AlphaRemap"] = (object m, ThemeId t) => (object)new Color(0f, 1f, 0f, 0f),
["_Color"] = delegate(object t, ThemeId theme)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
Material val = (Material)((t is Material) ? t : null);
return theme switch
{
ThemeId.Blue => (object)new Color(0f, 1f, 20f, 1f),
ThemeId.Green => (object)new Color(0f, 10f, 0f, 1f),
_ => val.GetColor("_Color"),
};
},
["_DepthFadeSmoothstep"] = (object m, ThemeId t) => Vector4.zero,
["_Glow"] = (object m, ThemeId t) => 10f,
["_BackgroundGlow"] = (object m, ThemeId t) => 0f,
["_Opacity"] = (object m, ThemeId t) => 1f,
["_Roundness"] = (object m, ThemeId t) => 10f,
["_RoundnessExp"] = (object m, ThemeId t) => 10f
});
}
[HarmonyPostfix]
[HarmonyPatch(typeof(GUIManager), "Start")]
internal static void GUIManagerStartPatch(GUIManager __instance)
{
ThemeManager.Register(__instance.hotSVFX.renderer.material, new Dictionary<string, Func<object, ThemeId, object>>
{
["_DistortScroll"] = (object m, ThemeId t) => Color.clear,
["_ScrollSpeed"] = (object m, ThemeId t) => 0f
});
}
[HarmonyPostfix]
[HarmonyPatch(typeof(Lantern), "Start")]
internal static void LanternStartPatch(Lantern __instance)
{
ThemeManager.RegisterIfRenderer((Component)(object)__instance.fireParticle, new Dictionary<string, Func<object, ThemeId, object>>
{
["_AlphaRemap"] = (object m, ThemeId t) => (object)new Color(0f, 1f, 0f, 0f),
["_Color"] = delegate(object t, ThemeId theme)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
Material val = (Material)((t is Material) ? t : null);
return theme switch
{
ThemeId.Blue => (object)new Color(0f, 1f, 20f, 1f),
ThemeId.Green => (object)new Color(0f, 10f, 0f, 1f),
_ => val.GetColor("_Color"),
};
},
["_DepthFadeSmoothstep"] = (object m, ThemeId t) => Vector4.zero,
["_Glow"] = (object m, ThemeId t) => 10f,
["_BackgroundGlow"] = (object m, ThemeId t) => 0f,
["_Opacity"] = (object m, ThemeId t) => 1f,
["_Roundness"] = (object m, ThemeId t) => 10f,
["_RoundnessExp"] = (object m, ThemeId t) => 10f
});
}
[HarmonyPostfix]
[HarmonyPatch(typeof(SpecialDayZone), "Start")]
internal static void SpecialDayZoneStartPatch(SpecialDayZone __instance)
{
if (((Object)__instance).name.Contains("Volcano") || ((Object)__instance).name.Contains("Caldera"))
{
ThemeManager.Register((Component)(object)__instance);
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(CharacterAfflictions), "Awake")]
internal static void CharacterAfflictionsAwakePatch(CharacterAfflictions __instance)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Invalid comparison between Unknown and I4
if (__instance.character.IsLocal)
{
PyrophobiaSetting setting = SettingsHandler.Instance.GetSetting<PyrophobiaSetting>();
if (setting == null || (int)((EnumSetting<OffOnMode>)(object)setting).Value == 0)
{
__instance.injuryFire.settings.pitch = 1f;
}
else
{
__instance.injuryFire.settings.pitch = 5f;
}
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(Character), "Awake")]
internal static void CharacterAwakePatch(Character __instance)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Invalid comparison between Unknown and I4
if (__instance.IsLocal)
{
PyrophobiaSetting setting = SettingsHandler.Instance.GetSetting<PyrophobiaSetting>();
if (setting != null && (int)((EnumSetting<OffOnMode>)(object)setting).Value != 0)
{
ThemeManager.ApplyTheme((Plugin.Instance._themeConfig.Value == "Blue") ? ThemeId.Blue : ThemeId.Green);
}
}
}
}
[BepInPlugin("com.snosz.peakpyrophobia", "PeakPyrophobia", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
public static Plugin Instance;
private static Harmony _harmony;
public ConfigEntry<string> _themeConfig;
private void Awake()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Expected O, but got Unknown
Instance = this;
_harmony = new Harmony("com.snosz.peakpyrophobia");
_themeConfig = ((BaseUnityPlugin)this).Config.Bind<string>("General", "Theme", "Blue", new ConfigDescription("Theme to use for pyro related materials when Pyrophobia mode is enabled", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[2] { "Blue", "Green" }), Array.Empty<object>()));
_themeConfig.SettingChanged += delegate
{
PyrophobiaSetting setting = SettingsHandler.Instance.GetSetting<PyrophobiaSetting>();
if (setting != null)
{
string value = _themeConfig.Value;
string text = value;
if (!(text == "Blue"))
{
if (text == "Green")
{
ThemeManager.ApplyTheme(ThemeId.Green);
}
}
else
{
ThemeManager.ApplyTheme(ThemeId.Blue);
}
}
};
ApplyPatches();
}
private void ApplyPatches()
{
if (_harmony != null)
{
_harmony.PatchAll(typeof(Patches));
}
}
private void OnDestroy()
{
_harmony.UnpatchSelf();
ThemeManager.RestoreAll();
}
}
public class PyrophobiaSetting : CustomLocalizedOffOnSetting, IExposedSetting, IConditionalSetting
{
public override void ApplyValue()
{
}
protected override OffOnMode GetDefaultValue()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return (OffOnMode)0;
}
public override List<LocalizedString> GetLocalizedChoices()
{
return null;
}
public string GetDisplayName()
{
return "PYROPHOBIAMODE";
}
public string GetCategory()
{
return "Accessibility";
}
public bool ShouldShow()
{
return !PhotonNetwork.InRoom;
}
}
public enum ThemeId
{
Default,
Blue,
Green
}
public class ThemeEntry
{
public Material Material;
public Component Component;
public string ComponentProperty;
public Dictionary<string, Func<object, ThemeId, object>> Overrides = new Dictionary<string, Func<object, ThemeId, object>>();
public Dictionary<string, object> OriginalValues = new Dictionary<string, object>();
}
public static class ThemeManager
{
private static readonly List<ThemeEntry> _registered = new List<ThemeEntry>();
private static ThemeId _activeTheme = ThemeId.Blue;
public static void Register(Material mat, Dictionary<string, Func<object, ThemeId, object>>? overrides = null)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Invalid comparison between Unknown and I4
PyrophobiaSetting setting = SettingsHandler.Instance.GetSetting<PyrophobiaSetting>();
if (setting != null && (int)((EnumSetting<OffOnMode>)(object)setting).Value != 0)
{
if (overrides == null)
{
overrides = new Dictionary<string, Func<object, ThemeId, object>>();
}
ThemeEntry themeEntry = new ThemeEntry
{
Material = mat,
Overrides = overrides
};
_registered.Add(themeEntry);
ApplyEntry(themeEntry);
}
}
public static void Register(Component comp, Dictionary<string, Func<object, ThemeId, object>>? overrides = null)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Invalid comparison between Unknown and I4
PyrophobiaSetting setting = SettingsHandler.Instance.GetSetting<PyrophobiaSetting>();
if (setting != null && (int)((EnumSetting<OffOnMode>)(object)setting).Value != 0)
{
if (overrides == null)
{
overrides = new Dictionary<string, Func<object, ThemeId, object>>();
}
ThemeEntry themeEntry = new ThemeEntry
{
Component = comp,
Overrides = overrides
};
_registered.Add(themeEntry);
ApplyEntry(themeEntry);
}
}
public static void RegisterIfRenderer(Component comp, Dictionary<string, Func<object, ThemeId, object>>? overrides = null)
{
if (!((Object)(object)comp == (Object)null))
{
Renderer componentInChildren = comp.GetComponentInChildren<Renderer>(true);
if ((Object)(object)componentInChildren != (Object)null)
{
Register(componentInChildren.material, overrides);
}
}
}
public static ThemeId GetTheme()
{
return _activeTheme;
}
public static void ApplyTheme(ThemeId theme)
{
_activeTheme = theme;
foreach (ThemeEntry item in _registered)
{
ApplyEntry(item);
if ((Object)(object)item.Material != (Object)null)
{
HueShiftDefaults(item);
}
if ((Object)(object)item.Component != (Object)null)
{
HueShiftComponentColors(item);
}
}
}
private static void ApplyEntry(ThemeEntry entry)
{
object obj = ((object)entry.Material) ?? ((object)entry.Component);
if (obj == null)
{
return;
}
foreach (KeyValuePair<string, Func<object, ThemeId, object>> @override in entry.Overrides)
{
string key = @override.Key;
CacheOriginal(entry, obj, key);
ApplyValue(obj, key, @override.Value(obj, _activeTheme));
}
}
private static void HueShiftDefaults(ThemeEntry entry)
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: 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_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
Material material = entry.Material;
int propertyCount = material.shader.GetPropertyCount();
for (int i = 0; i < propertyCount; i++)
{
string propertyName = material.shader.GetPropertyName(i);
if (!entry.Overrides.ContainsKey(propertyName))
{
ShaderPropertyType propertyType = material.shader.GetPropertyType(i);
if ((int)propertyType == 0 && IsCommonColorProperty(propertyName))
{
CacheOriginal(entry, material, propertyName);
Color orig = (Color)entry.OriginalValues[propertyName];
material.SetColor(propertyName, HueShift(orig, _activeTheme));
}
}
}
}
private static bool IsCommonColorProperty(string prop)
{
string text = prop.ToLower();
return text.Contains("color");
}
private static void CacheOriginal(ThemeEntry entry, object target, string prop)
{
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Expected I4, but got Unknown
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
if (entry.OriginalValues.ContainsKey(prop))
{
return;
}
Material val = (Material)((target is Material) ? target : null);
if (val != null)
{
int num = val.shader.FindPropertyIndex(prop);
if (num >= 0)
{
ShaderPropertyType propertyType = val.shader.GetPropertyType(num);
Dictionary<string, object> originalValues = entry.OriginalValues;
if (1 == 0)
{
}
object value = (int)propertyType switch
{
0 => val.GetColor(prop),
1 => val.GetVector(prop),
2 => val.GetFloat(prop),
3 => val.GetFloat(prop),
_ => null,
};
if (1 == 0)
{
}
originalValues[prop] = value;
}
return;
}
PropertyInfo property = target.GetType().GetProperty(prop);
if (property != null)
{
entry.OriginalValues[prop] = property.GetValue(target);
return;
}
FieldInfo field = target.GetType().GetField(prop);
if (field != null)
{
entry.OriginalValues[prop] = field.GetValue(target);
}
}
private static void ApplyValue(object target, string prop, object value)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
Material val = (Material)((target is Material) ? target : null);
if (val != null)
{
if (!(value is Color val2))
{
if (!(value is float num))
{
if (!(value is Vector4 val3))
{
Texture val4 = (Texture)((value is Texture) ? value : null);
if (val4 != null)
{
val.SetTexture(prop, val4);
}
}
else
{
val.SetVector(prop, val3);
}
}
else
{
val.SetFloat(prop, num);
}
}
else
{
val.SetColor(prop, val2);
}
return;
}
PropertyInfo property = target.GetType().GetProperty(prop);
if (property != null)
{
property.SetValue(target, value);
return;
}
FieldInfo field = target.GetType().GetField(prop);
if (field != null)
{
field.SetValue(target, value);
}
}
private static Color HueShift(Color orig, ThemeId theme)
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: 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_0025: 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_002b: 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_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: 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_0050: 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_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
switch (theme)
{
case ThemeId.Blue:
{
Vector3 hueDir2 = Normalize(new Vector3(0.1f, 0.3f, 1f));
return RemapColor(orig, hueDir2);
}
case ThemeId.Green:
{
Vector3 hueDir = Normalize(new Vector3(0.1f, 1f, 0.3f));
return RemapColor(orig, hueDir);
}
default:
return orig;
}
}
private static void HueShiftComponentColors(ThemeEntry entry)
{
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: 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_018f: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: Unknown result type (might be due to invalid IL or missing references)
//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)entry.Component == (Object)null)
{
return;
}
Component component = entry.Component;
Type type = ((object)component).GetType();
FieldInfo[] fields = type.GetFields();
foreach (FieldInfo fieldInfo in fields)
{
if (!(fieldInfo.FieldType != typeof(Color)) && fieldInfo.Name.ToLower().Contains("color") && !entry.Overrides.ContainsKey(fieldInfo.Name))
{
CacheOriginal(entry, component, fieldInfo.Name);
Color orig = (Color)entry.OriginalValues[fieldInfo.Name];
fieldInfo.SetValue(component, HueShift(orig, _activeTheme));
}
}
PropertyInfo[] properties = type.GetProperties();
foreach (PropertyInfo propertyInfo in properties)
{
if (!(propertyInfo.PropertyType != typeof(Color)) && propertyInfo.Name.ToLower().Contains("color") && propertyInfo.CanWrite && !entry.Overrides.ContainsKey(propertyInfo.Name))
{
CacheOriginal(entry, component, propertyInfo.Name);
Color orig2 = (Color)entry.OriginalValues[propertyInfo.Name];
propertyInfo.SetValue(component, HueShift(orig2, _activeTheme));
}
}
}
private static Color RemapColor(Color original, Vector3 hueDir)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//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_0032: Unknown result type (might be due to invalid IL or missing references)
float num = Lum(original);
float a = original.a;
Vector3 val = hueDir * num;
return new Color(val.x, val.y, val.z, a);
}
private static float Lum(Color c)
{
//IL_0000: 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_0019: Unknown result type (might be due to invalid IL or missing references)
return c.r * 0.2126f + c.g * 0.7152f + c.b * 0.0722f;
}
private static Vector3 Normalize(Vector3 v)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: 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_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
float num = Mathf.Max(v.x, Mathf.Max(v.y, v.z));
return (num > 0f) ? (v / num) : Vector3.zero;
}
public static void RestoreAll()
{
foreach (ThemeEntry item in _registered)
{
object obj = ((object)item.Material) ?? ((object)item.Component);
if (obj == null)
{
continue;
}
foreach (KeyValuePair<string, object> originalValue in item.OriginalValues)
{
ApplyValue(obj, originalValue.Key, originalValue.Value);
}
}
}
public static void ClearRegistered()
{
_registered.Clear();
}
public static void RestoreAndClearRegistered()
{
RestoreAll();
_registered.Clear();
}
}
}