访问原始玩家个人资料图片

编程入门 行业动态 更新时间:2024-10-21 06:32:37
本文介绍了访问原始玩家个人资料图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在为C#使用新的XBox Live API( github. com/Microsoft/xbox-live-api-csharp )以通过UWP应用进行官方访问.

I am using the new XBox Live API for C# (github/Microsoft/xbox-live-api-csharp) for official access through a UWP app.

我能够很好地进行身份验证并在上下文中引用XBox Live用户.

I am able to authenticate fine and reference the XBox Live user in context.

SignInResult result = await user.SignInAsync(); XboxLiveUser user = new XboxLiveUser();

成功!但是,我似乎找不到合适的API调用来返回 XboxUserProfile 或 XboxSocialProfile .这两个类都包含玩家原始游戏图片的URL.在回顾了MSDN文档和GH库之后,我不清楚这是如何实现的.任何帮助将不胜感激.

Success! However, I can't seem to find an appropriate API call to return XboxUserProfile or XboxSocialProfile. Both of these classes contain URLs to the player's raw gamer pics. After reviewing MSDN documentation and the GH library it isn't clear to me how this is achieved. Any help is greatly appreciated.

推荐答案

如果满足以下先决条件,以下示例应该可以工作:

The below sample should work if you meet the following pre requisits:

  • 引用包含项目中API的共享项目,而不引用"Microsoft.Xbox.Services.UWP.CSharp"项目
  • 将"Microsoft.Xbox.Services.UWP.CSharp"项目中的所有源代码文件复制到您的项目中
  • 将Newtonsoft.Json NuGet软件包包含到您的项目中
  • 步骤1& 2非常重要,因为这使您可以访问内部"构造函数,否则这些构造函数将受到保护.

    Steps 1 & 2 are important as this allows you to access the "internal" constructors which otherwise would be protected from you.

    用于检索配置文件数据的代码:

    Code to retrieve the profile data:

    XboxLiveUser user = new XboxLiveUser(); await user.SignInSilentlyAsync(); if (user.IsSignedIn) { XboxLiveContext context = new XboxLiveContext(user); PeopleHubService peoplehub = new PeopleHubService(context.Settings, context.AppConfig); XboxSocialUser socialuser = await peoplehub.GetProfileInfo(user, SocialManagerExtraDetailLevel.None); // Do whatever you want to do with the data in socialuser }

    您可能仍然像我一样遇到问题.构建项目时,您可能会遇到以下错误:

    You may still run into an issue like I did. When building the project you may face the following error:

    错误CS0103当前名称'UserPicker'不存在 context ... \ System \ UserImpl.cs 142有效

    Error CS0103 The name 'UserPicker' does not exist in the current context ...\System\UserImpl.cs 142 Active

    如果遇到该错误,请确保以Win 10.0 Build 14393为目标.

    If you get that error make sure you target Win 10.0 Build 14393.

    更多推荐

    访问原始玩家个人资料图片

    本文发布于:2023-10-11 23:12:08,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1483105.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:原始   个人资料   玩家   图片

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!