mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-11-05 06:14:36 +00:00
Adding updated source files
This commit is contained in:
parent
b1b3df25b5
commit
cb8aa3d175
71
source/Discord.hx
Normal file
71
source/Discord.hx
Normal 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'"
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,5 +1,8 @@
|
|||
package;
|
||||
|
||||
#if !html
|
||||
import Discord.DiscordClient;
|
||||
#end
|
||||
import flash.text.TextField;
|
||||
import flixel.FlxG;
|
||||
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;
|
||||
|
||||
#if debug
|
||||
|
@ -229,9 +237,9 @@ class FreeplayState extends MusicBeatState
|
|||
|
||||
function changeSelection(change:Int = 0)
|
||||
{
|
||||
#if !switch
|
||||
NGio.logEvent('Fresh');
|
||||
#end
|
||||
// #if !switch
|
||||
// NGio.logEvent('Fresh');
|
||||
// #end
|
||||
|
||||
// NGio.logEvent('Fresh');
|
||||
FlxG.sound.play(Paths.sound('scrollMenu'), 0.4);
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package;
|
||||
|
||||
#if !html
|
||||
import Discord.DiscordClient;
|
||||
#end
|
||||
import Section.SwagSection;
|
||||
import Song.SwagSong;
|
||||
import WiggleEffect.WiggleEffectType;
|
||||
|
@ -124,7 +127,6 @@ class PlayState extends MusicBeatState
|
|||
|
||||
override public function create()
|
||||
{
|
||||
|
||||
if (FlxG.sound.music != null)
|
||||
FlxG.sound.music.stop();
|
||||
|
||||
|
@ -174,6 +176,29 @@ class PlayState extends MusicBeatState
|
|||
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')
|
||||
{
|
||||
curStage = "spooky";
|
||||
|
@ -870,16 +895,8 @@ class PlayState extends MusicBeatState
|
|||
|
||||
var introAssets:Map<String, Array<String>> = new Map<String, Array<String>>();
|
||||
introAssets.set('default', ['ready', "set", "go"]);
|
||||
introAssets.set('school', [
|
||||
'weeb/pixelUI/ready-pixel',
|
||||
'weeb/pixelUI/set-pixel',
|
||||
'weeb/pixelUI/date-pixel'
|
||||
]);
|
||||
introAssets.set('schoolEvil', [
|
||||
'weeb/pixelUI/ready-pixel',
|
||||
'weeb/pixelUI/set-pixel',
|
||||
'weeb/pixelUI/date-pixel'
|
||||
]);
|
||||
introAssets.set('school', ['weeb/pixelUI/ready-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 altSuffix:String = "";
|
||||
|
@ -1059,9 +1076,7 @@ class PlayState extends MusicBeatState
|
|||
{
|
||||
swagNote.x += FlxG.width / 2; // general offset
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
else {}
|
||||
}
|
||||
daBeats += 1;
|
||||
}
|
||||
|
@ -1920,29 +1935,29 @@ class PlayState extends MusicBeatState
|
|||
*/
|
||||
// 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
|
||||
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);
|
||||
daNote.kill();
|
||||
notes.remove(daNote, true);
|
||||
daNote.destroy();
|
||||
}
|
||||
|
||||
//this is already done in noteCheck / goodNoteHit
|
||||
if (daNote.wasGoodHit)
|
||||
{
|
||||
daNote.kill();
|
||||
notes.remove(daNote, true);
|
||||
daNote.destroy();
|
||||
}
|
||||
*/
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package;
|
||||
|
||||
#if !html
|
||||
import Discord.DiscordClient;
|
||||
#end
|
||||
import flixel.FlxG;
|
||||
import flixel.FlxSprite;
|
||||
import flixel.addons.transition.FlxTransitionableState;
|
||||
|
@ -109,6 +112,10 @@ class StoryMenuState extends MusicBeatState
|
|||
add(grpLocks);
|
||||
|
||||
trace("Line 70");
|
||||
#if !html
|
||||
// Updating Discord Rich Presence
|
||||
DiscordClient.changePresence("In the menus.", null);
|
||||
#end
|
||||
|
||||
for (i in 0...weekData.length)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package;
|
||||
|
||||
#if !html5
|
||||
import Discord.DiscordClient;
|
||||
#end
|
||||
import flixel.FlxG;
|
||||
import flixel.FlxSprite;
|
||||
import flixel.FlxState;
|
||||
|
@ -23,6 +26,7 @@ import flixel.util.FlxTimer;
|
|||
import io.newgrounds.NG;
|
||||
import lime.app.Application;
|
||||
import openfl.Assets;
|
||||
import sys.thread.Thread;
|
||||
|
||||
using StringTools;
|
||||
|
||||
|
@ -45,7 +49,7 @@ class TitleState extends MusicBeatState
|
|||
#if polymod
|
||||
polymod.Polymod.init({modRoot: "mods", dirs: ['introMod']});
|
||||
#end
|
||||
|
||||
|
||||
PlayerSettings.init();
|
||||
|
||||
curWacky = FlxG.random.getObject(getIntroTextShit());
|
||||
|
@ -89,6 +93,10 @@ class TitleState extends MusicBeatState
|
|||
startIntro();
|
||||
});
|
||||
#end
|
||||
|
||||
#if !html
|
||||
DiscordClient.initialize();
|
||||
#end
|
||||
}
|
||||
|
||||
var logoBl:FlxSprite;
|
||||
|
@ -282,12 +290,12 @@ class TitleState extends MusicBeatState
|
|||
|
||||
if (version.trim() != NGio.GAME_VER_NUMS.trim() && !OutdatedSubState.leftState)
|
||||
{
|
||||
FlxG.switchState(new OutdatedSubState());
|
||||
trace('OLD VERSION!');
|
||||
trace('old ver');
|
||||
trace(version.trim());
|
||||
trace('cur ver');
|
||||
trace(NGio.GAME_VER_NUMS.trim());
|
||||
FlxG.switchState(new OutdatedSubState());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue