using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using UnityEngine;
using UnityEngine.UI;
[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.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("SoggyEverything")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SoggyEverything")]
[assembly: AssemblyTitle("SoggyEverything")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace SoggyEverything;
[BepInPlugin("fri.ultrakill.soggyeverything", "All Is Soggy", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
private static Texture2D s_theTexture;
private static Sprite s_theSprite;
private static Dictionary<string, Sprite> s_rankImages = new Dictionary<string, Sprite>();
private void Awake()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
new Harmony("soggyeverything").PatchAll(typeof(Plugin));
string path = Assembly.GetExecutingAssembly().Location.Replace("SoggyEverything.dll", "");
string text = Path.Combine(path, "soggyeverythingassets");
AssetBundle val = AssetBundle.LoadFromFile(text);
s_theTexture = val.LoadAsset<Texture2D>("soggycattexture");
s_theSprite = val.LoadAsset<Sprite>("soggycat");
s_rankImages.Add("RankU", val.LoadAsset<Sprite>("RankU"));
s_rankImages.Add("RankSSS", val.LoadAsset<Sprite>("RankSSS"));
s_rankImages.Add("RankSS", val.LoadAsset<Sprite>("RankSS"));
s_rankImages.Add("RankS", val.LoadAsset<Sprite>("RankS"));
s_rankImages.Add("RankA", val.LoadAsset<Sprite>("RankA"));
s_rankImages.Add("RankB", val.LoadAsset<Sprite>("RankB"));
s_rankImages.Add("RankC", val.LoadAsset<Sprite>("RankC"));
s_rankImages.Add("RankD", val.LoadAsset<Sprite>("RankD"));
}
[HarmonyPatch(typeof(Projectile), "Start")]
[HarmonyPostfix]
private static void MakeSoggy(Projectile __instance)
{
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
((Renderer)((Component)__instance).gameObject.GetComponent<MeshRenderer>()).material.mainTexture = (Texture)(object)s_theTexture;
MeshRenderer val = default(MeshRenderer);
if (((Component)((Component)__instance).transform.GetChild(0)).TryGetComponent<MeshRenderer>(ref val))
{
((Renderer)val).material.mainTexture = (Texture)(object)s_theTexture;
((Renderer)val).material.color = Color.white;
((Renderer)((Component)__instance).gameObject.GetComponent<MeshRenderer>()).enabled = false;
}
}
[HarmonyPatch(typeof(RailcannonMeter), "Start")]
[HarmonyPostfix]
private static void BecomeSoggy(RailcannonMeter __instance)
{
__instance.meterBackground.sprite = s_theSprite;
Image[] meters = __instance.meters;
foreach (Image val in meters)
{
val.sprite = s_theSprite;
}
}
[HarmonyPatch(typeof(CheckPoint), "Start")]
[HarmonyPostfix]
private static void InitiateSogging(CheckPoint __instance)
{
((Renderer)__instance.graphic.GetComponent<MeshRenderer>()).material.mainTexture = (Texture)(object)s_theTexture;
}
[HarmonyPatch(typeof(StyleHUD), "Start")]
[HarmonyPostfix]
private static void StyleSog(StyleHUD __instance)
{
foreach (StyleRank rank in __instance.ranks)
{
rank.sprite = s_rankImages[((Object)rank.sprite).name];
}
}
[HarmonyPatch(typeof(Image), "OnEnable")]
[HarmonyPostfix]
private static void ReplaceLogo(Image __instance)
{
if (!(((Object)__instance.sprite).name != "logowideborderlesssmaller"))
{
__instance.sprite = s_theSprite;
}
}
}