public static void LoadPlayerCreatedDecksFromFile() { string path = Path.Combine(Config.SavedDataFolder(), Config.SavedDecksFile()); List <string> lines = File.ReadAllLines(path).ToList(); List <string> decksToLoad = new List <string>(); string input = ""; for (int i = 0; i < lines.Count; i++) { input = input + lines[i] + "\n"; if (lines.Count == i + 1) { decksToLoad.Add(input); input = ""; } else { if (lines[i + 1].StartsWith("###")) { decksToLoad.Add(input); input = ""; } } } decksToLoad.ForEach(x => CurrentDecks.Add(DeckSerializer.Deserialize(x))); Log.Info("Successfully loaded player created decks from file."); }
public static void CreateNewDeck(Card heroCard, string name) { Deck newDeck = new Deck(); newDeck.HeroDbfId = heroCard.DbfId; newDeck.Name = name; newDeck.Format = FormatType.FT_STANDARD; CurrentDecks.Add(newDeck); }
private static void AddTestDeck() { Deck testDeck = new Deck(); testDeck.Name = "TESTDECK"; testDeck.HeroDbfId = 7; testDeck.Format = FormatType.FT_STANDARD; testDeck.CardDbfIds.Add(2757, 2); testDeck.CardDbfIds.Add(2507, 2); testDeck.CardDbfIds.Add(1688, 2); CurrentDecks.Add(testDeck); }