Change Discord stuff to only windows

This commit is contained in:
daniel11420
2021-04-06 01:56:20 +00:00
committed by GitHub
parent 572d1ddd01
commit 8af197ab19
9 changed files with 29 additions and 22 deletions

View File

@ -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;