当前位置: 首页>>代码示例>>C#>>正文


C# Deck.addCard方法代码示例

本文整理汇总了C#中Deck.addCard方法的典型用法代码示例。如果您正苦于以下问题:C# Deck.addCard方法的具体用法?C# Deck.addCard怎么用?C# Deck.addCard使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Deck的用法示例。


在下文中一共展示了Deck.addCard方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DeckBuilder

    public DeckBuilder(StoreDeck storeDeck)
    {
        Player player = Player.getInstance();

        deck = new Deck();
        deck.DeckName = storeDeck.DeckName;
        deck.TimesPlayed = 0;
        deck.IsEditable = false;        

        List<Card> storeCardList = storeDeck.cardList;
        foreach (Card storeCard in storeCardList)
        {
            Card card = new Card();            
            card.LeitnerLevel = 1;
            card.PortugueseText = storeCard.PortugueseText;
            card.EnglishText = storeCard.EnglishText;
            deck.addCard(card);            
        }
    }
开发者ID:gabrielamboss,项目名称:Ulkoa,代码行数:19,代码来源:DeckBuilder.cs

示例2: generateDeck

    /**
     * Functions to configure the deck generation
     */
    /**
     * Compile the deck
     */
    public Deck generateDeck()
    {
        Deck result = new Deck ();

        /**
         * Generate the deck here
         * TODO:
         * X - Random implementation first.
         *   - Sorted implementation based on weights.
         *   - ???
         *   - PROFIT!
         */

        /**
         * Doing it randomly is kinky.
         * We keep picking cards until the amount of cards in the drawPile
         * is that of the numberOfCards in preferences.
         *
         * In the future, this code will need to be refactored elsewhere
         * depending on the user's preferences in sorting.
         */
        /*
         * This function does several things: first, it computes the sum of all the binder weights.
         * Second, it randomly selects a binder based on its weight.
         * Third, it randomly selects a card in the randomly selected binder.
         * FINALLY, it adds the randomly chosen card into the deck for play.
         * Some time later down the road, this function may need to be refactored, but for now, it appears to be working.
         *
         * TODO: The random weighting system seems to be off. The last deck is ignored.
         *       Please fix regarding that.
         */

        int sum = 0;

        /*
         * Apply the
         */
        for (int i = 0; i < loadedBinders.Count; i++)
            sum += loadedBinders[i].weight;

        if (sum < 0)
            Debug.Log ("Cannot have a weight below 0! You suck. Nothing happens.");
        else {
            while (result.cardsLeft() < deckPreferences.numberOfCards) {
                int randomCard = Random.Range (0, sum+1);
                int i = 0;
                while (randomCard > loadedBinders[i].weight) {
                    randomCard -= loadedBinders [i].weight;
                    i++;
                }
                Card newCard = loadedBinders [i].getCard (-1);

                if (!(result.cardMatch (newCard)))
                    result.addCard (newCard);

            }
            result.shuffleDeck ();
        }
        return result;
    }
开发者ID:starrodkirby86,项目名称:better-quiz-app,代码行数:66,代码来源:DataBase.cs

示例3: DefaultDeck

    public static Deck DefaultDeck()
    {
        Deck deck = new Deck();
        deck.TimesPlayed = 0;
        deck.IsFirstTime = true;

        deck.addCard(MockCard("front1", "back1", 1));
        deck.addCard(MockCard("front2", "back2", 1));
        deck.addCard(MockCard("front3", "back3", 2));
        deck.addCard(MockCard("front4", "back4", 4));
        deck.addCard(MockCard("front5", "back5", 5));
        deck.addCard(MockCard("front6", "back6", 1));
        deck.addCard(MockCard("front7", "back7", 2));
        deck.addCard(MockCard("front8", "back8", 5));
        deck.addCard(MockCard("front9", "back9", 1));
        deck.addCard(MockCard("front10", "back10", 1));
        deck.addCard(MockCard("front11", "back11", 1));
        deck.addCard(MockCard("front12", "back12", 4));

        return deck;
    }
开发者ID:gabrielamboss,项目名称:Ulkoa,代码行数:21,代码来源:MockDeckFactory.cs


注:本文中的Deck.addCard方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。