Skip to content

Commit

Permalink
starting to implement play char settings
Browse files Browse the repository at this point in the history
  • Loading branch information
lemz1 committed Nov 13, 2024
1 parent ca446ab commit 250e934
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion assets
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package funkin.ui.debug.char.components.dialogs;

@:build(haxe.ui.macros.ComponentMacros.build("assets/exclude/data/ui/char-creator/dialogs/playable-character-settings-dialog.xml"))
class PlayableCharacterSettingsDialog extends DefaultPageDialog
{
override public function new(daPage:CharCreatorDefaultPage)
{
super(daPage);
}
}
20 changes: 20 additions & 0 deletions source/funkin/ui/debug/char/pages/CharCreatorSelectPage.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ package funkin.ui.debug.char.pages;

import haxe.ui.containers.menus.Menu;
import haxe.ui.containers.menus.MenuItem;
import haxe.ui.containers.menus.MenuCheckBox;
import funkin.audio.FunkinSound;
import funkin.data.freeplay.player.PlayerData;
import funkin.data.freeplay.player.PlayerRegistry;
import funkin.graphics.adobeanimate.FlxAtlasSprite;
import funkin.graphics.FunkinSprite;
import funkin.ui.debug.char.pages.subpages.CharSelectIndexSubPage;
import funkin.ui.debug.char.components.dialogs.*;
import funkin.util.FileUtil;
import flixel.group.FlxSpriteGroup.FlxTypedSpriteGroup;
import flixel.group.FlxSpriteGroup;
Expand Down Expand Up @@ -39,6 +41,8 @@ class CharCreatorSelectPage extends CharCreatorDefaultPage
var selectedIndexData:Int = 0;
var pixelIconFiles:Array<WizardFile> = [];

var dialogMap:Map<PlayCharDialogType, DefaultPageDialog>;

var subPages:Map<CharCreatorSelectSubPage, FlxSpriteGroup>;

var handleInput:Bool = true;
Expand Down Expand Up @@ -67,6 +71,9 @@ class CharCreatorSelectPage extends CharCreatorDefaultPage
nametag = new FlxSprite();
add(nametag);

dialogMap = new Map<PlayCharDialogType, DefaultPageDialog>();
dialogMap.set(SettingsDialog, new PlayableCharacterSettingsDialog(this));

subPages = new Map<CharCreatorSelectSubPage, FlxSpriteGroup>();
subPages.set(IndexSubPage, new CharSelectIndexSubPage(this));

Expand All @@ -89,6 +96,10 @@ class CharCreatorSelectPage extends CharCreatorDefaultPage
pixelStuff.addComponent(openFile);
pixelStuff.addComponent(openPos);

var settingsDialog = new MenuCheckBox();
settingsDialog.text = "Playable Character Settings";
menu.addComponent(settingsDialog);

// callbacks
openPos.onClick = function(_) {
cast(subPages[IndexSubPage], CharSelectIndexSubPage).open();
Expand All @@ -111,6 +122,10 @@ class CharCreatorSelectPage extends CharCreatorDefaultPage
cast(subPages[IndexSubPage], CharSelectIndexSubPage).resetIconTexture();
});
}

settingsDialog.onClick = function(_) {
dialogMap[SettingsDialog].hidden = !settingsDialog.selected;
}
}

function initBackground():Void
Expand Down Expand Up @@ -238,3 +253,8 @@ enum CharCreatorSelectSubPage
{
IndexSubPage;
}

enum PlayCharDialogType
{
SettingsDialog;
}

0 comments on commit 250e934

Please sign in to comment.