-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add TargetMethod() to Affinity #54
Comments
Could you provide an example of how you'd want this to look like with the Affinity system? |
Adding a [HarmonyTargetMethod]
private static MethodBase CalculateMethod() [AffinityTargetMethod]
private MethodBase CalculateMethod() An example is where you need to target a private type [AffinityPostfix]
[AffinityPatch(typeof(BeatmapObjectsInTimeRowProcessor.SliderTailData), "GetCopy")]
// not possible, as this is a private class
private void Postfix() [AffinityTargetMethod]
private MethodBase TargetMethod()
{
Type type = Type.GetType("BeatmapObjectsInTimeRowProcessor+SliderTailData,BeatmapCore");
return AccessTools.Method(type, "GetCopy");
}
[AffinityPostfix]
private void Postfix() |
What about when you want multiple target methods for different affinity patches? How do you think they should be distinguished? |
Following how Harmony does it: only allow one target method for a class and disallow using individual annotations with [AffinityTargetMethod]
private MethodBase TargetMethod()
{
return AccessTools.Method(typeof(something), "something");
}
[AffinityPostfix]
[AffinityPatch(typeof(something), "something")]
// invalid to use this while [AffinityTargetMethod] defined and will throw
private void Postfix() |
Useful to getting types that are not available at compile time
Adding TargetMethods() too would be nice
https://harmony.pardeike.net/articles/patching-auxilary.html#auxilary-patch-methods
The text was updated successfully, but these errors were encountered: