public static object GetPrivateField(string typei, string fieldname, GameObject go) { var type = LuaInterface.GetType(typei); var field = AccessTools.Field(type, fieldname); return(field.GetValue(go.GetComponent(type))); }
public static bool SetPrivateField(string typei, string fieldname, GameObject go, object value) { var type = LuaInterface.GetType(typei); var field = AccessTools.Field(type, fieldname); field.SetValue(go.GetComponent(type), convert(value, field)); return(true); }
public static bool ListFieldsString(string typename) { string fieldlist = " List all fields of " + typename; foreach (var i in LuaInterface.GetType(typename).GetFields()) { fieldlist += i.Name + " : " + i.GetValue(i).ToString(); } ScriptingCore.InfoLog(fieldlist); return(true); }
public static Type ClassHelpString(string classname) { Type t = LuaInterface.GetType(classname); if (t == null) { try { t = LuaInterface.GetType(ScriptingCore.classhelpdict[classname]); } catch { } } if (t == null) { ScriptingCore.InfoLog(" ClassHelperString " + classname + " Was not found. "); return(null); } ClassHelpType(t); return(t); }
public static Component LuaGetComponent(GameObject go, string componentname) { Type t = LuaInterface.GetType(componentname); if (t == null) { LuaInterface.RegisterType(componentname); t = LuaInterface.GetType(componentname); } if (t == null) { ScriptingCore.DebugLogError("The Component " + componentname + " could not be found!"); } if (go == null) { ScriptingCore.DebugLogError("The GameObject is Null!"); } return(go.GetComponent(t)); }
public static FieldInfo AccessPrivateField(string type, string fieldname) { return(AccessTools.Field(LuaInterface.GetType(type), fieldname)); }
public static FieldInfo[] GetFields(string typename) { return(LuaInterface.GetType(typename).GetFields()); }