-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPatch_VFPreload.cs
60 lines (53 loc) · 1.55 KB
/
Patch_VFPreload.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using HarmonyLib;
using UnityEngine;
namespace SphereOpt
{
internal static class Patch_VFPreload
{
[HarmonyPatch(typeof(VFPreload), "SaveMaterial")]
[HarmonyPrefix]
private static bool VFPreload_SaveMaterial(Material mat)
{
if (mat == null)
{
return false;
}
CustomShaderManager.ReplaceShaderIfAvailable(mat);
return true;
}
[HarmonyPatch(typeof(VFPreload), "SaveMaterials", typeof(Material[]))]
[HarmonyPrefix]
private static bool VFPreload_SaveMaterials(Material[] mats)
{
if (mats == null)
{
return false;
}
foreach (Material mat in mats)
{
if (mat == null) continue;
CustomShaderManager.ReplaceShaderIfAvailable(mat);
}
return true;
}
[HarmonyPatch(typeof(VFPreload), "SaveMaterials", typeof(Material[][]))]
[HarmonyPrefix]
private static bool VFPreload_SaveMaterials(Material[][] mats)
{
if (mats == null)
{
return false;
}
foreach (Material[] matarray in mats)
{
if(matarray == null) continue;
foreach (var mat in matarray)
{
if(mat == null) continue;
CustomShaderManager.ReplaceShaderIfAvailable(mat);
}
}
return true;
}
}
}