miuu-custom-cosmetic-loader/PatchEntryPoint.cs

41 lines
885 B
C#
Raw Normal View History

2023-08-26 12:29:43 -04:00
using HarmonyLib;
using System;
2023-08-26 17:59:50 -04:00
using System.IO;
using System.Reflection;
using UnityEngine;
2023-08-26 12:29:43 -04:00
using UnityEngine.SceneManagement;
namespace CustomCosmeticLoader
{
public static class PatchEntryPoint
{
private static bool IsPatched = false;
2023-08-26 17:59:50 -04:00
public static Texture2D skin;
2023-08-26 12:29:43 -04:00
public static void Start()
{
SceneManager.sceneLoaded += beginPatch;
}
private static void beginPatch(Scene scene, LoadSceneMode mode)
{
if (!IsPatched)
{
new Harmony("com.thearst3rd.customcosmeticloader").PatchAll();
IsPatched = true;
SceneManager.sceneLoaded -= beginPatch;
2023-08-26 17:59:50 -04:00
LoadCosmetics();
2023-08-26 12:29:43 -04:00
}
}
2023-08-26 17:59:50 -04:00
private static void LoadCosmetics()
{
string skinFile = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
skinFile = Path.Combine(skinFile, "skin.png");
skin = new Texture2D(2, 2);
skin.LoadImage(File.ReadAllBytes(skinFile));
}
2023-08-26 12:29:43 -04:00
}
}