Esempio n. 1
0
        public virtual void SaveAs(string name)
        {
            _deck.Name = name;
            DeckLibrary.Write(_deck);

            IsSaved = true;
            IsNew   = false;
        }
Esempio n. 2
0
        private void LoadDecks()
        {
            var decks = DeckLibrary.ReadDecks();

            foreach (var deck in decks)
            {
                var deckVm = CreateReadonlyDeckVm(deck);
                _decks.Add(deckVm);
            }

            Selected = _decks.FirstOrDefault();
        }
Esempio n. 3
0
        private Deck[] ChooseRandomDecks()
        {
            var decks = DeckLibrary.ReadDecks().ToList();

            var first = decks[RandomEx.Next(0, decks.Count)];

            var decksWithSameRating = decks
                                      .Where(x => x.Rating == first.Rating)
                                      .ToList();

            var second = decksWithSameRating[RandomEx.Next(0, decksWithSameRating.Count)];

            return(new[] { first, second });
        }
Esempio n. 4
0
    public void addSaveSlot(string username)
    {
        int           num      = saves.Count;
        string        filePath = savesFolder + startOfName + username + ".dat";
        PlayerAccount newSave;

        if (username == "Admin")
        {
            PlayerData temp = new PlayerData();
            DeckLibrary.giveAdminDeckTo(temp);
            newSave = PlayerAccount.createPlayerData(temp, filePath);
        }
        else
        {
            newSave = PlayerAccount.createPlayerData(filePath);
        }
        newSave.accountInfo.username = username;
        newSave.savePlayerData();

        saves.Insert(0, newSave);
        info.fileNames.Add(filePath);
        saveAccountInfo();
    }
Esempio n. 5
0
 public virtual void Save()
 {
     DeckLibrary.Write(_deck);
     IsSaved = true;
 }