如何使用Steam API (已启动并运行)在我的应用程序中获取当前使用(已登录)帐户的Steam用户名。
Steam id可以(例如)通过以下方式获得:
CSteamID id = SteamUser.GetSteamID();但是我找不到一种方法来获取用户名。
发布于 2016-02-15 04:00:16
帐户名
获得帐户名是困难的,因为据我所知没有API函数。
但是在<SteamInstallPath>/config文件夹中有一个SteamAppData.vdf文件,如下所示:
"SteamAppData"
{
"RememberPassword" "<0|1>"
"AutoLoginUser" "<accountName>"
}您可以使用steam_api.h中定义的SteamAPI_GetSteamInstallPath()命令获取蒸汽安装路径。
然后,您可以读取该文件并从中提取帐户名。
播放器名称
获取球员名称非常简单:
在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()应该给你球员的名字。
发布于 2020-05-09 01:22:03
SteamFriends()->GetPersonaName();
https://stackoverflow.com/questions/35281019
复制相似问题