Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unity 2018.4.24f1,slua1.6.2 ,自定义lua调用C#的回调方法没反应? #309

Open
onlyhan opened this issue Jul 14, 2020 · 1 comment

Comments

@onlyhan
Copy link

onlyhan commented Jul 14, 2020

环境:unity 2018.4.24f1+slua1.6.2+Nugui3.12.1,net运行时3.5EQ----编译2.0

c#中:
class UIEventListenerHelper
{
...
public static void SetPlayTweenFinish(UIPlayTween uiplaytween, LuaFunction func)
{
//Debug.log("----lua调用进不来---------------");
EventDelegate.Add(uiplaytween.onFinished, () => func.call(UIPlayTween.current), true);
// EventDelegate是Ngui的事件委托类,这里没有导出类;导出也没反应,或许需要特殊写法
}
...
}

lua这样调用:
local UIEventListenerHelper =UIEventListenerHelper
UIEventListenerHelper.SetPlayTweenFinish(uiplaytween, function(uifadeout)
pirnt(“--------回调不回来啦!O.O----------”)
end)

请大神指导下,新手一名,感激不尽啦,lua是不是不能给c#传递 lua的LuaFunction 过来呀,记得早期的版本可以的

@onlyhan
Copy link
Author

onlyhan commented Jul 16, 2020

找到问题了,UIPlayTween 的继承类 UIFadeIn 和 UIFadeOut是继承的,lua传递过来 UIFadeIn 与 UIFadeOut 跟UIPlayTween 类型不完全匹配,写 2个 不同的参数方法完事。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant