1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-24 07:43:56 +00:00

Pausing and unpausing updates RPC

This commit is contained in:
WorstAquaPlayer 2021-02-27 20:23:50 -03:00
parent 700acb86a1
commit dee03abd3f

View file

@ -130,6 +130,8 @@ class PlayState extends MusicBeatState
var storyDifficultyText:String = ""; var storyDifficultyText:String = "";
var iconRPC:String = ""; var iconRPC:String = "";
var songLength:Float = 0; var songLength:Float = 0;
var detailsText:String = "";
var detailsPausedText:String = "";
#end #end
override public function create() override public function create()
@ -208,15 +210,21 @@ class PlayState extends MusicBeatState
iconRPC = 'mom'; iconRPC = 'mom';
} }
// Updating Discord Rich Presence. // String that contains the mode defined here so it isn't necessary to call changePresence for each mode
if (isStoryMode) if (isStoryMode)
{ {
DiscordClient.changePresence("Story Mode: Week " + storyWeek, SONG.song + " (" + storyDifficultyText + ")", iconRPC); detailsText = "Story Mode: Week " + storyWeek;
} }
else else
{ {
DiscordClient.changePresence("Freeplay", SONG.song + " (" + storyDifficultyText + ")", iconRPC); detailsText = "Freeplay";
} }
// String for when the game is paused
detailsPausedText = "Paused - " + detailsText;
// Updating Discord Rich Presence.
DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC);
#end #end
if (SONG.song.toLowerCase() == 'spookeez' || SONG.song.toLowerCase() == 'monster' || SONG.song.toLowerCase() == 'south') if (SONG.song.toLowerCase() == 'spookeez' || SONG.song.toLowerCase() == 'monster' || SONG.song.toLowerCase() == 'south')
@ -1018,14 +1026,7 @@ class PlayState extends MusicBeatState
songLength = FlxG.sound.music.length; songLength = FlxG.sound.music.length;
// Updating Discord Rich Presence (with Time Left) // Updating Discord Rich Presence (with Time Left)
if (isStoryMode) DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC, true, songLength);
{
DiscordClient.changePresence("Story Mode: Week " + storyWeek, SONG.song + " (" + storyDifficultyText + ")", iconRPC, true, songLength);
}
else
{
DiscordClient.changePresence("Freeplay", SONG.song + " (" + storyDifficultyText + ")", iconRPC, true, songLength);
}
#end #end
} }
@ -1267,6 +1268,17 @@ class PlayState extends MusicBeatState
if (!startTimer.finished) if (!startTimer.finished)
startTimer.active = true; startTimer.active = true;
paused = false; paused = false;
#if !html
if (startTimer.finished)
{
DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC, true, songLength - Conductor.songPosition);
}
else
{
DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC);
}
#end
} }
super.closeSubState(); super.closeSubState();
@ -1334,6 +1346,10 @@ class PlayState extends MusicBeatState
} }
else else
openSubState(new PauseSubState(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y)); openSubState(new PauseSubState(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y));
#if !html
DiscordClient.changePresence(detailsPausedText, SONG.song + " (" + storyDifficultyText + ")", iconRPC);
#end
} }
if (FlxG.keys.justPressed.SEVEN) if (FlxG.keys.justPressed.SEVEN)