Esempio n. 1
0
 /// <summary>
 /// Applies an <see cref="IGameCommit{T}"/> to the current <see cref="State.GameState"/>.
 /// </summary>
 /// <param name="commit">The received <see cref="IGameCommit{T}"/> containing <see cref="IGameAction{T}"/>s to apply.</param>
 public void ApplyCommit(IGameCommit <T> commit)
 {
     foreach (var action in commit.GetActions())
     {
         ActionsList.Add(action);
         if (action.CanUpdate(GameState))
         {
             action.Update(GameState);
         }
     }
 }
Esempio n. 2
0
 /// <inheritdoc/>
 public JToken Convert(IGameCommit <T> item)
 {
     return(new JObject(
                new JProperty("type", "commit"),
                new JProperty("actions", item.GetActions().Select(a => ActionConverters.GetTo(a)))));
 }
Esempio n. 3
0
 /// <inheritdoc/>
 public override JToken WriteItem(IGameCommit <T> item)
 {
     return(ConverterContainer.Resolve <IToJsonConverter <IGameCommit <T> > >().GetTo(item));
 }
Esempio n. 4
0
 /// <inheritdoc/>
 public bool CanConvert(IGameCommit <T> item) => true;