Octgn.Play.Card.SetIndex C# (CSharp) Method

SetIndex() public method

public SetIndex ( int idx ) : void
idx int
return void
        public void SetIndex(int idx)
        {
            if (Group != null)
                Group.SetCardIndex(this, idx);
        }

Usage Example

Esempio n. 1
0
        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();
        }
All Usage Examples Of Octgn.Play.Card::SetIndex