static int __CreateInstance(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); if (LuaAPI.lua_gettop(L) == 1) { var gen_ret = new MonoBehaviourAdapter.Adaptor(); translator.Push(L, gen_ret); return(1); } if (LuaAPI.lua_gettop(L) == 3 && translator.Assignable <ILRuntime.Runtime.Enviorment.AppDomain>(L, 2) && translator.Assignable <ILRuntime.Runtime.Intepreter.ILTypeInstance>(L, 3)) { ILRuntime.Runtime.Enviorment.AppDomain _appdomain = (ILRuntime.Runtime.Enviorment.AppDomain)translator.GetObject(L, 2, typeof(ILRuntime.Runtime.Enviorment.AppDomain)); ILRuntime.Runtime.Intepreter.ILTypeInstance _instance = (ILRuntime.Runtime.Intepreter.ILTypeInstance)translator.GetObject(L, 3, typeof(ILRuntime.Runtime.Intepreter.ILTypeInstance)); var gen_ret = new MonoBehaviourAdapter.Adaptor(_appdomain, _instance); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to MonoBehaviourAdapter.Adaptor constructor!")); }
static int _m_CreateCLRInstance(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); ILRuntimeDemo.TestClassBaseAdapter gen_to_be_invoked = (ILRuntimeDemo.TestClassBaseAdapter)translator.FastGetCSObj(L, 1); { ILRuntime.Runtime.Enviorment.AppDomain _appdomain = (ILRuntime.Runtime.Enviorment.AppDomain)translator.GetObject(L, 2, typeof(ILRuntime.Runtime.Enviorment.AppDomain)); ILRuntime.Runtime.Intepreter.ILTypeInstance _instance = (ILRuntime.Runtime.Intepreter.ILTypeInstance)translator.GetObject(L, 3, typeof(ILRuntime.Runtime.Intepreter.ILTypeInstance)); var gen_ret = gen_to_be_invoked.CreateCLRInstance(_appdomain, _instance); translator.PushAny(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
public object ConvertCLRInstance(object value) { ILRuntime.Runtime.Intepreter.ILTypeInstance instance = value as ILRuntime.Runtime.Intepreter.ILTypeInstance; if (instance != null) { return(instance.CLRInstance); } return(value); }
public static void RegisterILRuntimeCLRRedirection(ILRuntime.Runtime.Enviorment.AppDomain appDomain) { foreach (ILRuntime.CLR.TypeSystem.IType item in appDomain.LoadedTypes.Values) { RegisterType(item.FullName, item.ReflectionType); } RegisterFunctionCreateInstance(typeName => appDomain.Instantiate(typeName)); RegisterFunctionGetRealType((obj) => { Type type = obj.GetType(); if (type.FullName == "ILRuntime.Runtime.Intepreter.ILTypeInstance") { ILRuntime.Runtime.Intepreter.ILTypeInstance instance = (ILRuntime.Runtime.Intepreter.ILTypeInstance)obj; type = FindType(instance.Type.FullName); } return(type); }); }