void FilterProjectList(ProjectListFilterData filterData)
        {
            bool stringFilter = !string.IsNullOrWhiteSpace(filterData.searchString);
            int  visibleCount = 0;

            foreach (var projectListItem in m_ProjectListItems)
            {
                bool visible = filterData.projectServerType.HasFlag(projectListItem.projectServerType);
                if (stringFilter)
                {
                    visible = visible && projectListItem.room.project.name.IndexOf(filterData.searchString, StringComparison.OrdinalIgnoreCase) >= 0;
                }

                if (visible)
                {
                    projectListItem.SetHighlightString(filterData.searchString);
                    visibleCount++;
                }

                projectListItem.gameObject.SetActive(visible);
            }

            var isLoggedIn = UIStateManager.current.sessionStateData.sessionState.loggedState == LoginState.LoggedIn;

            m_NoProjectPanel.SetActive(!isLoggedIn || HasNoProjectsAvailable());
        }
        void OnStateDataChanged(UIStateData data)
        {
            if (data.selectedProjectOption != m_CurrentSelectedProject)
            {
                if (m_LastHighlightedItem != null)
                {
                    m_LastHighlightedItem.SetHighlight(false);
                    m_LastHighlightedItem = null;
                }

                if (data.selectedProjectOption != Project.Empty)
                {
                    var projectListItem = m_ProjectListItems.SingleOrDefault(e => e.room.project == data.selectedProjectOption);
                    if (projectListItem != null)
                    {
                        projectListItem.SetHighlight(true);
                        m_LastHighlightedItem = projectListItem;
                    }

                    m_ProjectOption.transform.SetParent(m_ScrollRect.transform);
                    m_ProjectOption.transform.localPosition = GetOptionPosition(projectListItem);
                    m_ProjectOption.transform.SetParent(m_ScrollRect.transform.parent);

                    m_ScrollRect.StopMovement();
                    m_ProjectOption.InitProjectOption(data.selectedProjectOption);
                    m_ProjectOption.gameObject.SetActive(true);
                    m_TapDetector.SetActive(true);
                }
                else
                {
                    m_ProjectOption.gameObject.SetActive(false);
                    m_TapDetector.SetActive(false);
                }
                m_CurrentSelectedProject = data.selectedProjectOption;
                m_CurrentOptionIndex     = data.projectOptionIndex;
            }
            else if (data.projectOptionIndex != m_CurrentOptionIndex)
            {
                m_ProjectOption.InitProjectOption(data.selectedProjectOption);
                m_CurrentOptionIndex = data.projectOptionIndex;
            }

            if (data.landingScreenFilterData != m_CurrentFilterData)
            {
                m_ScrollRect.verticalNormalizedPosition = 1;
                FilterProjectList(data.landingScreenFilterData);
                m_CurrentFilterData = data.landingScreenFilterData;

                if (data.landingScreenFilterData.projectServerType != m_CurrentServerType)
                {
                    m_ProjectTabController.SelectButtonType(data.landingScreenFilterData.projectServerType);
                    m_CurrentServerType = data.landingScreenFilterData.projectServerType;
                }
            }

            UpdateLayout(data);
        }
示例#3
0
        void FilterProjectList(ProjectListFilterData filterData)
        {
            bool stringFilter = !string.IsNullOrWhiteSpace(filterData.searchString);
            int  visibleCount = 0;

            foreach (var projectListItem in m_ProjectListItems)
            {
                bool visible = filterData.projectServerType.HasFlag(projectListItem.projectServerType);
                if (stringFilter)
                {
                    visible = visible && projectListItem.project.name.IndexOf(filterData.searchString, StringComparison.OrdinalIgnoreCase) >= 0;
                }

                if (visible)
                {
                    projectListItem.SetHighlightString(filterData.searchString);
                    visibleCount++;
                }
                projectListItem.gameObject.SetActive(visible);
            }

            m_NoProjectPanel.SetActive(!m_WelcomePanel.activeSelf && visibleCount == 0);
        }