I just haven't seen a good, clear example of the format for calling a private method with inputs and returning a value.
I'm trying to call:
public static class CaravanEnterMapUtility
private static IntVec3 FindNearEdgeCell(Map map, Predicate<IntVec3> extraCellValidator)
What I've been able to cobble together so far doesn't work (below). Does anyone have an actual example I could look at, I would think this is a rather common thing to do.
MethodInfo methodInfo = typeof(CaravanEnterMapUtility).GetMethod("FindNearEdgeCell", BindingFlags.NonPublic | BindingFlags.Instance);
var parameters = new object[] { map, extraCellValidator };
__result = (IntVec3)methodInfo.Invoke(null, parameters);
Edit: Actually I think I got it to work, it should be BindingFlags.Static not BindingFlags.Instance since the method is static
I'm trying to call:
public static class CaravanEnterMapUtility
private static IntVec3 FindNearEdgeCell(Map map, Predicate<IntVec3> extraCellValidator)
What I've been able to cobble together so far doesn't work (below). Does anyone have an actual example I could look at, I would think this is a rather common thing to do.
MethodInfo methodInfo = typeof(CaravanEnterMapUtility).GetMethod("FindNearEdgeCell", BindingFlags.NonPublic | BindingFlags.Instance);
var parameters = new object[] { map, extraCellValidator };
__result = (IntVec3)methodInfo.Invoke(null, parameters);
Edit: Actually I think I got it to work, it should be BindingFlags.Static not BindingFlags.Instance since the method is static