34 lines
2.1 KiB
Markdown
34 lines
2.1 KiB
Markdown
# Application Services
|
|
|
|
The project relies heavily on dependency injection to provide specialized services. These are split into game-logic services (`Immortal`) and infrastructure services (`Website`).
|
|
|
|
## Game Logic Services (`Services.Immortal`)
|
|
|
|
- **IBuildOrderService (`BuildOrderService`)**: Manages build order creation, editing, and calculations.
|
|
- **IEconomyService (`EconomyService`)**: Handles calculations related to resource generation and expenditure.
|
|
- **IEconomyComparisonService (`EconomyComparisonService`)**: Compares different economic scenarios.
|
|
- **IEntityFilterService (`EntityFilterService`)**: Provides logic for filtering game entities based on various criteria.
|
|
- **IImmortalSelectionService (`ImmortalSelectionService`)**: Manages the current selection of the "Immortal" (faction/hero).
|
|
- **ITimingService (`TimingService`)**: Calculates timings for unit production and upgrades.
|
|
- **IMemoryTesterService (`MemoryTesterService`)**: Supports the memory tester mini-game.
|
|
|
|
## Infrastructure Services (`Services.Website`)
|
|
|
|
- **IStorageService (`StorageService`)**: Wraps LocalStorage to provide persistent state management for the application.
|
|
- **INavigationService (`NavigationService`)**: Manages application-level navigation and state.
|
|
- **ISearchService (`SearchService`)**: Powers the global search functionality.
|
|
- **IEntityDialogService (`EntityDialogService`)**: Controls the display of unit/building detail dialogs via portals.
|
|
- **IMyDialogService (`MyDialogService`)**: A wrapper around MudBlazor's dialog service for simplified use.
|
|
- **IToastService (`ToastService`)**: Provides a unified way to show notifications (toasts).
|
|
- **IDataCollectionService (`DataCollectionService`)**: Handles anonymous usage analytics.
|
|
- **IPermissionService (`PermissionService`)**: Manages user permissions or experimental feature toggles.
|
|
|
|
## Service Registration
|
|
|
|
All services are registered in `Program.cs`. Example:
|
|
```csharp
|
|
builder.Services.AddScoped<IBuildOrderService, BuildOrderService>();
|
|
builder.Services.AddScoped<IStorageService, StorageService>();
|
|
```
|
|
In Blazor WebAssembly, `AddScoped` effectively acts as a singleton for the session.
|