How annosz/uiinfosuite2 works
Main Components
• Mod Loader Entry Point: Show the ModEntry.cs, which is the primary entry point for the mod. This is where SMAPI initializes the mod during game startup.
• Compatibility Layer: Include the Compatibility directory. This component handles integration with external mods (such as NPC Map Locations or Level Extender) by checking for API presence and adapting behavior accordingly. Also include submodules like the CustomBush interfaces and related extensions.
• Infrastructure Services: Represent the Infrastructure directory which houses extensions, helpers, reflection utilities, asset/sound management (IconHandler, SoundHelper) and general-purpose tools that support other functionalities.
• Additional Features: Illustrate a separate module or subcomponent for any additional features that the mod provides (like SkipIntro functionality in AdditionalFeatures).
• Internationalization (i18n) & Assets: Although not in a C# folder, the i18n directory and assets folder represent core resources—language files and asset files (such as LevelUp.wav or licenses) that the mod uses. These should be clearly connected to the UI Elements and the Mod Entry as resources.
• Build and Configuration: Include peripheral nodes for continuous integration (GitHub workflows and Woodpecker build configurations) which support the automated building and testing of the mod.
Relationships and Interactions
• The ModEntry component initializes the mod runtime by loading the Options configurations, invoking the Compatibility logic, and registering UI Elements with both game and SMAPI events.
• The Options component influences the behavior of UI Elements – configuration changes affect how UI is rendered.
• The Infrastructure services are shared by both UI Elements and Compatibility; they provide helper functions (such as extension methods, asset handling, reflection, etc.) to ensure modularity.
• Data/resource flows from the assets and i18n directories into the UI Elements, ensuring that the right sound effects and language translations are available.
Architectural Patterns and Technologies
• This mod follows a modular design with strong separation of concerns: UI logic, configuration, compatibility, and core infrastructure are separated into distinct directories.
• It makes heavy use of dependency injection or at least service locator patterns (for utilities and helper classes) for maintainability.
• The project leverages extension methods for miscellaneous functionalities (as seen in the Infrastructure/Extensions directory), emphasizing code reuse and modularity.
Elements
• Each component (ModEntry, UI Elements, Options, Compatibility, Infrastructure, Additional Features, i18n, and Assets) should have a clear label.