are*_*mes 4 steam steamworks-api
如何使用Steam API(已启动并运行)获取我的应用程序中当前使用(登录)帐户的Steam用户名.
Steam id可以(例如)通过以下方式获得:
CSteamID id = SteamUser.GetSteamID();
Run Code Online (Sandbox Code Playgroud)
但我找不到获取用户名的方法.
获取帐户名称很困难,因为据我所知,没有API功能.
但SteamAppData.vdf文件<SteamInstallPath>/config夹中有一个文件看起来类似于:
"SteamAppData"
{
"RememberPassword" "<0|1>"
"AutoLoginUser" "<accountName>"
}
Run Code Online (Sandbox Code Playgroud)
您可以使用中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;
Run Code Online (Sandbox Code Playgroud)
所以SteamFriends.GetPersonaName()应该给你玩家的名字.
| 归档时间: |
|
| 查看次数: |
5786 次 |
| 最近记录: |