Beispiel #1
0
    public void LoadDecks()
    {
        try {
            string deckDir = $"{Application.persistentDataPath}/Decks";
            if (!System.IO.Directory.Exists(deckDir))
            {
                System.IO.Directory.CreateDirectory(deckDir);
            }

            string[] deckFiles = System.IO.Directory.GetFiles(deckDir);
            decks = SavedDeck.LoadLocalDecks();
            for (int i = 0; i < deckFiles.Length; i++)
            {
                string fileName = deckFiles[i].Substring(deckFiles[i].LastIndexOf("\\") + 1);
                decks[i] = new SavedDeck(fileName);
                decks[i].Load();

                var deck = Instantiate(deckPrefab, decksContent).GetComponent <FullDeck>();
                deck.SetDeck(decks[i], this);
                displayedDecks.Add(deck);
            }
        } catch (Exception err) {
            Debug.Log(err);
            // TODO: send some feedback to the client
        }
    }
Beispiel #2
0
 public void LoadBuilds()
 {
     availableBuilds = SavedDeck.LoadLocalDecks();
 }