我正在开发一款使用Unity的移动游戏,虽然很容易让核心游戏循环运行,但我一直遇到移动设备界面的问题,特别是苹果和谷歌提供的应用程序内购买功能.我听说有插件可以提供帮助.是否有任何地方列出所有选项,可以让我轻松比较它们?
在关于从另一个线程更新GUI的问题之后,我想稍微扩展代码,以便它可以用于除属性赋值之外的其他东西.具体来说,我试图找到一种方法将一些功能直接分配给lambda,以便我可以根据需要定义行为(我为WPF略微修改了原始内容):
private delegate void UpdateControlThreadSafeDelegate(Control control, System.Linq.Expressions.Expression<Action> property);
public void UpdateControl(Control control, System.Linq.Expressions.Expression<Action> property)
{
// If calling thread is not associated with control dispatcher, call our thread safe property update delegate
if (!control.Dispatcher.CheckAccess())
{
control.Dispatcher.Invoke(new UpdateControlThreadSafeDelegate(UpdateControl), new object[] { control, property });
}
else
{
Action call = property.Compile();
call();
}
}
Run Code Online (Sandbox Code Playgroud)
用法:
UpdateControl(lbFoo, () => lbFoo.Items.Clear()); // where lbFoo is a ListBox control
Run Code Online (Sandbox Code Playgroud)
这很好用.但我宁愿允许做类似的事情:
UpdateControl(lbFoo, () => { lbFoo.Items.Clear(); lbFoo.Items.Add("Bar");});
Run Code Online (Sandbox Code Playgroud)
这不起作用,返回错误CS0834:带有语句主体的lambda表达式无法转换为表达式树.错误是明确的,我只是不确定如何最好地继续.我可以按照原来的用法,在几行中做我需要的东西,它不是那么整洁.
我猜是有更好/更简单的方法来做我想要的.
我必须在Unity 3d中集成Awesomium.我已经完成了定义的步骤
http://labs.awesomium.com/unity3d-integration-tutorial-part-1/
但是当我必须将webTexture.cs拖到播放器对象上时,它会给出以下错误.
Assets/WebTexture.cs(226,13):错误CS0104:RenderBuffer' is an ambiguous reference betweenUnityEngine.RenderBuffer'和`AwesomiumMono.RenderBuffer'
请帮忙!
谢谢,万达娜