From f8d90ed230a88b8c92d431eea8d274e7840d6441 Mon Sep 17 00:00:00 2001 From: Ed Kolis Date: Sun, 5 Jan 2025 14:04:31 -0500 Subject: [PATCH] Rename factory classes to services (#350) --- FrEee.Core.Domain/FrEee.Core.Domain.csproj | 2 +- ...andFactory.cs => IDesignCommandService.cs} | 5 ++-- ...mandFactory.cs => IFleetCommandService.cs} | 4 +-- ...ndFactory.cs => IMessageCommandService.cs} | 4 +-- ...dFactory.cs => IMinisterCommandService.cs} | 4 +-- ...mmandFactory.cs => INoteCommandService.cs} | 5 ++-- ...mandFactory.cs => IOrderCommandService.cs} | 4 +-- ...ndFactory.cs => IProjectCommandService.cs} | 4 +-- ...dFactory.cs => IWaypointCommandService.cs} | 4 +-- .../Modding/Loaders/HullLoader.cs | 2 +- .../Civilization/Orders/ColonizeOrder.cs | 2 +- FrEee.Core.Domain/Objects/GameState/Game.cs | 2 +- .../Technology/MountedComponentTemplate.cs | 2 +- .../{IBattleFactory.cs => IBattleService.cs} | 12 ++++----- ...actory.cs => IConstructionQueueService.cs} | 8 +++--- .../Processes/Setup/GameSetup.cs | 2 +- FrEee.Core.Domain/Utility/DIRoot.cs | 26 +++++++++---------- .../{IDesignFactory.cs => IDesignService.cs} | 20 +++++++------- FrEee.Core.Domain/Vehicles/IHullFactory.cs | 21 --------------- FrEee.Core.Domain/Vehicles/IHullService.cs | 21 +++++++++++++++ FrEee.Core.Domain/Vehicles/IVehicleFactory.cs | 21 --------------- FrEee.Core.Domain/Vehicles/IVehicleService.cs | 21 +++++++++++++++ ...mandFactory.cs => DesignCommandService.cs} | 4 +-- ...mmandFactory.cs => FleetCommandService.cs} | 4 +-- ...andFactory.cs => MessageCommandService.cs} | 4 +-- ...ndFactory.cs => MinisterCommandService.cs} | 4 +-- ...ommandFactory.cs => NoteCommandService.cs} | 4 +-- ...mmandFactory.cs => OrderCommandService.cs} | 4 +-- ...andFactory.cs => ProjectCommandService.cs} | 4 +-- ...ndFactory.cs => WaypointCommandService.cs} | 4 +-- FrEee.Processes/Combat/Grid/Battle.cs | 2 +- .../{BattleFactory.cs => BattleService.cs} | 10 +++---- FrEee.Processes/Combat/Grid/GroundBattle.cs | 2 +- ...Factory.cs => ConstructionQueueService.cs} | 8 +++--- FrEee.Processes/TurnProcessor.cs | 2 +- FrEee.Root/Configuration.cs | 26 +++++++++---------- FrEee.Tests/Modding/FormulaTest.cs | 4 +-- .../Objects/Orders/ConstructionTest.cs | 2 +- .../Processes/Combat/DamageTypesTest.cs | 4 +-- FrEee.Tests/TestUtilities.cs | 4 +-- .../Forms/CombatSimulatorForm.cs | 4 +-- FrEee.UI.WinForms/Forms/GameSetupForm.cs | 2 +- FrEee.UI.WinForms/Forms/HostConsoleForm.cs | 2 +- FrEee.UI.WinForms/Forms/MainMenuForm.cs | 4 +-- FrEee.UI.WinForms/Forms/VehicleDesignForm.cs | 6 ++--- FrEee.UI.WinForms/Program.cs | 2 +- .../{DesignFactory.cs => DesignService.cs} | 14 +++++----- .../{HullFactory.cs => HullService.cs} | 6 ++--- FrEee.Vehicles/Types/MajorSpaceVehicle.cs | 2 +- FrEee.Vehicles/Vehicle.cs | 2 +- .../{VehicleFactory.cs => VehicleService.cs} | 6 ++--- 51 files changed, 172 insertions(+), 170 deletions(-) rename FrEee.Core.Domain/Gameplay/Commands/Designs/{IDesignCommandFactory.cs => IDesignCommandService.cs} (78%) rename FrEee.Core.Domain/Gameplay/Commands/Fleets/{IFleetCommandFactory.cs => IFleetCommandService.cs} (84%) rename FrEee.Core.Domain/Gameplay/Commands/Messages/{IMessageCommandFactory.cs => IMessageCommandService.cs} (78%) rename FrEee.Core.Domain/Gameplay/Commands/Ministers/{IMinisterCommandFactory.cs => IMinisterCommandService.cs} (72%) rename FrEee.Core.Domain/Gameplay/Commands/Notes/{INoteCommandFactory.cs => INoteCommandService.cs} (84%) rename FrEee.Core.Domain/Gameplay/Commands/Orders/{IOrderCommandFactory.cs => IOrderCommandService.cs} (85%) rename FrEee.Core.Domain/Gameplay/Commands/Projects/{IProjectCommandFactory.cs => IProjectCommandService.cs} (76%) rename FrEee.Core.Domain/Gameplay/Commands/Waypoints/{IWaypointCommandFactory.cs => IWaypointCommandService.cs} (83%) rename FrEee.Core.Domain/Processes/Combat/{IBattleFactory.cs => IBattleService.cs} (66%) rename FrEee.Core.Domain/Processes/Construction/{IConstructionQueueFactory.cs => IConstructionQueueService.cs} (67%) rename FrEee.Core.Domain/Vehicles/{IDesignFactory.cs => IDesignService.cs} (56%) delete mode 100644 FrEee.Core.Domain/Vehicles/IHullFactory.cs create mode 100644 FrEee.Core.Domain/Vehicles/IHullService.cs delete mode 100644 FrEee.Core.Domain/Vehicles/IVehicleFactory.cs create mode 100644 FrEee.Core.Domain/Vehicles/IVehicleService.cs rename FrEee.Gameplay/Commands/Designs/{DesignCommandFactory.cs => DesignCommandService.cs} (85%) rename FrEee.Gameplay/Commands/Fleets/{FleetCommandFactory.cs => FleetCommandService.cs} (92%) rename FrEee.Gameplay/Commands/Messages/{MessageCommandFactory.cs => MessageCommandService.cs} (84%) rename FrEee.Gameplay/Commands/Ministers/{MinisterCommandFactory.cs => MinisterCommandService.cs} (70%) rename FrEee.Gameplay/Commands/Notes/{NoteCommandFactory.cs => NoteCommandService.cs} (93%) rename FrEee.Gameplay/Commands/Orders/{OrderCommandFactory.cs => OrderCommandService.cs} (94%) rename FrEee.Gameplay/Commands/Projects/{ProjectCommandFactory.cs => ProjectCommandService.cs} (67%) rename FrEee.Gameplay/Commands/Waypoints/{WaypointCommandFactory.cs => WaypointCommandService.cs} (88%) rename FrEee.Processes/Combat/Grid/{BattleFactory.cs => BattleService.cs} (60%) rename FrEee.Processes/Construction/{ConstructionQueueFactory.cs => ConstructionQueueService.cs} (93%) rename FrEee.Vehicles/{DesignFactory.cs => DesignService.cs} (89%) rename FrEee.Vehicles/{HullFactory.cs => HullService.cs} (88%) rename FrEee.Vehicles/{VehicleFactory.cs => VehicleService.cs} (86%) diff --git a/FrEee.Core.Domain/FrEee.Core.Domain.csproj b/FrEee.Core.Domain/FrEee.Core.Domain.csproj index 4263c1b9..44e965f2 100644 --- a/FrEee.Core.Domain/FrEee.Core.Domain.csproj +++ b/FrEee.Core.Domain/FrEee.Core.Domain.csproj @@ -29,7 +29,7 @@ - + diff --git a/FrEee.Core.Domain/Gameplay/Commands/Designs/IDesignCommandFactory.cs b/FrEee.Core.Domain/Gameplay/Commands/Designs/IDesignCommandService.cs similarity index 78% rename from FrEee.Core.Domain/Gameplay/Commands/Designs/IDesignCommandFactory.cs rename to FrEee.Core.Domain/Gameplay/Commands/Designs/IDesignCommandService.cs index a2f3d04b..9f95d80c 100644 --- a/FrEee.Core.Domain/Gameplay/Commands/Designs/IDesignCommandFactory.cs +++ b/FrEee.Core.Domain/Gameplay/Commands/Designs/IDesignCommandService.cs @@ -11,8 +11,9 @@ namespace FrEee.Gameplay.Commands.Designs; /// -/// Builds various types of commands used for managing vehicle designs. -public interface IDesignCommandFactory +/// Creates various types of commands used for managing vehicle designs. +/// +public interface IDesignCommandService { ICreateDesignCommand CreateDesign(IDesign design) where T : IVehicle; diff --git a/FrEee.Core.Domain/Gameplay/Commands/Fleets/IFleetCommandFactory.cs b/FrEee.Core.Domain/Gameplay/Commands/Fleets/IFleetCommandService.cs similarity index 84% rename from FrEee.Core.Domain/Gameplay/Commands/Fleets/IFleetCommandFactory.cs rename to FrEee.Core.Domain/Gameplay/Commands/Fleets/IFleetCommandService.cs index 5ff86e71..dbc18533 100644 --- a/FrEee.Core.Domain/Gameplay/Commands/Fleets/IFleetCommandFactory.cs +++ b/FrEee.Core.Domain/Gameplay/Commands/Fleets/IFleetCommandService.cs @@ -8,9 +8,9 @@ namespace FrEee.Gameplay.Commands.Fleets; /// -/// Builds various types of commands used for managing fleets. +/// Creates various types of commands used for managing fleets. /// -public interface IFleetCommandFactory +public interface IFleetCommandService { ICreateFleetCommand CreateFleet(Fleet fleet, Sector sector); diff --git a/FrEee.Core.Domain/Gameplay/Commands/Messages/IMessageCommandFactory.cs b/FrEee.Core.Domain/Gameplay/Commands/Messages/IMessageCommandService.cs similarity index 78% rename from FrEee.Core.Domain/Gameplay/Commands/Messages/IMessageCommandFactory.cs rename to FrEee.Core.Domain/Gameplay/Commands/Messages/IMessageCommandService.cs index bf45da56..40f7bb69 100644 --- a/FrEee.Core.Domain/Gameplay/Commands/Messages/IMessageCommandFactory.cs +++ b/FrEee.Core.Domain/Gameplay/Commands/Messages/IMessageCommandService.cs @@ -9,9 +9,9 @@ namespace FrEee.Gameplay.Commands.Messages; /// -/// Builds commands allowing players to manage diplomatic messages. +/// Creates commands allowing players to manage diplomatic messages. /// -public interface IMessageCommandFactory +public interface IMessageCommandService { IDeleteMessageCommand DeleteMessage(IMessage message); diff --git a/FrEee.Core.Domain/Gameplay/Commands/Ministers/IMinisterCommandFactory.cs b/FrEee.Core.Domain/Gameplay/Commands/Ministers/IMinisterCommandService.cs similarity index 72% rename from FrEee.Core.Domain/Gameplay/Commands/Ministers/IMinisterCommandFactory.cs rename to FrEee.Core.Domain/Gameplay/Commands/Ministers/IMinisterCommandService.cs index ebf3a76f..cea31883 100644 --- a/FrEee.Core.Domain/Gameplay/Commands/Ministers/IMinisterCommandFactory.cs +++ b/FrEee.Core.Domain/Gameplay/Commands/Ministers/IMinisterCommandService.cs @@ -8,9 +8,9 @@ namespace FrEee.Gameplay.Commands.Ministers; /// -/// Builds commands used to manage AI ministers for an empire. +/// Creates commands used to manage AI ministers for an empire. /// -public interface IMinisterCommandFactory +public interface IMinisterCommandService { IToggleMinistersCommand ToggleMinisters(); } \ No newline at end of file diff --git a/FrEee.Core.Domain/Gameplay/Commands/Notes/INoteCommandFactory.cs b/FrEee.Core.Domain/Gameplay/Commands/Notes/INoteCommandService.cs similarity index 84% rename from FrEee.Core.Domain/Gameplay/Commands/Notes/INoteCommandFactory.cs rename to FrEee.Core.Domain/Gameplay/Commands/Notes/INoteCommandService.cs index a7333346..495799b2 100644 --- a/FrEee.Core.Domain/Gameplay/Commands/Notes/INoteCommandFactory.cs +++ b/FrEee.Core.Domain/Gameplay/Commands/Notes/INoteCommandService.cs @@ -10,8 +10,9 @@ namespace FrEee.Gameplay.Commands.Notes; /// -/// Builds various types of commands used for managing notes. -public interface INoteCommandFactory +/// Creates various types of commands used for managing notes. +/// +public interface INoteCommandService { ICommand ClearPlayerNote(IReferrable target); diff --git a/FrEee.Core.Domain/Gameplay/Commands/Orders/IOrderCommandFactory.cs b/FrEee.Core.Domain/Gameplay/Commands/Orders/IOrderCommandService.cs similarity index 85% rename from FrEee.Core.Domain/Gameplay/Commands/Orders/IOrderCommandFactory.cs rename to FrEee.Core.Domain/Gameplay/Commands/Orders/IOrderCommandService.cs index 1f875a9e..fbd5ab94 100644 --- a/FrEee.Core.Domain/Gameplay/Commands/Orders/IOrderCommandFactory.cs +++ b/FrEee.Core.Domain/Gameplay/Commands/Orders/IOrderCommandService.cs @@ -9,9 +9,9 @@ namespace FrEee.Gameplay.Commands.Orders; /// -/// Builds various types of commands used for managing s. +/// Creates various types of commands used for managing s. /// -public interface IOrderCommandFactory +public interface IOrderCommandService { IAddOrderCommand AddOrder(IOrderable target, IOrder order); diff --git a/FrEee.Core.Domain/Gameplay/Commands/Projects/IProjectCommandFactory.cs b/FrEee.Core.Domain/Gameplay/Commands/Projects/IProjectCommandService.cs similarity index 76% rename from FrEee.Core.Domain/Gameplay/Commands/Projects/IProjectCommandFactory.cs rename to FrEee.Core.Domain/Gameplay/Commands/Projects/IProjectCommandService.cs index 22b623c3..66aee300 100644 --- a/FrEee.Core.Domain/Gameplay/Commands/Projects/IProjectCommandFactory.cs +++ b/FrEee.Core.Domain/Gameplay/Commands/Projects/IProjectCommandService.cs @@ -7,9 +7,9 @@ namespace FrEee.Gameplay.Commands.Projects; /// -/// Builds commands for empire wide projects such as research and espionage. +/// Creates commands for empire wide projects such as research and espionage. /// -public interface IProjectCommandFactory +public interface IProjectCommandService { /// /// Creates an to assign research spending. diff --git a/FrEee.Core.Domain/Gameplay/Commands/Waypoints/IWaypointCommandFactory.cs b/FrEee.Core.Domain/Gameplay/Commands/Waypoints/IWaypointCommandService.cs similarity index 83% rename from FrEee.Core.Domain/Gameplay/Commands/Waypoints/IWaypointCommandFactory.cs rename to FrEee.Core.Domain/Gameplay/Commands/Waypoints/IWaypointCommandService.cs index 253b6e13..22ab0cce 100644 --- a/FrEee.Core.Domain/Gameplay/Commands/Waypoints/IWaypointCommandFactory.cs +++ b/FrEee.Core.Domain/Gameplay/Commands/Waypoints/IWaypointCommandService.cs @@ -8,9 +8,9 @@ namespace FrEee.Gameplay.Commands.Waypoints; /// -/// Builds commands to manage waypoints. +/// Creates commands to manage waypoints. /// -public interface IWaypointCommandFactory +public interface IWaypointCommandService { ICommand CreateWaypoint(Waypoint waypoint); diff --git a/FrEee.Core.Domain/Modding/Loaders/HullLoader.cs b/FrEee.Core.Domain/Modding/Loaders/HullLoader.cs index 53397974..8344e275 100644 --- a/FrEee.Core.Domain/Modding/Loaders/HullLoader.cs +++ b/FrEee.Core.Domain/Modding/Loaders/HullLoader.cs @@ -30,7 +30,7 @@ public override IEnumerable Load(Mod mod) var hulltype = rec.Get("Vehicle Type", null); try { - hull = DIRoot.Hulls.Build(Parser.ParseEnum(hulltype)); + hull = DIRoot.Hulls.CreateHull(Parser.ParseEnum(hulltype)); } catch (InvalidOperationException ex) { diff --git a/FrEee.Core.Domain/Objects/Civilization/Orders/ColonizeOrder.cs b/FrEee.Core.Domain/Objects/Civilization/Orders/ColonizeOrder.cs index 48f8b3d9..32247194 100644 --- a/FrEee.Core.Domain/Objects/Civilization/Orders/ColonizeOrder.cs +++ b/FrEee.Core.Domain/Objects/Civilization/Orders/ColonizeOrder.cs @@ -108,7 +108,7 @@ public void Execute(IOrderable ord) // colonize now!!! Planet.Colony = new Colony { Owner = sobj.Owner }; Owner.TriggerHappinessChange(hm => hm.PlanetColonized); - Planet.Colony.ConstructionQueue = DIRoot.ConstructionQueues.Build(Planet); + Planet.Colony.ConstructionQueue = DIRoot.ConstructionQueues.CreateConstructionQueue(Planet); if (sobj is ICargoContainer cc) { foreach (var kvp in cc.Cargo.Population) diff --git a/FrEee.Core.Domain/Objects/GameState/Game.cs b/FrEee.Core.Domain/Objects/GameState/Game.cs index eb09f839..c51cf773 100644 --- a/FrEee.Core.Domain/Objects/GameState/Game.cs +++ b/FrEee.Core.Domain/Objects/GameState/Game.cs @@ -794,7 +794,7 @@ public void MoveShips() && (!lastBattleTimestamps.ContainsKey(sector) || lastBattleTimestamps[sector] < Timestamp - (v.StrategicSpeed == 0 ? 1d : 1d / v.StrategicSpeed)))) // have we fought here too recently? { // resolve the battle - var battle = DIRoot.Battles.BuildSpaceBattle(sector); + var battle = DIRoot.Battles.CreateSpaceBattle(sector); battle.Resolve(); Battles.Add(battle); foreach (var emp in battle.Empires) diff --git a/FrEee.Core.Domain/Objects/Technology/MountedComponentTemplate.cs b/FrEee.Core.Domain/Objects/Technology/MountedComponentTemplate.cs index ad3502f4..adcd4fd8 100644 --- a/FrEee.Core.Domain/Objects/Technology/MountedComponentTemplate.cs +++ b/FrEee.Core.Domain/Objects/Technology/MountedComponentTemplate.cs @@ -274,7 +274,7 @@ public IDictionary Variables { get { - var design = Container ?? DIRoot.Designs.Build(Mod.Current.Hulls.FirstOrDefault(h => ComponentTemplate.VehicleTypes.HasFlag(h.VehicleType))); + var design = Container ?? DIRoot.Designs.CreateDesign(Mod.Current.Hulls.FirstOrDefault(h => ComponentTemplate.VehicleTypes.HasFlag(h.VehicleType))); var empire = Container == null ? Empire.Current : Container.Owner; return new Dictionary { diff --git a/FrEee.Core.Domain/Processes/Combat/IBattleFactory.cs b/FrEee.Core.Domain/Processes/Combat/IBattleService.cs similarity index 66% rename from FrEee.Core.Domain/Processes/Combat/IBattleFactory.cs rename to FrEee.Core.Domain/Processes/Combat/IBattleService.cs index c326a403..5dfc1120 100644 --- a/FrEee.Core.Domain/Processes/Combat/IBattleFactory.cs +++ b/FrEee.Core.Domain/Processes/Combat/IBattleService.cs @@ -8,21 +8,21 @@ namespace FrEee.Processes.Combat; /// -/// Builds battles. +/// Manages battles. /// -public interface IBattleFactory +public interface IBattleService { /// - /// Builds a space battle. + /// Creates a space battle. /// /// /// - IBattle BuildSpaceBattle(Sector location); + IBattle CreateSpaceBattle(Sector location); /// - /// Builds a ground battle. + /// Creates a ground battle. /// /// /// - IBattle BuildGroundBattle(Planet location); + IBattle CreateGroundBattle(Planet location); } diff --git a/FrEee.Core.Domain/Processes/Construction/IConstructionQueueFactory.cs b/FrEee.Core.Domain/Processes/Construction/IConstructionQueueService.cs similarity index 67% rename from FrEee.Core.Domain/Processes/Construction/IConstructionQueueFactory.cs rename to FrEee.Core.Domain/Processes/Construction/IConstructionQueueService.cs index 8dc8c2ef..220b8f73 100644 --- a/FrEee.Core.Domain/Processes/Construction/IConstructionQueueFactory.cs +++ b/FrEee.Core.Domain/Processes/Construction/IConstructionQueueService.cs @@ -4,17 +4,17 @@ namespace FrEee.Processes.Combat.Grid; /// -/// Builds s for s +/// Creates s for s /// and serves as a utility class for s. /// -public interface IConstructionQueueFactory +public interface IConstructionQueueService { /// - /// Builds a construction queue for a constructor. + /// Creates a construction queue for a constructor. /// /// /// - IConstructionQueue Build(IConstructor constructor); + IConstructionQueue CreateConstructionQueue(IConstructor constructor); /// /// Computes the rate at which a construction queue can build. diff --git a/FrEee.Core.Domain/Processes/Setup/GameSetup.cs b/FrEee.Core.Domain/Processes/Setup/GameSetup.cs index ef8a32f0..dff14088 100644 --- a/FrEee.Core.Domain/Processes/Setup/GameSetup.cs +++ b/FrEee.Core.Domain/Processes/Setup/GameSetup.cs @@ -579,7 +579,7 @@ private void PlaceEmpire(Galaxy gal, Empire emp, PRNG dice) hw.Colony = new Colony { Owner = emp, - ConstructionQueue = DIRoot.ConstructionQueues.Build(hw), + ConstructionQueue = DIRoot.ConstructionQueues.CreateConstructionQueue(hw), IsHomeworld = true, }; hw.AddPopulation(emp.PrimaryRace, hw.Size.MaxPopulation); diff --git a/FrEee.Core.Domain/Utility/DIRoot.cs b/FrEee.Core.Domain/Utility/DIRoot.cs index 5b4e6927..552a1c2b 100644 --- a/FrEee.Core.Domain/Utility/DIRoot.cs +++ b/FrEee.Core.Domain/Utility/DIRoot.cs @@ -31,67 +31,67 @@ public static class DIRoot /// /// Manages battles. /// - public static IBattleFactory Battles => DI.Get(); + public static IBattleService Battles => DI.Get(); /// /// Allows players to manage designs. /// - public static IDesignCommandFactory DesignCommands => DI.Get(); + public static IDesignCommandService DesignCommands => DI.Get(); /// /// Allows players to manage fleets. /// - public static IFleetCommandFactory FleetCommands => DI.Get(); + public static IFleetCommandService FleetCommands => DI.Get(); /// /// Allows players to manage diplomatic messages. /// - public static IMessageCommandFactory MessageCommands => DI.Get(); + public static IMessageCommandService MessageCommands => DI.Get(); /// /// Allows players to manage AI ministers. /// - public static IMinisterCommandFactory MinisterCommands => DI.Get(); + public static IMinisterCommandService MinisterCommands => DI.Get(); /// /// Allows players to manage notes. /// - public static INoteCommandFactory NoteCommands => DI.Get(); + public static INoteCommandService NoteCommands => DI.Get(); /// /// Allows players to issue orders. /// - public static IOrderCommandFactory OrderCommands => DI.Get(); + public static IOrderCommandService OrderCommands => DI.Get(); /// /// Allows players to manage empire wide projects such as research and espionage. /// - public static IProjectCommandFactory ProjectCommands => DI.Get(); + public static IProjectCommandService ProjectCommands => DI.Get(); /// /// Allows players to manage waypoints. /// - public static IWaypointCommandFactory WaypointCommands => DI.Get(); + public static IWaypointCommandService WaypointCommands => DI.Get(); /// /// Creates vehicle hulls. /// - public static IHullFactory Hulls => DI.Get(); + public static IHullService Hulls => DI.Get(); /// /// Creates vehicle designs. /// - public static IDesignFactory Designs => DI.Get(); + public static IDesignService Designs => DI.Get(); /// /// Creates vehicles. /// - public static IVehicleFactory Vehicles => DI.Get(); + public static IVehicleService Vehicles => DI.Get(); /// /// Creates construction queues. /// - public static IConstructionQueueFactory ConstructionQueues => DI.Get(); + public static IConstructionQueueService ConstructionQueues => DI.Get(); /// /// Manages the GUI. Only available when there is a GUI. diff --git a/FrEee.Core.Domain/Vehicles/IDesignFactory.cs b/FrEee.Core.Domain/Vehicles/IDesignService.cs similarity index 56% rename from FrEee.Core.Domain/Vehicles/IDesignFactory.cs rename to FrEee.Core.Domain/Vehicles/IDesignService.cs index 8655cda1..94315eb6 100644 --- a/FrEee.Core.Domain/Vehicles/IDesignFactory.cs +++ b/FrEee.Core.Domain/Vehicles/IDesignService.cs @@ -8,31 +8,31 @@ namespace FrEee.Vehicles; /// -/// Build vehicle designs. +/// Manages vehicle designs. /// -public interface IDesignFactory +public interface IDesignService { /// - /// Builds a design with a specific vehicle type. + /// Creates a design with a specific vehicle type. /// /// The vehicle type to build. - /// The built design, with no hull or components. - IDesign Build(VehicleTypes vehicleType); + /// The new design, with no hull or components. + IDesign CreateDesign(VehicleTypes vehicleType); /// - /// Builds a design with a specific hull. + /// Creates a design with a specific hull. /// /// The hull to use on the design. - /// The built design, with a hull but no components. - IDesign Build(IHull hull); + /// The new design, with a hull but no components. + IDesign CreateDesign(IHull hull); /// /// Imports designs from the user's library into the current game. /// - IEnumerable ImportFromLibrary(); + IEnumerable ImportDesignsFromLibrary(); /// /// The standard militia unit design for use in defending colonies. /// - IDesign Militia { get; } + IDesign MilitiaDesign { get; } } diff --git a/FrEee.Core.Domain/Vehicles/IHullFactory.cs b/FrEee.Core.Domain/Vehicles/IHullFactory.cs deleted file mode 100644 index fa264aed..00000000 --- a/FrEee.Core.Domain/Vehicles/IHullFactory.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using FrEee.Vehicles.Types; - -namespace FrEee.Vehicles; - -/// -/// Build vehicle hulls. -/// -public interface IHullFactory -{ - /// - /// Builds a hull of a specific type. - /// - /// The type of hull to build. - /// The built hull. - IHull Build(VehicleTypes vehicleType); -} diff --git a/FrEee.Core.Domain/Vehicles/IHullService.cs b/FrEee.Core.Domain/Vehicles/IHullService.cs new file mode 100644 index 00000000..989743fc --- /dev/null +++ b/FrEee.Core.Domain/Vehicles/IHullService.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using FrEee.Vehicles.Types; + +namespace FrEee.Vehicles; + +/// +/// Creates vehicle hulls. +/// +public interface IHullService +{ + /// + /// Creates a hull of a specific type. + /// + /// The type of hull to create. + /// The new hull. + IHull CreateHull(VehicleTypes vehicleType); +} diff --git a/FrEee.Core.Domain/Vehicles/IVehicleFactory.cs b/FrEee.Core.Domain/Vehicles/IVehicleFactory.cs deleted file mode 100644 index 05612d05..00000000 --- a/FrEee.Core.Domain/Vehicles/IVehicleFactory.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using FrEee.Vehicles.Types; - -namespace FrEee.Vehicles; - -/// -/// Build vehicles. -/// -public interface IVehicleFactory -{ - /// - /// Builds a vehicle of a specific type. - /// - /// The type of vehicle to build. - /// The built vehicle. - IVehicle Build(VehicleTypes vehicleType); -} diff --git a/FrEee.Core.Domain/Vehicles/IVehicleService.cs b/FrEee.Core.Domain/Vehicles/IVehicleService.cs new file mode 100644 index 00000000..39f9a3c1 --- /dev/null +++ b/FrEee.Core.Domain/Vehicles/IVehicleService.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using FrEee.Vehicles.Types; + +namespace FrEee.Vehicles; + +/// +/// Creates vehicles. +/// +public interface IVehicleService +{ + /// + /// Creates a vehicle of a specific type. + /// + /// The type of vehicle to create. + /// The new vehicle. + IVehicle CreateVehicle(VehicleTypes vehicleType); +} diff --git a/FrEee.Gameplay/Commands/Designs/DesignCommandFactory.cs b/FrEee.Gameplay/Commands/Designs/DesignCommandService.cs similarity index 85% rename from FrEee.Gameplay/Commands/Designs/DesignCommandFactory.cs rename to FrEee.Gameplay/Commands/Designs/DesignCommandService.cs index 563780d5..99ee0fb4 100644 --- a/FrEee.Gameplay/Commands/Designs/DesignCommandFactory.cs +++ b/FrEee.Gameplay/Commands/Designs/DesignCommandService.cs @@ -1,8 +1,8 @@ using FrEee.Vehicles; namespace FrEee.Gameplay.Commands.Designs; -public class DesignCommandFactory - : IDesignCommandFactory +public class DesignCommandService + : IDesignCommandService { public ICreateDesignCommand CreateDesign(IDesign design) where T : IVehicle diff --git a/FrEee.Gameplay/Commands/Fleets/FleetCommandFactory.cs b/FrEee.Gameplay/Commands/Fleets/FleetCommandService.cs similarity index 92% rename from FrEee.Gameplay/Commands/Fleets/FleetCommandFactory.cs rename to FrEee.Gameplay/Commands/Fleets/FleetCommandService.cs index 9bde6c6b..91a6b4d1 100644 --- a/FrEee.Gameplay/Commands/Fleets/FleetCommandFactory.cs +++ b/FrEee.Gameplay/Commands/Fleets/FleetCommandService.cs @@ -1,8 +1,8 @@ using FrEee.Objects.Space; namespace FrEee.Gameplay.Commands.Fleets; -public class FleetCommandFactory - : IFleetCommandFactory +public class FleetCommandService + : IFleetCommandService { public ICreateFleetCommand CreateFleet(Fleet fleet, Sector sector) { diff --git a/FrEee.Gameplay/Commands/Messages/MessageCommandFactory.cs b/FrEee.Gameplay/Commands/Messages/MessageCommandService.cs similarity index 84% rename from FrEee.Gameplay/Commands/Messages/MessageCommandFactory.cs rename to FrEee.Gameplay/Commands/Messages/MessageCommandService.cs index 0a1d153d..cc15b09c 100644 --- a/FrEee.Gameplay/Commands/Messages/MessageCommandFactory.cs +++ b/FrEee.Gameplay/Commands/Messages/MessageCommandService.cs @@ -1,8 +1,8 @@ using FrEee.Objects.Civilization.Diplomacy.Messages; namespace FrEee.Gameplay.Commands.Messages; -public class MessageCommandFactory - : IMessageCommandFactory +public class MessageCommandService + : IMessageCommandService { public ISendMessageCommand SendMessage(IMessage message) { diff --git a/FrEee.Gameplay/Commands/Ministers/MinisterCommandFactory.cs b/FrEee.Gameplay/Commands/Ministers/MinisterCommandService.cs similarity index 70% rename from FrEee.Gameplay/Commands/Ministers/MinisterCommandFactory.cs rename to FrEee.Gameplay/Commands/Ministers/MinisterCommandService.cs index 93a5738b..d79a94a3 100644 --- a/FrEee.Gameplay/Commands/Ministers/MinisterCommandFactory.cs +++ b/FrEee.Gameplay/Commands/Ministers/MinisterCommandService.cs @@ -1,6 +1,6 @@ namespace FrEee.Gameplay.Commands.Ministers; -public class MinisterCommandFactory - : IMinisterCommandFactory +public class MinisterCommandService + : IMinisterCommandService { public IToggleMinistersCommand ToggleMinisters() { diff --git a/FrEee.Gameplay/Commands/Notes/NoteCommandFactory.cs b/FrEee.Gameplay/Commands/Notes/NoteCommandService.cs similarity index 93% rename from FrEee.Gameplay/Commands/Notes/NoteCommandFactory.cs rename to FrEee.Gameplay/Commands/Notes/NoteCommandService.cs index 002b7537..811f7838 100644 --- a/FrEee.Gameplay/Commands/Notes/NoteCommandFactory.cs +++ b/FrEee.Gameplay/Commands/Notes/NoteCommandService.cs @@ -2,8 +2,8 @@ using FrEee.Objects.GameState; namespace FrEee.Gameplay.Commands.Notes; -public class NoteCommandFactory - : INoteCommandFactory +public class NoteCommandService + : INoteCommandService { public ICommand ClearPlayerNote(IReferrable target) { diff --git a/FrEee.Gameplay/Commands/Orders/OrderCommandFactory.cs b/FrEee.Gameplay/Commands/Orders/OrderCommandService.cs similarity index 94% rename from FrEee.Gameplay/Commands/Orders/OrderCommandFactory.cs rename to FrEee.Gameplay/Commands/Orders/OrderCommandService.cs index 05f800e2..2c03216c 100644 --- a/FrEee.Gameplay/Commands/Orders/OrderCommandFactory.cs +++ b/FrEee.Gameplay/Commands/Orders/OrderCommandService.cs @@ -2,8 +2,8 @@ using FrEee.Objects.Civilization.Orders; namespace FrEee.Gameplay.Commands.Orders; -public class OrderCommandFactory - : IOrderCommandFactory +public class OrderCommandService + : IOrderCommandService { public IAddOrderCommand AddOrder(IOrderable target, IOrder order) { diff --git a/FrEee.Gameplay/Commands/Projects/ProjectCommandFactory.cs b/FrEee.Gameplay/Commands/Projects/ProjectCommandService.cs similarity index 67% rename from FrEee.Gameplay/Commands/Projects/ProjectCommandFactory.cs rename to FrEee.Gameplay/Commands/Projects/ProjectCommandService.cs index e317ab40..e0390538 100644 --- a/FrEee.Gameplay/Commands/Projects/ProjectCommandFactory.cs +++ b/FrEee.Gameplay/Commands/Projects/ProjectCommandService.cs @@ -1,7 +1,7 @@ namespace FrEee.Gameplay.Commands.Projects; -public class ProjectCommandFactory - : IProjectCommandFactory +public class ProjectCommandService + : IProjectCommandService { public IResearchCommand Research() { diff --git a/FrEee.Gameplay/Commands/Waypoints/WaypointCommandFactory.cs b/FrEee.Gameplay/Commands/Waypoints/WaypointCommandService.cs similarity index 88% rename from FrEee.Gameplay/Commands/Waypoints/WaypointCommandFactory.cs rename to FrEee.Gameplay/Commands/Waypoints/WaypointCommandService.cs index 80f78617..4595632b 100644 --- a/FrEee.Gameplay/Commands/Waypoints/WaypointCommandFactory.cs +++ b/FrEee.Gameplay/Commands/Waypoints/WaypointCommandService.cs @@ -1,8 +1,8 @@ using FrEee.Objects.Civilization; namespace FrEee.Gameplay.Commands.Waypoints; -public class WaypointCommandFactory - : IWaypointCommandFactory +public class WaypointCommandService + : IWaypointCommandService { public ICommand CreateWaypoint(Waypoint Waypoint) { diff --git a/FrEee.Processes/Combat/Grid/Battle.cs b/FrEee.Processes/Combat/Grid/Battle.cs index 9930f3b0..f944f01d 100644 --- a/FrEee.Processes/Combat/Grid/Battle.cs +++ b/FrEee.Processes/Combat/Grid/Battle.cs @@ -502,7 +502,7 @@ int GetCombatSpeedThisRound(ICombatant c) var cd = new CargoDelta(); cd.UnitTypeTonnage.Add(VehicleTypes.Troop, null); cc.TransferCargo(cd, dropTarget, cc.Owner, true); - var groundBattle = DIRoot.Battles.BuildGroundBattle(dropTarget); + var groundBattle = DIRoot.Battles.CreateGroundBattle(dropTarget); groundBattle.Resolve(); } } diff --git a/FrEee.Processes/Combat/Grid/BattleFactory.cs b/FrEee.Processes/Combat/Grid/BattleService.cs similarity index 60% rename from FrEee.Processes/Combat/Grid/BattleFactory.cs rename to FrEee.Processes/Combat/Grid/BattleService.cs index 86a53927..af8155b7 100644 --- a/FrEee.Processes/Combat/Grid/BattleFactory.cs +++ b/FrEee.Processes/Combat/Grid/BattleService.cs @@ -8,17 +8,17 @@ namespace FrEee.Processes.Combat.Grid; /// -/// Implementation of for the grid-based combat engine. +/// Implementation of for the grid-based combat engine. /// -public class BattleFactory - : IBattleFactory +public class BattleService + : IBattleService { - public IBattle BuildGroundBattle(Planet location) + public IBattle CreateGroundBattle(Planet location) { return new GroundBattle(location); } - public IBattle BuildSpaceBattle(Sector location) + public IBattle CreateSpaceBattle(Sector location) { return new SpaceBattle(location); } diff --git a/FrEee.Processes/Combat/Grid/GroundBattle.cs b/FrEee.Processes/Combat/Grid/GroundBattle.cs index 5e5d1d3a..6aea3b12 100644 --- a/FrEee.Processes/Combat/Grid/GroundBattle.cs +++ b/FrEee.Processes/Combat/Grid/GroundBattle.cs @@ -29,7 +29,7 @@ public GroundBattle(Planet location) var combatants = new HashSet(Planet.Cargo.Units.Where(q => q.CanInvadeAndPoliceColonies)); for (var i = 0; i < Planet.PopulationFill.Value / Mod.Current.Settings.PopulationFactor / (Mod.Current.Settings.PopulationPerMilitia == 0 ? 20 : Mod.Current.Settings.PopulationPerMilitia); i++) { - var militia = DIRoot.Designs.Militia.Instantiate(); + var militia = DIRoot.Designs.MilitiaDesign.Instantiate(); militia.Owner = Planet.Owner; combatants.Add(militia); } diff --git a/FrEee.Processes/Construction/ConstructionQueueFactory.cs b/FrEee.Processes/Construction/ConstructionQueueService.cs similarity index 93% rename from FrEee.Processes/Construction/ConstructionQueueFactory.cs rename to FrEee.Processes/Construction/ConstructionQueueService.cs index fe45585a..0f8915ea 100644 --- a/FrEee.Processes/Construction/ConstructionQueueFactory.cs +++ b/FrEee.Processes/Construction/ConstructionQueueService.cs @@ -15,12 +15,12 @@ namespace FrEee.Processes.Construction; /// -/// Stock implementation of . +/// Stock implementation of . /// -public class ConstructionQueueFactory - : IConstructionQueueFactory +public class ConstructionQueueService + : IConstructionQueueService { - public IConstructionQueue Build(IConstructor constructor) + public IConstructionQueue CreateConstructionQueue(IConstructor constructor) { return new ConstructionQueue(constructor); } diff --git a/FrEee.Processes/TurnProcessor.cs b/FrEee.Processes/TurnProcessor.cs index 9a2e4b65..9855c0df 100644 --- a/FrEee.Processes/TurnProcessor.cs +++ b/FrEee.Processes/TurnProcessor.cs @@ -430,7 +430,7 @@ public IEnumerable ProcessTurn(Game game, bool safeMode, Status status = foreach (var p in game.Galaxy.FindSpaceObjects(p => p.Cargo != null && p.Cargo.Units.Any(u => u.IsHostileTo(p.Owner) || p.IsHostileTo(u.Owner))) ) { - var battle = DIRoot.Battles.BuildGroundBattle(p); + var battle = DIRoot.Battles.CreateGroundBattle(p); battle.Resolve(); game.Battles.Add(battle); foreach (var emp in battle.Empires) diff --git a/FrEee.Root/Configuration.cs b/FrEee.Root/Configuration.cs index 3fee2d87..b3056f42 100644 --- a/FrEee.Root/Configuration.cs +++ b/FrEee.Root/Configuration.cs @@ -37,23 +37,23 @@ public static void ConfigureDI(Action additionlConfig = null) // processes DI.RegisterSingleton(); - DI.RegisterSingleton(); - DI.RegisterSingleton(); + DI.RegisterSingleton(); + DI.RegisterSingleton(); // gameplay - DI.RegisterSingleton(); - DI.RegisterSingleton(); - DI.RegisterSingleton(); - DI.RegisterSingleton(); - DI.RegisterSingleton(); - DI.RegisterSingleton(); - DI.RegisterSingleton(); - DI.RegisterSingleton(); + DI.RegisterSingleton(); + DI.RegisterSingleton(); + DI.RegisterSingleton(); + DI.RegisterSingleton(); + DI.RegisterSingleton(); + DI.RegisterSingleton(); + DI.RegisterSingleton(); + DI.RegisterSingleton(); // vehicles - DI.RegisterSingleton(); - DI.RegisterSingleton(); - DI.RegisterSingleton(); + DI.RegisterSingleton(); + DI.RegisterSingleton(); + DI.RegisterSingleton(); // addtional configuration for the GUI or whatever additionlConfig?.Invoke(); diff --git a/FrEee.Tests/Modding/FormulaTest.cs b/FrEee.Tests/Modding/FormulaTest.cs index 707cdd47..12b332eb 100644 --- a/FrEee.Tests/Modding/FormulaTest.cs +++ b/FrEee.Tests/Modding/FormulaTest.cs @@ -44,13 +44,13 @@ public void DynamicFormula() Mod.Current.Mounts.Add(mount); Mod.Current.AssignID(mount); - var hull = DIRoot.Hulls.Build(VehicleTypes.Ship); + var hull = DIRoot.Hulls.CreateHull(VehicleTypes.Ship); hull.ModID = hull.Name = "Generic Hull"; hull.Size = 150; Mod.Current.Hulls.Add(hull); Mod.Current.AssignID(hull); - var design = DIRoot.Designs.Build(hull); + var design = DIRoot.Designs.CreateDesign(hull); Game.Current.AssignID(design); var mct = new MountedComponentTemplate(design, armor, mount); design.Components.Add(mct); diff --git a/FrEee.Tests/Objects/Orders/ConstructionTest.cs b/FrEee.Tests/Objects/Orders/ConstructionTest.cs index 08442dc6..ffba594d 100644 --- a/FrEee.Tests/Objects/Orders/ConstructionTest.cs +++ b/FrEee.Tests/Objects/Orders/ConstructionTest.cs @@ -51,7 +51,7 @@ public void Init() colony = new Colony(); colony.Facilities.Add(new Facility(sy)); colony.Population.Add(race, (long)1e9); // 1 billion population; - colony.ConstructionQueue = DIRoot.ConstructionQueues.Build(planet); + colony.ConstructionQueue = DIRoot.ConstructionQueues.CreateConstructionQueue(planet); planet.Colony = colony; } diff --git a/FrEee.Tests/Processes/Combat/DamageTypesTest.cs b/FrEee.Tests/Processes/Combat/DamageTypesTest.cs index 0a507d7c..665c3fbc 100644 --- a/FrEee.Tests/Processes/Combat/DamageTypesTest.cs +++ b/FrEee.Tests/Processes/Combat/DamageTypesTest.cs @@ -31,12 +31,12 @@ public static void ClassInit() public void Init() { // create dummy designs - attackerDesign = (IDesign)DIRoot.Designs.Build(VehicleTypes.Ship); + attackerDesign = (IDesign)DIRoot.Designs.CreateDesign(VehicleTypes.Ship); attackerDesign.AddComponent(mod.ComponentTemplates.FindByName("Bridge")); attackerDesign.AddComponent(mod.ComponentTemplates.FindByName("Life Support")); attackerDesign.AddComponent(mod.ComponentTemplates.FindByName("Crew Quarters")); attackerDesign.AddComponent(mod.ComponentTemplates.FindByName("Quantum Reactor")); - defenderDesign = (IDesign)DIRoot.Designs.Build(VehicleTypes.Ship); + defenderDesign = (IDesign)DIRoot.Designs.CreateDesign(VehicleTypes.Ship); defenderDesign.AddComponent(mod.ComponentTemplates.FindByName("Bridge")); defenderDesign.AddComponent(mod.ComponentTemplates.FindByName("Life Support")); defenderDesign.AddComponent(mod.ComponentTemplates.FindByName("Crew Quarters")); diff --git a/FrEee.Tests/TestUtilities.cs b/FrEee.Tests/TestUtilities.cs index 38be1072..20cc6b66 100644 --- a/FrEee.Tests/TestUtilities.cs +++ b/FrEee.Tests/TestUtilities.cs @@ -38,7 +38,7 @@ public static Empire CreateEmpire(string name = "Galactic Empire") => public static IHull CreateHull(VehicleTypes vehicleType, string name = "Generic Hull") { - var hull = DIRoot.Hulls.Build(vehicleType); + var hull = DIRoot.Hulls.CreateHull(vehicleType); hull.Name = name; hull.ModID = name; hull.ThrustPerMove = 1; @@ -49,7 +49,7 @@ public static IHull CreateHull(VehicleTypes vehicleType, string name = "Generic public static IDesign CreateDesign(Empire owner, IHull hull, string name = "Generic Design") { - var design = DIRoot.Designs.Build(hull); + var design = DIRoot.Designs.CreateDesign(hull); design.BaseName = name; design.Owner = owner; return design; diff --git a/FrEee.UI.WinForms/Forms/CombatSimulatorForm.cs b/FrEee.UI.WinForms/Forms/CombatSimulatorForm.cs index bec02db7..72d5baca 100644 --- a/FrEee.UI.WinForms/Forms/CombatSimulatorForm.cs +++ b/FrEee.UI.WinForms/Forms/CombatSimulatorForm.cs @@ -257,7 +257,7 @@ private void btnOK_Click(object sender, EventArgs e) simPlanet.Sector = new Sector(new StarSystem(0) { Name = "Simulation" }, new Point()); foreach (IUnit t in Empires.SelectMany(se => se.Troops.Select(ss => ss.Unit))) planet.Cargo.Units.Add(t); - battle = DIRoot.Battles.BuildGroundBattle(planet); + battle = DIRoot.Battles.CreateGroundBattle(planet); // simulate the battle battle.Resolve(); @@ -269,7 +269,7 @@ private void btnOK_Click(object sender, EventArgs e) ispobj.Sector = location; // create battle with all our combatants //var battle = new Battle_Space(Empires.SelectMany(se => se.SpaceObjects.Select(ss => ss.SpaceObject))); - battle = DIRoot.Battles.BuildSpaceBattle(location); + battle = DIRoot.Battles.CreateSpaceBattle(location); // simulate the battle battle.Resolve(); diff --git a/FrEee.UI.WinForms/Forms/GameSetupForm.cs b/FrEee.UI.WinForms/Forms/GameSetupForm.cs index c1fa7586..755ace81 100644 --- a/FrEee.UI.WinForms/Forms/GameSetupForm.cs +++ b/FrEee.UI.WinForms/Forms/GameSetupForm.cs @@ -523,7 +523,7 @@ private void btnStart_Click(object sender, EventArgs e) var turn = Game.Current.TurnNumber; status.Message = "Loading game"; Game.Load(name + "_" + turn + "_0001.gam"); - DIRoot.Designs.ImportFromLibrary(); + DIRoot.Designs.ImportDesignsFromLibrary(); Hide(); MainMenuForm.GetInstance().ShowChildForm(new MainGameForm(false, true)); } diff --git a/FrEee.UI.WinForms/Forms/HostConsoleForm.cs b/FrEee.UI.WinForms/Forms/HostConsoleForm.cs index e47337b2..506da890 100644 --- a/FrEee.UI.WinForms/Forms/HostConsoleForm.cs +++ b/FrEee.UI.WinForms/Forms/HostConsoleForm.cs @@ -85,7 +85,7 @@ private void btnPlayerView_Click(object sender, EventArgs e) Game.Current.CurrentEmpire = emp; Game.Current.Redact(); } - DIRoot.Designs.ImportFromLibrary(); + DIRoot.Designs.ImportDesignsFromLibrary(); var form = new MainGameForm(true, false); Hide(); this.ShowChildForm(form); diff --git a/FrEee.UI.WinForms/Forms/MainMenuForm.cs b/FrEee.UI.WinForms/Forms/MainMenuForm.cs index 5a2f0f7e..41a20c18 100644 --- a/FrEee.UI.WinForms/Forms/MainMenuForm.cs +++ b/FrEee.UI.WinForms/Forms/MainMenuForm.cs @@ -115,7 +115,7 @@ private void btnQuickStart_Click(object sender, EventArgs e) if (status.Exception == null && !warnings.Any()) { - DIRoot.Designs.ImportFromLibrary(); + DIRoot.Designs.ImportDesignsFromLibrary(); var game = new MainGameForm(false, true); this.ShowChildForm(game); game.FormClosed += (s, args) => @@ -165,7 +165,7 @@ private void LoadGalaxyFromFile(string filename, bool? loadPlr = null) } // load library designs - DIRoot.Designs.ImportFromLibrary(); + DIRoot.Designs.ImportDesignsFromLibrary(); // display game view var form = new MainGameForm(false, true); diff --git a/FrEee.UI.WinForms/Forms/VehicleDesignForm.cs b/FrEee.UI.WinForms/Forms/VehicleDesignForm.cs index b2ee00ad..3e5c4557 100644 --- a/FrEee.UI.WinForms/Forms/VehicleDesignForm.cs +++ b/FrEee.UI.WinForms/Forms/VehicleDesignForm.cs @@ -33,7 +33,7 @@ public VehicleDesignForm(IHull hull) { InitializeComponent(); ShowComponentDetails(null); - Design = DIRoot.Designs.Build(hull); + Design = DIRoot.Designs.CreateDesign(hull); try { this.Icon = new Icon(FrEee.UI.WinForms.Properties.Resources.FrEeeIcon); } catch { } @@ -290,7 +290,7 @@ private void btnHull_Click(object sender, EventArgs e) // Changing vehicle types requires starting over, so warn the user if (MessageBox.Show("Changing the vehicle type requires starting over with your design. Abandon your old design?", "FrEee", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { - var d = DIRoot.Designs.Build(form.Hull.VehicleType); + var d = DIRoot.Designs.CreateDesign(form.Hull.VehicleType); d.TurnNumber = Game.Current.TurnNumber; d.Owner = Empire.Current; d.Hull = form.Hull; @@ -306,7 +306,7 @@ private void btnHull_Click(object sender, EventArgs e) } else { - var d = DIRoot.Designs.Build(form.Hull.VehicleType); + var d = DIRoot.Designs.CreateDesign(form.Hull.VehicleType); d.TurnNumber = Game.Current.TurnNumber; d.Owner = Empire.Current; d.Hull = form.Hull; diff --git a/FrEee.UI.WinForms/Program.cs b/FrEee.UI.WinForms/Program.cs index c27dd424..1a9053a5 100644 --- a/FrEee.UI.WinForms/Program.cs +++ b/FrEee.UI.WinForms/Program.cs @@ -183,7 +183,7 @@ private static int PlayTurn(string plrfile = null) MessageBox.Show(plrfile + " does not exist. You will need to start your turn from the beginning."); } - DIRoot.Designs.ImportFromLibrary(); + DIRoot.Designs.ImportDesignsFromLibrary(); var form = new MainGameForm(false, true); form.KeyPreview = true; diff --git a/FrEee.Vehicles/DesignFactory.cs b/FrEee.Vehicles/DesignService.cs similarity index 89% rename from FrEee.Vehicles/DesignFactory.cs rename to FrEee.Vehicles/DesignService.cs index 94268e17..0ff3a080 100644 --- a/FrEee.Vehicles/DesignFactory.cs +++ b/FrEee.Vehicles/DesignService.cs @@ -13,10 +13,10 @@ using FrEee.Vehicles.Types; namespace FrEee.Vehicles; -public class DesignFactory - : IDesignFactory +public class DesignService + : IDesignService { - public IDesign Militia { get; } = BuildMilitia(); + public IDesign MilitiaDesign { get; } = BuildMilitia(); private static IDesign BuildMilitia() { @@ -36,7 +36,7 @@ private static IDesign BuildMilitia() return militiaDesign; } - public IDesign Build(VehicleTypes vehicleType) + public IDesign CreateDesign(VehicleTypes vehicleType) { return vehicleType switch { @@ -52,9 +52,9 @@ public IDesign Build(VehicleTypes vehicleType) }; } - public IDesign Build(IHull hull) + public IDesign CreateDesign(IHull hull) { - var design = Build(hull.VehicleType); + var design = CreateDesign(hull.VehicleType); design.Hull = hull; return design; } @@ -64,7 +64,7 @@ public IDesign Build(IHull hull) /// Requires a current empire. Should only be called client side. /// /// Copied designs imported. - public IEnumerable ImportFromLibrary() + public IEnumerable ImportDesignsFromLibrary() { if (Empire.Current == null) throw new InvalidOperationException("Can't import designs without a current empire."); diff --git a/FrEee.Vehicles/HullFactory.cs b/FrEee.Vehicles/HullService.cs similarity index 88% rename from FrEee.Vehicles/HullFactory.cs rename to FrEee.Vehicles/HullService.cs index 89781a35..a7fbb2e7 100644 --- a/FrEee.Vehicles/HullFactory.cs +++ b/FrEee.Vehicles/HullService.cs @@ -6,10 +6,10 @@ using FrEee.Vehicles.Types; namespace FrEee.Vehicles; -public class HullFactory - : IHullFactory +public class HullService + : IHullService { - public IHull Build(VehicleTypes vehicleType) + public IHull CreateHull(VehicleTypes vehicleType) { return vehicleType switch { diff --git a/FrEee.Vehicles/Types/MajorSpaceVehicle.cs b/FrEee.Vehicles/Types/MajorSpaceVehicle.cs index 0982f0cb..78597354 100644 --- a/FrEee.Vehicles/Types/MajorSpaceVehicle.cs +++ b/FrEee.Vehicles/Types/MajorSpaceVehicle.cs @@ -20,7 +20,7 @@ public abstract class MajorSpaceVehicle protected MajorSpaceVehicle() : base() { Cargo = new Cargo(); - constructionQueue = DIRoot.ConstructionQueues.Build(this); + constructionQueue = DIRoot.ConstructionQueues.CreateConstructionQueue(this); } public override void Place(ISpaceObject target) diff --git a/FrEee.Vehicles/Vehicle.cs b/FrEee.Vehicles/Vehicle.cs index 4c800bc2..d3503ad4 100644 --- a/FrEee.Vehicles/Vehicle.cs +++ b/FrEee.Vehicles/Vehicle.cs @@ -641,7 +641,7 @@ public virtual void Redact(Empire emp) if (Design.CheckVisibility(emp) < Visibility.Scanned) { // create fake design - var d = DIRoot.Designs.Build(Design.VehicleType); + var d = DIRoot.Designs.CreateDesign(Design.VehicleType); d.Hull = Design.Hull; d.Owner = Design.Owner; Design = d; diff --git a/FrEee.Vehicles/VehicleFactory.cs b/FrEee.Vehicles/VehicleService.cs similarity index 86% rename from FrEee.Vehicles/VehicleFactory.cs rename to FrEee.Vehicles/VehicleService.cs index 67df17e1..3f820d43 100644 --- a/FrEee.Vehicles/VehicleFactory.cs +++ b/FrEee.Vehicles/VehicleService.cs @@ -6,10 +6,10 @@ using FrEee.Vehicles.Types; namespace FrEee.Vehicles; -public class VehicleFactory - : IVehicleFactory +public class VehicleService + : IVehicleService { - public IVehicle Build(VehicleTypes vehicleType) + public IVehicle CreateVehicle(VehicleTypes vehicleType) { return vehicleType switch {