Files
sbox-public/engine/Sandbox.GameInstance/RichPresence/RichPresenceSystem.cs
s&box team 71f266059a Open source release
This commit imports the C# engine code and game files, excluding C++ source code.

[Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
2025-11-24 09:05:18 +00:00

39 lines
878 B
C#

namespace Sandbox
{
/// <summary>
/// We might have multiple rich presence systems running (Steam, Discord, ...)
/// </summary>
internal interface IRichPresenceSystem
{
public void Poll();
}
/// <summary>
/// Rich Presence System - polls rich presence state periodically.
/// All in one place so we don't update rich presence in 100 places
/// </summary>
internal static class RichPresenceSystem
{
/// <summary>
/// The current rich presence system
/// </summary>
static IRichPresenceSystem Current { get; set; } = new SteamRichPresenceSystem();
static RealTimeUntil TimeUntilNextPoll = 0;
/// <summary>
/// Called by ClientDll Tick to poll active rich presence systems
/// </summary>
internal static void Tick()
{
if ( TimeUntilNextPoll )
{
Current.Poll();
// Poll every 5 seconds
TimeUntilNextPoll = 5;
}
}
}
}