Adding updated source files

This commit is contained in:
Jakkzero 2021-02-26 12:27:32 +00:00 committed by GitHub
parent eff2a19257
commit 90277aaa67
5 changed files with 149 additions and 40 deletions

71
source/Discord.hx Normal file
View File

@ -0,0 +1,71 @@
package;
import discord_rpc.DiscordRpc;
import haxe.Timer;
using StringTools;
class DiscordClient
{
public function new()
{
trace("Discord Client starting...");
DiscordRpc.start({
clientID: "814588678700924999",
onReady: onReady,
onError: onError,
onDisconnected: onDisconnected
});
trace("Discord Client started.");
while (true)
{
trace("process called");
DiscordRpc.process();
trace("pre-delay");
Timer.delay(continue, 2000);
trace("post-delay");
}
DiscordRpc.shutdown();
}
static function onReady()
{
DiscordRpc.presence({
details: "In the Menus",
state: null,
largeImageKey: 'icon',
largeImageText: "Friday Night Funkin'"
});
}
static function onError(_code:Int, _message:String)
{
trace('Error! $_code : $_message');
}
static function onDisconnected(_code:Int, _message:String)
{
trace('Disconnected! $_code : $_message');
}
public static function initialize()
{
var DiscordDaemon = sys.thread.Thread.create(() ->
{
new DiscordClient();
});
trace("Discord Client initialized");
}
public static function changePresence(details:String, state:Null<String>)
{
DiscordRpc.presence({
details: details,
state: state,
largeImageKey: 'icon',
largeImageText: "Friday Night Funkin'"
});
}
}

View File

@ -1,5 +1,8 @@
package; package;
#if !html
import Discord.DiscordClient;
#end
import flash.text.TextField; import flash.text.TextField;
import flixel.FlxG; import flixel.FlxG;
import flixel.FlxSprite; import flixel.FlxSprite;
@ -45,6 +48,11 @@ class FreeplayState extends MusicBeatState
} }
*/ */
#if !html
// Updating Discord Rich Presence
DiscordClient.changePresence("In the menus.", null);
#end
var isDebug:Bool = false; var isDebug:Bool = false;
#if debug #if debug
@ -229,9 +237,9 @@ class FreeplayState extends MusicBeatState
function changeSelection(change:Int = 0) function changeSelection(change:Int = 0)
{ {
#if !switch // #if !switch
NGio.logEvent('Fresh'); // NGio.logEvent('Fresh');
#end // #end
// NGio.logEvent('Fresh'); // NGio.logEvent('Fresh');
FlxG.sound.play(Paths.sound('scrollMenu'), 0.4); FlxG.sound.play(Paths.sound('scrollMenu'), 0.4);

View File

@ -1,5 +1,8 @@
package; package;
#if !html
import Discord.DiscordClient;
#end
import Section.SwagSection; import Section.SwagSection;
import Song.SwagSong; import Song.SwagSong;
import WiggleEffect.WiggleEffectType; import WiggleEffect.WiggleEffectType;
@ -124,7 +127,6 @@ class PlayState extends MusicBeatState
override public function create() override public function create()
{ {
if (FlxG.sound.music != null) if (FlxG.sound.music != null)
FlxG.sound.music.stop(); FlxG.sound.music.stop();
@ -174,6 +176,29 @@ class PlayState extends MusicBeatState
dialogue = CoolUtil.coolTextFile(Paths.txt('thorns/thornsDialogue')); dialogue = CoolUtil.coolTextFile(Paths.txt('thorns/thornsDialogue'));
} }
#if !html
// Making difficulty text for Discord Rich Presence.
var storyDifficultyText = "";
switch (storyDifficulty)
{
case 0:
storyDifficultyText = "Easy";
case 1:
storyDifficultyText = "Normal";
case 2:
storyDifficultyText = "Hard";
}
// Updating Discord Rich Presence.
if (isStoryMode)
{
DiscordClient.changePresence("Story Mode: Week " + storyWeek, SONG.song + " (" + storyDifficultyText + ")");
}
else
{
DiscordClient.changePresence("Freeplay", SONG.song + " (" + storyDifficultyText + ")");
}
#end
if (SONG.song.toLowerCase() == 'spookeez' || SONG.song.toLowerCase() == 'monster' || SONG.song.toLowerCase() == 'south') if (SONG.song.toLowerCase() == 'spookeez' || SONG.song.toLowerCase() == 'monster' || SONG.song.toLowerCase() == 'south')
{ {
curStage = "spooky"; curStage = "spooky";
@ -870,16 +895,8 @@ class PlayState extends MusicBeatState
var introAssets:Map<String, Array<String>> = new Map<String, Array<String>>(); var introAssets:Map<String, Array<String>> = new Map<String, Array<String>>();
introAssets.set('default', ['ready', "set", "go"]); introAssets.set('default', ['ready', "set", "go"]);
introAssets.set('school', [ introAssets.set('school', ['weeb/pixelUI/ready-pixel', 'weeb/pixelUI/set-pixel', 'weeb/pixelUI/date-pixel']);
'weeb/pixelUI/ready-pixel', introAssets.set('schoolEvil', ['weeb/pixelUI/ready-pixel', 'weeb/pixelUI/set-pixel', 'weeb/pixelUI/date-pixel']);
'weeb/pixelUI/set-pixel',
'weeb/pixelUI/date-pixel'
]);
introAssets.set('schoolEvil', [
'weeb/pixelUI/ready-pixel',
'weeb/pixelUI/set-pixel',
'weeb/pixelUI/date-pixel'
]);
var introAlts:Array<String> = introAssets.get('default'); var introAlts:Array<String> = introAssets.get('default');
var altSuffix:String = ""; var altSuffix:String = "";
@ -1059,9 +1076,7 @@ class PlayState extends MusicBeatState
{ {
swagNote.x += FlxG.width / 2; // general offset swagNote.x += FlxG.width / 2; // general offset
} }
else else {}
{
}
} }
daBeats += 1; daBeats += 1;
} }
@ -1920,29 +1935,29 @@ class PlayState extends MusicBeatState
*/ */
// trace(daNote.noteData); // trace(daNote.noteData);
/* /*
switch (daNote.noteData) switch (daNote.noteData)
{
case 2: // NOTES YOU JUST PRESSED
if (upP || rightP || downP || leftP)
noteCheck(upP, daNote);
case 3:
if (upP || rightP || downP || leftP)
noteCheck(rightP, daNote);
case 1:
if (upP || rightP || downP || leftP)
noteCheck(downP, daNote);
case 0:
if (upP || rightP || downP || leftP)
noteCheck(leftP, daNote);
}
//this is already done in noteCheck / goodNoteHit
if (daNote.wasGoodHit)
{ {
case 2: // NOTES YOU JUST PRESSED daNote.kill();
if (upP || rightP || downP || leftP) notes.remove(daNote, true);
noteCheck(upP, daNote); daNote.destroy();
case 3:
if (upP || rightP || downP || leftP)
noteCheck(rightP, daNote);
case 1:
if (upP || rightP || downP || leftP)
noteCheck(downP, daNote);
case 0:
if (upP || rightP || downP || leftP)
noteCheck(leftP, daNote);
} }
//this is already done in noteCheck / goodNoteHit
if (daNote.wasGoodHit)
{
daNote.kill();
notes.remove(daNote, true);
daNote.destroy();
}
*/ */
} }
else else

