public void OnOpponentPlayCard(Hearthstone_Deck_Tracker.Hearthstone.Card card)
        {
            if (!card.Collectible)
            {
                return;
            }
            m_CurrentDeck.AddCard(card);
            m_BestDeck = m_GameDecks.GetBestCompareDeck(m_CurrentDeck);
            List <Hearthstone_Deck_Tracker.Hearthstone.Card> cardList = new List <Hearthstone_Deck_Tracker.Hearthstone.Card>();
            var pEnum = m_BestDeck.GetEnumerator();

            for (; pEnum.MoveNext();)
            {
                cardList.Add(pEnum.Current.Key);
            }
            for (int i = 0; i < cardList.Count - 1; i++)
            {
                for (int j = 0; j < cardList.Count - 1; j++)
                {
                    if (cardList[j].Cost > cardList[j + 1].Cost)
                    {
                        var temp = cardList[j];
                        cardList[j]     = cardList[j + 1];
                        cardList[j + 1] = temp;
                    }
                }
            }
            if (m_List != null)
            {
                m_List.Update(cardList);
                m_List.Show();
            }
            //m_List.Update(m_BestDeck);
        }
Exemple #2
0
        public void OnOpponentPlayCard(Hearthstone_Deck_Tracker.Hearthstone.Card card)
        {
            if (m_NeedFilterByClass)
            {
                var game = Hearthstone_Deck_Tracker.API.Core.Game;
                if (game != null) //для игры
                {
                    m_GameDecks         = m_GameDecks.FilterDeck(utils.KlassConverter(game.Opponent.Class));
                    m_NeedFilterByClass = false;
                }
                else if (card.IsClassCard)//для отладки тестов (игры то нет)
                {
                    m_GameDecks         = m_GameDecks.FilterDeck(utils.KlassConverter(card.PlayerClass));
                    m_NeedFilterByClass = false;
                }
            }

            if (!card.Collectible)
            {
                return;
            }
            if (card.IsCreated)
            {
                return;
            }
            m_CurrentDeck.AddCard(card);

            List <PlayedDeck> deckList = m_GameDecks.GetBestDeckList(m_CurrentDeck);

            deckList.Sort(delegate(PlayedDeck d1, PlayedDeck d2) { return(d2.GetFoundPercent().CompareTo(d1.GetFoundPercent())); });
            m_BestDeck = deckList[0];
            if (m_procentForm != null)
            {
                if (deckList.Count <= 8) //иначе по ширине в экран не влезет
                {
                    m_procentForm.SetShowDeckList(deckList);
                }
                else
                {
                    m_procentForm.SetShowDeck(m_BestDeck);
                }
            }
        }