Beispiel #1
0
    public void OnGenerationChanged(TMP_Dropdown dd)
    {
        // Destroy stuff of old generation
        foreach (GameObject page in pages.Values)
        {
            GameObject.Destroy(page);
        }
        pages.Clear();
        maxPageFilled = 0;

        GameManager.SelectedGeneration = generationDropdown.value + 1;
        generationProgressText.text = "You own cards for " + PlayerStats.GetGeneration(GameManager.SelectedGeneration).cards.Count + " out of " + CardFactory.numberOfNPNsInGeneration[GameManager.SelectedGeneration]
                                        + "\r\nNational Pokedex Numbers of this generation";
        // set up pages for new generation
        int totalPages = (CardFactory.numberOfNPNsInGeneration[GameManager.SelectedGeneration] + pageSize - 1) / pageSize;
        pageSwiper.totalPages = totalPages;
        RectTransform phRectTransform = pageHolder.GetComponent<RectTransform>();
        phRectTransform.sizeDelta = new Vector2(900 * totalPages, phRectTransform.sizeDelta.y);
        generation = PlayerStats.GetGeneration(GameManager.SelectedGeneration);
        for (int pageNumber = 0; pageNumber < totalPages; pageNumber++)
        {
            GameObject page = GameObject.Instantiate(pagePrefab);
            pages.Add(pageNumber, page);
            page.transform.SetParent(pageHolder.transform);
            page.transform.localPosition = new Vector3(900 * pageNumber, 0f, 0f);
            page.transform.localScale = new Vector3(1f, 1f, 1f);
        }
        numberOfDoubles = PlayerStats.CheckDoubles(GameManager.SelectedGeneration);
        doublesButton.SetActive(numberOfDoubles > 0);
        // 8 in 15000 chance that you get a double in your first pack
        tutorialTurnInDoublesPanel.SetActive(numberOfDoubles > 0 && PlayerStats.GetShowTutorialStep(TutorialStep.TurnInDoubles));
        // pageSwiper will publish event pageChanged which will fill some pages
        pageSwiper.BackToPage1();
    }
Beispiel #2
0
 public void OnPointerClick(PossibleCard ownedCard, Image image)
 {
     if (singleNPNPageHolder.activeSelf)
     {
         // from NPN to singleCard
         PlayerStats.SetTutorialStepCompleted(TutorialStep.ZoomCard);
         tutorialZoomCardPanel.SetActive(false);
         singleCardImage.sprite = image.sprite;
         currentSingle = ownedCard;
         SetFavoriteButtonColor(ownedCard.id.Equals(PlayerStats.GetFavorite(ownedCard.nationalPokedexNumber)));
         favoriteButton.SetActive(true);
         tutorialMakeFavoritePanel.SetActive(PlayerStats.GetShowTutorialStep(TutorialStep.MakeFavorite));
         singleNPNPageHolder.SetActive(false);
         npnProgressText.gameObject.SetActive(false);
         singleCard.SetActive(true);
     }
     else
     {
         // for people clicking before swiping
         PlayerStats.SetTutorialStepCompleted(TutorialStep.SwipeCollection);
         tutorialSwipeCollectionPanel.SetActive(false);
         // for people with the 8 in 15000 chance AND clicking before swiping
         tutorialTurnInDoublesPanel.SetActive(false);
         // from generation to NPN
         SingleNPNStart(ownedCard.nationalPokedexNumber);
     }
 }
Beispiel #3
0
 // Start is called before the first frame update
 void Start()
 {
     generationProgressText.gameObject.SetActive(true);
     npnProgressText.gameObject.SetActive(false);
     
     PlayerStats.SetTutorialStepCompleted(TutorialStep.GoToCollection);
     // pageSwiper will force a pageChanged, which will complete SwipeCollection, so SetActive should be above pageSwiper filling
     tutorialSwipeCollectionPanel.SetActive(PlayerStats.GetShowTutorialStep(TutorialStep.SwipeCollection));
     pageSwiper = pageHolder.GetComponent<PageSwiper>();
     singleNPNPageSwiper = singleNPNPageHolder.GetComponent<PageSwiper>();
     singleCardImage = singleCard.GetComponent<Image>();
     favoriteButtonImage = favoriteButton.GetComponent<Image>();
     generationDropdown.ClearOptions();
     for (int i = 1; i <= CardFactory.numberOfGenerations; i++)
     {
         if (PlayerStats.IsGenerationUnlocked(i))
         {
             generationDropdown.options.Add(new TMP_Dropdown.OptionData("Gen " + i));
         }
     }
     generationDropdown.value = GameManager.SelectedGeneration - 1;
     // if GameManager.SelectedGeneration != 1, then line above will have triggered OnGenerationChanged
     if (GameManager.SelectedGeneration == 1)
     {
         OnGenerationChanged(generationDropdown);
     }
 }
Beispiel #4
0
 private void SingleNPNStart(int nationalPokedexNumber)
 {
     tutorialZoomCardPanel.SetActive(PlayerStats.GetShowTutorialStep(TutorialStep.ZoomCard));
     GameManager.selectedNPN = nationalPokedexNumber;
     generation = PlayerStats.GetGeneration(GameManager.SelectedGeneration);
     cardsOfNumber = generation.cards[nationalPokedexNumber];
     npnProgressText.text = "You own " + cardsOfNumber.Count + " out of " + CardFactory.GetNumberOfAvailableCards(GameManager.SelectedGeneration, nationalPokedexNumber)
                                     + "\r\ncards of this National Pokedex Number " + nationalPokedexNumber;
     // set up pages for new NPN
     int totalPages = (cardsOfNumber.Count + pageSize - 1) / pageSize;
     singleNPNPageSwiper = singleNPNPageHolder.GetComponent<PageSwiper>();
     singleNPNPageSwiper.totalPages = totalPages;
     RectTransform phRectTransform = singleNPNPageHolder.GetComponent<RectTransform>();
     phRectTransform.sizeDelta = new Vector2(900 * totalPages, phRectTransform.sizeDelta.y);
     for (int pageNumber = 0; pageNumber < totalPages; pageNumber++)
     {
         GameObject page = GameObject.Instantiate(pagePrefab);
         singleNPNPages.Add(pageNumber, page);
         page.transform.SetParent(singleNPNPageHolder.transform);
         page.transform.localPosition = new Vector3(900 * pageNumber, 0f, 0f);
         page.transform.localScale = new Vector3(1f, 1f, 1f);
     }
     // pageSwiper will publish event pageChanged which will fill some pages
     pageHolder.SetActive(false);
     generationDropdown.gameObject.SetActive(false);
     generationProgressText.gameObject.SetActive(false);
     singleNPNPageHolder.SetActive(true);
     npnProgressText.gameObject.SetActive(true);
     singleNPNPageSwiper.BackToPage1();
 }