예제 #1
0
        public static async Task CreatDeck(Deck newDeck)
        {
            StorageFolder folder = ApplicationData.Current.LocalFolder;

            if (await folder.TryGetItemAsync("Decks") == null)
            {
                await folder.CreateFolderAsync("Decks");
            }
            folder = await folder.GetFolderAsync("Decks");

            folder = await folder.CreateFolderAsync(newDeck.Name);

            StorageFolder minionFolder = await folder.CreateFolderAsync("Minions");

            StorageFolder spellFolder = await folder.CreateFolderAsync("Spells");

            StorageFile file;

            CardDataManager.SortCardListByCost(newDeck.MinionCard);
            CardDataManager.SortCardListByCost(newDeck.SpellCard);
            for (int i = 0; i < newDeck.MinionCard.Count; i++)
            {
                file = await minionFolder.CreateFileAsync(i.ToString() + ".txt");

                CardDataManager.SaveMinionCardToFile(newDeck.MinionCard[i], file);
            }
            for (int i = 0; i < newDeck.SpellCard.Count; i++)
            {
                file = await spellFolder.CreateFileAsync(i.ToString() + ".txt");

                CardDataManager.SaveSpellCardToFile(newDeck.SpellCard[i], file);
            }
        }
예제 #2
0
 public static void UpdateHandCardGirdView(GridView gridView, PlayerData player)
 {
     gridView.Items.Clear();
     for (int i = 0; i < player.HandCard.Count; i++)
     {
         if (player.HandCard[i].CardType == CardTypes.MinionCard)
         {
             CardDataManager.AddCardToGridView_Little(gridView, player.HandCard[i].CardData as MinionCard, player.HandCard[i]);
         }
         else
         {
             CardDataManager.AddCardToGridView_Little(gridView, player.HandCard[i].CardData as SpellCard, player.HandCard[i]);
         }
     }
 }
예제 #3
0
        public static async Task <Deck> LoadDeckFromDeckFolder(StorageFolder folder)
        {
            Deck          newDeck = new Deck(folder.Name);
            MinionCard    tmpMinionCard;
            SpellCard     tmpSpellCard;
            StorageFolder minionFolder = await folder.GetFolderAsync("Minions");

            StorageFolder spellFolder = await folder.GetFolderAsync("Spells");

            foreach (var item in await minionFolder.GetFilesAsync())
            {
                tmpMinionCard = await CardDataManager.LoadMinionCardFromFile(item as StorageFile);

                newDeck.MinionCard.Add(tmpMinionCard);
            }
            foreach (var item in await spellFolder.GetFilesAsync())
            {
                tmpSpellCard = await CardDataManager.LoadSpellCardFromFile(item as StorageFile);

                newDeck.SpellCard.Add(tmpSpellCard);
            }
            return(newDeck);
        }
예제 #4
0
        public static async Task CreatDeck(Deck newDeck, StorageFolder folder)
        {
            folder = await folder.CreateFolderAsync(newDeck.Name);

            StorageFolder minionFolder = await folder.CreateFolderAsync("Minions");

            StorageFolder spellFolder = await folder.CreateFolderAsync("Spells");

            StorageFile file;

            for (int i = 0; i < newDeck.MinionCard.Count; i++)
            {
                file = await minionFolder.CreateFileAsync(i.ToString() + ".txt");

                CardDataManager.SaveMinionCardToFile(newDeck.MinionCard[i], file);
            }
            for (int i = 0; i < newDeck.SpellCard.Count; i++)
            {
                file = await spellFolder.CreateFileAsync(i.ToString() + ".txt");

                CardDataManager.SaveSpellCardToFile(newDeck.SpellCard[i], file);
            }
        }