From e0c74e01d77833987761fb03cfe9d90e95b74997 Mon Sep 17 00:00:00 2001 From: jarjin Date: Sun, 10 Sep 2017 14:56:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0tolua#=E5=88=B01.0.7.376?= =?UTF-8?q?=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/LuaFramework/ToLua/Core/LuaState.cs | 1 - .../LuaFramework/ToLua/Editor/ToLuaExport.cs | 13 ++++--- .../LuaFramework/ToLua/Lua/System/Timer.lua | 15 ++++++-- Assets/LuaFramework/ToLua/Lua/event.lua | 35 ++++++++++--------- .../LuaFramework/ToLua/Lua/system/Timer.lua | 15 ++++++-- ReadMe.txt | 3 ++ 6 files changed, 54 insertions(+), 28 deletions(-) diff --git a/Assets/LuaFramework/ToLua/Core/LuaState.cs b/Assets/LuaFramework/ToLua/Core/LuaState.cs index 14bf84212..7dcfdad08 100644 --- a/Assets/LuaFramework/ToLua/Core/LuaState.cs +++ b/Assets/LuaFramework/ToLua/Core/LuaState.cs @@ -1909,7 +1909,6 @@ public void Dispose() { if (IntPtr.Zero != L) { - LuaGC(LuaGCOptions.LUA_GCCOLLECT, 0); Collect(); foreach (KeyValuePair kv in metaMap) diff --git a/Assets/LuaFramework/ToLua/Editor/ToLuaExport.cs b/Assets/LuaFramework/ToLua/Editor/ToLuaExport.cs index 3ee70d05a..afb6c204e 100644 --- a/Assets/LuaFramework/ToLua/Editor/ToLuaExport.cs +++ b/Assets/LuaFramework/ToLua/Editor/ToLuaExport.cs @@ -127,6 +127,7 @@ public static class ToLuaExport "AnimationClip.isAnimatorMotion", "AnimationClip.isHumanMotion", "AnimatorOverrideController.PerformOverrideClipListCleanup", + "AnimatorControllerParameter.name", "Caching.SetNoBackupFlag", "Caching.ResetNoBackupFlag", "Light.areaSize", @@ -287,7 +288,7 @@ public string GenParamTypes(int offset = 0) else { Type genericClass = typeof(LuaOut<>); - Type t = genericClass.MakeGenericType(args[i].ParameterType); + Type t = genericClass.MakeGenericType(args[i].ParameterType.GetElementType()); list.Add(t); } } @@ -4177,16 +4178,20 @@ static void ProcessEditorExtend(Type extendType, List<_MethodBase> list) { continue; } - } + } if (IsUseDefinedAttributee(list2[i])) { - list.RemoveAll((md) => { return md.Name == list2[i].Name; }); + list.RemoveAll((md) => { return md.Name == list2[i].Name; }); } else { int index = list.FindIndex((md) => { return IsMethodEqualExtend(md.Method, list2[i]); }); - if (index >= 0) list.RemoveAt(index); + + if (index >= 0) + { + list.RemoveAt(index); + } } if (!IsObsolete(list2[i])) diff --git a/Assets/LuaFramework/ToLua/Lua/System/Timer.lua b/Assets/LuaFramework/ToLua/Lua/System/Timer.lua index 3d6fc2d48..0fb6defaa 100644 --- a/Assets/LuaFramework/ToLua/Lua/System/Timer.lua +++ b/Assets/LuaFramework/ToLua/Lua/System/Timer.lua @@ -40,7 +40,10 @@ end function Timer:Stop() self.running = false - UpdateBeat:RemoveListener(self.handle) + + if self.handle then + UpdateBeat:RemoveListener(self.handle) + end end function Timer:Update() @@ -93,7 +96,10 @@ end function FrameTimer:Stop() self.running = false - CoUpdateBeat:RemoveListener(self.handle) + + if self.handle then + CoUpdateBeat:RemoveListener(self.handle) + end end function FrameTimer:Update() @@ -140,7 +146,10 @@ end function CoTimer:Stop() self.running = false - CoUpdateBeat:RemoveListener(self.handle) + + if self.handle then + CoUpdateBeat:RemoveListener(self.handle) + end end function CoTimer:Update() diff --git a/Assets/LuaFramework/ToLua/Lua/event.lua b/Assets/LuaFramework/ToLua/Lua/event.lua index 9c300c220..ec0ac970e 100644 --- a/Assets/LuaFramework/ToLua/Lua/event.lua +++ b/Assets/LuaFramework/ToLua/Lua/event.lua @@ -76,9 +76,8 @@ function _event:Add(func, obj) end if self.lock then - local node = {value = func, _prev = 0, _next = 0} - table.insert(self.opList, node) - node.op = list.pushnode + local node = {value = func, _prev = 0, _next = 0, removed = true} + table.insert(self.opList, function() self.list:pushnode(node) end) return node else return self.list:push(func) @@ -90,8 +89,7 @@ function _event:Remove(func, obj) for i, v in ilist(self.list) do if v.func == func and v.obj == obj then if self.lock then - table.insert(self.opList, i) - node.op = list.remove + table.insert(self.opList, function() self.list:remove(i) end) else self.list:remove(i) end @@ -111,21 +109,23 @@ function _event:CreateListener(func, obj) end function _event:AddListener(handle) - if self.lock then - table.insert(self.opList, handle) - handle.op = list.pushnode + assert(handle) + + if self.lock then + table.insert(self.opList, function() self.list:pushnode(handle) end) else self.list:pushnode(handle) end end -function _event:RemoveListener(handle) +function _event:RemoveListener(handle) + assert(handle) + if self.lock then - table.insert(self.opList, handle) - handle.op = list.remove + table.insert(self.opList, function() self.list:remove(handle) end) else self.list:remove(handle) - end + end end function _event:Count() @@ -174,12 +174,13 @@ _event.__call = function(self, ...) end end - for _, i in ipairs(self.opList) do - i.op(_list, i) - end - - self.lock = false + local opList = self.opList self.opList = {} + self.lock = false + + for _, op in ipairs(opList) do + op() + end end function event(name, safe) diff --git a/Assets/LuaFramework/ToLua/Lua/system/Timer.lua b/Assets/LuaFramework/ToLua/Lua/system/Timer.lua index 3d6fc2d48..0fb6defaa 100644 --- a/Assets/LuaFramework/ToLua/Lua/system/Timer.lua +++ b/Assets/LuaFramework/ToLua/Lua/system/Timer.lua @@ -40,7 +40,10 @@ end function Timer:Stop() self.running = false - UpdateBeat:RemoveListener(self.handle) + + if self.handle then + UpdateBeat:RemoveListener(self.handle) + end end function Timer:Update() @@ -93,7 +96,10 @@ end function FrameTimer:Stop() self.running = false - CoUpdateBeat:RemoveListener(self.handle) + + if self.handle then + CoUpdateBeat:RemoveListener(self.handle) + end end function FrameTimer:Update() @@ -140,7 +146,10 @@ end function CoTimer:Stop() self.running = false - CoUpdateBeat:RemoveListener(self.handle) + + if self.handle then + CoUpdateBeat:RemoveListener(self.handle) + end end function CoTimer:Update() diff --git a/ReadMe.txt b/ReadMe.txt index 875de70d2..999e3e6eb 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -23,6 +23,9 @@ Excel配置:https://github.com/sy-yanghuan/proton ULUA/TOLUA骏擎Unity素材商店: https://junfine.taobao.com +//-------------2017-09-10------------- +(1)更新tolua#到1.0.7.376版 + //-------------2017-08-22------------- (1)更新tolua#到1.0.7.367版