private void LoadDeck() { GameObject prefab = (GameObject)Resources.Load ("Card", typeof(GameObject)); m_opponentDeckUnit.Clear(); m_opponentDeckLand.Clear(); ReadDeckBehaviour deckList = new ReadDeckBehaviour("opponentCard.xml"); ReadXmlBehaviour cardList = new ReadXmlBehaviour(); for (int i = 0; i < deckList.PropDeck.Count; i++) { int id = int.Parse(deckList.PropDeck[i].ToString()); if(id < 1000) { GameObject Card = GameObject.Instantiate((GameObject)cardList.List[id - 1]); Card.AddComponent<DraggableBehaviour>(); Card.name = "Card" + i.ToString(); Card.GetComponent<DraggableBehaviour>().m_currentTypeCard = "Unit"; m_opponentDeckUnit.Add(Card); } else { GameObject Card = GameObject.Instantiate((GameObject)cardList.ListLand[id - 1001]); Card.name = "Card" + i.ToString(); Card.AddComponent<DraggableBehaviour>(); Card.GetComponent<DraggableBehaviour>().m_currentTypeCard = "Land"; m_opponentDeckLand.Add(Card); } } Shuffle(m_opponentDeckLand); Shuffle(m_opponentDeckUnit); }
public void LoadDeck() { m_deck.Clear(); ReadDeckBehaviour deckList = new ReadDeckBehaviour(); ReadXmlBehaviour cardList = new ReadXmlBehaviour("CardInventory", "CardGUILandInventory"); for (int i = 0; i < deckList.PropDeck.Count; i++) { int id = int.Parse(deckList.PropDeck[i].ToString()); if(id < 1000) { GameObject Card = GameObject.Instantiate((GameObject)cardList.List[id-1]); Card.GetComponent<OnClickBehaviour>().m_container = e_containedBy.DeckList; Card.name = "Card" + i.ToString(); m_deck.Add(Card); } else { GameObject Card = GameObject.Instantiate((GameObject)cardList.ListLand[id - 1001]); Card.GetComponent<OnClickBehaviour>().m_container = e_containedBy.DeckList; Card.name = "Card" + i.ToString(); m_deck.Add(Card); } } }