示例#1
0
        private void reloadCardList()
        {
            BuildCardList.clearItems();
            foreach (CardDefine card in
                     cards.Where(
                         c => ui.getManager <CardManager>().isStandardCard(c)
                         )
                     )
            {
                if (parent.game.cards.tryGetSkin(card.id, out var skin))
                {
                    if (FilterPanel.cardFilter(card, skin))
                    {
                        var item = BuildCardList.addItem();
                        item.update(card, skin);
                    }
                }
                else
                {
                    UberDebug.LogErrorChannel("UI", "无法找到" + card + "的皮肤");
                }

                BuildCardList.sortItems(FilterPanel.sortCompareMethod);
            }
        }
示例#2
0
        protected override void onDisplay()
        {
            base.onDisplay();
            //目前只有一个卡组
            cards = parent.game.getManager <CardManager>().GetCardDefines(d => d.GetType().Assembly == typeof(THHGame).Assembly);
            int[]        deck       = parent.game.deck;
            CardSkinData masterSkin = parent.game.cards.GetCardSkin(deck[0]);

            MasterButton.setSprite(masterSkin.image);
            MasterNameText.text = masterSkin.name;
            BuildDeckList.clearItems();
            foreach (var cards in deck.Skip(1).Select(id => cards.First(c => c.id == id)).GroupBy(c => c.id))
            {
                var item = BuildDeckList.addItem();
                var skin = parent.game.cards.GetCardSkin(cards.First().id);
                item.update(cards.First(), skin, cards.Count());
            }
            BuildCardList.clearItems();
            foreach (CardDefine card in
                     cards.Where(
                         c => c.id != 0 &&
                         c is ServantCardDefine servant &&
                         !servant.isToken
                         )
                     )
            {
                var skin = parent.game.cards.GetCardSkin(card.id);
                var item = BuildCardList.addItem();
                item.update(card, skin);
            }
            BuildDeckList.sortItems((a, b) =>
            {
                if (a.card.getCost() != b.card.getCost())
                {
                    return(a.card.getCost() - b.card.getCost());
                }
                else
                {
                    return(a.card.id - b.card.id);
                }
            });
            DragCard.hide();
        }