| | |
| | | ERROR |
| | | } |
| | | |
| | | #if UNITY_EDITOR || XLUA_GENERAL |
| | | Type delegate_birdge_type; |
| | | |
| | | #if UNITY_EDITOR || XLUA_GENERAL |
| | | class CompareByArgRet : IEqualityComparer<MethodInfo> |
| | | { |
| | | public bool Equals(MethodInfo x, MethodInfo y) |
| | |
| | | |
| | | void initCSharpCallLua() |
| | | { |
| | | delegate_birdge_type = typeof(DelegateBridge); |
| | | #if UNITY_EDITOR || XLUA_GENERAL |
| | | delegate_birdge_type = typeof(DelegateBridge); |
| | | if (!DelegateBridge.Gen_Flag) |
| | | { |
| | | List<Type> cs_call_lua = new List<Type>(); |
| | |
| | | } |
| | | } |
| | | |
| | | throw new InvalidCastException("This type must add to CSharpCallLua: " + delegateType); |
| | | throw new InvalidCastException("This type must add to CSharpCallLua: " + delegateType.GetFriendlyName()); |
| | | } |
| | | Dictionary<int, WeakReference> delegate_bridges = new Dictionary<int, WeakReference>(); |
| | | public object CreateDelegateBridge(RealStatePtr L, Type delegateType, int idx) |
| | |
| | | LuaAPI.xlua_pushasciistring(L, "import_type"); |
| | | LuaAPI.lua_pushstdcallcfunction(L,importTypeFunction); |
| | | LuaAPI.lua_rawset(L, -3); |
| | | LuaAPI.xlua_pushasciistring(L, "import_generic_type"); |
| | | LuaAPI.lua_pushstdcallcfunction(L, StaticLuaCallbacks.ImportGenericType); |
| | | LuaAPI.lua_rawset(L, -3); |
| | | LuaAPI.xlua_pushasciistring(L, "cast"); |
| | | LuaAPI.lua_pushstdcallcfunction(L, castFunction); |
| | | LuaAPI.lua_rawset(L, -3); |
| | |
| | | LuaAPI.lua_rawset(L, -3); |
| | | LuaAPI.xlua_pushasciistring(L, "tofunction"); |
| | | LuaAPI.lua_pushstdcallcfunction(L, StaticLuaCallbacks.ToFunction); |
| | | LuaAPI.lua_rawset(L, -3); |
| | | LuaAPI.xlua_pushasciistring(L, "get_generic_method"); |
| | | LuaAPI.lua_pushstdcallcfunction(L, StaticLuaCallbacks.GetGenericMethod); |
| | | LuaAPI.lua_rawset(L, -3); |
| | | LuaAPI.xlua_pushasciistring(L, "release"); |
| | | LuaAPI.lua_pushstdcallcfunction(L, StaticLuaCallbacks.ReleaseCsObject); |
| | |
| | | if (rawObject != null) |
| | | { |
| | | obj = rawObject.Target; |
| | | } |
| | | if (obj == null) |
| | | { |
| | | return !type.IsValueType; |
| | | } |
| | | return type.IsAssignableFrom(obj.GetType()); |
| | | } |
| | |
| | | } |
| | | else if (objects.TryGetValue(udata, out obj)) |
| | | { |
| | | #if !UNITY_5 && !XLUA_GENERAL && !UNITY_2017 |
| | | #if !UNITY_5 && !XLUA_GENERAL && !UNITY_2017 && !UNITY_2017_1_OR_NEWER && !UNITY_2018 |
| | | if (obj != null && obj is UnityEngine.Object && ((obj as UnityEngine.Object) == null)) |
| | | { |
| | | //throw new UnityEngine.MissingReferenceException("The object of type '"+ obj.GetType().Name +"' has been destroyed but you are still trying to access it."); |