-
Notifications
You must be signed in to change notification settings - Fork 18
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
Improved Options system #140
Draft
Spartan322
wants to merge
14
commits into
develop
Choose a base branch
from
feature/improved-options
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
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
I hope to add a capability to change the plugin options so that they can also support being drawn in a less "standard" position better, might require manually storing X, Y as nullable ints however. |
And with that tabs and options support being in custom positions with overriding the draw methods. |
Additions to #164:
|
Deprecates old options system, marked for deletion in next major version Enables overriding default behavior Default behavior saves and loads to configs according to its Id, and in accordance to default value Tab names and tab ids can be separated Tabs are optionally modifiable Tabs and Options store their position and size data in DrawData Simplifies PathfinderOptions immensely Manages config loading and registers saving in PostLoad DrawData allows storing and modifying position and size structs easily
Updater now uses new option/config system
MainMenuOverride: Changed IsEnabledBox, IncludePrerelease, and NotRestartPrompt to PluginCheckbox Modify PFAPILoaded to use OptionsManager Tab PluginOptionTab registry Removed OptionsSaved method as superflous Removed PathfinderUpdaterPlugin's superflous ConfigEntry variables, relies on MainMenuOverride option values Changed RestartPopupScreen.ExitScreen to only update MainMenuOverride.RestartPrompt.Value
Eases the construction of custom tabs GUI.DrawData updated to C#10
Renamed to PluginOptionDrawData X, Y, Width, and Height made as stored nullable ints instead Modified Add method for ease of convenience Added QuickAdd for simpler alternative to modified Add Corrected cases of PluginOptionDrawData's nullable ints usage Corrected ambiguous generic type references for GetTab in OptionsManager PathfinderOptionsMenu: Renamed currentTabName to public CurrentTabId { get; private set; } Added SetCurrentTab(string), SetCurrentTab(PlugionOptionTab), and SetCurrentTab(OptionsTab) for tab registry safety PlugionOptionTab: Move option draw data setting functionality to _SetDrawPositions method Correct options OnDraw calls to use gameTime
Disabled obsolete warnings in Options and PathfinderOptionsMenu
pluginToOptionsTag renamed to pluginToOptTabAttribute that stores OptionsTabAttribute as value Added TabName and TabId Made Tag obsolete and redirects to TabName Property setters are made public Added OptionsManager.GetIdFrom(string, string) for PluginOptionTab id resolution OptionsAttribute: Added TabName and TabId Made Tag obsolete redirects to TabName Can register tabs with ID
…adContent BasePluginOption: Removed DrawDataField, use DrawData Removed Id.set Added HeaderColor, DescriptionColor, HeaderFont, DescriptionFont, HeaderTextSize, and DescritptionTextSize Added protected constructor for needed assignment Assign fonts and size in LoadContent Fix config.Bind throwing for ConfigDescription being null Added protected DrawString method OptionManager: Made GetIdFrom public Added Postfix Patch to Game1.LoadContent for calling LoadContent on all tabs PathfinderOptions will add to an existing Pathfinder option tab if it exists PluginCheckbox has been cleaned up and given SelectedColor PluginOptionTab: Changed options to IDictionary<string, IPluginOption> Added SpriteBatch Batch Renamed IsRegistered to IsLoaded Implements IReadOnlyDictionary<string, IPluginOption> for options instead Renamed OnRegistered to LoadContent, runs on Game1.LoadContent Properly set IsLoaded to true in LoadContent Properly set draw data positions Added PluginSlider for slider option Added incomplete and unpolished PluginTextbox Partly addresses #72
Deleted PluginOptionDrawData IPluginOption: Removed DrawData Added Rectangle and Size Added TrySetOffset(Vector2) BasePluginOption: Added Position, Offset, and MinSize BasePluginOption derived classes use Position and Size for drawing and MinSize for configuring the Size PluginOptionTab corrects option positions on every draw call using IPluginOption.TrySetOffset Added expanding behavior for PluginTextbox
PluginOptionTab: Removed ButtonData Added ButtonRect, ButtonPosition, ButtonOffset Added TrySetButtonOffset(Point) Draws tab button using ButtonPosition and ButtonRect's Size values PathfinderOptionsMenu relies on tab button offset drawing
Spartan322
force-pushed
the
feature/improved-options
branch
from
May 2, 2022 02:35
87404e6
to
7bc7c62
Compare
Added CustomOptionsLoadEvent: Runs when opening the options screen Inverse of CustomOptionsSaveEvent Corrected MiscPatches.NoSteamErrorMessageIL for PathfinderOptions.DisableSteamCloudError's conversion to a PluginCheckbox Moved OptionsTab to a new file PluginOptionTab: Added HacknetPlugin Plugin Constructor relies on assigning a plugin to the tab Modified OnSave(ConfigFile) to Save(), by default forces Plugin.Config to Save to disk Modified OnLoad(ConfigFile) to Load(), by default does nothing IPluginOption: Removed OnSave and OnLoad Added ConfigEntryBase IPluginOption.ConfigEntry BasePluginOption<ValueT>: Added ConfigEntry<ValueT> TypedConfigEntry Automatically handles the setting and retrieving of its config value Added static string MakeIdFrom(string, string) to replace old OptionsManager.GetIdFrom OptionsManager: PluginTabs made into a Dictionary<string, PluginOptionTab> PluginTabs made private and renamed to _PluginTabs Public PluginTabs accessor has become a ReadOnlyDictionary of _PluginTabs Added const string PluginOptionTabIdPostfix Added MakeTabDataFrom(HacknetPlugin, string) Reworked GetIdFrom as GetIdFrom(HacknetPlugin, string, string) All RegisterTab methods require a HacknetPlugin argument now All RegisterOption methods also require a HacknetPlugin argument now Added ThrowDuplicateIdAttempt(string) for consistent exception response Removed OPTION_TAG from PathfinderOptions Removed Rectangle Outline from PluginCheckbox, PluginSlider, and PluginTextbox PathfinderAPIPlugin: Added PathfinderAPIPlugin Instance for singleton reference Postfix patched HacknetPlugin.PostLoad to automatically load and save configs (Is disabled if it does not call HacknetPlugin.PostLoad) MainMenuOverride: Call PFAPILoaded in PathfinderAPIPlugin.Load, removed patching Added UpdaterTab MainMenuOverride always refers to MainMenuOverride.NoRestartPrompt for NoRestartPrompt option MainMenuOverride always refers to MainMenuOverride.IsEnabledBox for Enabled option Implementation currently ignores the old config implmentation PathfinderUpdaterPlugin: Added PathfinderUpdaterPlugin Instance for singleton reference Replaced uses of IsEnabled with MainMenuOverride.IsEnabledBox Replaced uses of IncludePreReleases with MainMenuOverride.IncludePrerelease RestartPopupScreen: Made NoRestartPrompt PluginCheckbox Constructor requires a ConfigFile argument Moved buttons and checkbox for the sake of polish Forcibly save data if NoRestartPrompt's value changes Updated OptionAttribute
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added DrawData
Added PluginOptionTab registry methods
GetOrRegisterTab("tabName").AddOption(PluginOption).AddOption(PluginOption2)
Added ease of use PluginOption registry method
RegisterOption("tabName", PluginOption);
GetOrRegisterTab(string).AddOption(IPluginOption)
while returning the option object#127 needs to be updated when this is merged, or this needs to be updated when #127 is merged