Skip to content

Commit

Permalink
add freeplay settings dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
lemz1 committed Nov 16, 2024
1 parent a060b79 commit f86b1f8
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package funkin.ui.debug.char.components.dialogs;

@:build(haxe.ui.macros.ComponentMacros.build("assets/exclude/data/ui/char-creator/dialogs/freeplay-dj-settings-dialog.xml"))
class FreeplayDJSettingsDialog extends DefaultPageDialog
{
public var bgText1(get, never):String;

function get_bgText1():String
{
return bgTextField1.value ?? bgTextField1.placeholder;
}

public var bgText2(get, never):String;

function get_bgText2():String
{
return bgTextField2.value ?? bgTextField2.placeholder;
}

public var bgText3(get, never):String;

function get_bgText3():String
{
return bgTextField3.value ?? bgTextField3.placeholder;
}

override public function new(daPage:CharCreatorDefaultPage)
{
super(daPage);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import haxe.ui.data.ArrayDataSource;
import funkin.data.character.CharacterRegistry;
import funkin.util.SortUtil;

// TODO: Move bgText to FreeplayDJCreator

@:build(haxe.ui.macros.ComponentMacros.build("assets/exclude/data/ui/char-creator/dialogs/playable-character-settings-dialog.xml"))
class PlayableCharacterSettingsDialog extends DefaultPageDialog
{
Expand All @@ -20,27 +18,6 @@ class PlayableCharacterSettingsDialog extends DefaultPageDialog
return ownedCharBox.listOwnedCharacters();
}

public var bgText1(get, never):String;

function get_bgText1():String
{
return bgTextField1.value ?? bgTextField1.placeholder;
}

public var bgText2(get, never):String;

function get_bgText2():String
{
return bgTextField2.value ?? bgTextField2.placeholder;
}

public var bgText3(get, never):String;

function get_bgText3():String
{
return bgTextField3.value ?? bgTextField3.placeholder;
}

var ownedCharBox:AddOwnedCharBox;

override public function new(daPage:CharCreatorDefaultPage)
Expand All @@ -67,9 +44,9 @@ private class AddOwnedCharBox extends HBox
verticalAlign = "center";

var addButton = new Button();
addButton.text = "Add";
addButton.text = "Add New Box";
var removeButton = new Button();
removeButton.text = "Remove";
removeButton.text = "Remove Last Box";

addButton.percentWidth = removeButton.percentWidth = 50;
addButton.percentHeight = removeButton.percentHeight = 100;
Expand Down
28 changes: 28 additions & 0 deletions source/funkin/ui/debug/char/pages/CharCreatorFreeplayPage.hx
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
package funkin.ui.debug.char.pages;

import haxe.ui.components.Label;
import haxe.ui.containers.Box;
import haxe.ui.containers.HBox;
import haxe.ui.containers.menus.Menu;
import haxe.ui.containers.menus.MenuItem;
import haxe.ui.containers.menus.MenuCheckBox;
import funkin.ui.freeplay.LetterSort;
import flixel.text.FlxText;
import funkin.ui.freeplay.FreeplayState.DifficultySprite;
import funkin.ui.debug.char.components.dialogs.*;
import funkin.graphics.FunkinSprite;
import funkin.data.freeplay.style.FreeplayStyleRegistry;
import funkin.graphics.shaders.AngleMask;
Expand All @@ -20,6 +27,8 @@ import openfl.display.BlendMode;
// mainly used for dj animations and style
class CharCreatorFreeplayPage extends CharCreatorDefaultPage
{
var dialogMap:Map<FreeplayDialogType, DefaultPageDialog>;

var data:WizardGenerateParams;

override public function new(state:CharCreatorState, data:WizardGenerateParams)
Expand All @@ -29,6 +38,20 @@ class CharCreatorFreeplayPage extends CharCreatorDefaultPage

initBackingCard();
initBackground();

dialogMap = new Map<FreeplayDialogType, DefaultPageDialog>();
dialogMap.set(FreeplayDJSettings, new FreeplayDJSettingsDialog(this));
}

override public function fillUpPageSettings(menu:Menu)
{
var settingsDialog = new MenuCheckBox();
settingsDialog.text = "Freeplay DJ Settings";
menu.addComponent(settingsDialog);

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

var pinkBack:FunkinSprite;
Expand Down Expand Up @@ -142,3 +165,8 @@ class CharCreatorFreeplayPage extends CharCreatorDefaultPage
}, 0);
}
}

enum FreeplayDialogType
{
FreeplayDJSettings;
}

0 comments on commit f86b1f8

Please sign in to comment.