-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ENHANCEMENT] Preferences Menu Pages #4081
base: develop
Are you sure you want to change the base?
Conversation
This issue #3844 would be closed by this PR. |
I don't really think it would, this doesn't have to do anything with experimental features, it just makes it so that the preferences menu has a support for pages, which in turn, can make the preferences menu more organized |
Well, my thinking is, are there currently any experimental features that would go into a preferences submenu using this? If not, then there's not much point leaving this #3844 issue up. |
This PR was done in order to satisfy a suggestion that I've linked all the way above. It requested a support for multiple pages in the preferences menu for mods that are willing to append custom options/configurations without making the preference menu look unorganized and messy. For instance, let's say that I wanted to add an option to disable a function of my mod without unloading the entire thing. Normally it would appear at the bottom of the options, looking rather unorganized with the rest of them. It wouldn't be too bad on it's own but you have to consider some players are willing to play with dozens of mods that also add custom options to the preferences menu, which, without proper organization, is just going to give anyone looking at the preferences menu a headache. Also, I genuinely don't see how experimental features would be implemented - that would require the game to update almost weekly, which is practically impossible for a team of independent developers. But that's a topic for another time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really good so far! I do have some questions though:
- How would mods create custom preferences with this new system?
- How can mods add additional pages?
Also, it'd be nice if there was a sort of UI element at the top that showed you the current page (i.e "BASE GAME")!
I'd imagine creating new pages like this
Also, sure, I'll add the preference page name field |
b6a9e6d
to
dad0612
Compare
I've changed the system so that when creating the pages you no longer need the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tested this out on a mod and it doesn't appear to work...
override function onStateChangeEnd(event:StateChangeScriptEvent):Void
{
super.onStateChangeEnd(event);
// Options Menu stuff
if (event.targetState is OptionsState)
{
var prefs = event.targetState.pages.get("preferences");
if (prefs != null)
{
prefs.preferencePages.push({
name: "Funker Selector",
itemDatas: [
{
type: "checkbox",
name: "Simplify UI",
desc: "Simplifies the UI and disables character sprite caching.",
onChange: function(value:Dynamic) {
FS_SaveDataHandler.scriptCall('setPreference', ["potatoMode", value]);
},
defaultValue: FS_SaveDataHandler.scriptCall('getPreference', ["potatoMode"])
}
]
});
}
}
}
Ran a bit of testing and apparently this happens because when the preference page is generated with Edit: done and dusted! tested with the same script you provided |
actually make this moddable lmao
dad0612
to
ba01002
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Peak
10.out.of.10.mp4
Code snippet:
override function onStateChangeEnd(event:StateChangeScriptEvent):Void
{
super.onStateChangeEnd(event);
// Options Menu stuff
if (event.targetState is OptionsState)
{
event.targetState.pages.get("preferences").preferencePages.push({
name: "FUNKER SELECTOR",
itemDatas: [
{
type: "checkbox",
name: "Simplify UI",
desc: "Simplifies the UI and disables character sprite caching.",
onChange: function(value:Dynamic) {
FS_SaveDataHandler.scriptCall('setPreference', ["potatoMode", value]);
},
defaultValue: FS_SaveDataHandler.scriptCall('getPreference', ["potatoMode"])
},
{
type: "checkbox",
name: "Preload Sprites",
desc: "Whether to preload the character sprites or not. Will cause lag on the Character Selection Menu if off!",
onChange: function(value:Dynamic) {
FS_SaveDataHandler.scriptCall('setPreference', ["preloadSprites", value]);
if (value)
{
FS_CharacterDataHandler.scriptCall("cacheJSONSparrows");
}
else
{
// Remove the JSON Characters from memory when the user disables the option.
FS_CharacterDataHandler.scriptCall("purgeJSONSparrowCache");
}
},
defaultValue: FS_SaveDataHandler.scriptCall('getPreference', ["preloadSprites"])
},
{
type: "enum",
name: "Menu SFX",
desc: "Change the SFX used for the Character Menu.",
values: ["funkin" => "Funkin' Main Menu", "charSelect" => "Funkin' Character Select"],
onChange: function(value:Dynamic) {
FS_SaveDataHandler.scriptCall('setPreference', ["preferredSFX", value]);
if (value == "charSelect")
{
FunkinSound.playOnce(Paths.sound('CS_confirm'));
}
else
{
FunkinSound.playOnce(Paths.sound('confirmMenu'));
}
},
defaultValue: FS_SaveDataHandler.scriptCall('getPreference', ["preferredSFX"])
},
{
type: "checkbox",
name: "DJ Replacement",
desc: "When enabled, the Freeplay DJ can be swapped out for the currently selected character's own DJ.",
onChange: function(value:Dynamic) {
FS_SaveDataHandler.scriptCall('setPreference', ["djSwapping", value]);
},
defaultValue: FS_SaveDataHandler.scriptCall('getPreference', ["djSwapping"])
}
]
});
}
}
Once I get some changeable options in the updated screenshot plugin, I'll use this stuff and put the options on a separate page (though ofc only when it's all been merged and such). |
Does this PR close any issues? If so, link them below.
#4043
Briefly describe the issue(s) fixed.
Overhauled most of the things from the preference menu, whoops! Anyways yeah adding custom options/modifying pre-existing options shouldn't be a hassle now! Oh and also to switch pages just press Q or E probably should've put that somewhere but oh well!
Include any relevant screenshots or videos.
2025-02-01.13-01-15.mp4
disclaimer: the "test#" item does not come with this pr and has been temporarily added as a demonstration