mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-27 01:55:52 -05:00
no flashing menu
This commit is contained in:
parent
b470cfc83a
commit
105c05f2e2
4 changed files with 109 additions and 57 deletions
|
@ -1,8 +1,6 @@
|
|||
package;
|
||||
|
||||
import NGio;
|
||||
|
||||
import flixel.ui.FlxButton;
|
||||
import flixel.FlxG;
|
||||
import flixel.FlxObject;
|
||||
import flixel.FlxSprite;
|
||||
|
@ -14,26 +12,26 @@ import flixel.group.FlxGroup.FlxTypedGroup;
|
|||
import flixel.text.FlxText;
|
||||
import flixel.tweens.FlxEase;
|
||||
import flixel.tweens.FlxTween;
|
||||
import flixel.ui.FlxButton;
|
||||
import flixel.util.FlxColor;
|
||||
import flixel.util.FlxTimer;
|
||||
import lime.app.Application;
|
||||
import ui.AtlasMenuList;
|
||||
import ui.MenuList;
|
||||
import ui.OptionsState;
|
||||
import ui.PreferencesMenu;
|
||||
import ui.Prompt;
|
||||
|
||||
using StringTools;
|
||||
|
||||
#if desktop
|
||||
import Discord.DiscordClient;
|
||||
#end
|
||||
|
||||
#if newgrounds
|
||||
import io.newgrounds.NG;
|
||||
import ui.NgPrompt;
|
||||
#end
|
||||
|
||||
import ui.AtlasMenuList;
|
||||
import ui.MenuList;
|
||||
import ui.OptionsState;
|
||||
import ui.Prompt;
|
||||
|
||||
using StringTools;
|
||||
|
||||
class MainMenuState extends MusicBeatState
|
||||
{
|
||||
var menuItems:MainMenuList;
|
||||
|
@ -80,6 +78,7 @@ class MainMenuState extends MusicBeatState
|
|||
magenta.visible = false;
|
||||
magenta.antialiasing = true;
|
||||
magenta.color = 0xFFfd719b;
|
||||
if (PreferencesMenu.preferences.get('flashing-menu'))
|
||||
add(magenta);
|
||||
// magenta.scrollFactor.set();
|
||||
|
||||
|
@ -91,17 +90,15 @@ class MainMenuState extends MusicBeatState
|
|||
FlxFlicker.flicker(magenta, 1.1, 0.15, false, true);
|
||||
});
|
||||
|
||||
|
||||
|
||||
menuItems.enabled = false;// disable for intro
|
||||
menuItems.createItem('story mode', function () startExitState(new StoryMenuState()));
|
||||
menuItems.createItem('freeplay', function () startExitState(new FreeplayState()));
|
||||
menuItems.enabled = false; // disable for intro
|
||||
menuItems.createItem('story mode', function() startExitState(new StoryMenuState()));
|
||||
menuItems.createItem('freeplay', function() startExitState(new FreeplayState()));
|
||||
// addMenuItem('options', function () startExitState(new OptionMenu()));
|
||||
#if CAN_OPEN_LINKS
|
||||
var hasPopupBlocker = #if web true #else false #end;
|
||||
menuItems.createItem('donate', selectDonate, hasPopupBlocker);
|
||||
#end
|
||||
menuItems.createItem('options', function () startExitState(new OptionsState()));
|
||||
menuItems.createItem('options', function() startExitState(new OptionsState()));
|
||||
// #if newgrounds
|
||||
// if (NGio.isLoggedIn)
|
||||
// menuItems.createItem("logout", selectLogout);
|
||||
|
@ -186,7 +183,7 @@ class MainMenuState extends MusicBeatState
|
|||
var onPromptClose = checkLoginStatus;
|
||||
if (onClose != null)
|
||||
{
|
||||
onPromptClose = function ()
|
||||
onPromptClose = function()
|
||||
{
|
||||
checkLoginStatus();
|
||||
onClose();
|
||||
|
@ -209,7 +206,7 @@ class MainMenuState extends MusicBeatState
|
|||
public function openPrompt(prompt:Prompt, onClose:Void->Void)
|
||||
{
|
||||
menuItems.enabled = false;
|
||||
prompt.closeCallback = function ()
|
||||
prompt.closeCallback = function()
|
||||
{
|
||||
menuItems.enabled = true;
|
||||
if (onClose != null)
|
||||
|
@ -226,7 +223,7 @@ class MainMenuState extends MusicBeatState
|
|||
{
|
||||
if (menuItems.selectedIndex != item.ID)
|
||||
{
|
||||
FlxTween.tween(item, {alpha: 0}, duration, { ease: FlxEase.quadOut });
|
||||
FlxTween.tween(item, {alpha: 0}, duration, {ease: FlxEase.quadOut});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -255,11 +252,10 @@ private class MainMenuList extends MenuTypedList<MainMenuItem>
|
|||
{
|
||||
public var atlas:FlxAtlasFrames;
|
||||
|
||||
public function new ()
|
||||
public function new()
|
||||
{
|
||||
atlas = Paths.getSparrowAtlas('main_menu');
|
||||
super(Vertical);
|
||||
|
||||
}
|
||||
|
||||
public function createItem(x = 0.0, y = 0.0, name:String, callback, fireInstantly = false)
|
||||
|
@ -277,6 +273,7 @@ private class MainMenuList extends MenuTypedList<MainMenuItem>
|
|||
atlas = null;
|
||||
}
|
||||
}
|
||||
|
||||
private class MainMenuItem extends AtlasMenuItem
|
||||
{
|
||||
public function new(x = 0.0, y = 0.0, name, atlas, callback)
|
||||
|
|
|
@ -17,6 +17,7 @@ import flixel.util.FlxTimer;
|
|||
import lime.app.Application;
|
||||
import openfl.Assets;
|
||||
import shaderslmfao.ColorSwap;
|
||||
import ui.PreferencesMenu;
|
||||
|
||||
using StringTools;
|
||||
|
||||
|
@ -59,6 +60,8 @@ class TitleState extends MusicBeatState
|
|||
|
||||
super.create();
|
||||
|
||||
PreferencesMenu.initPrefs();
|
||||
|
||||
FlxG.save.bind('funkin', 'ninjamuffin99');
|
||||
PlayerSettings.init();
|
||||
Highscore.load();
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
package ui;
|
||||
|
||||
import flixel.FlxG;
|
||||
import flixel.FlxSprite;
|
||||
import flixel.group.FlxGroup;
|
||||
import flixel.util.FlxColor;
|
||||
import ui.AtlasText.AtlasFont;
|
||||
import ui.TextMenuList.TextMenuItem;
|
||||
|
||||
class PreferencesMenu extends ui.OptionsState.Page
|
||||
{
|
||||
|
@ -9,6 +13,8 @@ class PreferencesMenu extends ui.OptionsState.Page
|
|||
|
||||
var items:TextMenuList;
|
||||
|
||||
var checkboxes:Array<Dynamic> = [];
|
||||
|
||||
public function new()
|
||||
{
|
||||
super();
|
||||
|
@ -16,6 +22,14 @@ class PreferencesMenu extends ui.OptionsState.Page
|
|||
|
||||
createPrefItem('naughtyness', 'censor-naughty', false);
|
||||
createPrefItem('downscroll', 'downscroll', false);
|
||||
createPrefItem('flashing menu', 'flashing-menu', true);
|
||||
}
|
||||
|
||||
public static function initPrefs():Void
|
||||
{
|
||||
preferenceCheck('censor-naughty', false);
|
||||
preferenceCheck('downscroll', false);
|
||||
preferenceCheck('flashing-menu', true);
|
||||
}
|
||||
|
||||
private function createPrefItem(prefName:String, prefString:String, prefValue:Dynamic):Void
|
||||
|
@ -34,9 +48,24 @@ class PreferencesMenu extends ui.OptionsState.Page
|
|||
}
|
||||
});
|
||||
|
||||
switch (Type.typeof(prefValue).getName())
|
||||
{
|
||||
case 'TBool':
|
||||
createCheckbox(prefString);
|
||||
|
||||
default:
|
||||
trace('swag');
|
||||
}
|
||||
|
||||
trace(Type.typeof(prefValue).getName());
|
||||
}
|
||||
|
||||
function createCheckbox(prefString:String)
|
||||
{
|
||||
var checkbox:CheckboxThingie = new CheckboxThingie(0, 100 * items.length, preferences.get(prefString));
|
||||
add(checkbox);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assumes that the preference has already been checked/set?
|
||||
*/
|
||||
|
@ -53,7 +82,7 @@ class PreferencesMenu extends ui.OptionsState.Page
|
|||
super.update(elapsed);
|
||||
}
|
||||
|
||||
private function preferenceCheck(prefString:String, prefValue:Dynamic):Void
|
||||
private static function preferenceCheck(prefString:String, prefValue:Dynamic):Void
|
||||
{
|
||||
if (preferences.get(prefString) == null)
|
||||
{
|
||||
|
@ -66,3 +95,26 @@ class PreferencesMenu extends ui.OptionsState.Page
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
class CheckboxThingie extends FlxSprite
|
||||
{
|
||||
public var daValue(default, set):Bool = false;
|
||||
|
||||
public function new(x:Float, y:Float, daValue:Bool = false)
|
||||
{
|
||||
super(x, y);
|
||||
|
||||
this.daValue = daValue;
|
||||
makeGraphic(50, 50, FlxColor.WHITE);
|
||||
}
|
||||
|
||||
function set_daValue(value:Bool):Bool
|
||||
{
|
||||
if (value)
|
||||
color = FlxColor.GREEN;
|
||||
else
|
||||
color = FlxColor.RED;
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import ui.MenuList;
|
|||
|
||||
class TextMenuList extends MenuTypedList<TextMenuItem>
|
||||
{
|
||||
public function new (navControls:NavControls = Vertical, ?wrapMode)
|
||||
public function new(navControls:NavControls = Vertical, ?wrapMode)
|
||||
{
|
||||
super(navControls, wrapMode);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ class TextMenuList extends MenuTypedList<TextMenuItem>
|
|||
|
||||
class TextMenuItem extends TextTypedMenuItem<AtlasText>
|
||||
{
|
||||
public function new (x = 0.0, y = 0.0, name:String, font:AtlasFont = Bold, callback)
|
||||
public function new(x = 0.0, y = 0.0, name:String, font:AtlasFont = Bold, callback)
|
||||
{
|
||||
super(x, y, new AtlasText(0, 0, name, font), name, callback);
|
||||
setEmptyBackground();
|
||||
|
@ -29,12 +29,12 @@ class TextMenuItem extends TextTypedMenuItem<AtlasText>
|
|||
|
||||
class TextTypedMenuItem<T:AtlasText> extends MenuTypedItem<T>
|
||||
{
|
||||
public function new (x = 0.0, y = 0.0, label:T, name:String, callback)
|
||||
public function new(x = 0.0, y = 0.0, label:T, name:String, callback)
|
||||
{
|
||||
super(x, y, label, name, callback);
|
||||
}
|
||||
|
||||
override function setItem(name:String, ?callback:Void -> Void)
|
||||
override function setItem(name:String, ?callback:Void->Void)
|
||||
{
|
||||
if (label != null)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue