gpt4 book ai didi

steam - 如何使用 SteamWorks API 检索 Steam 用户名?

转载 作者:行者123 更新时间:2023-12-04 23:41:46 26 4
gpt4 key购买 nike

如何使用 Steam API(已启动并运行)获取我的应用程序中当前使用(登录)帐户的 Steam 用户名。

Steam ID 可以(例如)通过以下方式获得:

CSteamID id = SteamUser.GetSteamID();

但是我找不到获取用户名的方法。

最佳答案

用户名
获取帐户名很困难,因为据我所知没有 API 功能。
但是有一个SteamAppData.vdf <SteamInstallPath>/config 中的文件看起来与此类似的文件夹:

"SteamAppData"
{
"RememberPassword" "<0|1>"
"AutoLoginUser" "<accountName>"
}
您可以通过 SteamAPI_GetSteamInstallPath() 获取 Steam 安装路径。在 steam_api.h 中定义的命令.
然后您可以读取该文件并从中提取帐户名称。
选手姓名
获取玩家名称非常简单:
isteamfriends.h你应该找到这个方法:
// returns the local players name - guaranteed to not be NULL.
// this is the same name as on the users community profile page
// this is stored in UTF-8 format
// like all the other interface functions that return a char *, it's important that this pointer is not saved
// off; it will eventually be free'd or re-allocated
virtual const char *GetPersonaName() = 0;
所以 SteamFriends.GetPersonaName()应该给你玩家名字。

关于steam - 如何使用 SteamWorks API 检索 Steam 用户名?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35281019/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com