Пример #1
0
    void HandleThoughtsState()
    {
        Debug.Log($"Thoughts count on opening thoughts inventory: {game.GetThoughtsCount()}");

        if (game.GetThoughtsCount() > 0)
        {
            ShowThoughts();
        }
        else
        {
            ShowEmptyState();
        }

        void ShowThoughts()
        {
            thoughts.SetActive(true);
            emptyThoughts.SetActive(false);
        }

        void ShowEmptyState()
        {
            /// If empty state always reset selected button to the top bar
            if (
                EventSystem.current != null &&
                EventSystem.current.currentSelectedGameObject != EmptyStateDefaultButton.gameObject
                )
            {
                EventSystem.current.SetSelectedGameObject(EmptyStateDefaultButton.gameObject);
                EmptyStateDefaultButton.GetComponent <Script_ButtonHighlighter>().Select();
            }

            thoughts.SetActive(false);
            emptyThoughts.SetActive(true);
        }
    }