diff --git a/Project.xml b/Project.xml index 192a2dc7d..c6eb34e14 100644 --- a/Project.xml +++ b/Project.xml @@ -126,7 +126,7 @@ - + diff --git a/source/FreeplayState.hx b/source/FreeplayState.hx index 4c3e492e3..2297439e3 100644 --- a/source/FreeplayState.hx +++ b/source/FreeplayState.hx @@ -1,6 +1,5 @@ package; - -#if desktop +#if discord_rpc import Discord.DiscordClient; #end import flash.text.TextField; @@ -52,7 +51,7 @@ class FreeplayState extends MusicBeatState FlxG.sound.playMusic(Paths.music('freakyMenu')); } - #if desktop + #if discord_rpc // Updating Discord Rich Presence DiscordClient.changePresence("In the Menus", null); #end diff --git a/source/MainMenuState.hx b/source/MainMenuState.hx index 75fab2853..bdcbd277c 100644 --- a/source/MainMenuState.hx +++ b/source/MainMenuState.hx @@ -41,7 +41,7 @@ class MainMenuState extends MusicBeatState override function create() { - #if desktop + #if discord_rpc // Updating Discord Rich Presence DiscordClient.changePresence("In the Menus", null); #end diff --git a/source/PlayState.hx b/source/PlayState.hx index 6dbad2a19..b930a9846 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -43,7 +43,7 @@ import ui.PreferencesMenu; using StringTools; -#if desktop +#if discord_rpc import Discord.DiscordClient; #end @@ -134,7 +134,7 @@ class PlayState extends MusicBeatState var inCutscene:Bool = false; - #if desktop + #if discord_rpc // Discord RPC variables var storyDifficultyText:String = ""; var iconRPC:String = ""; @@ -833,7 +833,7 @@ class PlayState extends MusicBeatState function initDiscord():Void { - #if desktop + #if discord_rpc storyDifficultyText = CoolUtil.difficultyString(); iconRPC = SONG.player2; @@ -1073,7 +1073,7 @@ class PlayState extends MusicBeatState FlxG.sound.music.onComplete = endSong; vocals.play(); - #if desktop + #if discord_rpc // Song duration in a float, useful for the time left feature songLength = FlxG.sound.music.length; @@ -1324,7 +1324,7 @@ class PlayState extends MusicBeatState startTimer.active = true; paused = false; - #if desktop + #if discord_rpc if (startTimer.finished) { DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC, true, songLength - Conductor.songPosition); @@ -1339,9 +1339,9 @@ class PlayState extends MusicBeatState super.closeSubState(); } + #if discord_rpc override public function onFocus():Void { - #if desktop if (health > 0 && !paused) { if (Conductor.songPosition > 0.0) @@ -1353,22 +1353,20 @@ class PlayState extends MusicBeatState DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC); } } - #end super.onFocus(); } override public function onFocusLost():Void { - #if desktop if (health > 0 && !paused) { DiscordClient.changePresence(detailsPausedText, SONG.song + " (" + storyDifficultyText + ")", iconRPC); } - #end super.onFocusLost(); } + #end function resyncVocals():Void { @@ -1470,7 +1468,7 @@ class PlayState extends MusicBeatState boyfriendPos.put(); } - #if desktop + #if discord_rpc DiscordClient.changePresence(detailsPausedText, SONG.song + " (" + storyDifficultyText + ")", iconRPC); #end } @@ -1479,7 +1477,7 @@ class PlayState extends MusicBeatState { FlxG.switchState(new ChartingState()); - #if desktop + #if discord_rpc DiscordClient.changePresence("Chart Editor", null, null, true); #end } @@ -1598,7 +1596,7 @@ class PlayState extends MusicBeatState // FlxG.switchState(new GameOverState(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y)); - #if desktop + #if discord_rpc // Game Over doesn't get his own variable because it's only used here DiscordClient.changePresence("Game Over - " + detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC); #end diff --git a/source/StoryMenuState.hx b/source/StoryMenuState.hx index 3c9d629ec..013c171d3 100644 --- a/source/StoryMenuState.hx +++ b/source/StoryMenuState.hx @@ -1,6 +1,6 @@ package; -#if desktop +#if discord_rpc import Discord.DiscordClient; #end import flixel.FlxG; @@ -113,7 +113,7 @@ class StoryMenuState extends MusicBeatState trace("Line 70"); - #if desktop + #if discord_rpc // Updating Discord Rich Presence DiscordClient.changePresence("In the Menus", null); #end diff --git a/source/TitleState.hx b/source/TitleState.hx index 496de123d..bdb394bcf 100644 --- a/source/TitleState.hx +++ b/source/TitleState.hx @@ -22,8 +22,10 @@ import ui.PreferencesMenu; using StringTools; -#if desktop +#if discord_rpc import Discord.DiscordClient; +#end +#if desktop import sys.thread.Thread; #end @@ -98,7 +100,7 @@ class TitleState extends MusicBeatState }); #end - #if desktop + #if discord_rpc DiscordClient.initialize(); #end }