Ejemplo n.º 1
0
        /// <summary>
        /// 关闭搜索结果的容器
        /// </summary>
        private void CloseSearchResultContainer(bool doDestory)
        {
            Debug.Log("关闭搜索结果的容器");

            _searchResultContainer.gameObject.SetActive(false);

            if (doDestory)
            {
                Destroy(_searchResultAgent.gameObject);
                _searchResultAgent = null;
            }
        }
Ejemplo n.º 2
0
        // 搜索功能
        public void DoSearch()
        {
            if (_cardAgent.CardStatus == CardStatusEnum.DESTORYINGFIRST)
            {
                _onUpdate.Invoke();
            }
            else
            {
                CloseSearchAgentContainer(false);

                //  获取查询词,进行搜索,得到 SearchBean 列表
                var daoType = _cardAgent.daoTypeEnum;

                //List<SearchBean> searchBeans = _manager.daoServiceFactory.GetDaoService(daoType).Search(_searchWord);
                List <SearchBean> searchBeans = _manager.daoServiceFactory.Search(_searchWord);

                Debug.Log("搜索到结果 : " + searchBeans.Count);


                //  生成搜索结果控件,并进行初始化
                if (_searchResultAgent == null)
                {
                    Debug.Log("_searchResultAgent == null");

                    _searchResultAgent = Instantiate(_searchResultAgentPrefab, _searchResultContainer) as SearchResultAgent;
                    _searchResultAgent.Init(_onUpdate);
                }
                else
                {
                    _searchResultAgent.Init(_onUpdate);
                }

                //  搜索结果控件进行加载数据
                _searchResultAgent.InitData(searchBeans, _searchWord, _manager, _cardAgent);


                //  装载事件代理
                _searchResultAgent.SetOnClickMoveBtn(OnClickSearchResultMoveBtn);
                _searchResultAgent.SetOnClickReturnBtn(OnClickSearchResultReturnBtn);
                _searchResultAgent.SetOnClickSearchResultItem(OnClickSearchResultItem);

                OpenSearchResultContainer();
            }
        }