【问题标题】:Steam API getting persona nameSteam API 获取角色名称
【发布时间】:2015-07-31 17:50:54
【问题描述】:

我一直在关注 Steam 文档,但我已经到了需要根据 Steam ID 检索玩家姓名的地步,而 Steam 在他们的文档中有一个功能:

const char *pchName = SteamFriends()->GetPersonaName(steamID);

但是 Visual Studio 说没有具有这么多参数的函数。唯一可接受的功能是

const char *pchName = SteamFriends()->GetPersonaName();

这应该返回本地玩家的角色名称(它确实如此)。我可以设法从每个用户那里获取此信息,并在登录时将其存储在我的服务器上,但它确实看起来应该可行。我应该如何获取朋友的 uint64 SteamID 的角色名称?他们最近是否更改了此功能?

我在源代码中使用 Unreal Engine 4.7.6 和 Steam API 1.30。

【问题讨论】:

    标签: c++ steam unreal-engine4 steamworks-api


    【解决方案1】:

    显然 Steam 不擅长更新他们的文档。我打开 isteamfriends.h 标头,发现了这个 Steam 文档中从未提及的功能:

    // returns the name another user - guaranteed to not be NULL.
    // same rules as GetFriendPersonaState() apply as to whether or not the user knowns the name of the other user
    // note that on first joining a lobby, chat room or game server the local user will not known the name of the other users automatically; that information will arrive asyncronously
    // 
    virtual const char *GetFriendPersonaName( CSteamID steamIDFriend ) = 0;
    

    来吧,Steam... 大约 30 分钟前,我直接从他们的实时文档中提取了这条线,但它不起作用。

    const char *pchName = SteamFriends()->GetPersonaName(steamID);
    

    那么正确的做法是:

    const char *pchName = SteamFriends()->GetFriendsPersonaName(steamID);
    

    【讨论】:

      猜你喜欢
      • 2015-01-23
      • 2018-02-11
      • 2020-10-30
      • 1970-01-01
      • 2019-07-11
      • 2016-12-26
      • 1970-01-01
      • 1970-01-01
      • 2022-01-15
      相关资源
      最近更新 更多