/// <summary> /// get the deck path /// enemy decks are stored in the resource folder so they are added to build /// </summary> /// <returns></returns> private string getDeckPath() { if(playerDeck) { return SaveAndLoadJson.getBaseFilePath(Deck.playerDecks); } else { return SaveAndLoadJson.getResourcePath(Deck.baddyDecks,""); } }
private bool loadDeckFromMemory(string deckName) { JsonDeck deck; bool loadSuccess = false; if (playerDeck) { loadSuccess = SaveAndLoadJson.loadStruct(SaveAndLoadJson.getBaseFilePath(playerDecks, deckName), out deck); } else { loadSuccess = SaveAndLoadJson.loadStruct(SaveAndLoadJson.getResourcePath(baddyDecks, deckName), out deck); } if (!loadSuccess) { if (!SaveAndLoadJson.loadStruct(SaveAndLoadJson.getResourcePath(baddyDecks, "errorDeck"), out deck)) { return(false); } } //get card class types from names Type[] cardClasses = new Type[deck.cardTypeName.Length]; for (int i = 0; i < deck.cardTypeName.Length; i++) { cardClasses[i] = Type.GetType(deck.cardTypeName[i]); } addCardsToDeck(cardClasses); return(loadSuccess); }
//TODO abstract which type is loaded at start public void loadDeckType(Toggle deckType) { if (deckType.isOn) { loadDeckFolder(SaveAndLoadJson.getBaseFilePath(Deck.playerDecks)); } else { loadDeckFolder(SaveAndLoadJson.getResourcePath(Deck.baddyDecks)); } }
// Use this for initialization void Start() { loadDeckFolder(SaveAndLoadJson.getBaseFilePath(Deck.playerDecks)); }
private string soundFilePath() { return(SaveAndLoadJson.getBaseFilePath() + folderName + "/" + fileName); }