Add OrderSet model
This commit is contained in:
parent
3db01c0ffd
commit
771d390409
28
MultiversalDiplomacy/Model/OrderSet.cs
Normal file
28
MultiversalDiplomacy/Model/OrderSet.cs
Normal file
@ -0,0 +1,28 @@
|
||||
namespace MultiversalDiplomacy.Model;
|
||||
|
||||
/// <summary>
|
||||
/// A list of unit orders submitted by a power.
|
||||
/// </summary>
|
||||
public class OrderSet
|
||||
{
|
||||
/// <summary>
|
||||
/// The raw text of the submitted orders, including the name of the submitting power.
|
||||
/// </summary>
|
||||
public string Text { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the order set has already been adjudicated.
|
||||
/// </summary>
|
||||
public bool Adjudicated { get; }
|
||||
|
||||
/// <summary>
|
||||
/// UTC timestamp at which the order set was submitted
|
||||
/// </summary>
|
||||
public DateTime SubmittedAt { get; }
|
||||
|
||||
public OrderSet(string text)
|
||||
{
|
||||
Text = text;
|
||||
SubmittedAt = DateTime.UtcNow;
|
||||
}
|
||||
}
|
@ -44,6 +44,11 @@ public class World
|
||||
/// </summary>
|
||||
public ReadOnlyDictionary<Season, OrderHistory> OrderHistory { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Submitted order sets.
|
||||
/// </summary>
|
||||
public ReadOnlyCollection<OrderSet> OrderSets { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Immutable game options.
|
||||
/// </summary>
|
||||
@ -60,6 +65,7 @@ public class World
|
||||
ReadOnlyCollection<Unit> units,
|
||||
ReadOnlyCollection<RetreatingUnit> retreatingUnits,
|
||||
ReadOnlyDictionary<Season, OrderHistory> orderHistory,
|
||||
ReadOnlyCollection<OrderSet> orderSets,
|
||||
Options options)
|
||||
{
|
||||
this.Provinces = provinces;
|
||||
@ -69,6 +75,7 @@ public class World
|
||||
this.Units = units;
|
||||
this.RetreatingUnits = retreatingUnits;
|
||||
this.OrderHistory = orderHistory;
|
||||
this.OrderSets = orderSets;
|
||||
this.Options = options;
|
||||
}
|
||||
|
||||
@ -83,6 +90,7 @@ public class World
|
||||
ReadOnlyCollection<Unit>? units = null,
|
||||
ReadOnlyCollection<RetreatingUnit>? retreatingUnits = null,
|
||||
ReadOnlyDictionary<Season, OrderHistory>? orderHistory = null,
|
||||
ReadOnlyCollection<OrderSet>? orderSets = null,
|
||||
Options? options = null)
|
||||
: this(
|
||||
provinces ?? previous.Provinces,
|
||||
@ -92,6 +100,7 @@ public class World
|
||||
units ?? previous.Units,
|
||||
retreatingUnits ?? previous.RetreatingUnits,
|
||||
orderHistory ?? previous.OrderHistory,
|
||||
orderSets ?? previous.OrderSets,
|
||||
options ?? previous.Options)
|
||||
{
|
||||
}
|
||||
@ -110,6 +119,7 @@ public class World
|
||||
new(new List<Unit>()),
|
||||
new(new List<RetreatingUnit>()),
|
||||
new(new Dictionary<Season, OrderHistory>()),
|
||||
new(new List<OrderSet>()),
|
||||
new Options());
|
||||
}
|
||||
|
||||
@ -123,7 +133,8 @@ public class World
|
||||
IEnumerable<Season>? seasons = null,
|
||||
IEnumerable<Unit>? units = null,
|
||||
IEnumerable<RetreatingUnit>? retreats = null,
|
||||
IEnumerable<KeyValuePair<Season, OrderHistory>>? orders = null)
|
||||
IEnumerable<KeyValuePair<Season, OrderHistory>>? orders = null,
|
||||
IEnumerable<OrderSet>? orderSets = null)
|
||||
=> new World(
|
||||
previous: this,
|
||||
seasons: seasons == null
|
||||
@ -137,7 +148,10 @@ public class World
|
||||
: new(retreats.ToList()),
|
||||
orderHistory: orders == null
|
||||
? this.OrderHistory
|
||||
: new(orders.ToDictionary(kvp => kvp.Key, kvp => kvp.Value)));
|
||||
: new(orders.ToDictionary(kvp => kvp.Key, kvp => kvp.Value)),
|
||||
orderSets: orderSets == null
|
||||
? this.OrderSets
|
||||
: new(orderSets.ToList()));
|
||||
|
||||
/// <summary>
|
||||
/// Create a new world with new units created from unit specs. Units specs are in the format
|
||||
|
Loading…
Reference in New Issue
Block a user