1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-12-26 23:16:46 +00:00

nicer pausemenu exit, and force loading for ez tests

This commit is contained in:
Cameron Taylor 2022-04-15 17:11:01 -04:00
parent 8302b2d2ba
commit 967f847800
3 changed files with 111 additions and 83 deletions

View file

@ -1,9 +1,5 @@
package funkin;
import funkin.util.Constants;
import funkin.modding.events.ScriptEvent.UpdateScriptEvent;
import funkin.modding.module.ModuleHandler;
import funkin.NGio;
import flixel.FlxObject;
import flixel.FlxSprite;
import flixel.FlxState;
@ -18,14 +14,18 @@ import flixel.tweens.FlxTween;
import flixel.ui.FlxButton;
import flixel.util.FlxColor;
import flixel.util.FlxTimer;
import lime.app.Application;
import openfl.filters.ShaderFilter;
import funkin.NGio;
import funkin.modding.events.ScriptEvent.UpdateScriptEvent;
import funkin.modding.module.ModuleHandler;
import funkin.shaderslmfao.ScreenWipeShader;
import funkin.ui.AtlasMenuList;
import funkin.ui.MenuList;
import funkin.ui.OptionsState;
import funkin.ui.PreferencesMenu;
import funkin.ui.Prompt;
import funkin.util.Constants;
import lime.app.Application;
import openfl.filters.ShaderFilter;
using StringTools;
@ -33,8 +33,8 @@ using StringTools;
import Discord.DiscordClient;
#end
#if newgrounds
import io.newgrounds.NG;
import funkin.ui.NgPrompt;
import io.newgrounds.NG;
#end
class MainMenuState extends MusicBeatState
@ -102,7 +102,7 @@ class MainMenuState extends MusicBeatState
}
});
menuItems.enabled = false; // disable for intro
menuItems.enabled = true; // can move on intro
menuItems.createItem('story mode', function() startExitState(new StoryMenuState()));
menuItems.createItem('freeplay', function()
{
@ -169,7 +169,7 @@ class MainMenuState extends MusicBeatState
{
super.finishTransIn();
menuItems.enabled = true;
// menuItems.enabled = true;
// #if newgrounds
// if (NGio.savedSessionFailed)

View file

@ -1,6 +1,5 @@
package funkin;
import funkin.Controls.Control;
import flixel.FlxSprite;
import flixel.FlxSubState;
import flixel.addons.transition.FlxTransitionableState;
@ -11,6 +10,7 @@ import flixel.text.FlxText;
import flixel.tweens.FlxEase;
import flixel.tweens.FlxTween;
import flixel.util.FlxColor;
import funkin.Controls.Control;
import funkin.play.PlayState;
class PauseSubState extends MusicBeatSubstate
@ -33,6 +33,9 @@ class PauseSubState extends MusicBeatSubstate
var practiceText:FlxText;
var exitingToMenu:Bool = false;
var bg:FlxSprite;
public function new(x:Float, y:Float)
{
super();
@ -45,7 +48,7 @@ class PauseSubState extends MusicBeatSubstate
FlxG.sound.list.add(pauseMusic);
var bg:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK);
bg = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK);
bg.alpha = 0;
bg.scrollFactor.set();
add(bg);
@ -130,71 +133,93 @@ class PauseSubState extends MusicBeatSubstate
var downP = controls.UI_DOWN_P;
var accepted = controls.ACCEPT;
if (upP)
if (!exitingToMenu)
{
changeSelection(-1);
}
if (downP)
{
changeSelection(1);
}
var androidPause:Bool = false;
#if android
androidPause = FlxG.android.justPressed.BACK;
#end
if (androidPause)
close();
if (accepted)
{
var daSelected:String = menuItems[curSelected];
switch (daSelected)
if (upP)
{
case "Resume":
close();
case "EASY" | 'NORMAL' | "HARD":
PlayState.currentSong = SongLoad.loadFromJson(PlayState.currentSong.song.toLowerCase(), PlayState.currentSong.song.toLowerCase());
SongLoad.curDiff = daSelected.toLowerCase();
PlayState.storyDifficulty = curSelected;
PlayState.needsReset = true;
close();
case 'Toggle Practice Mode':
PlayState.isPracticeMode = !PlayState.isPracticeMode;
practiceText.visible = PlayState.isPracticeMode;
case 'Change Difficulty':
menuItems = difficultyChoices;
regenMenu();
case 'BACK':
menuItems = pauseOG;
regenMenu();
case "Restart Song":
PlayState.needsReset = true;
close();
// FlxG.resetState();
case "Exit to menu":
PlayState.seenCutscene = false;
PlayState.deathCounter = 0;
if (PlayState.isStoryMode)
FlxG.switchState(new StoryMenuState());
else
FlxG.switchState(new FreeplayState());
changeSelection(-1);
}
if (downP)
{
changeSelection(1);
}
}
if (FlxG.keys.justPressed.J)
{
// for reference later!
// PlayerSettings.player1.controls.replaceBinding(Control.LEFT, Keys, FlxKey.J, null);
var androidPause:Bool = false;
#if android
androidPause = FlxG.android.justPressed.BACK;
#end
if (androidPause)
close();
if (accepted)
{
var daSelected:String = menuItems[curSelected];
switch (daSelected)
{
case "Resume":
close();
case "EASY" | 'NORMAL' | "HARD":
PlayState.currentSong = SongLoad.loadFromJson(PlayState.currentSong.song.toLowerCase(), PlayState.currentSong.song.toLowerCase());
SongLoad.curDiff = daSelected.toLowerCase();
PlayState.storyDifficulty = curSelected;
PlayState.needsReset = true;
close();
case 'Toggle Practice Mode':
PlayState.isPracticeMode = !PlayState.isPracticeMode;
practiceText.visible = PlayState.isPracticeMode;
case 'Change Difficulty':
menuItems = difficultyChoices;
regenMenu();
case 'BACK':
menuItems = pauseOG;
regenMenu();
case "Restart Song":
PlayState.needsReset = true;
close();
// FlxG.resetState();
case "Exit to menu":
exitingToMenu = true;
PlayState.seenCutscene = false;
PlayState.deathCounter = 0;
for (item in grpMenuShit.members)
{
item.targetY = -3;
item.alpha = 0.6;
}
FlxTween.tween(bg, {alpha: 1}, 0.4, {
ease: FlxEase.quartInOut,
onComplete: function(_)
{
FlxTransitionableState.skipNextTransIn = true;
FlxTransitionableState.skipNextTransOut = true;
FlxG.cameras.list[1].alpha = 0; // bullshit for the UI camera???
if (PlayState.isStoryMode)
FlxG.switchState(new StoryMenuState());
else
FlxG.switchState(new FreeplayState());
}
});
}
}
if (FlxG.keys.justPressed.J)
{
// for reference later!
// PlayerSettings.player1.controls.replaceBinding(Control.LEFT, Keys, FlxKey.J, null);
}
}
}
@ -216,12 +241,9 @@ class PauseSubState extends MusicBeatSubstate
if (curSelected >= menuItems.length)
curSelected = 0;
var bullShit:Int = 0;
for (item in grpMenuShit.members)
for (index => item in grpMenuShit.members)
{
item.targetY = bullShit - curSelected;
bullShit++;
item.targetY = index - curSelected;
item.alpha = 0.6;
// item.setGraphicSize(Std.int(item.width * 0.8));

View file

@ -1,6 +1,5 @@
package funkin;
import funkin.audiovis.SpectogramSprite;
import flixel.FlxObject;
import flixel.FlxSprite;
import flixel.FlxState;
@ -16,6 +15,11 @@ import flixel.tweens.FlxEase;
import flixel.tweens.FlxTween;
import flixel.util.FlxColor;
import flixel.util.FlxTimer;
import funkin.audiovis.SpectogramSprite;
import funkin.shaderslmfao.BuildingShaders;
import funkin.shaderslmfao.ColorSwap;
import funkin.shaderslmfao.TitleOutline;
import funkin.ui.PreferencesMenu;
import lime.app.Application;
import lime.graphics.Image;
import lime.media.AudioContext;
@ -29,10 +33,6 @@ import openfl.events.NetStatusEvent;
import openfl.media.Video;
import openfl.net.NetConnection;
import openfl.net.NetStream;
import funkin.shaderslmfao.BuildingShaders;
import funkin.shaderslmfao.ColorSwap;
import funkin.shaderslmfao.TitleOutline;
import funkin.ui.PreferencesMenu;
using StringTools;
@ -382,6 +382,13 @@ class TitleState extends MusicBeatState
pressedEnter = true;
#end
}
// a faster intro thing lol!
if (pressedEnter && transitioning && skippedIntro)
{
FlxG.switchState(new MainMenuState());
}
if (pressedEnter && !transitioning && skippedIntro)
{
if (FlxG.sound.music != null)
@ -427,7 +434,6 @@ class TitleState extends MusicBeatState
Assets.cache.clear(Paths.image('logoBumpin'));
Assets.cache.clear(Paths.image('titleEnter'));
// ngSpr??
FlxG.switchState(targetState);
});
// FlxG.sound.play(Paths.music('titleShoot'), 0.7);
}