2
如何使用Steam API(已啓動並正在運行)獲取我的應用程序中當前使用(已登錄)帳戶的Steam用戶名。如何使用SteamWorks API檢索Steam用戶名?
的蒸汽ID可以(例如)通過以下步驟獲得:
CSteamID id = SteamUser.GetSteamID();
但我不能找到一種方法,以獲得的用戶名。
如何使用Steam API(已啓動並正在運行)獲取我的應用程序中當前使用(已登錄)帳戶的Steam用戶名。如何使用SteamWorks API檢索Steam用戶名?
的蒸汽ID可以(例如)通過以下步驟獲得:
CSteamID id = SteamUser.GetSteamID();
但我不能找到一種方法,以獲得的用戶名。
獲取帳戶名稱很困難,因爲據我所知沒有API函數。
但是有一個SteamAppData.vdf
文件中的文件夾<SteamInstallPath>/config
看起來與此類似:
"SteamAppData"
{
"RememberPassword" "<0|1>"
"AutoLoginUser" "<accountName>"
}
你可以在Steam安裝路徑與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()
應該給你的球員的名字。