mirror of https://github.com/hykilpikonna/AquaDX
[F] IconLoader
parent
9143b92932
commit
0e02dd660c
|
@ -24,7 +24,9 @@ public class LoadAssetsPng
|
|||
private static Dictionary<string, string> framepatternPaths = new();
|
||||
private static Dictionary<string, string> iconPaths = new();
|
||||
private static Dictionary<string, string> charaPaths = new();
|
||||
|
||||
private static Dictionary<string, string> partnerPaths = new();
|
||||
|
||||
//private static Dictionary<string, string> navicharaPaths = new();
|
||||
private static Dictionary<string, string> tabTitlePaths = new();
|
||||
private static Dictionary<string, string> localAssetsContents = new();
|
||||
|
@ -166,6 +168,7 @@ public class LoadAssetsPng
|
|||
texture.LoadImage(File.ReadAllBytes(path));
|
||||
return texture;
|
||||
}
|
||||
|
||||
private static string GetPlatePath(string id)
|
||||
{
|
||||
return platePaths.GetValueOrDefault(id);
|
||||
|
@ -219,6 +222,7 @@ public class LoadAssetsPng
|
|||
texture.LoadImage(File.ReadAllBytes(path));
|
||||
return texture;
|
||||
}
|
||||
|
||||
private static string GetIconPath(string id)
|
||||
{
|
||||
return iconPaths.GetValueOrDefault(id);
|
||||
|
@ -236,6 +240,7 @@ public class LoadAssetsPng
|
|||
texture.LoadImage(File.ReadAllBytes(path));
|
||||
return texture;
|
||||
}
|
||||
|
||||
private static string GetCharaPath(string id)
|
||||
{
|
||||
return charaPaths.GetValueOrDefault(id);
|
||||
|
@ -253,6 +258,7 @@ public class LoadAssetsPng
|
|||
texture.LoadImage(File.ReadAllBytes(path));
|
||||
return texture;
|
||||
}
|
||||
|
||||
private static string GetPartnerPath(string id)
|
||||
{
|
||||
return partnerPaths.GetValueOrDefault(id);
|
||||
|
@ -466,26 +472,17 @@ public class LoadAssetsPng
|
|||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch]
|
||||
public static class IconLoader
|
||||
{
|
||||
public static IEnumerable<MethodBase> TargetMethods()
|
||||
{
|
||||
var AM = typeof(AssetManager);
|
||||
var method = AM.GetMethod("GetIconTexture2D", new[] { typeof(string) });
|
||||
if (method != null)
|
||||
{
|
||||
yield return method;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool Prefix(string filename, ref Texture2D __result, AssetManager __instance)
|
||||
// Private | Instance
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(AssetManager), "GetIconTexture2D", typeof(string))]
|
||||
public static bool IconLoader(string filename, ref Texture2D __result, AssetManager __instance)
|
||||
{
|
||||
var matches = Regex.Matches(filename, @"UI_Icon_(\d+)\.png");
|
||||
if (matches.Count < 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
MelonLogger.Msg(filename);
|
||||
var id = matches[0].Groups[1].Value;
|
||||
|
||||
|
@ -494,7 +491,6 @@ public class LoadAssetsPng
|
|||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch]
|
||||
public static class CharaLoader
|
||||
|
|
Loading…
Reference in New Issue