本文整理汇总了C#中Octgn.Play.Gui.CardsEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# CardsEventArgs类的具体用法?C# CardsEventArgs怎么用?C# CardsEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CardsEventArgs类属于Octgn.Play.Gui命名空间,在下文中一共展示了CardsEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCardOver
protected virtual void OnCardOver(object sender, CardsEventArgs e)
{
e.Handled = e.CanDrop = true;
e.Handler = this;
switch (group.Visibility)
{
case GroupVisibility.Nobody:
e.FaceUp = false;
break;
case GroupVisibility.Everybody:
e.FaceUp = true;
break;
case GroupVisibility.Owner:
e.FaceUp = group.Owner == Player.LocalPlayer;
break;
case GroupVisibility.Undefined:
if (e.ClickedCard.Group != group)
e.FaceUp = null;
else
e.FaceUp = e.ClickedCard.FaceUp;
break;
case GroupVisibility.Custom:
e.FaceUp = group.Viewers.Contains(Player.LocalPlayer);
break;
default:
throw new NotImplementedException("Unknown visibility : " + group.Visibility);
}
}
示例2: OnCardOver
protected override void OnCardOver(object sender, CardsEventArgs e)
{
base.OnCardOver(sender, e);
for(var i = 0;i<e.Cards.Length;i++)
{
e.CardSizes[i] = new Size(cardsCtrl.ActualWidth, cardsCtrl.ActualHeight);
if (cardsCtrl.ActualWidth > cardsCtrl.ActualHeight)
{
e.CardSizes[i] = new Size(e.Cards[i].RealWidth*cardsCtrl.ActualHeight/e.Cards[i].RealHeight, cardsCtrl.ActualHeight);
}
else
{
e.CardSizes[i] = new Size(cardsCtrl.ActualWidth, e.Cards[i].RealHeight * cardsCtrl.ActualWidth / e.Cards[i].RealWidth);
}
}
if (bottomZone.Visibility != Visibility.Visible)
{
bottomZone.Visibility = Visibility.Visible;
Anim.From = 0;
Anim.To = 0.4;
bottomZone.BeginAnimation(OpacityProperty, Anim);
Anim.From = null;
}
else
{
Anim.To = 0.4;
bottomZone.BeginAnimation(OpacityProperty, Anim);
}
}
示例3: OnCardDropped
protected override void OnCardDropped(object sender, CardsEventArgs e)
{
e.Handled = e.CanDrop = true;
if (group.TryToManipulate())
foreach (Card c in e.Cards)
c.MoveTo(group, e.FaceUp != null && e.FaceUp.Value, 0);
}
示例4: OnCardOver
protected override void OnCardOver(object sender, CardsEventArgs e)
{
base.OnCardOver(sender, e);
e.CardSize =
new Size(
100*Program.GameEngine.Definition.CardWidth/Program.GameEngine.Definition.CardHeight, 100);
_fanPanel.DisplayInsertIndicator(e.ClickedCard, _fanPanel.GetIndexFromPoint(Mouse.GetPosition(_fanPanel)));
}
示例5: OnCardOver
protected override void OnCardOver(object sender, CardsEventArgs e)
{
base.OnCardOver(sender, e);
for(var i = 0;i<e.Cards.Length;i++)
{
e.CardSizes[i] = new Size(e.Cards[i].RealWidth * 30 / e.Cards[i].RealHeight, 30);
}
//e.CardSize = new Size(30*group.Def.Width/group.Def.Height, 30);
}
示例6: OnCardOver
protected override void OnCardOver(object sender, CardsEventArgs e)
{
base.OnCardOver(sender, e);
for(var i = 0;i<e.Cards.Length;i++)
{
e.CardSizes[i] = new Size(e.Cards[i].Size.Width * 100 / e.Cards[i].Size.Height, 100);
}
//e.CardSize = new Size(100 * Program.GameEngine.Definition.DefaultSize.Width / Program.GameEngine.Definition.DefaultSize.Height, 100);
_fanPanel.DisplayInsertIndicator(e.ClickedCard, _fanPanel.GetIndexFromPoint(Mouse.GetPosition(_fanPanel)));
}
示例7: OnCardDropped
protected override void OnCardDropped(object sender, CardsEventArgs e)
{
e.Handled = e.CanDrop = true;
if (group.CanManipulate())
{
var cards = e.Cards.ToArray();
Card.MoveCardsTo(group, cards,
Enumerable.Repeat(e.FaceUp ?? false,cards.Length).ToArray()
,Enumerable.Repeat(0,cards.Length).ToArray(),false);
}
//foreach (Card c in e.Cards)
// c.MoveTo(group, e.FaceUp != null && e.FaceUp.Value, 0, false);
}
示例8: OnCardDropped
protected override void OnCardDropped(object sender, CardsEventArgs e)
{
e.Handled = e.CanDrop = true;
if (group.TryToManipulate())
{
int idx = fanPanel.GetIndexFromPoint(Mouse.GetPosition(fanPanel));
foreach (Card c in e.Cards)
{
bool doNotIncrement = (c.Group == group && group.GetCardIndex(c) < idx);
c.MoveTo(group, e.FaceUp.Value, idx);
if (!doNotIncrement) idx++;
}
}
}
示例9: OnCardDropped
protected override void OnCardDropped(object sender, CardsEventArgs e)
{
e.Handled = e.CanDrop = true;
if ([email protected]()) return;
int idx = _fanPanel.GetIndexFromPoint(Mouse.GetPosition(_fanPanel));
foreach (Card c in e.Cards)
{
bool doNotIncrement = (c.Group == @group && @group.GetCardIndex(c) < idx);
c.MoveTo(@group, e.FaceUp != null && e.FaceUp.Value, idx,false);
// Fix: some cards (notably copies like token) may be deleted when they change group
// in those case we should increment idx, otherwise an IndexOutOfRange exception may occur
if (c.Group != @group)
doNotIncrement = true;
if (!doNotIncrement) idx++;
}
}
示例10: OnCardOver
protected override void OnCardOver(object sender, CardsEventArgs e)
{
base.OnCardOver(sender, e);
e.CardSize = new Size(cardsCtrl.ActualWidth, cardsCtrl.ActualHeight);
if (bottomZone.Visibility != Visibility.Visible)
{
bottomZone.Visibility = Visibility.Visible;
anim.From = 0; anim.To = 0.4;
bottomZone.BeginAnimation(OpacityProperty, anim);
anim.From = null;
}
else
{
anim.To = 0.4;
bottomZone.BeginAnimation(OpacityProperty, anim);
}
}
示例11: OnCardOut
protected override void OnCardOut(object sender, CardsEventArgs e)
{
bottomZone.Visibility = Visibility.Collapsed;
}
示例12: OnCardDroppedBottom
private void OnCardDroppedBottom(object sender, CardsEventArgs e)
{
e.Handled = e.CanDrop = true;
//if (group.TryToManipulate())
// foreach (Card c in e.Cards)
// c.MoveTo(group, e.FaceUp != null && e.FaceUp.Value, group.Count,false);
if (group.CanManipulate())
{
var cards = e.Cards.ToArray();
Card.MoveCardsTo(group, cards,
Enumerable.Repeat(e.FaceUp ?? false,cards.Length).ToArray()
,Enumerable.Range(group.Count,cards.Length).ToArray(),false);
}
}
示例13: OnCardOverBottom
private void OnCardOverBottom(object sender, CardsEventArgs e)
{
OnCardOver(sender, e);
Anim.To = 0.8;
bottomZone.BeginAnimation(OpacityProperty, Anim);
}
示例14: OnCardDropped
protected virtual void OnCardDropped(object sender, CardsEventArgs e)
{
// The method cannot be abstract, because abstract classes can't be named in XAML (e.g. TableControl.xaml)
throw new NotImplementedException("OnCardDropped must be overriden");
}
示例15: OnCardDropped
protected override void OnCardDropped(object sender, CardsEventArgs e)
{
// Drop is forbidden when not ordered by position
if (SortByName)
{
e.Handled = true;
e.CanDrop = false;
return;
}
// When the list is restricted to some cards only,
// one cannot drop cards from outside this list
if (RestrictDrop && !e.Cards.All(c => Cards.Contains(c)))
{
e.Handled = true;
e.CanDrop = false;
return;
}
StopDragScroll();
e.Handled = e.CanDrop = true;
if ([email protected]()) return;
int idx = _wrapPanel.GetIndexFromPoint(Mouse.GetPosition(_wrapPanel));
// When the list is restricted, real index may be different from index in the GUI
if (RestrictDrop)
{
Card c = null;
bool after = false;
if (idx < _view.Count)
c = (Card) _view.GetItemAt(idx);
else if (_view.Count > 0)
{
c = (Card) _view.GetItemAt(_view.Count - 1);
after = true;
}
if (c != null) idx = @group.Cards.IndexOf(c) + (after ? 1 : 0);
}
foreach (Card c in e.Cards)
{
// Fix the target index if the card is already in the group at a lower index
if (c.Group == @group && c.GetIndex() < idx) --idx;
c.MoveTo(@group, e.FaceUp != null && e.FaceUp.Value, idx++);
}
}