Lua使用coroutine调用C#异步接口
This commit is contained in:
parent
7ccd51e9a1
commit
f9348288ce
@ -113,4 +113,19 @@ function ResMgr:Destroy()
|
||||
end
|
||||
end
|
||||
|
||||
___G_Coroutine_Id_Dict = {}
|
||||
function ResMgr:LuaGetGoFromPool(path, asset)
|
||||
local k = path.."/"..asset
|
||||
local retgo = nil
|
||||
___G_Coroutine_Id_Dict[k] = coroutine.create(function()
|
||||
self:GetGoFromPoolAsync(path, asset, function(go)
|
||||
retgo = go
|
||||
coroutine.resume(___G_Coroutine_Id_Dict[k])
|
||||
end)
|
||||
coroutine.yield()
|
||||
end)
|
||||
coroutine.resume(___G_Coroutine_Id_Dict[k])
|
||||
return retgo
|
||||
end
|
||||
|
||||
return ResMgr
|
||||
Loading…
x
Reference in New Issue
Block a user