/// <summary> /// Ienums the set data. /// </summary> /// <returns>The set data.</returns> private IEnumerator IenumSetData() { string _commonFileName = LocalFileConstants.GetLocalFileDir() + LocalFileConstants.COMMON_LOCAL_FILE_NAME; LocalFileHandler.Init(_commonFileName); //ファイルが作成されるまでポーリングして処理待ち while (System.IO.File.Exists(_commonFileName) == false) { yield return(System.IO.File.Exists(_commonFileName) == true); } SearchEventManager.Instance._order = _orderAPIThrow; SearchEventManager.Instance._sex = _sexAPIThrow; SearchEventManager.Instance._ageTo = _ageHighAPIThrow; SearchEventManager.Instance._ageFrom = _ageLowAPIThrow; SearchEventManager.Instance._heightTo = _heightToAPIThrow; SearchEventManager.Instance._heightFrom = _heightFromAPIThrow; SearchEventManager.Instance._bodyType = _bodyTypeAPIThrow; SearchEventManager.Instance._isImage = _isImageAPIThrow; SearchEventManager.Instance._radius = _radiusAPIThrow; SearchEventManager.Instance._keyword = _keyword.text; SearchEventManager.SearchCondition condition = new SearchEventManager.SearchCondition(); condition._lat = SearchEventManager.Instance._lat; condition._lng = SearchEventManager.Instance._lng; condition._order = SearchEventManager.Instance._order; condition._sex = SearchEventManager.Instance._sex; condition._ageFrom = SearchEventManager.Instance._ageFrom; condition._ageTo = SearchEventManager.Instance._ageTo; condition._heightFrom = SearchEventManager.Instance._heightFrom; condition._heightTo = SearchEventManager.Instance._heightTo; condition._bodyType = SearchEventManager.Instance._bodyType; condition._isImage = SearchEventManager.Instance._isImage; condition._radius = SearchEventManager.Instance._radius; condition._keyword = SearchEventManager.Instance._keyword; Debug.Log(condition._isImage + " 画像の有無で検索。 "); Debug.Log(condition._radius + " 距離で検索 "); Debug.Log(condition._keyword + " キ=ワードで検索 "); LocalFileHandler.Save <SearchEventManager.SearchCondition>(LocalFileConstants.SEARCH_CONDITION_KEY, condition); LocalFileHandler.Flush(); Debug.Log(" 検索条件を保存。 "); }
/// <summary> /// Sets the data. /// マスターデータから動的に値が変更する所用 /// </summary> public void SetData() { //StartCoroutine(IenumSetData ()); string _commonFileName = LocalFileConstants.GetLocalFileDir() + LocalFileConstants.COMMON_LOCAL_FILE_NAME; LocalFileHandler.Init(_commonFileName); SearchEventManager.Instance._order = _orderAPIThrow; SearchEventManager.Instance._sex = _sexAPIThrow; SearchEventManager.Instance._ageTo = _ageHighAPIThrow; SearchEventManager.Instance._ageFrom = _ageLowAPIThrow; SearchEventManager.Instance._heightTo = _heightToAPIThrow; SearchEventManager.Instance._heightFrom = _heightFromAPIThrow; SearchEventManager.Instance._bodyType = _bodyTypeAPIThrow; SearchEventManager.Instance._isImage = _isImageAPIThrow; SearchEventManager.Instance._radius = _radiusAPIThrow; SearchEventManager.Instance._keyword = _keyword.text; SearchEventManager.SearchCondition condition = new SearchEventManager.SearchCondition(); condition._lat = SearchEventManager.Instance._lat; condition._lng = SearchEventManager.Instance._lng; condition._order = SearchEventManager.Instance._order; condition._sex = SearchEventManager.Instance._sex; condition._ageFrom = SearchEventManager.Instance._ageFrom; condition._ageTo = SearchEventManager.Instance._ageTo; condition._heightFrom = SearchEventManager.Instance._heightFrom; condition._heightTo = SearchEventManager.Instance._heightTo; condition._bodyType = SearchEventManager.Instance._bodyType; condition._isImage = SearchEventManager.Instance._isImage; condition._radius = SearchEventManager.Instance._radius; condition._keyword = SearchEventManager.Instance._keyword; Debug.Log(condition._isImage + " 画像の有無で検索。 "); Debug.Log(condition._radius + " 距離で検索 "); Debug.Log(condition._keyword + " キ=ワードで検索 "); LocalFileHandler.Save <SearchEventManager.SearchCondition>(LocalFileConstants.SEARCH_CONDITION_KEY, condition); LocalFileHandler.Flush(); }
IEnumerator InitFromCondition() { _loadingOverlay.SetActive(true); string _commonFileName = LocalFileConstants.GetLocalFileDir() + LocalFileConstants.COMMON_LOCAL_FILE_NAME; LocalFileHandler.Init(_commonFileName); //ファイルが作成されるまでポーリングして処理待ち while (System.IO.File.Exists(_commonFileName) == false) { yield return(System.IO.File.Exists(_commonFileName) == true); } SearchEventManager.SearchCondition SearchCondition = LocalFileHandler.Load <SearchEventManager.SearchCondition>(LocalFileConstants.SEARCH_CONDITION_KEY); //条件検索のデータがローカルファイルに残っている場合。 if (SearchCondition != null) { SearchEventManager.Instance._lat = SearchCondition._lat; SearchEventManager.Instance._lng = SearchCondition._lng; SearchEventManager.Instance._order = SearchCondition._order; SearchEventManager.Instance._sex = SearchCondition._sex; SearchEventManager.Instance._ageFrom = SearchCondition._ageFrom; SearchEventManager.Instance._ageTo = SearchCondition._ageTo; SearchEventManager.Instance._heightFrom = SearchCondition._heightFrom; SearchEventManager.Instance._heightTo = SearchCondition._heightTo; SearchEventManager.Instance._bodyType = SearchCondition._bodyType; SearchEventManager.Instance._isImage = SearchCondition._isImage; SearchEventManager.Instance._radius = SearchCondition._radius; SearchEventManager.Instance._keyword = SearchCondition._keyword; } // 通信レスポンス待ってから UserListApi._success = false; new UserListApi( // todo とりあえず試すため全部の設定 あとできちんと値を設定して絞り込むようにしてください AppStartLoadBalanceManager._userKey, EventManager.SearchEventManager.Instance._lat, EventManager.SearchEventManager.Instance._lng, EventManager.SearchEventManager.Instance._order, EventManager.SearchEventManager.Instance._sex, EventManager.SearchEventManager.Instance._ageFrom, EventManager.SearchEventManager.Instance._ageTo, EventManager.SearchEventManager.Instance._heightFrom, EventManager.SearchEventManager.Instance._heightTo, EventManager.SearchEventManager.Instance._bodyType, EventManager.SearchEventManager.Instance._isImage, EventManager.SearchEventManager.Instance._radius, EventManager.SearchEventManager.Instance._keyword, "1" ); while (UserListApi._success == false) { yield return(UserListApi._success == true); } SearchEventManager.SearchCondition condition = new SearchEventManager.SearchCondition(); condition._lat = SearchEventManager.Instance._lat; condition._lng = SearchEventManager.Instance._lng; condition._order = SearchEventManager.Instance._order; condition._sex = SearchEventManager.Instance._sex; condition._ageFrom = SearchEventManager.Instance._ageFrom; condition._ageTo = SearchEventManager.Instance._ageTo; condition._heightFrom = SearchEventManager.Instance._heightFrom; condition._heightTo = SearchEventManager.Instance._heightTo; condition._bodyType = SearchEventManager.Instance._bodyType; condition._isImage = SearchEventManager.Instance._isImage; condition._radius = SearchEventManager.Instance._radius; condition._keyword = SearchEventManager.Instance._keyword; LocalFileHandler.Save <SearchEventManager.SearchCondition>(LocalFileConstants.SEARCH_CONDITION_KEY, condition); LocalFileHandler.Flush(); if (UserListApi._httpCatchData.result.users != null) { if (UserListApi._httpCatchData.result.users.Count > 0) { _InfiniteLimitScroll.GetComponent <SearchListSmallImageInfiniteLimitScroll> ().m_currentItemNo = 0; _InfiniteLimitScroll.GetComponent <SearchListSmallImageInfiniteLimitScroll> ().Init(); EventManager.SearchEventManager.Instance._nowShowPage = "1"; _InfiniteLimitScrollBar.GetComponent <Scrollbar> ().value = 0.9995f; if (UserListApi._httpCatchData.result.users.Count >= 20) { _nextButton.SetActive(true); } } else { // リストのないページカウントになってるので 一旦通信とリストの更新をさせないようにする _disablePageForNetworkCall = true; _InfiniteLimitScrollBar.GetComponent <Scrollbar> ().value = 0.005f; Debug.Log("存在しないページにアクセスしようとしたのでやめる"); PopupPanel.Instance.PopMessageInsert( LocalMsgConst.LIST_SEARCH_ZERO, LocalMsgConst.OK, PanelListZeroFinishClose ); PanelPopupAnimate(GameObject.FindGameObjectWithTag(CommonConstants.POPUP_BASIC_TAG)); } } else { _disablePageForNetworkCall = true; _InfiniteLimitScrollBar.GetComponent <Scrollbar> ().value = 0.005f; Debug.Log("存在しないページにアクセスしようとしたのでやめる"); } _loadingOverlay.SetActive(false); }
IEnumerator InitFromCondition() { _loadingOverlay.SetActive(true); string lat = ""; string lng = ""; #if !UNITY_EDITOR if (string.IsNullOrEmpty(GetUserApi._httpCatchData.result.user.lat) == false) { lat = GetUserApi._httpCatchData.result.user.lat; } if (string.IsNullOrEmpty(GetUserApi._httpCatchData.result.user.lng) == false) { lng = GetUserApi._httpCatchData.result.user.lng; } #endif // 通信レスポンス待ってから new BoardListApi ( AppStartLoadBalanceManager._userKey, EventManager.BulletinBoardEventManager.Instance._CategoryID, lat, lng, EventManager.BulletinBoardEventManager.Instance._sex, EventManager.BulletinBoardEventManager.Instance._ageFrom, EventManager.BulletinBoardEventManager.Instance._ageTo, EventManager.BulletinBoardEventManager.Instance._heightFrom, EventManager.BulletinBoardEventManager.Instance._heightTo, EventManager.BulletinBoardEventManager.Instance._bodyType, EventManager.BulletinBoardEventManager.Instance._isImage, EventManager.BulletinBoardEventManager.Instance._radius, EventManager.BulletinBoardEventManager.Instance._keyword, "1" ); while (BoardListApi._success == false) { yield return(BoardListApi._success == true); } string _commonFileName = LocalFileConstants.GetLocalFileDir() + LocalFileConstants.COMMON_LOCAL_FILE_NAME; LocalFileHandler.Init(_commonFileName); BulletinBoardEventManager.SearchCondition condition = new BulletinBoardEventManager.SearchCondition(); condition._lat = BulletinBoardEventManager.Instance._lat; condition._lng = BulletinBoardEventManager.Instance._lng; condition._CategoryID = BulletinBoardEventManager.Instance._CategoryID; condition._sex = BulletinBoardEventManager.Instance._sex; condition._ageFrom = BulletinBoardEventManager.Instance._ageFrom; condition._ageTo = BulletinBoardEventManager.Instance._ageTo; condition._heightFrom = BulletinBoardEventManager.Instance._heightFrom; condition._heightTo = BulletinBoardEventManager.Instance._heightTo; condition._bodyType = BulletinBoardEventManager.Instance._bodyType; condition._isImage = BulletinBoardEventManager.Instance._isImage; condition._radius = BulletinBoardEventManager.Instance._radius; condition._keyword = BulletinBoardEventManager.Instance._keyword; LocalFileHandler.Save <BulletinBoardEventManager.SearchCondition>(LocalFileConstants.BBS_SEARCH_CONDITION_KEY, condition); LocalFileHandler.Flush(); if (BoardListApi._httpCatchData.result.boards != null) { if (BoardListApi._httpCatchData.result.boards.Count > 0) { // 条件検索の場合は無条件に初期化 _boardListInfiniteLimitScroll.GetComponent <BoardListInfiniteLimitScroll> ().m_currentItemNo = 0; _boardListInfiniteLimitScroll.GetComponent <BoardListInfiniteLimitScroll> ().Init(); _boardListInfiniteLimitScrollBar.GetComponent <Scrollbar> ().value = 0.995f; EventManager.BulletinBoardEventManager.Instance._nowShowPage = "1"; } else { // リストのないページカウントになってるので 一旦通信とリストの更新をさせないようにする _boardListInfiniteLimitScrollBar.GetComponent <Scrollbar> ().value = 0.005f; Debug.Log("存在しないページにアクセスしようとしたのでやめる"); PopupPanel.Instance.PopMessageInsert( LocalMsgConst.LIST_SEARCH_ZERO, LocalMsgConst.OK, BoardPanelListZeroFinishClose ); PanelPopupAnimate(GameObject.FindGameObjectWithTag(CommonConstants.POPUP_BASIC_TAG)); } } else { _boardListInfiniteLimitScrollBar.GetComponent <Scrollbar> ().value = 0.005f; Debug.Log("存在しないページにアクセスしようとしたのでやめる"); PopupPanel.Instance.PopMessageInsert( LocalMsgConst.LIST_SEARCH_ZERO, LocalMsgConst.OK, BoardPanelListZeroFinishClose ); } _loadingOverlay.SetActive(false); }
IEnumerator Init(int pageChange) { string _commonFileName = LocalFileConstants.GetLocalFileDir() + LocalFileConstants.COMMON_LOCAL_FILE_NAME; LocalFileHandler.Init(_commonFileName); //ファイルが作成されるまでポーリングして処理待ち while (System.IO.File.Exists(_commonFileName) == false) { yield return(System.IO.File.Exists(_commonFileName) == true); } _loadingOverlay.SetActive(true); SearchEventManager.SearchCondition SearchCondition = LocalFileHandler.Load <SearchEventManager.SearchCondition>(LocalFileConstants.SEARCH_CONDITION_KEY); //条件検索のデータがローカルファイルに残っている場合。 if (SearchCondition != null) { SearchEventManager.Instance._lat = SearchCondition._lat; SearchEventManager.Instance._lng = SearchCondition._lng; SearchEventManager.Instance._order = SearchCondition._order; SearchEventManager.Instance._sex = SearchCondition._sex; SearchEventManager.Instance._ageFrom = SearchCondition._ageFrom; SearchEventManager.Instance._ageTo = SearchCondition._ageTo; SearchEventManager.Instance._heightFrom = SearchCondition._heightFrom; SearchEventManager.Instance._heightTo = SearchCondition._heightTo; SearchEventManager.Instance._bodyType = SearchCondition._bodyType; SearchEventManager.Instance._isImage = SearchCondition._isImage; SearchEventManager.Instance._radius = SearchCondition._radius; SearchEventManager.Instance._keyword = SearchCondition._keyword; } // 通信レスポンス待ってから UserListApi._success = false; int page_next = int.Parse(EventManager.SearchEventManager.Instance._nowShowPage) + pageChange; new UserListApi( AppStartLoadBalanceManager._userKey, SearchEventManager.Instance._lat, SearchEventManager.Instance._lng, SearchEventManager.Instance._order, SearchEventManager.Instance._sex, SearchEventManager.Instance._ageFrom, SearchEventManager.Instance._ageTo, SearchEventManager.Instance._heightFrom, SearchEventManager.Instance._heightTo, SearchEventManager.Instance._bodyType, SearchEventManager.Instance._isImage, SearchEventManager.Instance._radius, SearchEventManager.Instance._keyword, page_next.ToString() //EventManager.SearchEventManager.Instance._nowShowPage ); while (UserListApi._success == false) { yield return(UserListApi._success == true); } SearchEventManager.SearchCondition condition = new SearchEventManager.SearchCondition(); condition._lat = SearchEventManager.Instance._lat; condition._lng = SearchEventManager.Instance._lng; condition._order = SearchEventManager.Instance._order; condition._sex = SearchEventManager.Instance._sex; condition._ageFrom = SearchEventManager.Instance._ageFrom; condition._ageTo = SearchEventManager.Instance._ageTo; condition._heightFrom = SearchEventManager.Instance._heightFrom; condition._heightTo = SearchEventManager.Instance._heightTo; condition._bodyType = SearchEventManager.Instance._bodyType; condition._isImage = SearchEventManager.Instance._isImage; condition._radius = SearchEventManager.Instance._radius; condition._keyword = SearchEventManager.Instance._keyword; LocalFileHandler.Save <SearchEventManager.SearchCondition>(LocalFileConstants.SEARCH_CONDITION_KEY, condition); LocalFileHandler.Flush(); if (UserListApi._httpCatchData.result.users != null) { if (UserListApi._httpCatchData.result.users.Count > 0) { _InfiniteLimitScroll.GetComponent <SearchListLargeImageInfiniteLimitScroll> ().Init(); // 更新後のリストの位置にバーをあわせる if (pageChange >= 0) { _InfiniteLimitScrollBar.GetComponent <Scrollbar> ().value = 0.995f; } else { _InfiniteLimitScrollBar.GetComponent <Scrollbar> ().value = 0.005f; } int page = int.Parse(SearchEventManager.Instance._nowShowPage) + pageChange; if (page % 4 == 0) { System.GC.Collect(); Resources.UnloadUnusedAssets(); } SearchEventManager.Instance._nowShowPage = page.ToString(); } else { // リストのないページカウントになってるので 一旦通信とリストの更新をさせないようにする _disablePageForNetworkCall = true; _InfiniteLimitScrollBar.GetComponent <Scrollbar> ().value = 0.995f; Debug.Log("存在しないページにアクセスしようとしたのでやめる"); //_InfiniteLimitScroll.GetComponent<SearchListLargeImageInfiniteLimitScroll> ().SetPanelMax(0); //_InfiniteLimitScroll.GetComponent<SearchListLargeImageInfiniteLimitScroll> ().SetPanelInstantateCount(0); } } else { _disablePageForNetworkCall = true; _InfiniteLimitScrollBar.GetComponent <Scrollbar> ().value = 0.995f; Debug.Log("存在しないページにアクセスしようとしたのでやめる"); //_InfiniteLimitScroll.GetComponent<SearchListLargeImageInfiniteLimitScroll> ().SetPanelMax(0); //_InfiniteLimitScroll.GetComponent<SearchListLargeImageInfiniteLimitScroll> ().SetPanelInstantateCount(0); } _loadingOverlay.SetActive(false); }