简体   繁体   English

从XNA发布WP7游戏成就到Facebook

[英]Post WP7 Game Achievements from XNA to Facebook

Lately we've been working on a 3D XNA-powered game for Windows Phone 7. We wanted to integrate an achievements system and be able to post achievements to Facebook. 最近我们一直致力于为Windows Phone 7开发基于3D XNA的游戏。我们希望整合一个成就系统,并能够将成就发布到Facebook。 My question is: have someone done already a similar thing? 我的问题是:有人做过类似的事吗? Are there any good tutorials/resources on how to do so? 有关如何这样做的任何好的教程/资源吗?

To my understanding, in order to login on Facebook, one can fire a WebBrowserTask on XNA, which will open a url using internet explorer app but meanwhile the xna game will be deactivated and reactivated when user press back button. 根据我的理解,为了在Facebook上登录,可以在XNA上启动WebBrowserTask,这将使用Internet Explorer应用程序打开网址,但同时当用户按下后退按钮时,xna游戏将被停用并重新激活。 The OAuth token could be transmitted back to the app using our own server. 可以使用我们自己的服务器将OAuth令牌传输回应用程序。 But would it be the only way to do so? 但这是唯一的方法吗?

EDIT: I've successfully solved Facebook OAuth without a browser problem, see my blogpost: http://roman.ae-labs.org/?p=116 编辑:我已成功解决Facebook OAuth没有浏览器问题,请参阅我的博文: http: //roman.ae-labs.org/?p = 116

You couldn't do this directly with the WebBrowserTask. 您无法直接使用WebBrowserTask执行此操作。 You'd been to embed a web browser in your app, which, with XNA, you can't do. 您已经在您的应用中嵌入了一个Web浏览器,使用XNA,您无法做到。

This was asked on the facebook forums . 这是在facebook论坛上提出的

As a workaround you could try using the WebBrowserTask indirectly: 作为一种解决方法,您可以尝试间接使用WebBrowserTask:

  1. Have you app open a web page (with the WebBrowserTask) on your site and pass it the ANID from the device. 你有app在你的网站上打开一个网页(使用WebBrowserTask)并从设备传递ANID。
  2. In that web page, present the ability to do the OAUTH with Facebook and have your web page manage the association between ANID and OAUTH login. 在该网页中,提供了使用Facebook执行OAUTH并让您的网页管理ANID和OAUTH登录之间的关联的功能。
  3. When you wish to post an achievement. 当你想发表成就时。 Have the app send the achievement and ANID to your website and then have that relay the update to Facebook. 让应用程序将成就和ANID发送到您的网站,然后将更新中继到Facebook。

Your app would need to check with your website to see if the oauth had been done or not as the site couldn't send the response back after step 2 (without a push notification). 您的应用需要检查您的网站,看看oauth是否已经完成,因为该网站无法在步骤2之后发回响应(没有推送通知)。

Untested, but I don't see why the above wouldn't work. 未经测试,但我不明白为什么上述不起作用。

Check out the Facebook C# SDK. 查看Facebook C#SDK。 In the current source we have a sample WP7 app that shows you how to do Facebook login. 在当前的源代码中,我们有一个示例WP7应用程序,向您展示如何进行Facebook登录。 That should be everything you need to get started. 这应该是您开始所需的一切。 http://facebooksdk.codeplex.com http://facebooksdk.codeplex.com

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM