當前位置: 首頁>>代碼示例>>C#>>正文


C# Card.Count方法代碼示例

本文整理匯總了C#中Card.Count方法的典型用法代碼示例。如果您正苦於以下問題:C# Card.Count方法的具體用法?C# Card.Count怎麽用?C# Card.Count使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Card的用法示例。


在下文中一共展示了Card.Count方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: MoveCardsToTable

        public static void MoveCardsToTable(Card[] cards, int[] x, int[] y, bool[] lFaceUp, int[] idx, bool isScriptMove)
        {
            if( cards.Length == 0 ) return;

            if (Program.GameEngine.Definition.Events.ContainsKey("OverrideCardsMoved") && !isScriptMove)
            {
                var tos = Enumerable.Repeat(Program.GameEngine.Table, cards.Count()).ToArray();
                Program.GameEngine.EventProxy.OverrideCardsMoved_3_1_0_2(cards, tos, idx, x, y);
                return;
            }
            Program.Client.Rpc.MoveCardAtReq(cards.Select(a => a.Id).ToArray(), x, y, idx, isScriptMove, lFaceUp);
            new MoveCards(Player.LocalPlayer, cards, x, y, idx, lFaceUp, isScriptMove).Do();
            foreach (var c in cards)
                Program.Client.Rpc.CardSwitchTo(Player.LocalPlayer, c, c.Alternate());
        }
開發者ID:octgn,項目名稱:OCTGN,代碼行數:15,代碼來源:Card.cs

示例2: MoveCardsTo

 internal static void MoveCardsTo(Group to, Card[] cards, bool[] faceups, int[] idxs, bool isScriptMove)
 {
     var notMoved = new List<Card>();
     for (var i = 0; i < cards.Length; i++)
     {
         var c = cards[i];
         var lFaceUp = faceups[i];
         //converts negative indexes to count from the bottom for consistency with python behavior
         if (idxs[i] < 0) idxs[i] = to.Count + 1 + idxs[i];
         //over-large indecies reduced to place cards at end of pile
         if (idxs[i] >= to.Count) idxs[i] = to.Count;
         if (idxs[i] < 0) idxs[i] = 0;
         //move skipped if card already at location specified
         if (to == c.Group && idxs[i] < c.Group.Count && c.Group[idxs[i]] == c)
         {
             notMoved.Add(c);
             continue;
         }
         if (to.Visibility != GroupVisibility.Undefined) lFaceUp = c.FaceUp;
     }
     if (Program.GameEngine.Definition.Events.ContainsKey("OverrideCardsMoved") && !isScriptMove)
     {
         var xy = Enumerable.Repeat(0, cards.Count()).ToArray();
         var tos = Enumerable.Repeat(to, cards.Count()).ToArray();
         Program.GameEngine.EventProxy.OverrideCardsMoved_3_1_0_2(cards, tos, idxs, xy, xy);
         return;
     }
     Program.Client.Rpc.MoveCardReq(cards.Select(x => x.Id).ToArray(), to, idxs, faceups, isScriptMove);
     new MoveCards(Player.LocalPlayer, cards, to, idxs, faceups, isScriptMove).Do();
     foreach (var c in cards.Where(x => notMoved.Contains(x) == false))
         Program.Client.Rpc.CardSwitchTo(Player.LocalPlayer, c, c.Alternate());
 }
開發者ID:octgn,項目名稱:OCTGN,代碼行數:32,代碼來源:Card.cs

示例3: UniqueCards

 private bool UniqueCards(Card[] allCardsFromDeck)
 {
     return allCardsFromDeck.All(c => allCardsFromDeck.Count(c.Equals) == 1);
 }
開發者ID:yakimovim,項目名稱:Cards,代碼行數:4,代碼來源:DeckCreatorTests.cs


注:本文中的Card.Count方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。