forked from FunkinCrew/Funkin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6837de5
commit 12c19c5
Showing
6 changed files
with
102 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
source/funkin/ui/debug/char/components/wizard/ImportDataDialog.hx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
package funkin.ui.debug.char.components.wizard; | ||
|
||
import funkin.data.character.CharacterData; | ||
import funkin.data.character.CharacterRegistry; | ||
import funkin.data.freeplay.player.PlayerRegistry; | ||
import haxe.ui.components.OptionBox; | ||
|
||
@:xml(' | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<dialog width="400" height="425" title="Character Creator - Import Data" closable="false"> | ||
<vbox width="100%" height="100%"> | ||
<label text="Choose the Optional Data to import." width="100%"/> | ||
<hbox width="100%" height="100%"> | ||
|
||
<vbox id="importCharData" width="50%" height="100%"> | ||
<checkbox id="importCharCheck" text="Use Characater Data"/> | ||
<scrollview width="100%" height="100%" contentWidth="100%"> | ||
<vbox id="importCharList" width="100%" disabled="true"/> | ||
</scrollview> | ||
</vbox> | ||
|
||
<vbox id="importPlayer" width="50%" height="100%"> | ||
<checkbox id="importPlayerCheck" text="Use Player Data"/> | ||
<scrollview width="100%" height="100%" contentWidth="100%"> | ||
<vbox id="importPlayerList" width="100%" disabled="true"/> | ||
</scrollview> | ||
</vbox> | ||
|
||
</hbox> | ||
|
||
</vbox> | ||
</dialog> | ||
') | ||
class ImportDataDialog extends DefaultWizardDialog | ||
{ | ||
override public function new() | ||
{ | ||
super(IMPORT_DATA); | ||
|
||
importCharCheck.onChange = function(_) importCharList.disabled = !importCharCheck.selected; | ||
importPlayerCheck.onChange = function(_) importPlayerList.disabled = !importPlayerCheck.selected; | ||
|
||
for (id in CharacterRegistry.listCharacterIds()) | ||
{ | ||
var check = new OptionBox(); | ||
check.text = id; | ||
check.selected = (id == selectedData); | ||
check.onChange = _ -> { | ||
selectedData = id; | ||
} | ||
importCharList.addComponent(check); | ||
} | ||
|
||
for (id in PlayerRegistry.instance.listEntryIds()) | ||
{ | ||
var check = new OptionBox(); | ||
check.text = id; | ||
check.selected = (id == selectedPlayer); | ||
check.onChange = _ -> { | ||
selectedPlayer = id; | ||
} | ||
importPlayerList.addComponent(check); | ||
} | ||
} | ||
|
||
var selectedData:String = Constants.DEFAULT_CHARACTER; | ||
var selectedPlayer:String = "bf"; // eh | ||
|
||
override public function showDialog(modal:Bool = true) | ||
{ | ||
super.showDialog(modal); | ||
|
||
// we dont want to import any data if we don't even generate the character to begin with | ||
importCharData.disabled = !params.generateCharacter; | ||
importPlayer.disabled = !params.generatePlayerData; | ||
} | ||
|
||
override public function isNextStepAvailable() | ||
{ | ||
if (params.generateCharacter && importCharCheck.selected) params.importedCharacter = selectedData; | ||
else | ||
params.importedCharacter = null; | ||
|
||
// same shit for the player, though it's currently not my priority | ||
|
||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters