Refactor runtime bootstrap and ship control flows
This commit is contained in:
69
apps/backend/Shared/Runtime/KnownShipTaxonomy.cs
Normal file
69
apps/backend/Shared/Runtime/KnownShipTaxonomy.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
namespace SpaceGame.Api.Shared.Runtime;
|
||||
|
||||
internal static class KnownShipTypes
|
||||
{
|
||||
internal const string Resupplier = "resupplier";
|
||||
internal const string Miner = "miner";
|
||||
internal const string Carrier = "carrier";
|
||||
internal const string Fighter = "fighter";
|
||||
internal const string HeavyFighter = "heavyfighter";
|
||||
internal const string Destroyer = "destroyer";
|
||||
internal const string LargeMiner = "largeminer";
|
||||
internal const string Freighter = "freighter";
|
||||
internal const string Bomber = "bomber";
|
||||
internal const string Scavenger = "scavenger";
|
||||
internal const string Frigate = "frigate";
|
||||
internal const string Transporter = "transporter";
|
||||
internal const string Interceptor = "interceptor";
|
||||
internal const string Scout = "scout";
|
||||
internal const string Courier = "courier";
|
||||
internal const string Builder = "builder";
|
||||
internal const string Corvette = "corvette";
|
||||
internal const string Police = "police";
|
||||
internal const string Battleship = "battleship";
|
||||
internal const string Gunboat = "gunboat";
|
||||
internal const string Tug = "tug";
|
||||
internal const string Compactor = "compactor";
|
||||
}
|
||||
|
||||
internal static class ShipTaxonomyExtensions
|
||||
{
|
||||
internal static string ToDataValue(this ShipPurpose purpose) =>
|
||||
purpose switch
|
||||
{
|
||||
ShipPurpose.Auxiliary => "auxiliary",
|
||||
ShipPurpose.Build => "build",
|
||||
ShipPurpose.Fight => "fight",
|
||||
ShipPurpose.Mine => "mine",
|
||||
ShipPurpose.Trade => "trade",
|
||||
_ => purpose.ToString(),
|
||||
};
|
||||
|
||||
internal static string ToDataValue(this ShipType type) =>
|
||||
type switch
|
||||
{
|
||||
ShipType.Resupplier => "resupplier",
|
||||
ShipType.Miner => "miner",
|
||||
ShipType.Carrier => "carrier",
|
||||
ShipType.Fighter => "fighter",
|
||||
ShipType.HeavyFighter => "heavyfighter",
|
||||
ShipType.Destroyer => "destroyer",
|
||||
ShipType.LargeMiner => "largeminer",
|
||||
ShipType.Freighter => "freighter",
|
||||
ShipType.Bomber => "bomber",
|
||||
ShipType.Scavenger => "scavenger",
|
||||
ShipType.Frigate => "frigate",
|
||||
ShipType.Transporter => "transporter",
|
||||
ShipType.Interceptor => "interceptor",
|
||||
ShipType.Scout => "scout",
|
||||
ShipType.Courier => "courier",
|
||||
ShipType.Builder => "builder",
|
||||
ShipType.Corvette => "corvette",
|
||||
ShipType.Police => "police",
|
||||
ShipType.Battleship => "battleship",
|
||||
ShipType.Gunboat => "gunboat",
|
||||
ShipType.Tug => "tug",
|
||||
ShipType.Compactor => "compactor",
|
||||
_ => type.ToString(),
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user