Skip to content

Commit

Permalink
更新tolua#到1.0.7.376版
Browse files Browse the repository at this point in the history
  • Loading branch information
jarjin2000 committed Sep 10, 2017
1 parent ee44dd9 commit e0c74e0
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 28 deletions.
1 change: 0 additions & 1 deletion Assets/LuaFramework/ToLua/Core/LuaState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1909,7 +1909,6 @@ public void Dispose()
{
if (IntPtr.Zero != L)
{
LuaGC(LuaGCOptions.LUA_GCCOLLECT, 0);
Collect();

foreach (KeyValuePair<Type, int> kv in metaMap)
Expand Down
13 changes: 9 additions & 4 deletions Assets/LuaFramework/ToLua/Editor/ToLuaExport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ public static class ToLuaExport
"AnimationClip.isAnimatorMotion",
"AnimationClip.isHumanMotion",
"AnimatorOverrideController.PerformOverrideClipListCleanup",
"AnimatorControllerParameter.name",
"Caching.SetNoBackupFlag",
"Caching.ResetNoBackupFlag",
"Light.areaSize",
Expand Down Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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]))
Expand Down
15 changes: 12 additions & 3 deletions Assets/LuaFramework/ToLua/Lua/System/Timer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down
35 changes: 18 additions & 17 deletions Assets/LuaFramework/ToLua/Lua/event.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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()
Expand Down Expand Up @@ -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)
Expand Down
15 changes: 12 additions & 3 deletions Assets/LuaFramework/ToLua/Lua/system/Timer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down
3 changes: 3 additions & 0 deletions ReadMe.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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版

Expand Down

0 comments on commit e0c74e0

Please sign in to comment.