using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("UltrakillGDIcons")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("UltrakillGDIcons")]
[assembly: AssemblyTitle("UltrakillGDIcons")]
[assembly: AssemblyVersion("1.0.0.0")]
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 UltrakillGDIcons
{
[BepInPlugin("maxthetomas-ultrakill-gd-icons", "Ultrakill GD Icons", "1.0")]
public class UltrakillIcons : BaseUnityPlugin
{
private AssetBundle bundle;
public static Texture2D Auto;
public static Texture2D Easy;
public static Texture2D Normal;
public static Texture2D Hard;
public static Texture2D Harder;
public static Texture2D Insane;
public static Texture2D EasyDemon;
public static Texture2D MediumDemon;
public static Texture2D HardDemon;
public static Texture2D InsaneDemon;
public static Texture2D ExtremeDemon;
public static Texture2D Unrated;
public static GameObject Prefab;
private void Awake()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
new Harmony("maxthetomas-ultrakill-gd-icons").PatchAll();
LoadAssets();
}
private void LoadAssets()
{
Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("UltrakillGDIcons.gdicons");
bundle = AssetBundle.LoadFromStream(manifestResourceStream);
Auto = GetDifficulty("Auto");
Easy = GetDifficulty("Easy");
Normal = GetDifficulty("Normal");
Hard = GetDifficulty("Hard");
Harder = GetDifficulty("Harder");
Insane = GetDifficulty("Insane");
EasyDemon = GetDifficulty("EasyDemon");
MediumDemon = GetDifficulty("MediumDemon");
HardDemon = GetDifficulty("Demon");
InsaneDemon = GetDifficulty("InsaneDemon");
ExtremeDemon = GetDifficulty("ExtremeDemon");
Unrated = GetDifficulty("Unrated");
Prefab = bundle.LoadAsset<GameObject>("Assets/GD/Prefab.prefab");
}
public Texture2D GetDifficulty(string name)
{
return bundle.LoadAsset<Texture2D>("Assets/GD/" + name + ".png");
}
public static Texture2D GetImageForLevel(int mission)
{
return (Texture2D)(mission switch
{
1 => Easy,
2 => Normal,
3 => Normal,
4 => Hard,
5 => Hard,
6 => Easy,
7 => Hard,
8 => Hard,
9 => EasyDemon,
10 => Hard,
11 => Hard,
12 => Hard,
13 => Harder,
14 => Harder,
15 => EasyDemon,
16 => Hard,
17 => Harder,
18 => Hard,
19 => MediumDemon,
20 => Harder,
21 => Insane,
22 => Insane,
23 => Harder,
24 => Insane,
25 => MediumDemon,
26 => Insane,
27 => EasyDemon,
28 => MediumDemon,
29 => MediumDemon,
667 => HardDemon,
668 => InsaneDemon,
_ => Unrated,
});
}
public static Texture2D GetImageForSecretLevel(int mission)
{
return (Texture2D)(mission switch
{
0 => Insane,
1 => Auto,
2 => Auto,
4 => InsaneDemon,
5 => Easy,
7 => Unrated,
8 => Unrated,
_ => Unrated,
});
}
public static Image CreateNewImage(RectTransform parent)
{
return Object.Instantiate<GameObject>(Prefab, (Transform)(object)parent).GetComponent<Image>();
}
}
[HarmonyPatch(typeof(LevelSelectPanel))]
[HarmonyPatch("OnEnable")]
public static class LevelSelectPanelPatch_Enable
{
public static void Postfix(LevelSelectPanel __instance)
{
//IL_0050: 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_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: 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_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)((Component)((Component)__instance).transform.Find("Image")).GetComponent<Image>().sprite == (Object)(object)__instance.lockedSprite))
{
Image val = UltrakillIcons.CreateNewImage(((Component)((Component)__instance).transform.Find("Stats/Rank")).GetComponent<RectTransform>());
Sprite sprite = val.sprite;
((Component)val).transform.localScale = Vector3.one * 1.25f;
((Component)val).transform.localPosition = new Vector3(-10f, 10f);
if (__instance.levelNumber == 666)
{
((Component)val).transform.localPosition = new Vector3(155f, 10f, 0f);
val.sprite = Sprite.Create(UltrakillIcons.GetImageForLevel(__instance.levelNumber + __instance.levelNumberInLayer), sprite.rect, sprite.pivot);
}
else
{
val.sprite = Sprite.Create(UltrakillIcons.GetImageForLevel(__instance.levelNumber), sprite.rect, sprite.pivot);
}
((Graphic)val).canvas.sortingOrder = 2;
}
}
}
[HarmonyPatch(typeof(SecretMissionPanel))]
[HarmonyPatch("OnEnable")]
public static class SecretMissionPanelPatch
{
public static void Postfix(SecretMissionPanel __instance)
{
//IL_003d: 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_0058: 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_0081: Unknown result type (might be due to invalid IL or missing references)
if (GameProgressSaver.GetSecretMission(__instance.missionNumber) > 0)
{
Image obj = UltrakillIcons.CreateNewImage(((Component)((Component)__instance).transform.Find("")).GetComponent<RectTransform>());
Sprite sprite = obj.sprite;
obj.sprite = Sprite.Create(UltrakillIcons.GetImageForSecretLevel(__instance.missionNumber), sprite.rect, sprite.pivot);
((Component)obj).transform.localScale = Vector3.one * 1.25f;
((Component)obj).transform.localPosition = new Vector3(-10f, -45f, 0f);
((Graphic)obj).canvas.sortingOrder = 2;
}
}
}
}