Exemple #1
0
    public void loadDeckFolder(string folderPath)
    {
        string[] deckPathList;
        try {
            deckPathList = Directory.GetFiles(folderPath, "*.json", SearchOption.TopDirectoryOnly);
        } catch (System.Exception) {
            Debug.LogError("error loading deck list");
            return;
        }


        if (deckPathList == null)
        {
            Debug.LogError("error loading deck list");
            return;
        }
        if (deckPathList.Length == 0)
        {
            Debug.LogError("no decks found at " + folderPath);
            return;
        }

        decks = new DeckStorage[deckPathList.Length];
        for (int i = 0; i < deckPathList.Length; i++)
        {
            decks[i] = new DeckStorage(Path.GetFileNameWithoutExtension(deckPathList[i]), File.ReadAllText(deckPathList[i]));
        }

        dropdown.ClearOptions();
        List <Dropdown.OptionData> dropdownData = new List <Dropdown.OptionData>();

        for (int i = 0; i < decks.Length; i++)
        {
            dropdownData.Add(new Dropdown.OptionData(decks[i].name));
        }
        dropdown.AddOptions(dropdownData);
    }
Exemple #2
0
 void Awake()
 {
     //AllDecks = new List<DeckInfo> ();
     //Debug.Log ("all deck instantiated");
     Instance = this;
 }