protected override void OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e)
{
base.OnPreviewMouseLeftButtonDown(e);
if (Card == null)
{
return;
}
// Clear or modify selection
if ((Keyboard.Modifiers & ModifierKeys.Control) != 0)
{
if (Program.GameEngine == null || Program.GameEngine.Table == null)
{
return;
}
// Add/Remove from selection (currently only on table and hand)
if (Card.Group == Program.GameEngine.Table || Card.Group is Hand)
{
if (Card.Anchored == false)
{
if (Card.Selected)
{
mouseClickHandler.AutoFireNext();
Selection.Remove(Card);
}
else if (Card.Controller == Player.LocalPlayer)
{
mouseClickHandler.AutoFireNext();
Selection.Add(Card);
}
}
}
e.Handled = true;
}
else
{
if (!Card.Selected)
{
Selection.Clear();
}
}
// Targetting is always allowed
if (Keyboard.Modifiers == ModifierKeys.Shift && img.IsMouseDirectlyOver)
{
mouseClickHandler.AutoFireNext();
return;
}
// otherwise check controlship
if (!Card.TryToManipulate())
{
//e.Handled = true;
}
}