small organization/cleanup of Discord things

This commit is contained in:
Cameron Taylor 2021-03-18 20:26:17 -04:00
parent 619f7c8a22
commit 99407f07ab

View file

@ -193,47 +193,7 @@ class PlayState extends MusicBeatState
dialogue = CoolUtil.coolTextFile(Paths.txt('thorns/thornsDialogue')); dialogue = CoolUtil.coolTextFile(Paths.txt('thorns/thornsDialogue'));
} }
#if desktop initDiscord();
// Making difficulty text for Discord Rich Presence.
switch (storyDifficulty)
{
case 0:
storyDifficultyText = "Easy";
case 1:
storyDifficultyText = "Normal";
case 2:
storyDifficultyText = "Hard";
}
iconRPC = SONG.player2;
// To avoid having duplicate images in Discord assets
switch (iconRPC)
{
case 'senpai-angry':
iconRPC = 'senpai';
case 'monster-christmas':
iconRPC = 'monster';
case 'mom-car':
iconRPC = 'mom';
}
// String that contains the mode defined here so it isn't necessary to call changePresence for each mode
if (isStoryMode)
{
detailsText = "Story Mode: Week " + storyWeek;
}
else
{
detailsText = "Freeplay";
}
// String for when the game is paused
detailsPausedText = "Paused - " + detailsText;
// Updating Discord Rich Presence.
DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC);
#end
switch (SONG.song.toLowerCase()) switch (SONG.song.toLowerCase())
{ {
@ -870,6 +830,32 @@ class PlayState extends MusicBeatState
super.create(); super.create();
} }
function initDiscord():Void
{
#if desktop
storyDifficultyText = CoolUtil.difficultyString();
iconRPC = SONG.player2;
// To avoid having duplicate images in Discord assets
switch (iconRPC)
{
case 'senpai-angry':
iconRPC = 'senpai';
case 'monster-christmas':
iconRPC = 'monster';
case 'mom-car':
iconRPC = 'mom';
}
// String that contains the mode defined here so it isn't necessary to call changePresence for each mode
detailsText = isStoryMode ? "Story Mode: Week " + storyWeek : "Freeplay";
detailsPausedText = "Paused - " + detailsText;
// Updating Discord Rich Presence.
DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC);
#end
}
function schoolIntro(?dialogueBox:DialogueBox):Void function schoolIntro(?dialogueBox:DialogueBox):Void
{ {
var black:FlxSprite = new FlxSprite(-100, -100).makeGraphic(FlxG.width * 2, FlxG.height * 2, FlxColor.BLACK); var black:FlxSprite = new FlxSprite(-100, -100).makeGraphic(FlxG.width * 2, FlxG.height * 2, FlxColor.BLACK);