mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Allow for rich presence to be set on game join
better title: Allow for rich presence to be set through BloxstrapRPC on immediate game join
This commit is contained in:
parent
871bf2f9b1
commit
b22d72a1b8
@ -9,6 +9,7 @@ namespace Bloxstrap.Integrations
|
|||||||
|
|
||||||
private DiscordRPC.RichPresence? _currentPresence;
|
private DiscordRPC.RichPresence? _currentPresence;
|
||||||
private DiscordRPC.RichPresence? _currentPresenceCopy;
|
private DiscordRPC.RichPresence? _currentPresenceCopy;
|
||||||
|
private Message? _stashedRPCMessage;
|
||||||
|
|
||||||
private bool _visible = true;
|
private bool _visible = true;
|
||||||
private long _currentUniverseId;
|
private long _currentUniverseId;
|
||||||
@ -55,6 +56,13 @@ namespace Bloxstrap.Integrations
|
|||||||
|
|
||||||
if (_currentPresence is null || _currentPresenceCopy is null)
|
if (_currentPresence is null || _currentPresenceCopy is null)
|
||||||
{
|
{
|
||||||
|
if (_activityWatcher.ActivityInGame)
|
||||||
|
{
|
||||||
|
App.Logger.WriteLine(LOG_IDENT, "Presence is not yet set, but is currently in game, stashing presence set request");
|
||||||
|
_stashedRPCMessage = message;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
App.Logger.WriteLine(LOG_IDENT, "Presence is not set, aborting");
|
App.Logger.WriteLine(LOG_IDENT, "Presence is not set, aborting");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -173,7 +181,10 @@ namespace Bloxstrap.Integrations
|
|||||||
if (!_activityWatcher.ActivityInGame)
|
if (!_activityWatcher.ActivityInGame)
|
||||||
{
|
{
|
||||||
App.Logger.WriteLine(LOG_IDENT, "Not in game, clearing presence");
|
App.Logger.WriteLine(LOG_IDENT, "Not in game, clearing presence");
|
||||||
_currentPresence = _currentPresenceCopy = null;
|
|
||||||
|
_currentPresence = _currentPresenceCopy = null;
|
||||||
|
_stashedRPCMessage = null;
|
||||||
|
|
||||||
UpdatePresence();
|
UpdatePresence();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -268,7 +279,16 @@ namespace Bloxstrap.Integrations
|
|||||||
// this is used for configuration from BloxstrapRPC
|
// this is used for configuration from BloxstrapRPC
|
||||||
_currentPresenceCopy = _currentPresence.Clone();
|
_currentPresenceCopy = _currentPresence.Clone();
|
||||||
|
|
||||||
UpdatePresence();
|
if (_stashedRPCMessage is not null)
|
||||||
|
{
|
||||||
|
App.Logger.WriteLine(LOG_IDENT, "Found stashed RPC message, invoking presence set command now");
|
||||||
|
ProcessRPCMessage(_stashedRPCMessage);
|
||||||
|
_stashedRPCMessage = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UpdatePresence();
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user