예제 #1
0
 public virtual bool ExecuteDefaultCardAction(Card card)
 {
     var defaultCardAction = GetDefaultCardAction();
     if (defaultCardAction == null || !card.TryToManipulate()) 
         return false;
     group.KeepControl();
     card.KeepControl();
     if (defaultCardAction.Execute != null)
         ScriptEngine.ExecuteOnCards(defaultCardAction.Execute, Selection.ExtendToSelection(card));
     else if (defaultCardAction.BatchExecute != null)
         ScriptEngine.ExecuteOnBatch(defaultCardAction.BatchExecute, Selection.ExtendToSelection(card));
     group.ReleaseControl();
     card.ReleaseControl();
     return true;
 }
예제 #2
0
 public void ExecuteDefaultAction(Card card)
 {
     if (_defaultCardAction != null)
     {
         if (!card.TryToManipulate()) return;
         group.KeepControl();
         card.KeepControl();
         if (_defaultCardAction.Execute != null)
             ScriptEngine.ExecuteOnCards(_defaultCardAction.Execute, Selection.ExtendToSelection(card));
         else if (_defaultCardAction.BatchExecute != null)
             ScriptEngine.ExecuteOnBatch(_defaultCardAction.BatchExecute, Selection.ExtendToSelection(card));
         group.ReleaseControl();
         card.ReleaseControl();
     }
     else
         ExecuteDefaultAction();
 }