public virtual void SaveAs(string name) { _deck.Name = name; DeckLibrary.Write(_deck); IsSaved = true; IsNew = false; }
private void LoadDecks() { var decks = DeckLibrary.ReadDecks(); foreach (var deck in decks) { var deckVm = CreateReadonlyDeckVm(deck); _decks.Add(deckVm); } Selected = _decks.FirstOrDefault(); }
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 }); }
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(); }
public virtual void Save() { DeckLibrary.Write(_deck); IsSaved = true; }