本文整理汇总了C#中Deck.resetActive方法的典型用法代码示例。如果您正苦于以下问题:C# Deck.resetActive方法的具体用法?C# Deck.resetActive怎么用?C# Deck.resetActive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Deck
的用法示例。
在下文中一共展示了Deck.resetActive方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: loadDeck
public void loadDeck()
{
Deck = new Deck();
DeckReader reader = new DeckReader();
List<Card> stock = reader.load(DeckPath);
foreach (Card c in stock)
{
Deck.archiveDeck.Add(c);
}
Deck.resetActive();
Deck.shuffle();
}
示例2: Start
// Use this for initialization
void Start()
{
path = Application.dataPath + "/scripts/xml/cards.xml";
DeckReader reader = new DeckReader();
if (File.Exists(path))
{
List<Card> database = reader.load(path);
foreach (Card card in database)
{
print(card.CardName + "_cost:" + card.Cost + " atk:" + card.Attack + " hp:" + card.Health);
}
Deck deck = new Deck();
deck.activeDeck = new List<Card>();
deck.archiveDeck = new List<Card>();
foreach (Card c in database)
{
deck.archiveDeck.Add(c);
}
deck.resetActive();
deck.shuffle();
Debug.Log(deck.peek().CardName + "bypass archiving and reset active");
deck.shuffle();
Debug.Log("Post Filter");
foreach (Card card in deck.activeDeck)
{
print(card.CardName + "_cost:" + card.Cost + " atk:" + card.Attack + " hp:" + card.Health);
}
Debug.Log("Printed list operated upon.");
}
else
{
Debug.Log("Error: File not Found");
}
}
示例3: populate
private void populate(int direction)
{
//populate page with 10 cards from those viable for current player's build
//load database array from path using Reader
if (!loadedDatabase)
{
Path = Application.dataPath + "/scripts/xml/database.xml";
DeckReader reader = new DeckReader();
if (File.Exists(Path))
{
List<Card> cardList = reader.load(Path);
Debug.Log("Card List: " + cardList[0].CardName);
Database = new Deck();
Database.activeDeck = new List<Card>();
Database.archiveDeck = new List<Card>();
foreach (Card c in cardList)
{
Database.archiveDeck.Add(c);
}
Debug.Log("archiveDeck: " + Database.archiveDeck[0].CardName);
foreach (Card c in Database.archiveDeck)
{
Database.activeDeck.Add(c);
}
Database.resetActive();
Debug.Log("activeDeck: " + Database.activeDeck[0].CardName);
loadedDatabase = true;
//TODO: Sort Database Deck by cost and lettering
}
else
{
Debug.Log("Error: File not Found");
}
}
//instantiate the objects/visual representation
Card current;
int DatabaseSize = Database.activeDeck.Count;
switch (direction)
{
case -1:
for (int i = DatabaseSize-1; i >= DatabaseSize - 10; i--)
{
Debug.LogError(i);
current = Database.activeDeck[i];
Database.activeDeck.RemoveAt(i);
Debug.Log("Current:" + current.CardName);
DisplayedCards.Add(current);
}
break;
case 0:
for (int i = 0; i < 10; i++)
{
current = Database.activeDeck[i];
Database.activeDeck.RemoveAt(i);
Debug.Log("Current:" + current.CardName);
DisplayedCards.Add(current);
}
break;
case 1:
for (int i = 0; i < 10; i++)
{
current = Database.activeDeck[i];
Database.activeDeck.RemoveAt(i);
Debug.Log("Current:" + current.CardName);
DisplayedCards.Add(current);
}
break;
}
Debug.LogError("Free From Loop");
for (int i = 1; i <= 10; i++)
{
GameObject card;
if (Database.hasNext())
{
current = DisplayedCards[i-1];
// Create the card with creature prefab
card = (GameObject)Instantiate(displayedCardPrefab, slot1.transform.position, slot1.transform.rotation);
card.transform.FindChild("Splash").gameObject.GetComponent<Image>().sprite = spriteSheet[UnityEngine.Random.Range(0, 8)]; //TODO: nonrandom sprites
if (current.Type.Equals("Creature"))
{
card.transform.FindChild("Frame_creature").gameObject.SetActive(true);
card.transform.FindChild("Frame_spell").gameObject.SetActive(false);
}
// Or create it using the spell prefab
else
{
card.transform.FindChild("Frame_creature").gameObject.SetActive(false);
card.transform.FindChild("Frame_spell").gameObject.SetActive(true);
}
//quick reference card's script component
Card cardsScript = card.GetComponent<Card>();
switch (i)
{ //TODO: Finish conversions
case 1:
card.transform.SetParent(slot1.transform.parent);
card.transform.position = new Vector3(slot1.transform.position.x, slot1.transform.position.y + 6, slot1.transform.position.z);
break;
case 2:
card.transform.SetParent(slot2.transform.parent);
//.........这里部分代码省略.........