mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-01-27 15:26:55 +00:00
alphabet menu items + separate ngPrompt
This commit is contained in:
parent
3936f739b2
commit
aef55f90c6
38
Project.xml
38
Project.xml
|
@ -71,24 +71,24 @@
|
|||
<library name="week6" preload="false" />
|
||||
</section>
|
||||
|
||||
<assets path="assets/songs" library="songs" exclude="*.ogg" if="web"/>
|
||||
<assets path="assets/songs" library="songs" exclude="*.mp3" unless="web"/>
|
||||
<assets path="assets/shared" library="shared" exclude="*.ogg" if="web"/>
|
||||
<assets path="assets/shared" library="shared" exclude="*.mp3" unless="web"/>
|
||||
<assets path="assets/tutorial" library="tutorial" exclude="*.ogg" if="web"/>
|
||||
<assets path="assets/tutorial" library="tutorial" exclude="*.mp3" unless="web"/>
|
||||
<assets path="assets/week1" library="week1" exclude="*.ogg" if="web"/>
|
||||
<assets path="assets/week1" library="week1" exclude="*.mp3" unless="web"/>
|
||||
<assets path="assets/week2" library="week2" exclude="*.ogg" if="web"/>
|
||||
<assets path="assets/week2" library="week2" exclude="*.mp3" unless="web"/>
|
||||
<assets path="assets/week3" library="week3" exclude="*.ogg" if="web"/>
|
||||
<assets path="assets/week3" library="week3" exclude="*.mp3" unless="web"/>
|
||||
<assets path="assets/week4" library="week4" exclude="*.ogg" if="web"/>
|
||||
<assets path="assets/week4" library="week4" exclude="*.mp3" unless="web"/>
|
||||
<assets path="assets/week5" library="week5" exclude="*.ogg" if="web"/>
|
||||
<assets path="assets/week5" library="week5" exclude="*.mp3" unless="web"/>
|
||||
<assets path="assets/week6" library="week6" exclude="*.ogg" if="web"/>
|
||||
<assets path="assets/week6" library="week6" exclude="*.mp3" unless="web"/>
|
||||
<assets path="assets/songs" library="songs" exclude="*.fla|*.ogg" if="web"/>
|
||||
<assets path="assets/songs" library="songs" exclude="*.fla|*.mp3" unless="web"/>
|
||||
<assets path="assets/shared" library="shared" exclude="*.fla|*.ogg" if="web"/>
|
||||
<assets path="assets/shared" library="shared" exclude="*.fla|*.mp3" unless="web"/>
|
||||
<assets path="assets/tutorial" library="tutorial" exclude="*.fla|*.ogg" if="web"/>
|
||||
<assets path="assets/tutorial" library="tutorial" exclude="*.fla|*.mp3" unless="web"/>
|
||||
<assets path="assets/week1" library="week1" exclude="*.fla|*.ogg" if="web"/>
|
||||
<assets path="assets/week1" library="week1" exclude="*.fla|*.mp3" unless="web"/>
|
||||
<assets path="assets/week2" library="week2" exclude="*.fla|*.ogg" if="web"/>
|
||||
<assets path="assets/week2" library="week2" exclude="*.fla|*.mp3" unless="web"/>
|
||||
<assets path="assets/week3" library="week3" exclude="*.fla|*.ogg" if="web"/>
|
||||
<assets path="assets/week3" library="week3" exclude="*.fla|*.mp3" unless="web"/>
|
||||
<assets path="assets/week4" library="week4" exclude="*.fla|*.ogg" if="web"/>
|
||||
<assets path="assets/week4" library="week4" exclude="*.fla|*.mp3" unless="web"/>
|
||||
<assets path="assets/week5" library="week5" exclude="*.fla|*.ogg" if="web"/>
|
||||
<assets path="assets/week5" library="week5" exclude="*.fla|*.mp3" unless="web"/>
|
||||
<assets path="assets/week6" library="week6" exclude="*.fla|*.ogg" if="web"/>
|
||||
<assets path="assets/week6" library="week6" exclude="*.fla|*.mp3" unless="web"/>
|
||||
|
||||
<assets path='example_mods' rename='mods' embed='false'/>
|
||||
<assets path='art/readme.txt' rename='do NOT readme.txt' />
|
||||
|
@ -171,7 +171,7 @@
|
|||
|
||||
<section if="newgrounds">
|
||||
<!-- Enables Ng.core.verbose -->
|
||||
<haxedef name="NG_VERBOSE" />
|
||||
<!-- <haxedef name="NG_VERBOSE" /> -->
|
||||
|
||||
<!-- Enables a NG debug session, so medals don't permently unlock -->
|
||||
<!-- <haxedef name="NG_DEBUG" /> -->
|
||||
|
|
|
@ -40,7 +40,7 @@ class Alphabet extends FlxSpriteGroup
|
|||
|
||||
var isBold:Bool = false;
|
||||
|
||||
public function new(x:Float, y:Float, text:String = "", ?bold:Bool = false, typed:Bool = false)
|
||||
public function new(x:Float = 0.0, y:Float = 0.0, text:String = "", ?bold:Bool = false, typed:Bool = false)
|
||||
{
|
||||
super(x, y);
|
||||
|
||||
|
|
|
@ -21,7 +21,8 @@ import lime.app.Application;
|
|||
import io.newgrounds.NG;
|
||||
#end
|
||||
|
||||
import ui.MenuItemList;
|
||||
import ui.MenuList;
|
||||
import ui.AtlasMenuList;
|
||||
import ui.Prompt;
|
||||
import ui.NgPrompt;
|
||||
|
||||
|
@ -29,7 +30,7 @@ using StringTools;
|
|||
|
||||
class MainMenuState extends MusicBeatState
|
||||
{
|
||||
var menuItems:MainMenuItemList;
|
||||
var menuItems:MainMenuList;
|
||||
|
||||
var magenta:FlxSprite;
|
||||
var camFollow:FlxObject;
|
||||
|
@ -70,7 +71,7 @@ class MainMenuState extends MusicBeatState
|
|||
add(magenta);
|
||||
// magenta.scrollFactor.set();
|
||||
|
||||
menuItems = new MainMenuItemList('FNF_main_menu_assets');
|
||||
menuItems = new MainMenuList();
|
||||
add(menuItems);
|
||||
menuItems.onChange.add(onMenuItemChange);
|
||||
menuItems.onAcceptPress.add(function(_)
|
||||
|
@ -88,6 +89,7 @@ class MainMenuState extends MusicBeatState
|
|||
#if CAN_OPEN_LINKS
|
||||
menuItems.createItem('donate', selectDonate, hasPopupBlocker);
|
||||
#end
|
||||
// menuItems.createItem('options', function () startExitState(new OptionsMenu()));
|
||||
#if newgrounds
|
||||
if (NGio.isLoggedIn)
|
||||
menuItems.createItem("logout", selectLogout);
|
||||
|
@ -123,10 +125,10 @@ class MainMenuState extends MusicBeatState
|
|||
|
||||
menuItems.enabled = true;
|
||||
|
||||
#if newgrounds
|
||||
if (NGio.savedSessionFailed)
|
||||
showSavedSessionFailed();
|
||||
#end
|
||||
// #if newgrounds
|
||||
// if (NGio.savedSessionFailed)
|
||||
// showSavedSessionFailed();
|
||||
// #end
|
||||
}
|
||||
|
||||
function onMenuItemChange(selected:MenuItem)
|
||||
|
@ -146,23 +148,46 @@ class MainMenuState extends MusicBeatState
|
|||
#if newgrounds
|
||||
function selectLogin()
|
||||
{
|
||||
openPrompt(NgPrompt.showLogin(),
|
||||
function onPromptClose() menuItems.resetItem("login", "logout", selectLogout)
|
||||
);
|
||||
openNgPrompt(NgPrompt.showLogin());
|
||||
}
|
||||
|
||||
function selectLogout()
|
||||
{
|
||||
openPrompt(NgPrompt.showLogout(),
|
||||
function onPromptClose() menuItems.resetItem("logout", "login", selectLogin)
|
||||
);
|
||||
openNgPrompt(NgPrompt.showLogout());
|
||||
}
|
||||
|
||||
function showSavedSessionFailed()
|
||||
{
|
||||
openPrompt(NgPrompt.showSavedSessionFailed(),
|
||||
function onPromptClose() menuItems.resetItem("login", "logout", selectLogout)
|
||||
);
|
||||
openNgPrompt(NgPrompt.showSavedSessionFailed());
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls openPrompt and redraws the login/logout button
|
||||
* @param prompt
|
||||
* @param onClose
|
||||
*/
|
||||
public function openNgPrompt(prompt:Prompt, ?onClose:Void->Void)
|
||||
{
|
||||
var onPromptClose = checkLoginStatus;
|
||||
if (onClose != null)
|
||||
{
|
||||
onPromptClose = function ()
|
||||
{
|
||||
checkLoginStatus();
|
||||
onClose();
|
||||
}
|
||||
}
|
||||
|
||||
openPrompt(prompt, onPromptClose);
|
||||
}
|
||||
|
||||
function checkLoginStatus()
|
||||
{
|
||||
var prevLoggedIn = menuItems.has("logout");
|
||||
if (prevLoggedIn && !NGio.isLoggedIn)
|
||||
menuItems.resetItem("login", "logout", selectLogout);
|
||||
else if (!prevLoggedIn && NGio.isLoggedIn)
|
||||
menuItems.resetItem("logout", "login", selectLogin);
|
||||
}
|
||||
#end
|
||||
|
||||
|
@ -211,26 +236,22 @@ class MainMenuState extends MusicBeatState
|
|||
}
|
||||
}
|
||||
|
||||
private class MainMenuItemList extends MenuTypedItemList<MainMenuItem>
|
||||
private class MainMenuList extends MenuTypedList<MainMenuItem>
|
||||
{
|
||||
public var atlas:FlxAtlasFrames;
|
||||
|
||||
public function new (atlas)
|
||||
public function new ()
|
||||
{
|
||||
atlas = Paths.getSparrowAtlas('main_menu');
|
||||
super(Vertical);
|
||||
|
||||
if (Std.is(atlas, String))
|
||||
this.atlas = Paths.getSparrowAtlas(cast atlas);
|
||||
else
|
||||
this.atlas = cast atlas;
|
||||
}
|
||||
|
||||
public function createItem(x = 0.0, y = 0.0, name:String, callback, fireInstantly = false)
|
||||
{
|
||||
var i = length;
|
||||
var item = new MainMenuItem(x, y, name, atlas, callback);
|
||||
item.fireInstantly = fireInstantly;
|
||||
item.ID = i;
|
||||
item.ID = length;
|
||||
|
||||
return addItem(name, item);
|
||||
}
|
||||
|
@ -241,7 +262,7 @@ private class MainMenuItemList extends MenuTypedItemList<MainMenuItem>
|
|||
atlas = null;
|
||||
}
|
||||
}
|
||||
private class MainMenuItem extends MenuItem
|
||||
private class MainMenuItem extends AtlasMenuItem
|
||||
{
|
||||
public function new(x = 0.0, y = 0.0, name, atlas, callback)
|
||||
{
|
||||
|
|
53
source/ui/AlphabetMenuList.hx
Normal file
53
source/ui/AlphabetMenuList.hx
Normal file
|
@ -0,0 +1,53 @@
|
|||
package ui;
|
||||
|
||||
import ui.MenuList;
|
||||
|
||||
class AlphabetMenuList extends MenuTypedList<AlphabetMenuItem>
|
||||
{
|
||||
public function new (navControls:NavControls = Vertical)
|
||||
{
|
||||
super(navControls);
|
||||
}
|
||||
|
||||
public function createItem(x = 0.0, y = 0.0, name:String, bold = true, callback, fireInstantly = false)
|
||||
{
|
||||
var item = new AlphabetMenuItem(x, y, name, bold, callback);
|
||||
item.fireInstantly = fireInstantly;
|
||||
return addItem(name, item);
|
||||
}
|
||||
}
|
||||
|
||||
class AlphabetMenuItem extends AlphabetTypedMenuItem<Alphabet>
|
||||
{
|
||||
public function new (x = 0.0, y = 0.0, name:String, bold = true, callback)
|
||||
{
|
||||
super(x, y, new Alphabet(x, y, name, bold), name, callback);
|
||||
}
|
||||
}
|
||||
|
||||
class AlphabetTypedMenuItem<T:Alphabet> extends MenuTypedItem<T>
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (label != null)
|
||||
{
|
||||
label.text = name;
|
||||
width = label.width;
|
||||
height = label.height;
|
||||
}
|
||||
|
||||
super.setItem(name, callback);
|
||||
}
|
||||
|
||||
override function set_label(value:T):T
|
||||
{
|
||||
super.set_label(value);
|
||||
setItem(name, callback);
|
||||
return value;
|
||||
}
|
||||
}
|
81
source/ui/AtlasMenuList.hx
Normal file
81
source/ui/AtlasMenuList.hx
Normal file
|
@ -0,0 +1,81 @@
|
|||
package ui;
|
||||
|
||||
import ui.MenuList;
|
||||
|
||||
import flixel.graphics.frames.FlxAtlasFrames;
|
||||
|
||||
typedef AtlasAsset = flixel.util.typeLimit.OneOfTwo<String, FlxAtlasFrames>;
|
||||
|
||||
class AtlasMenuList extends MenuTypedList<AtlasMenuItem>
|
||||
{
|
||||
public var atlas:FlxAtlasFrames;
|
||||
|
||||
public function new (atlas, navControls:NavControls = Vertical)
|
||||
{
|
||||
super(navControls);
|
||||
|
||||
if (Std.is(atlas, String))
|
||||
this.atlas = Paths.getSparrowAtlas(cast atlas);
|
||||
else
|
||||
this.atlas = cast atlas;
|
||||
}
|
||||
|
||||
public function createItem(x = 0.0, y = 0.0, name, callback, fireInstantly = false)
|
||||
{
|
||||
var item = new AtlasMenuItem(x, y, name, atlas, callback);
|
||||
item.fireInstantly = fireInstantly;
|
||||
return addItem(name, item);
|
||||
}
|
||||
|
||||
override function destroy()
|
||||
{
|
||||
super.destroy();
|
||||
atlas = null;
|
||||
}
|
||||
}
|
||||
|
||||
class AtlasMenuItem extends MenuItem
|
||||
{
|
||||
var atlas:FlxAtlasFrames;
|
||||
public function new (x = 0.0, y = 0.0, name:String, atlas:FlxAtlasFrames, callback)
|
||||
{
|
||||
this.atlas = atlas;
|
||||
super(x, y, name, callback);
|
||||
}
|
||||
|
||||
override function setData(name:String, ?callback:Void->Void)
|
||||
{
|
||||
frames = atlas;
|
||||
animation.addByPrefix('idle', '$name idle', 24);
|
||||
animation.addByPrefix('selected', '$name selected', 24);
|
||||
|
||||
super.setData(name, callback);
|
||||
}
|
||||
|
||||
function changeAnim(animName:String)
|
||||
{
|
||||
animation.play(animName);
|
||||
updateHitbox();
|
||||
}
|
||||
|
||||
override function idle()
|
||||
{
|
||||
changeAnim('idle');
|
||||
}
|
||||
|
||||
override function select()
|
||||
{
|
||||
changeAnim('selected');
|
||||
}
|
||||
|
||||
override function get_selected()
|
||||
{
|
||||
return animation.curAnim != null && animation.curAnim.name == "selected";
|
||||
}
|
||||
|
||||
override function destroy()
|
||||
{
|
||||
super.destroy();
|
||||
atlas = null;
|
||||
}
|
||||
}
|
|
@ -1,46 +1,13 @@
|
|||
package ui;
|
||||
|
||||
import flixel.util.typeLimit.OneOfTwo;
|
||||
import flixel.math.FlxPoint;
|
||||
import flixel.FlxG;
|
||||
import flixel.FlxSprite;
|
||||
import flixel.effects.FlxFlicker;
|
||||
import flixel.graphics.frames.FlxAtlasFrames;
|
||||
import flixel.group.FlxGroup;
|
||||
import flixel.tweens.FlxEase;
|
||||
import flixel.tweens.FlxTween;
|
||||
import flixel.util.FlxSignal;
|
||||
|
||||
typedef AtlasAsset = OneOfTwo<String, FlxAtlasFrames>;
|
||||
|
||||
class MenuItemList extends MenuTypedItemList<MenuItem>
|
||||
{
|
||||
public var atlas:FlxAtlasFrames;
|
||||
|
||||
public function new (atlas, navControls:NavControls = Vertical)
|
||||
{
|
||||
super(navControls);
|
||||
|
||||
if (Std.is(atlas, String))
|
||||
this.atlas = Paths.getSparrowAtlas(cast atlas);
|
||||
else
|
||||
this.atlas = cast atlas;
|
||||
}
|
||||
|
||||
public function createItem(x = 0.0, y = 0.0, name, callback, fireInstantly = false)
|
||||
{
|
||||
var item = new MenuItem(x, y, name, atlas, callback);
|
||||
item.fireInstantly = fireInstantly;
|
||||
return addItem(name, item);
|
||||
}
|
||||
|
||||
override function destroy()
|
||||
{
|
||||
super.destroy();
|
||||
atlas = null;
|
||||
}
|
||||
}
|
||||
|
||||
class MenuTypedItemList<T:MenuItem> extends FlxTypedGroup<T>
|
||||
class MenuTypedList<T:MenuItem> extends FlxTypedGroup<T>
|
||||
{
|
||||
public var selectedIndex(default, null) = 0;
|
||||
/** Called when a new item is highlighted */
|
||||
|
@ -165,6 +132,11 @@ class MenuTypedItemList<T:MenuItem> extends FlxTypedGroup<T>
|
|||
onChange.dispatch(selected);
|
||||
}
|
||||
|
||||
public function has(name:String)
|
||||
{
|
||||
return byName.exists(name);
|
||||
}
|
||||
|
||||
public function getItem(name:String)
|
||||
{
|
||||
return byName[name];
|
||||
|
@ -177,51 +149,140 @@ class MenuTypedItemList<T:MenuItem> extends FlxTypedGroup<T>
|
|||
}
|
||||
}
|
||||
|
||||
class MenuItem extends flixel.FlxSprite
|
||||
{
|
||||
class MenuItem extends FlxSprite
|
||||
{
|
||||
public var callback:Void->Void;
|
||||
public var name:String;
|
||||
/**
|
||||
* Set to true for things like opening URLs otherwise, it may it get blocked.
|
||||
*/
|
||||
public var fireInstantly = false;
|
||||
public var selected(get, never):Bool;
|
||||
function get_selected() return alpha == 1.0;
|
||||
|
||||
public function new (x = 0.0, y = 0.0, name, tex, callback)
|
||||
public function new (x = 0.0, y = 0.0, name:String, callback)
|
||||
{
|
||||
super(x, y);
|
||||
|
||||
frames = tex;
|
||||
setItem(name, callback);
|
||||
antialiasing = true;
|
||||
setData(name, callback);
|
||||
idle();
|
||||
}
|
||||
|
||||
public function setItem(name:String, ?callback:Void->Void)
|
||||
function setData(name:String, ?callback:Void->Void)
|
||||
{
|
||||
this.name = name;
|
||||
|
||||
if (callback != null)
|
||||
this.callback = callback;
|
||||
|
||||
var selected = animation.curAnim != null && animation.curAnim.name == "selected";
|
||||
|
||||
animation.addByPrefix('idle', '$name basic', 24);
|
||||
animation.addByPrefix('selected', '$name white', 24);
|
||||
idle();
|
||||
if (selected)
|
||||
select();
|
||||
}
|
||||
|
||||
function changeAnim(anim:String)
|
||||
/**
|
||||
* Calls setData and resets/redraws the state of the item
|
||||
* @param name
|
||||
* @param callback
|
||||
*/
|
||||
public function setItem(name:String, ?callback:Void->Void)
|
||||
{
|
||||
animation.play(anim);
|
||||
updateHitbox();
|
||||
setData(name, callback);
|
||||
|
||||
if (selected)
|
||||
select();
|
||||
else
|
||||
idle();
|
||||
}
|
||||
|
||||
public function idle()
|
||||
{
|
||||
changeAnim('idle');
|
||||
alpha = 0.6;
|
||||
}
|
||||
|
||||
public function select()
|
||||
{
|
||||
changeAnim('selected');
|
||||
alpha = 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
class MenuTypedItem<T:FlxSprite> extends MenuItem
|
||||
{
|
||||
public var label(default, set):T;
|
||||
|
||||
public function new (x = 0.0, y = 0.0, label:T, name:String, callback)
|
||||
{
|
||||
super(x, y, name, callback);
|
||||
// set label after super otherwise setters fuck up
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this when you only want to show the label
|
||||
*/
|
||||
function setEmptyBackground()
|
||||
{
|
||||
var oldWidth = width;
|
||||
var oldHeight = height;
|
||||
makeGraphic(1, 1, 0x0);
|
||||
width = oldWidth;
|
||||
height = oldHeight;
|
||||
}
|
||||
|
||||
function set_label(value:T)
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
value.x = x;
|
||||
value.y = y;
|
||||
value.alpha = alpha;
|
||||
}
|
||||
return this.label = value;
|
||||
}
|
||||
|
||||
override function update(elapsed:Float)
|
||||
{
|
||||
super.update(elapsed);
|
||||
if (label != null)
|
||||
label.update(elapsed);
|
||||
}
|
||||
|
||||
override function draw()
|
||||
{
|
||||
super.draw();
|
||||
if (label != null)
|
||||
{
|
||||
label.cameras = cameras;
|
||||
label.scrollFactor.copyFrom(scrollFactor);
|
||||
label.draw();
|
||||
}
|
||||
}
|
||||
|
||||
override function set_alpha(value:Float):Float
|
||||
{
|
||||
super.set_alpha(value);
|
||||
|
||||
if (label != null)
|
||||
label.alpha = alpha;
|
||||
|
||||
return alpha;
|
||||
}
|
||||
|
||||
override function set_x(value:Float):Float
|
||||
{
|
||||
super.set_x(value);
|
||||
|
||||
if (label != null)
|
||||
label.x = x;
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
override function set_y(Value:Float):Float
|
||||
{
|
||||
super.set_y(Value);
|
||||
|
||||
if (label != null)
|
||||
label.y = y;
|
||||
|
||||
return y;
|
||||
}
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@ class NgPrompt extends Prompt
|
|||
{
|
||||
public function new (text:String, style:ButtonStyle = Yes_No)
|
||||
{
|
||||
super("prompt-ng_login", text, style);
|
||||
super(text, style);
|
||||
}
|
||||
|
||||
static public function showLogin()
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package ui;
|
||||
|
||||
import ui.MenuList;
|
||||
|
||||
import flixel.FlxG;
|
||||
import flixel.FlxSprite;
|
||||
import flixel.graphics.frames.FlxAtlasFrames;
|
||||
import flixel.text.FlxText;
|
||||
|
@ -11,33 +14,19 @@ class Prompt extends flixel.FlxSubState
|
|||
|
||||
public var onYes:Void->Void;
|
||||
public var onNo:Void->Void;
|
||||
public var buttons:MenuItemList;
|
||||
public var field:FlxText;
|
||||
public var back:FlxSprite;
|
||||
public var buttons:AlphabetMenuList;
|
||||
public var field:Alphabet;
|
||||
|
||||
var style:ButtonStyle;
|
||||
|
||||
public function new (atlas, text:String, style:ButtonStyle = Ok)
|
||||
public function new (text:String, style:ButtonStyle = Ok)
|
||||
{
|
||||
this.style = style;
|
||||
super();
|
||||
super(0xA0000000);
|
||||
|
||||
var texture:FlxAtlasFrames;
|
||||
if (Std.is(atlas, String))
|
||||
texture = Paths.getSparrowAtlas(cast atlas);
|
||||
else
|
||||
texture = cast atlas;
|
||||
buttons = new AlphabetMenuList(Horizontal);
|
||||
|
||||
back = new FlxSprite();
|
||||
back.frames = texture;
|
||||
back.animation.addByPrefix("idle", "back");
|
||||
back.scrollFactor.set(0, 0);
|
||||
|
||||
buttons = new MenuItemList(texture, Horizontal);
|
||||
|
||||
field = new FlxText();
|
||||
field.setFormat(Paths.font("vcr.ttf"), 64, FlxColor.BLACK, CENTER);
|
||||
field.text = text;
|
||||
field = new Alphabet(text, true);
|
||||
field.scrollFactor.set(0, 0);
|
||||
}
|
||||
|
||||
|
@ -45,12 +34,7 @@ class Prompt extends flixel.FlxSubState
|
|||
{
|
||||
super.create();
|
||||
|
||||
back.animation.play("idle");
|
||||
back.updateHitbox();
|
||||
back.screenCenter(XY);
|
||||
add(back);
|
||||
|
||||
field.y = back.y + MARGIN;
|
||||
field.y = MARGIN;
|
||||
field.screenCenter(X);
|
||||
add(field);
|
||||
|
||||
|
@ -90,16 +74,16 @@ class Prompt extends flixel.FlxSubState
|
|||
// pass anonymous functions rather than the current callbacks, in case they change later
|
||||
var yesButton = buttons.createItem(yes, function() onYes());
|
||||
yesButton.screenCenter(X);
|
||||
yesButton.y = back.y + back.height - yesButton.height - MARGIN;
|
||||
yesButton.y = FlxG.height - yesButton.height - MARGIN;
|
||||
yesButton.scrollFactor.set(0, 0);
|
||||
if (no != null)
|
||||
{
|
||||
// place right
|
||||
yesButton.x = back.x + back.width - yesButton.width - MARGIN;
|
||||
yesButton.x = FlxG.width - yesButton.width - MARGIN;
|
||||
|
||||
var noButton = buttons.createItem(no, function() onNo());
|
||||
noButton.x = back.x + MARGIN;
|
||||
noButton.y = back.y + back.height - noButton.height - MARGIN;
|
||||
noButton.x = MARGIN;
|
||||
noButton.y = FlxG.height - noButton.height - MARGIN;
|
||||
noButton.scrollFactor.set(0, 0);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue