public override void PageButtonPressed(PageButton buttonPressed)
    {
        BaseStorybookGame gameManager = GameManager.GetInstance<BaseStorybookGame>();
        PageData pageData = buttonPressed.PageData;

        if (pageData.InventoryId < gameManager.DeckSize)
        {
            if (m_selectedDeckPage != null)
            {
                m_selectedDeckPage.DisplaySelectedImage(false);
            }

            if (m_selectedDeckPage == buttonPressed)
            {
                m_selectedDeckPage.DisplaySelectedImage(false);
                m_selectedDeckPage = null;
            }
            else
            {
                m_selectedDeckPage = buttonPressed;
                m_selectedDeckPage.DisplaySelectedImage(true);
            }          
        }
        else
        {
            if (m_selectedInventoryPage != null)
            {
                m_selectedInventoryPage.DisplaySelectedImage(false);
            }

            if (m_selectedInventoryPage == buttonPressed)
            {
                m_selectedInventoryPage.DisplaySelectedImage(false);
                m_selectedInventoryPage = null;
            }
            else
            {
                m_selectedInventoryPage = buttonPressed;
                m_selectedInventoryPage.DisplaySelectedImage(true);
            }
        }
        _checkForSwap();
    }
    public override void PageButtonPressed(PageButton pageButton)
    {
        if (m_selectedPage != null)
        {
            m_selectedPage.DisplaySelectedImage(false);
        }

        if (pageButton == m_selectedPage)
        {
            m_selectedPage = null;
            m_submitButton.interactable = false;
        }
        else
        {
            m_selectedPage = pageButton;
            pageButton.DisplaySelectedImage(true);
            m_submitButton.interactable = true;
        }  
    }
Пример #3
0
 // Send the page data to the combat system which will process the move, but only if the player is thinking
 public override void PageButtonPressed(PageButton pageButton)
 {
     // Send PageData to the combat system
     if (m_isThinking)
     {
         if (m_selectedPageButton != null)
         {
             m_selectedPageButton.DisplaySelectedImage(false);
         }
         m_selectedPageButton = pageButton;
         pageButton.DisplaySelectedImage(true);
         _hideEnemyTargetButtons();
         _hidePlayerTargetButtons();
         m_handId = m_pageButtonList.IndexOf(pageButton);
         _displayTargetButtons(pageButton);
         if (pageButton.PageData.IsRare)
         {
             m_selectedMoveTargets = 4;
         }
         else
         {
             m_selectedMoveTargets = 1;
         }
     }
     return;
 }
Пример #4
0
    /// <summary>
    /// When a page button is pressed in this menu, that page becomes the current selected page and is displayed
    /// underneath the 'selected page' label
    /// </summary>
    /// <param name="buttonPressed">The page button that was pressed</param>
    public override void PageButtonPressed(PageButton buttonPressed)
    {
        if (m_pageButtonInScroll != null)
        {
            m_pageButtonInScroll.DisplaySelectedImage(false);
        }
        m_pageButtonInScroll = buttonPressed;
        buttonPressed.DisplaySelectedImage(true);
        Button selectedButton = _initializePageButton(buttonPressed.PageData);
        selectedButton.enabled = false;
        RectTransform[] AllRects = GetComponentsInChildren<RectTransform>();
        RectTransform selectedPageRect = null;

        // Find the selected page rect
        foreach(RectTransform rectT in AllRects)
        {
            if (rectT.name == "SelectedPage")
            {
                selectedPageRect = rectT;
                break;
            }
        }

        // If there was a previously selected page, destroy it in the UI
        if (m_selectedButton != null)
        {
            Destroy(selectedPageRect.GetChild(0).gameObject);
        }

        GridLayoutGroup grid = selectedPageRect.GetComponent<GridLayoutGroup>();
        grid.cellSize = new Vector2(m_buttonWidth, m_buttonHeight);

        selectedButton.transform.SetParent(selectedPageRect.transform, false);
        m_selectedButton = selectedButton;
        m_selectedPageButton = selectedButton.GetComponent<PageButton>();
        m_submitPageButton.enabled = true;
    }