我正在尝试使用MonoTouch为我的应用添加游戏中心支持,我查看了示例代码......它甚至无法编译..它给出了内部编译错误,没有任何意义根本就是:我只是创建了一个类,添加了一个函数并将代码直接粘贴到其中:
public bool Authenticate ()
{
//
// This shows how to authenticate on both iOS 6.0 and older versions
//
if (UIDevice.CurrentDevice.CheckSystemVersion (6, 0))
{
//
// iOS 6.0 and newer
//
GKLocalPlayer.LocalPlayer.AuthenticateHandler = (ui, error) => {
// If ui is null, that means the user is already authenticated,
// for example, if the user used Game Center directly to log in
if (ui != null)
current.PresentModalViewController (ui, true);
else
{
// Check if you are authenticated:
var authenticated = GKLocalPlayer.LocalPlayer.Authenticated;
}
Console.WriteLine ("Authentication result: {0}", err);
};
}
else
{
// Versions prior to iOS 6.0
GKLocalPlayer.LocalPlayer.Authenticate ((err) => {
Console.WriteLine ("Authentication result: {0}", err);
});
}
}
它在GKLocalPlayer的召唤中爆炸......
什么事?有谁知道一个简单的例子来使用它?应该能够将所有这些包装成一个单独的类来创建它...(这是我计划做的,如果它还没有完成。)
-Traderhut Games