/// <summary> /// The callback to execute when we press the 'Tutorial' button /// </summary> /// <param name="baseObject"></param> private void OnTutorialButtonLeftClicked(BaseObject baseObject) { PlayerDataRegistryData startingRegistryData = AssetManager.GetData <PlayerDataRegistryData>(PlayerDataRegistry.startingDataRegistryDataAsset); Deck tutorialDeck = new Deck(); tutorialDeck.Create(startingRegistryData.Decks[0].CardDataAssets); Transition(new TutorialScreen(tutorialDeck)); }
/// <summary> /// Load our player's card and deck data if we have not done so already. /// Don't copy from the Central Card registry because we want to create multiples instances of the same card. /// If we used the Central Card Registry, they would all be the same? /// </summary> /// <param name="content"></param> public void LoadAssets(string path) { // If we have already loaded there is no need to load again - just raises the possibility of overwriting data if (Loaded) { return; } Decks = new Deck[maxDeckNumber]; for (int i = 0; i < maxDeckNumber; i++) { Decks[i] = new Deck(); } PlayerData = AssetManager.GetData <PlayerDataRegistryData>(path); DebugUtils.AssertNotNull(PlayerData); // Load decks too Debug.Assert(PlayerData.Decks.Count <= maxDeckNumber); int deckIndex = 0; foreach (DeckData deckData in PlayerData.Decks) { Debug.Assert(deckIndex < maxDeckNumber); DebugUtils.AssertNotNull(Decks[deckIndex]); Decks[deckIndex].Create(deckData.CardDataAssets); Decks[deckIndex].Name = deckData.Name; deckIndex++; } Loaded = true; }