示例#1
0
    public void OnPointerClick(PointerEventData eventData)
    {
        string name = Card.GetType().Name;

        if (Collection.CardsInDeck.FindAll((str) => str == name).Count < 4)
        {
            Collection.CardsInDeck.Add(name);
            cardInDeck = Instantiate(CardInDeckPrefab, Collection.DeckHolderPanel);
            DeckRemoveableCard removeableCard = cardInDeck.gameObject.AddComponent <DeckRemoveableCard>();
            removeableCard.Collection = Collection;
            removeableCard.Name       = name;
            cardInDeck.GetComponentInChildren <Text>().text        = Card.OriginalName;
            cardInDeck.GetComponentsInChildren <Image>()[1].sprite = Resources.Load <Sprite>("Cards/Artwork/" + Card.OriginalName);
        }
    }
 public void LoadDeck(string deckName)
 {
     ClearDeckHolderPanel();
     deckHolder = DeckHolder.LoadDeck(deckName);
     deckNameInputField.text = deckName;
     CardsInDeck.Clear();
     CardsInDeck.AddRange(deckHolder.Cards);
     for (int i = 0; i < deckHolder.Cards.Length; i++)
     {
         Card       card       = (Card)Activator.CreateInstance(Type.GetType("DuelMasters.Cards." + deckHolder.Cards[i]), fakeGame.CurrentDuelistTurn);
         GameObject cardInDeck = Instantiate(cardInDeckPrefab, DeckHolderPanel);
         cardInDeck.GetComponentsInChildren <Image>()[1].sprite = Resources.Load <Sprite>("Cards/Artwork/" + card.OriginalName);
         cardInDeck.GetComponentInChildren <Text>().text        = card.OriginalName;
         DeckRemoveableCard removeableCard = cardInDeck.AddComponent <DeckRemoveableCard>();
         removeableCard.Collection = this;
         removeableCard.Name       = card.GetType().Name;
     }
     LoadPage();
     SetViewDeck();
 }