void LoadDecks() { decks = new List <DeckFile>(); for (int i = 0; i < deck_displays.Count; i++) { DeckFile deck = LoadDeckFile("Deck" + i + ".deck"); int deck_to_choose = i; decks.Add(deck); if (deck != null) { deck_displays[i].SetNewDeck(false); deck_displays[i].SetDeckName(deck.name); deck_displays[i].SetArt(GetArt(deck.deck_class)); deck_displays[i].SetOnClick(() => SelectDeck(deck_to_choose)); } else { deck_displays[i].SetNewDeck(true); deck_displays[i].SetOnClick(() => StartDeckEditor(new DeckFile("Deck" + deck_to_choose), deck_to_choose)); } } main_display.gameObject.SetActive(false); }
public void StartGame() { player_1_deckfile = null; player_2_deckfile = null; int p1 = 0, p2 = 0; for (int i = 0; i < decks.Count; i++) { if (decks[i] == null) { continue; } else { if (player_1_deck.value == p1) { player_1_deckfile = decks[i]; } if (player_2_deck.value == p2) { player_2_deckfile = decks[i]; } p1++; p2++; } } SceneManager.LoadScene("CardGameScene"); }
public override bool Execute(Arguments arguments) { if (arguments.Count != 1 && arguments.Count != 5) { return(false); } var count = int.Parse(arguments["count"]); MediaLibrary.LoadSets(); MagicSet starterSet; MagicSet boosterSet1; MagicSet boosterSet2; MagicSet boosterSet3; if (arguments.Count == 1) { starterSet = MediaLibrary.RandomSet(); boosterSet1 = MediaLibrary.RandomSet(); boosterSet2 = MediaLibrary.RandomSet(); boosterSet3 = MediaLibrary.RandomSet(); } else { starterSet = MediaLibrary.GetSet(arguments["s"]); boosterSet1 = MediaLibrary.GetSet(arguments["b1"]); boosterSet2 = MediaLibrary.GetSet(arguments["b2"]); boosterSet3 = MediaLibrary.GetSet(arguments["b3"]); } Console.WriteLine("Starter: {0}\nBooster1: {1}\nBooster2: {2}\nBooster3: {3}\n", starterSet.Name, boosterSet1.Name, boosterSet2.Name, boosterSet3.Name); for (var i = 0; i < count; i++) { var starter = starterSet.GenerateTournamentPack(); var booster1 = boosterSet1.GenerateBoosterPack(); var booster2 = boosterSet2.GenerateBoosterPack(); var booster3 = boosterSet3.GenerateBoosterPack(); var library = new List <CardInfo>(); library.AddRange(starter); library.AddRange(booster1); library.AddRange(booster2); library.AddRange(booster3); var ratings = CardRatings.Merge(CardRatings.Merge(boosterSet2.Ratings, boosterSet3.Ratings), CardRatings.Merge(starterSet.Ratings, boosterSet1.Ratings)); var deck = DeckBuilder.BuildDeck(library, ratings); deck.LimitedCode = MagicSet.GetLimitedCode(starterSet.Name, new[] { boosterSet1.Name, boosterSet2.Name, boosterSet3.Name }); File.WriteAllBytes(Guid.NewGuid() + ".dec", DeckFile.Write(deck)); } return(true); }
public void Load(DeckFile deck_file) { to_display.Load(deck_file); name_field.text = deck_file.name; dropdown.value = (int)deck_file.deck_class - 1; ReloadCardButtons(); }
public LocalInformer(string localDeckName, string oppDeckName) { DeckFile localDeck = new DeckFile(localDeckName); DeckFile oppDeck = new DeckFile(oppDeckName); localHero = localDeck.hero; // TODO: Shuffle localCards = localDeck.cards; oppHero = oppDeck.hero; oppCards = oppDeck.cards; }
DeckFile LoadDeckFile(string filename) { if (!File.Exists(Application.persistentDataPath + "/Decks/" + filename)) { return(null); } BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + "/Decks/" + filename, FileMode.Open); DeckFile deck = (DeckFile)bf.Deserialize(file); file.Close(); return(deck); }
protected Deck GetDeck(string name) { return(DeckFile.Read(@".\" + name)); }
void StartDeckEditor(DeckFile deckfile, int index) { deck_contsructor_panel.SetActive(true); deck_constructor.Load(deckfile); main_deck_index = index; }
public void Copy(DeckFile deckfile) { cards = deckfile.cards; deck_class = deckfile.deck_class; name = deckfile.name; }
public void Load(DeckFile decklist) { card_ids = new List <int>(decklist.cards); deck_class = decklist.deck_class; }
public Decklist(DeckFile file) { card_ids = new List <int>(); Load(file); }