Reflection
Methods which can help you to call private methods, get and set values to/from private fields.
Constructors
No constructors
Fields
No fields
Methods
CallMethod(this o, methodName, params args): object
Call private method
Returns: object
Examples:
using ReflectionUtility;
MapBox.instance.stackEffects.CallMethod("startSpawnEffect", newUnit.currentTile, "spawn");
ReflectionUtility.Reflection.CallMethod(MapBox.instance.stackEffects, "startSpawnEffect", newUnit.currentTile, "spawn");
using ReflectionUtility;
var isEnemy = (bool)pActor.kingdom.CallMethod("isEnemy", kingdom);
CallStaticMethod(type, methodName, params args): object
Call static private method
Returns: object
Examples:
using ReflectionUtility;
Reflection.CallStaticMethod(typeof(ScrollWindow), "checkWindowExist", "inspect_unit");
GetField(type, instance, fieldName): object
Get value from private field
Returns: object
Examples:
using ReflectionUtility;
var texts = (Dictionary<string, string>)Reflection.GetField(LocalizedTextManager.instance.GetType(), LocalizedTextManager.instance, "localizedText");
using ReflectionUtility;
Reflection.GetField(typeof(ScrollWindow), null, "allWindows") as Dictionary<string, ScrollWindow>;
SetField(originalObject, fieldName, T newValue): void
Set value to private field
Returns: void
Examples:
using ReflectionUtility;
Reflection.SetField<Race>(city, "race", raceObj);