diff --git a/Project.xml b/Project.xml index 08b9a5a..0de6121 100644 --- a/Project.xml +++ b/Project.xml @@ -116,7 +116,7 @@ - + diff --git a/source/Discord.hx b/source/Discord.hx index 5dc9c64..f48bf4b 100644 --- a/source/Discord.hx +++ b/source/Discord.hx @@ -1,3 +1,4 @@ +# if windows package; import Sys.sleep; @@ -84,4 +85,5 @@ class DiscordClient //trace('Discord RPC Updated. Arguments: $details, $state, $smallImageKey, $hasStartTimestamp, $endTimestamp'); } -} \ No newline at end of file +} +#end \ No newline at end of file diff --git a/source/FreeplayState.hx b/source/FreeplayState.hx index 145f2fc..b7efe64 100644 --- a/source/FreeplayState.hx +++ b/source/FreeplayState.hx @@ -11,7 +11,7 @@ import flixel.util.FlxColor; import lime.utils.Assets; -#if desktop +#if windows import Discord.DiscordClient; #end @@ -53,7 +53,7 @@ class FreeplayState extends MusicBeatState } */ - #if desktop + #if windows // Updating Discord Rich Presence DiscordClient.changePresence("In the Menus", null); #end diff --git a/source/GameplayCustomizeState.hx b/source/GameplayCustomizeState.hx index 355691e..b3991c8 100644 --- a/source/GameplayCustomizeState.hx +++ b/source/GameplayCustomizeState.hx @@ -2,7 +2,7 @@ import flixel.math.FlxMath; import flixel.FlxCamera; import flixel.math.FlxPoint; import flixel.FlxObject; -#if desktop +#if windows import Discord.DiscordClient; import sys.thread.Thread; #end @@ -33,7 +33,7 @@ class GameplayCustomizeState extends MusicBeatState private var camHUD:FlxCamera; public override function create() { - #if desktop + #if windows // Updating Discord Rich Presence DiscordClient.changePresence("Customizing Gameplay", null); #end diff --git a/source/MainMenuState.hx b/source/MainMenuState.hx index f33ad95..0351715 100644 --- a/source/MainMenuState.hx +++ b/source/MainMenuState.hx @@ -14,7 +14,7 @@ import flixel.util.FlxColor; import io.newgrounds.NG; import lime.app.Application; -#if desktop +#if windows import Discord.DiscordClient; #end @@ -46,7 +46,7 @@ class MainMenuState extends MusicBeatState override function create() { - #if desktop + #if windows // Updating Discord Rich Presence DiscordClient.changePresence("In the Menus", null); #end diff --git a/source/MusicBeatState.hx b/source/MusicBeatState.hx index 3900654..29260f8 100644 --- a/source/MusicBeatState.hx +++ b/source/MusicBeatState.hx @@ -1,6 +1,8 @@ package; +#if windows import Discord.DiscordClient; +#end import flixel.tweens.FlxTween; import flixel.util.FlxColor; import openfl.Lib; diff --git a/source/PlayState.hx b/source/PlayState.hx index 415de42..aa54b97 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -40,7 +40,7 @@ import openfl.display.BlendMode; import openfl.display.StageQuality; import openfl.filters.ShaderFilter; -#if desktop +#if windows import Discord.DiscordClient; #end @@ -72,7 +72,7 @@ class PlayState extends MusicBeatState var songLength:Float = 0; - #if desktop + #if windows // Discord RPC variables var storyDifficultyText:String = ""; var iconRPC:String = ""; @@ -197,7 +197,7 @@ class PlayState extends MusicBeatState repPresses = 0; repReleases = 0; - #if desktop + #if windows // Making difficulty text for Discord Rich Presence. switch (storyDifficulty) { @@ -1192,7 +1192,7 @@ class PlayState extends MusicBeatState default: allowedToHeadbang = false; } - #if desktop + #if windows // Updating Discord Rich Presence (with Time Left) DiscordClient.changePresence(detailsText + " " + SONG.song + " (" + storyDifficultyText + ") " + generateRanking(), "\nAcc: " + truncateFloat(accuracy, 2) + "% | Score: " + songScore + " | Misses: " + misses , iconRPC); #end @@ -1421,7 +1421,7 @@ class PlayState extends MusicBeatState vocals.pause(); } - #if desktop + #if windows DiscordClient.changePresence("PAUSED on " + SONG.song + " (" + storyDifficultyText + ") " + generateRanking(), "Acc: " + truncateFloat(accuracy, 2) + "% | Score: " + songScore + " | Misses: " + misses , iconRPC); #end if (!startTimer.finished) @@ -1444,7 +1444,7 @@ class PlayState extends MusicBeatState startTimer.active = true; paused = false; - #if desktop + #if windows if (startTimer.finished) { DiscordClient.changePresence(detailsText + " " + SONG.song + " (" + storyDifficultyText + ") " + generateRanking(), "\nAcc: " + truncateFloat(accuracy, 2) + "% | Score: " + songScore + " | Misses: " + misses, iconRPC, true, songLength - Conductor.songPosition); @@ -1469,7 +1469,7 @@ class PlayState extends MusicBeatState vocals.time = Conductor.songPosition; vocals.play(); - #if desktop + #if windows DiscordClient.changePresence(detailsText + " " + SONG.song + " (" + storyDifficultyText + ") " + generateRanking(), "\nAcc: " + truncateFloat(accuracy, 2) + "% | Score: " + songScore + " | Misses: " + misses , iconRPC); #end } @@ -1655,7 +1655,7 @@ class PlayState extends MusicBeatState if (FlxG.keys.justPressed.SEVEN) { - #if desktop + #if windows DiscordClient.changePresence("Chart Editor", null, null, true); #end FlxG.switchState(new ChartingState()); @@ -1940,7 +1940,7 @@ class PlayState extends MusicBeatState openSubState(new GameOverSubstate(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y)); - #if desktop + #if windows // Game Over doesn't get his own variable because it's only used here DiscordClient.changePresence("GAME OVER -- " + SONG.song + " (" + storyDifficultyText + ") " + generateRanking(),"\nAcc: " + truncateFloat(accuracy, 2) + "% | Score: " + songScore + " | Misses: " + misses , iconRPC); #end @@ -3111,7 +3111,7 @@ class PlayState extends MusicBeatState // yes this updates every step. // yes this is bad // but i'm doing it to update misses and accuracy - #if desktop + #if windows // Song duration in a float, useful for the time left feature songLength = FlxG.sound.music.length; diff --git a/source/StoryMenuState.hx b/source/StoryMenuState.hx index c2e1cb7..a7677a5 100644 --- a/source/StoryMenuState.hx +++ b/source/StoryMenuState.hx @@ -13,7 +13,7 @@ import flixel.util.FlxColor; import flixel.util.FlxTimer; import lime.net.curl.CURLCode; -#if desktop +#if windows import Discord.DiscordClient; #end @@ -74,7 +74,7 @@ class StoryMenuState extends MusicBeatState override function create() { - #if desktop + #if windows // Updating Discord Rich Presence DiscordClient.changePresence("In the Menus", null); #end diff --git a/source/TitleState.hx b/source/TitleState.hx index ec98454..e38e58e 100644 --- a/source/TitleState.hx +++ b/source/TitleState.hx @@ -24,8 +24,11 @@ import io.newgrounds.NG; import lime.app.Application; import openfl.Assets; -#if desktop +#if windows import Discord.DiscordClient; +#end + +#if desktop import sys.thread.Thread; #end @@ -59,7 +62,7 @@ class TitleState extends MusicBeatState PlayerSettings.init(); - #if desktop + #if windows DiscordClient.initialize(); Application.current.onExit.add (function (exitCode) {