private void SortList()
    {
        List <string> cardNames = new List <string> ();

        framesToWait = true;
        foreach (GameObject findedPanelOb in PanelsInDeckList)
        {
            cardDescStruct newCard     = new cardDescStruct();
            CardPanel      findedPanel = findedPanelOb.GetComponent <CardPanel> ();
            newCard.CardName = findedPanel.PanelCardName;
            if (findedPanel.Card != null)
            {
                newCard.Card = findedPanel.Card;
            }
            newCard.CardsNumber = findedPanel.CardsNumber;
            PanelsInDeckCards.Add(newCard);
            cardNames.Add(findedPanel.PanelCardName);
            Destroy(findedPanel.PrevCard);
            findedPanel.DestroyPanelOnly();
        }
        PanelsInDeckList.Clear();
        cardNames = CardsBaseComponent.SortCardsList(cardNames);
        foreach (string cardName in cardNames)
        {
            GameObject panel     = Instantiate(CardPanel);
            CardPanel  panelComp = panel.GetComponent <CardPanel> ();
            panel.transform.SetParent(CardsInDeckTable, false);
            panelComp.PanelInDeck = true;
            foreach (cardDescStruct cardStOb in PanelsInDeckCards)
            {
                if (string.Compare(cardStOb.CardName, cardName) == 0)
                {
                    panelComp.KeepCardPosition = false;
                    panelComp.CardPosReached   = false;
                    if (cardStOb.Card != null)
                    {
                        panelComp.AddCard(cardStOb.Card);
                    }
                    panelComp.PanelCardName = cardStOb.CardName;
                    panelComp.CardsNumber   = cardStOb.CardsNumber;
                    panelComp.RefreshCardsNumber();
                    break;
                }
            }
            PanelsInDeckList.Add(panel);
        }
        PanelsInDeckCards.Clear();
    }
Exemplo n.º 2
0
    public void LoadDeckView(string[] deckCardsNames, string heroName, string deckName, int deckIndex)
    {
        MainMenuComponent.WaitForDataScreen.enabled = false;
        DeckIndex  = deckIndex;
        TableWidth = CardTable.rect.width;
        List <string> cardNames = CardBaseComponent.SortCardsList(new List <string>(deckCardsNames));

        if (HeroPlace != null)
        {
            GameObject hero = HeroesBaseComponent.GetHeroByName(heroName);
            hero.transform.SetParent(HeroPlace, false);
            hero.transform.localPosition = new Vector3(0, 0, 0);
            hero.transform.localScale    = new Vector3(heroScale, heroScale, heroScale);
            hero.GetComponent <SpriteRenderer> ().sortingOrder = 55;
            PanelsList.Add(hero);
        }
        DeckName.text          = deckName;
        DeckViewCanvas.enabled = true;
        StopLoadTask           = false;
        StartCoroutine(LoadList(cardNames));
    }