Decompiled source of Ghurklasian style title v1.0.0

ghurklasiantitles.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ghurklasiantitles")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ghurklasiantitles")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a3e24298-2e01-435a-9285-73e6d762e540")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ghurklasiantitles;

[BepInPlugin("ghurklasian.style.title", "Ghurklasian Titles", "1.0.0")]
public class Class1 : BaseUnityPlugin
{
	public const string GUID = "ghurklasian.style.title";

	public const string Name = "Ghurklasian Titles";

	public const string Version = "1.0.0";

	public static string modPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));

	public static string titlePath = Path.Combine(modPath, "Titles");

	public static Texture2D tex = new Texture2D(2, 2);

	public static Texture2D tex_d = new Texture2D(2, 2);

	public static Sprite sprite_d;

	public static Texture2D tex_c = new Texture2D(2, 2);

	public static Sprite sprice_c;

	public static Sprite sprice_b;

	public static Texture2D tex_b = new Texture2D(2, 2);

	public static Sprite sprice_a;

	public static Texture2D tex_a = new Texture2D(2, 2);

	public static Sprite sprice_s;

	public static Texture2D tex_s = new Texture2D(2, 2);

	public static Sprite sprice_ss;

	public static Texture2D tex_ss = new Texture2D(2, 2);

	public static Sprite sprice_sss;

	public static Texture2D tex_sss = new Texture2D(2, 2);

	public static Sprite sprice_u;

	public static Texture2D tex_u = new Texture2D(2, 2);

	public static List<Sprite> list_sprite = new List<Sprite>();

	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("ghurklasian.style.title");
		val.PatchAll();
	}
}
[HarmonyPatch(typeof(StyleHUD), "Start")]
public class PatchStyleHud
{
	public static void SetStyleHud()
	{
		if (Class1.list_sprite == null)
		{
			Debug.LogWarning((object)"Null list, returning.");
			return;
		}
		if ((Object)(object)MonoSingleton<StyleHUD>.Instance == (Object)null)
		{
			Debug.LogWarning((object)"Null StyleHUD, returning.");
			return;
		}
		for (int i = 0; i < MonoSingleton<StyleHUD>.Instance.ranks.Count; i++)
		{
			MonoSingleton<StyleHUD>.Instance.ranks[i].sprite = Class1.list_sprite[i];
		}
		MonoSingleton<StyleHUD>.Instance.rankImage.sprite = Class1.list_sprite[MonoSingleton<StyleHUD>.Instance.rankIndex];
	}

	public static void Postfix(StyleHUD __instance)
	{
		//IL_0086: 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_00fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_010d: 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_0185: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0266: Unknown result type (might be due to invalid IL or missing references)
		//IL_0275: Unknown result type (might be due to invalid IL or missing references)
		//IL_02de: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_0356: Unknown result type (might be due to invalid IL or missing references)
		//IL_0365: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_03dd: Unknown result type (might be due to invalid IL or missing references)
		Console.Write("ghurk loading");
		Console.Write("Checking for Rank Titles");
		if (ImageConversion.LoadImage(Class1.tex, File.ReadAllBytes(Path.Combine(Class1.titlePath, "RankD.png"))))
		{
			ImageConversion.LoadImage(Class1.tex_d, File.ReadAllBytes(Path.Combine(Class1.titlePath, "RankD.png")));
			Class1.list_sprite.Add(Sprite.Create(Class1.tex_d, new Rect(0f, 0f, (float)((Texture)Class1.tex_d).width, (float)((Texture)Class1.tex_d).height), new Vector2(0.5f, 0.5f), 100f));
			Console.WriteLine("rank-D image loaded");
			ImageConversion.LoadImage(Class1.tex_c, File.ReadAllBytes(Path.Combine(Class1.titlePath, "RankC.png")));
			Class1.list_sprite.Add(Sprite.Create(Class1.tex_c, new Rect(0f, 0f, (float)((Texture)Class1.tex_c).width, (float)((Texture)Class1.tex_c).height), new Vector2(0.5f, 0.5f), 100f));
			Console.WriteLine("rank-C image loaded");
			ImageConversion.LoadImage(Class1.tex_b, File.ReadAllBytes(Path.Combine(Class1.titlePath, "RankB.png")));
			Class1.list_sprite.Add(Sprite.Create(Class1.tex_b, new Rect(0f, 0f, (float)((Texture)Class1.tex_b).width, (float)((Texture)Class1.tex_b).height), new Vector2(0.5f, 0.5f), 100f));
			Console.WriteLine("rank-B image loaded");
			ImageConversion.LoadImage(Class1.tex_a, File.ReadAllBytes(Path.Combine(Class1.titlePath, "RankA.png")));
			Class1.list_sprite.Add(Sprite.Create(Class1.tex_a, new Rect(0f, 0f, (float)((Texture)Class1.tex_a).width, (float)((Texture)Class1.tex_a).height), new Vector2(0.5f, 0.5f), 100f));
			Console.WriteLine("rank-A image loaded");
			ImageConversion.LoadImage(Class1.tex_s, File.ReadAllBytes(Path.Combine(Class1.titlePath, "RankS.png")));
			Class1.list_sprite.Add(Sprite.Create(Class1.tex_s, new Rect(0f, 0f, (float)((Texture)Class1.tex_s).width, (float)((Texture)Class1.tex_s).height), new Vector2(0.5f, 0.5f), 100f));
			Console.WriteLine("rank-S image loaded");
			ImageConversion.LoadImage(Class1.tex_ss, File.ReadAllBytes(Path.Combine(Class1.titlePath, "RankSS.png")));
			Class1.list_sprite.Add(Sprite.Create(Class1.tex_ss, new Rect(0f, 0f, (float)((Texture)Class1.tex_ss).width, (float)((Texture)Class1.tex_ss).height), new Vector2(0.5f, 0.5f), 100f));
			Console.WriteLine("rank-SS image loaded");
			ImageConversion.LoadImage(Class1.tex_sss, File.ReadAllBytes(Path.Combine(Class1.titlePath, "RankSSS.png")));
			Class1.list_sprite.Add(Sprite.Create(Class1.tex_sss, new Rect(0f, 0f, (float)((Texture)Class1.tex_sss).width, (float)((Texture)Class1.tex_sss).height), new Vector2(0.5f, 0.5f), 100f));
			Console.WriteLine("rank-SSS image loaded");
			ImageConversion.LoadImage(Class1.tex_u, File.ReadAllBytes(Path.Combine(Class1.titlePath, "RankU.png")));
			Class1.list_sprite.Add(Sprite.Create(Class1.tex_u, new Rect(0f, 0f, (float)((Texture)Class1.tex_u).width, (float)((Texture)Class1.tex_u).height), new Vector2(0.5f, 0.5f), 100f));
			Console.WriteLine("rank-U image loaded");
			SetStyleHud();
		}
		else
		{
			Console.Write("Didn't find rank-D");
		}
	}

	private void Uptade()
	{
		if ((Object)(object)MonoSingleton<StyleHUD>.Instance != (Object)null && MonoSingleton<StyleHUD>.Instance.rankIndex > 0)
		{
			MonoSingleton<StyleHUD>.Instance.rankImage.sprite = Class1.list_sprite[MonoSingleton<StyleHUD>.Instance.rankIndex];
		}
	}
}