How eightman999/hoi4navalmodder works
Main Components
• UI Layer:
• Views (found in the “View” directory) and Windows (in the “Window” directory). These represent the various screens (such as design views for guns, torpedoes, depth charges, radars, and fleet deployments) that the user interacts with.
• That Avalonia UI is used for the user interface.
• Business Logic / Core Layer:
• The “Core” folder contains the central logic, including Models (like NavalBase, NavalEquipment, IDESettingsManager), Services (e.g., DatabaseManager), and various Utilities (e.g., NavalGunIdGenerator, Map tools, UniqueIdGenerator). This layer orchestrates the core functionality, making calculations, data validations, and integrations.
• Calculators:
• The “Calculators” folder includes modules such as DepthChargeCalculator, GunCalculator, RadarCalculator, SonarCalculator, and TorpedoCalculator. These are specialized components that perform engineering and performance calculations for the naval designs.
• Mapper Layer:
• The “Mapper” folder contains modules that translate or map design data (e.g., gun, radar, sonar data) into the format needed by the database layer, ensuring that in-memory domain objects correctly align with the persistence model.
• Data Storage:
• Even though there isn’t an explicit “database” folder, dependencies like System.Data.SQLite indicate that a database (likely SQLite) is used, with data management integrated through services (DatabaseManager in Core/Services).
Relationships and Interactions
• UI Components (Views & Windows) interact directly with the Core layer through data binding and command patterns (the RelayCommand file in Core suggests use of MVVM).
• The Core layer relies on the Calculators to perform domain-specific computations which are often triggered via UI events.
• The Mapper layer serves as an adapter to transform in-memory data to database entities. It connects the Core and Persistence (DatabaseManager) components.
• The Core’s Utilities and Services provide cross-cutting functionalities (e.g., unique ID generation, map caching, etc.) that many components may call.
Architectural Patterns and Design Principles
• MVVM (Model-View-ViewModel): Indicated by Avalonia UI usage, separation of UI (View) from business logic (Models/Services).
• Layered Architecture: Clear separation between UI, Business Logic (including calculation and mapping), and Data Storage.
• Modularization: Separate directories for Calculators and Mapper modules to handle specific functionalities independently.