miuu-custom-cosmetic-loader/PatchEntryPoint.cs

40 lines
885 B
C#

using HarmonyLib;
using System;
using System.IO;
using System.Reflection;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace CustomCosmeticLoader
{
public static class PatchEntryPoint
{
private static bool IsPatched = false;
public static Texture2D skin;
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;
LoadCosmetics();
}
}
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));
}
}
}