コード例 #1
0
        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)));
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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));
        }
コード例 #6
0
 public static FieldInfo AccessPrivateField(string type, string fieldname)
 {
     return(AccessTools.Field(LuaInterface.GetType(type), fieldname));
 }
コード例 #7
0
 public static FieldInfo[] GetFields(string typename)
 {
     return(LuaInterface.GetType(typename).GetFields());
 }