From b1993259bf8765cfb20d9d6e42167c87032eb133 Mon Sep 17 00:00:00 2001 From: WorstAquaPlayer Date: Sat, 27 Feb 2021 21:06:30 -0300 Subject: [PATCH] Changed RPC !html and added Debug Status --- source/Discord.hx | 2 +- source/FreeplayState.hx | 6 +++--- source/PlayState.hx | 20 ++++++++++++-------- source/StoryMenuState.hx | 7 ++++--- source/TitleState.hx | 4 ++-- 5 files changed, 22 insertions(+), 17 deletions(-) diff --git a/source/Discord.hx b/source/Discord.hx index 39875a37d..253a4f59a 100644 --- a/source/Discord.hx +++ b/source/Discord.hx @@ -77,6 +77,6 @@ class DiscordClient endTimestamp : Std.int(endTimestamp / 1000) }); - trace('Discord RPC Updated. Argument: $details, $state, $smallImageKey, $hasStartTimestamp, $endTimestamp'); + //trace('Discord RPC Updated. Arguments: $details, $state, $smallImageKey, $hasStartTimestamp, $endTimestamp'); } } diff --git a/source/FreeplayState.hx b/source/FreeplayState.hx index edc68b1a8..7dbc84f3a 100644 --- a/source/FreeplayState.hx +++ b/source/FreeplayState.hx @@ -1,6 +1,6 @@ package; -#if !html +#if desktop import Discord.DiscordClient; #end import flash.text.TextField; @@ -48,9 +48,9 @@ class FreeplayState extends MusicBeatState } */ - #if !html + #if desktop // Updating Discord Rich Presence - DiscordClient.changePresence("In the menus.", null); + DiscordClient.changePresence("In the Menus", null); #end var isDebug:Bool = false; diff --git a/source/PlayState.hx b/source/PlayState.hx index 3f80deb92..4ac546024 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -1,6 +1,6 @@ package; -#if !html +#if desktop import Discord.DiscordClient; #end import Section.SwagSection; @@ -125,7 +125,7 @@ class PlayState extends MusicBeatState var inCutscene:Bool = false; - #if !html + #if desktop // Discord RPC variables var storyDifficultyText:String = ""; var iconRPC:String = ""; @@ -185,7 +185,7 @@ class PlayState extends MusicBeatState dialogue = CoolUtil.coolTextFile(Paths.txt('thorns/thornsDialogue')); } - #if !html + #if desktop // Making difficulty text for Discord Rich Presence. switch (storyDifficulty) { @@ -1021,7 +1021,7 @@ class PlayState extends MusicBeatState FlxG.sound.music.onComplete = endSong; vocals.play(); - #if !html + #if desktop // Song duration in a float, useful for the time left feature songLength = FlxG.sound.music.length; @@ -1269,7 +1269,7 @@ class PlayState extends MusicBeatState startTimer.active = true; paused = false; - #if !html + #if desktop if (startTimer.finished) { DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC, true, songLength - Conductor.songPosition); @@ -1286,7 +1286,7 @@ class PlayState extends MusicBeatState override public function onFocus():Void { - #if !html + #if desktop if (health > 0 && !paused) { if (Conductor.songPosition > 0.0) @@ -1305,7 +1305,7 @@ class PlayState extends MusicBeatState override public function onFocusLost():Void { - #if !html + #if desktop if (health > 0 && !paused) { DiscordClient.changePresence(detailsPausedText, SONG.song + " (" + storyDifficultyText + ")", iconRPC); @@ -1378,7 +1378,7 @@ class PlayState extends MusicBeatState else openSubState(new PauseSubState(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y)); - #if !html + #if desktop DiscordClient.changePresence(detailsPausedText, SONG.song + " (" + storyDifficultyText + ")", iconRPC); #end } @@ -1386,6 +1386,10 @@ class PlayState extends MusicBeatState if (FlxG.keys.justPressed.SEVEN) { FlxG.switchState(new ChartingState()); + + #if desktop + DiscordClient.changePresence("Chart Editor", null, null, true); + #end } // FlxG.watch.addQuick('VOL', vocals.amplitudeLeft); diff --git a/source/StoryMenuState.hx b/source/StoryMenuState.hx index 0e4b06558..6d1f8f20c 100644 --- a/source/StoryMenuState.hx +++ b/source/StoryMenuState.hx @@ -1,6 +1,6 @@ package; -#if !html +#if desktop import Discord.DiscordClient; #end import flixel.FlxG; @@ -112,9 +112,10 @@ class StoryMenuState extends MusicBeatState add(grpLocks); trace("Line 70"); - #if !html + + #if desktop // Updating Discord Rich Presence - DiscordClient.changePresence("In the menus.", null); + DiscordClient.changePresence("In the Menus", null); #end for (i in 0...weekData.length) diff --git a/source/TitleState.hx b/source/TitleState.hx index 4bc6ef63f..c91dc54eb 100644 --- a/source/TitleState.hx +++ b/source/TitleState.hx @@ -1,6 +1,6 @@ package; -#if !html5 +#if desktop import Discord.DiscordClient; import sys.thread.Thread; #end @@ -94,7 +94,7 @@ class TitleState extends MusicBeatState }); #end - #if !html + #if desktop DiscordClient.initialize(); #end }