Hacknet-Pathfinder icon indicating copy to clipboard operation
Hacknet-Pathfinder copied to clipboard

Improved Options system

Open Spartan322 opened this issue 4 years ago • 3 comments

  • 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, can be overriden
  • Tab names and tab ids can be separated
  • Tabs are optionally modifiable
  • Tabs and Options store their position and size data in an instance DrawData struct
  • Simplifies PathfinderOptions immensely
  • Manages config loading and registers saving in PostLoad
  • DrawData allows storing and modifying position and size structs easily (currently the X position of tab buttons are hard coded to be 10 pixels after the previous tab button however)

Added DrawData

  • Simple position and size data struct
  • Converts between any draw relevant types
  • Also has simple data modifiers

Added PluginOptionTab registry methods

  • Registers the option tab object for drawing and retrieves the tab object
  • Enables chained method calls like GetOrRegisterTab("tabName").AddOption(PluginOption).AddOption(PluginOption2)
  • Can separate tab ids and tab names

Added ease of use PluginOption registry method

  • For the case that one does not wish to mess with tab objects
  • Does not allow chain methods, is called instead like so RegisterOption("tabName", PluginOption);
  • Shortcut for GetOrRegisterTab(string).AddOption(IPluginOption) while returning the option object
  • Can separate tab ids and tab names

#127 needs to be updated when this is merged, or this needs to be updated when #127 is merged

Spartan322 avatar Nov 09 '21 06:11 Spartan322

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.

Spartan322 avatar Apr 25 '22 10:04 Spartan322

And with that tabs and options support being in custom positions with overriding the draw methods.

Spartan322 avatar Apr 25 '22 23:04 Spartan322

Additions to #164:

  • Pathfinder.Meta.Load:
    • [ ] OptionAttribute.Tag
    • [ ] OptionsTabAttribute.Tag
  • Pathfinder.Options:
    • [ ] Option
    • [ ] OptionsManager.Tabs
    • [ ] OptionsManager.AddOption(string, Option)
    • [ ] OptionsTab

Spartan322 avatar Apr 29 '22 03:04 Spartan322