c# - 如何获得用户玩我的游戏花了多少小时? Steamworks API

标签 c# unity3d steamworks-api

如何获取用户玩我的游戏所花费的时间?在 Unity 中使用 Steamworks API 和 C#。我浏览了一份文档,但没有找到类似的东西,并认为我遗漏了一些东西。

我本应该使用一个简单的脚本来记录自己游戏中的上场时间,但为时已晚。如果有人能给我一击或指出正确的方向,我将不胜感激。

最佳答案

您可能仍有机会让它发挥作用。据我所知,有一种方法可以通过使用已弃用的 Community XML Data 来获取总播放时间(如 Gameplay stats 所示) :

Player Game Stats

To retrieve game stats, you will need the game's Steam Community name. Developers can contact Valve to obtain the community name for their game.

You can retrieve stats and achievements for a player per game using the player's 64-bit Steam ID with: Format: http://steamcommunity.com/profiles/[SteamID]/stats/[CommunityGameName]/?xml=1

Example: http://steamcommunity.com/profiles/76561197968575517/stats/L4D/?xml=1

在示例中,您可以在图像底部看到 hoursPlayed 字段:

hoursPlayed field

现在,问题显然是这已被弃用,Steam 建议您尽可能使用 Web API。但是,我还没有找到通过 Web API 访问此数据的方法,因此我认为这是最好的选择,无需推出自定义的播放时间跟踪方式。

关于c# - 如何获得用户玩我的游戏花了多少小时? Steamworks API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45764769/

相关文章:

c# - 使用 Linq to SQL 从数据库中检索图像

C# 获取光标处的控制权

c# - 为什么 Unity 在某些函数(例如 GetChild())中使用变换而不是游戏对象?

unity3d - (Unity + 2D) 更改 UI 按钮位置问题

c# - 使用 Unity Video Player 连续无缝播放不同的视频

javascript - 使用SteamAPI获取当前用户的GameID

c# - 如何从 .Net Core 中的单独类库获取经过身份验证的用户

c# - SharpSVN 使用 'SvnLookClient' 获取提交后 Hook

c# - 如何在 C# 的 Unity3D 中从 Steamworks API 获取 steamID?

steamworks-api - 如何完成 "Public Default Branch Includes ' Beans.exe锦标赛'"