View File

@ -1,5 +1,8 @@
package; package;
#if !html
import Discord.DiscordClient;
#end
import flixel.FlxG; import flixel.FlxG;
import flixel.FlxSprite; import flixel.FlxSprite;
import flixel.addons.transition.FlxTransitionableState; import flixel.addons.transition.FlxTransitionableState;
@ -109,6 +112,10 @@ class StoryMenuState extends MusicBeatState
add(grpLocks); add(grpLocks);
trace("Line 70"); trace("Line 70");
#if !html
// Updating Discord Rich Presence
DiscordClient.changePresence("In the menus.", null);
#end
for (i in 0...weekData.length) for (i in 0...weekData.length)
{ {

View File

@ -1,5 +1,8 @@
package; package;
#if !html5
import Discord.DiscordClient;
#end
import flixel.FlxG; import flixel.FlxG;
import flixel.FlxSprite; import flixel.FlxSprite;
import flixel.FlxState; import flixel.FlxState;
@ -23,6 +26,7 @@ import flixel.util.FlxTimer;
import io.newgrounds.NG; import io.newgrounds.NG;
import lime.app.Application; import lime.app.Application;
import openfl.Assets; import openfl.Assets;
import sys.thread.Thread;
using StringTools; using StringTools;
@ -45,7 +49,7 @@ class TitleState extends MusicBeatState
#if polymod #if polymod
polymod.Polymod.init({modRoot: "mods", dirs: ['introMod']}); polymod.Polymod.init({modRoot: "mods", dirs: ['introMod']});
#end #end
PlayerSettings.init(); PlayerSettings.init();
curWacky = FlxG.random.getObject(getIntroTextShit()); curWacky = FlxG.random.getObject(getIntroTextShit());
@ -89,6 +93,10 @@ class TitleState extends MusicBeatState
startIntro(); startIntro();
}); });
#end #end
#if !html
DiscordClient.initialize();
#end
} }
var logoBl:FlxSprite; var logoBl:FlxSprite;
@ -282,12 +290,12 @@ class TitleState extends MusicBeatState
if (version.trim() != NGio.GAME_VER_NUMS.trim() && !OutdatedSubState.leftState) if (version.trim() != NGio.GAME_VER_NUMS.trim() && !OutdatedSubState.leftState)
{ {
FlxG.switchState(new OutdatedSubState());
trace('OLD VERSION!'); trace('OLD VERSION!');
trace('old ver'); trace('old ver');
trace(version.trim()); trace(version.trim());
trace('cur ver'); trace('cur ver');
trace(NGio.GAME_VER_NUMS.trim()); trace(NGio.GAME_VER_NUMS.trim());
FlxG.switchState(new OutdatedSubState());
} }
else else
{ {