コード例 #1
0
 private Action<AbilityUseContext> CreateSelectionAction(CardSelection selection, Action<AbilityUseContext> nextAction)
 {
     Action<AbilityUseContext> action =
         context =>
             {
                 var selector = selection.Select(context);
                 var requestor = selection.Callbacks
                     .Select(callback => selector.Callback(selectionContext => context.ProcessSelection(selectionContext, callback))).ToList()
                     .Last();
                 var continuation = nextAction ?? (x =>
                                                       {
                                                           if (Continuation != null)
                                                               Continuation(context.Player);
                                                           else
                                                               context.Player.UseAbilities();
                                                       });
                 requestor.SendRequest(selectionContext => continuation(context));
             };
     return action;
 }