本文整理汇总了C#中Octgn.Play.Card.SetIndex方法的典型用法代码示例。如果您正苦于以下问题:C# Card.SetIndex方法的具体用法?C# Card.SetIndex怎么用?C# Card.SetIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Octgn.Play.Card
的用法示例。
在下文中一共展示了Card.SetIndex方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MoveCardAt
public void MoveCardAt(Player player, Card card, int x, int y, int idx, bool faceUp)
{
// Get the table control
Table table = Program.GameEngine.Table;
// Because every player may manipulate the table at the same time, the index may be out of bound
if (card.Group == table)
{ if (idx >= table.Count) idx = table.Count - 1; }
else
if (idx > table.Count) idx = table.Count;
// Ignore cards moved by the local player (already done, for responsiveness)
if (player == Player.LocalPlayer)
{
// See remark in MoveCard
if (card.Group == table)
card.SetIndex(idx); // This is done to preserve stack order consistency with other players (should be a noop most of the time)
return;
}
// Find the old position on the table, if any
//bool onTable = card.Group == table;
//double oldX = card.X, oldY = card.Y;
// Do the move
new MoveCard(player, card, x, y, idx, faceUp).Do();
}
示例2: MoveCard
public void MoveCard(Player player, Card card, Group to, int idx, bool faceUp)
{
// Ignore cards moved by the local player (already done, for responsiveness)
if (player != Player.LocalPlayer)
new MoveCard(player, card, to, idx, faceUp).Do();
else
{
// Fix: cards may move quickly locally from one group to another one, before we get a chance
// to execute this handler, during game actions scripts (e.g. Mulligan with one player -
// shuffling happens locally). The result is that we are going to receive two messages,
// one for the move to group A, then the move to group B; while the card already is in group B.
// In this case, trying to set index inside group B with an index coming from the time the card
// was in group A is just plain wrong and may crash depending on the index.
if (card.Group == to)
card.SetIndex(idx); // This is done to preserve stack order consistency with other players (should be a noop most of the time)
}
}