mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-11-03 04:56:29 +01:00
Move rolling stock and physics into the domain
VehicleDatabase becomes VehicleCatalog, Physics becomes VehiclePhysics, and the textures.txt and .fiz parsers move to Infrastructure. GameLibrary replaces the GameData singleton.
This commit is contained in:
@@ -51,5 +51,11 @@ public interface IFileSystem
|
||||
/// <summary>Top-level directories, empty when the directory does not exist.</summary>
|
||||
IReadOnlyList<string> GetDirectories(string path);
|
||||
|
||||
/// <summary>
|
||||
/// Files matching the pattern anywhere below the path. Empty when the
|
||||
/// directory does not exist.
|
||||
/// </summary>
|
||||
IReadOnlyList<string> GetFilesRecursive(string path, string searchPattern);
|
||||
|
||||
DateTime GetLastWriteTimeUtc(string path);
|
||||
}
|
||||
|
||||
19
StarterNG/Application/Abstractions/IMiniTextureIndex.cs
Normal file
19
StarterNG/Application/Abstractions/IMiniTextureIndex.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
namespace StarterNG.Application.Abstractions;
|
||||
|
||||
/// <summary>
|
||||
/// The thumbnails in textures/mini, looked up by name. Backed by one directory
|
||||
/// scan; a name with no bitmap falls back to the generic "other" thumbnail.
|
||||
/// </summary>
|
||||
public interface IMiniTextureIndex
|
||||
{
|
||||
/// <summary>Builds the index up front, off the UI thread.</summary>
|
||||
void Preload();
|
||||
|
||||
bool Has(string? miniName);
|
||||
|
||||
/// <summary>Bitmap for the name, the fallback thumbnail, or null when neither exists.</summary>
|
||||
string? PathFor(string? miniName);
|
||||
|
||||
/// <summary>The generic thumbnail shown for unknown stock.</summary>
|
||||
string? FallbackPath { get; }
|
||||
}
|
||||
21
StarterNG/Application/Abstractions/IPhysicsRepository.cs
Normal file
21
StarterNG/Application/Abstractions/IPhysicsRepository.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using StarterNG.Domain.Vehicles;
|
||||
|
||||
namespace StarterNG.Application.Abstractions;
|
||||
|
||||
/// <summary>
|
||||
/// Looks up the .fiz physics of a vehicle type by model name.
|
||||
/// </summary>
|
||||
public interface IPhysicsRepository
|
||||
{
|
||||
/// <summary>Indexes the installation's .fiz files up front, off the UI thread.</summary>
|
||||
void Preload();
|
||||
|
||||
/// <summary>How many vehicle types were indexed; zero means a broken installation.</summary>
|
||||
int IndexedCount { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Physics for a model name (with or without extension), or null when the
|
||||
/// installation has no .fiz for it.
|
||||
/// </summary>
|
||||
VehiclePhysics? For(string? dataFolder, string? model);
|
||||
}
|
||||
17
StarterNG/Application/Abstractions/IVehicleRepository.cs
Normal file
17
StarterNG/Application/Abstractions/IVehicleRepository.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using StarterNG.Domain.Vehicles;
|
||||
|
||||
namespace StarterNG.Application.Abstractions;
|
||||
|
||||
/// <summary>
|
||||
/// Reads the installation's rolling stock. The only route from the dynamic/
|
||||
/// folder to a <see cref="VehicleCatalog"/>.
|
||||
/// </summary>
|
||||
public interface IVehicleRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// Fills the catalogue from every textures.txt under dynamic/. Returns the
|
||||
/// number of liveries read, which the caller uses to spot an installation
|
||||
/// with no rolling stock at all.
|
||||
/// </summary>
|
||||
int Load(VehicleCatalog catalog);
|
||||
}
|
||||
Reference in New Issue
Block a user