void OnVisibleButtonClicked(string groupKey, string filterKey, bool visible)
        {
            var filterItemInfo = new FilterItemInfo
            {
                groupKey  = groupKey,
                filterKey = filterKey,
                visible   = visible
            };

            Dispatcher.Dispatch(SetVisibleFilterAction.From(filterItemInfo));
        }
コード例 #2
0
        void OnVisibleButtonClicked(string groupKey, string filterKey, bool visible)
        {
            var filterItemInfo = new FilterItemInfo
            {
                groupKey  = groupKey,
                filterKey = filterKey,
                visible   = visible
            };

            UIStateManager.current.Dispatcher.Dispatch(Payload <ActionTypes> .From(ActionTypes.SetVisibleFilter,
                                                                                   filterItemInfo));
        }
コード例 #3
0
        void CreateFilterListItem(FilterItemInfo filterItemInfo)
        {
            FilterListItem filterListItem;

            if (m_FilterListItemPool.Count > 0)
            {
                filterListItem = m_FilterListItemPool.Pop();
            }
            else
            {
                filterListItem = Instantiate(m_FilterListItemPrefab, m_ParentTransform);
                filterListItem.visibleButtonClicked += OnVisibleButtonClicked;
                filterListItem.listItemClicked      += OnListItemClicked;
            }

            filterListItem.InitItem(filterItemInfo.groupKey, filterItemInfo.filterKey, filterItemInfo.visible,
                                    filterItemInfo.highlight);
            filterListItem.gameObject.SetActive(true);
            filterListItem.transform.SetAsLastSibling();
            m_ActiveFilterListItem.Add(filterListItem);
        }
コード例 #4
0
        void OnProjectStateDataChanged(UIProjectStateData data)
        {
            if (!EnumerableExtension.SafeSequenceEquals(data.filterGroupList, m_CurrentFilterGroupList))
            {
                // fill filter group Dropdown
                m_FilterGroupDropdown.options.Clear();

                if (data.filterGroupList.Count == 0)
                {
                    // show no data
                    ClearFilterList();
                    m_FilterGroupDropdown.interactable = false;
                    m_FilterGroupDropdown.options.Add(k_NoCategoryOption);
                    m_NoDataText.gameObject.SetActive(true);
                    m_DropdownMask.SetActive(true);
                }
                else
                {
                    m_FilterGroupDropdown.interactable = true;
                    m_NoDataText.gameObject.SetActive(false);
                    m_DropdownMask.SetActive(false);

                    var filterGroupList = data.filterGroupList;
                    foreach (string group in filterGroupList)
                    {
                        m_FilterGroupDropdown.options.Add(new TMP_Dropdown.OptionData(group));
                    }

                    // default select index = 0,
                    StartCoroutine(SetDefaultGroup());
                }
                m_CurrentFilterGroupList = data.filterGroupList;
            }

            if (!EnumerableExtension.SafeSequenceEquals(data.filterItemInfos, m_CurrentFilterKeys))
            {
                ClearFilterList();
                foreach (var filterItemInfo in data.filterItemInfos)
                {
                    CreateFilterListItem(filterItemInfo);
                }

                m_CurrentFilterKeys = data.filterItemInfos;
            }

            if (data.lastChangedFilterItem != m_LastChangedFilterItem)
            {
                var filterItemInfo = data.lastChangedFilterItem;
                var filterListItem = m_ActiveFilterListItem.SingleOrDefault(e =>
                                                                            e.groupKey == filterItemInfo.groupKey && e.filterKey == filterItemInfo.filterKey);

                if (filterListItem != null)
                {
                    filterListItem.SetVisible(filterItemInfo.visible);
                }

                m_LastChangedFilterItem = data.lastChangedFilterItem;
            }

            if (data.highlightFilter != m_CurrentHighlightFilter)
            {
                var filterListItem = m_ActiveFilterListItem.SingleOrDefault(e =>
                                                                            e.groupKey == m_CurrentHighlightFilter.groupKey &&
                                                                            e.filterKey == m_CurrentHighlightFilter.filterKey);
                if (filterListItem != null)
                {
                    filterListItem.SetHighlight(false);
                }

                filterListItem = m_ActiveFilterListItem.SingleOrDefault(e =>
                                                                        e.groupKey == data.highlightFilter.groupKey && e.filterKey == data.highlightFilter.filterKey);
                if (filterListItem != null)
                {
                    filterListItem.SetHighlight(true);
                }

                m_CurrentHighlightFilter = data.highlightFilter;
            }
        }