From 0216d407fc5c9717833d7c1f96e950e11405640b Mon Sep 17 00:00:00 2001 From: George FunBook Date: Mon, 22 Mar 2021 09:09:46 -0500 Subject: [PATCH 1/2] allow run without discord stuff --- source/FreeplayState.hx | 5 ++--- source/MainMenuState.hx | 4 ++-- source/PlayState.hx | 22 ++++++++++------------ source/StoryMenuState.hx | 4 ++-- source/TitleState.hx | 6 ++++-- 5 files changed, 20 insertions(+), 21 deletions(-) diff --git a/source/FreeplayState.hx b/source/FreeplayState.hx index 802f557f34..301ab6611b 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 a4c45ee1a7..4171418529 100644 --- a/source/MainMenuState.hx +++ b/source/MainMenuState.hx @@ -1,6 +1,6 @@ package; -#if desktop +#if discord_rpc import Discord.DiscordClient; #end import flixel.FlxG; @@ -36,7 +36,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 013a8c2de5..9229190181 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -42,7 +42,7 @@ import shaderslmfao.ColorSwap; using StringTools; -#if desktop +#if discord_rpc import Discord.DiscordClient; #end @@ -133,7 +133,7 @@ class PlayState extends MusicBeatState var inCutscene:Bool = false; - #if desktop + #if discord_rpc // Discord RPC variables var storyDifficultyText:String = ""; var iconRPC:String = ""; @@ -834,7 +834,7 @@ class PlayState extends MusicBeatState function initDiscord():Void { - #if desktop + #if discord_rpc storyDifficultyText = CoolUtil.difficultyString(); iconRPC = SONG.player2; @@ -1074,7 +1074,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; @@ -1327,7 +1327,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); @@ -1342,9 +1342,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) @@ -1356,22 +1356,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 { @@ -1464,7 +1462,7 @@ class PlayState extends MusicBeatState else openSubState(new PauseSubState(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y)); - #if desktop + #if discord_rpc DiscordClient.changePresence(detailsPausedText, SONG.song + " (" + storyDifficultyText + ")", iconRPC); #end } @@ -1473,7 +1471,7 @@ class PlayState extends MusicBeatState { FlxG.switchState(new ChartingState()); - #if desktop + #if discord_rpc DiscordClient.changePresence("Chart Editor", null, null, true); #end } @@ -1642,7 +1640,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 1c2dc87832..5f2405bc8a 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 ca5340b933..a9dca89d76 100644 --- a/source/TitleState.hx +++ b/source/TitleState.hx @@ -21,8 +21,10 @@ import shaderslmfao.ColorSwap; 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 } From b292c9e8cdb7e64af324fb7e3a3813dcc1c5d014 Mon Sep 17 00:00:00 2001 From: George FunBook Date: Tue, 23 Mar 2021 14:17:04 -0500 Subject: [PATCH 2/2] change discord to cpp --- Project.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.xml b/Project.xml index 3572496c25..fc71598e0a 100644 --- a/Project.xml +++ b/Project.xml @@ -125,7 +125,7 @@ - +