コード例 #1
0
        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);
        }
コード例 #2
0
        // 初期化 changepaeはページが進むか戻るか
        IEnumerator Init(int ChangePage)
        {
            //HeaderPanel.Instance.GetComponent<Text> ().text = PanelStateManager.GetHeaderStringByKey("BulletInBoardPanel");

            _loadingOverlay.SetActive(true);

            // 通信レスポンス待ってから
            int    page_next       = int.Parse(EventManager.BulletinBoardEventManager.Instance._nowShowPage) + ChangePage;
            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);
            }

            BulletinBoardEventManager.SearchCondition SearchCondition = LocalFileHandler.Load <BulletinBoardEventManager.SearchCondition>(LocalFileConstants.BBS_SEARCH_CONDITION_KEY);

            //条件検索のデータがローカルファイルに残っている場合。
            if (SearchCondition != null)
            {
                if (string.IsNullOrEmpty(SearchCondition._lat) == false)
                {
                    BulletinBoardEventManager.Instance._lat = SearchCondition._lat;
                }

                if (string.IsNullOrEmpty(SearchCondition._lng) == false)
                {
                    BulletinBoardEventManager.Instance._lng = SearchCondition._lng;
                }

                if (string.IsNullOrEmpty(SearchCondition._CategoryID) == false)
                {
                    BulletinBoardEventManager.Instance._CategoryID = SearchCondition._CategoryID;
                }

                if (string.IsNullOrEmpty(SearchCondition._sex) == false)
                {
                    BulletinBoardEventManager.Instance._sex = SearchCondition._sex;
                }

                if (string.IsNullOrEmpty(SearchCondition._ageFrom) == false)
                {
                    BulletinBoardEventManager.Instance._ageFrom = SearchCondition._ageFrom;
                }

                if (string.IsNullOrEmpty(SearchCondition._ageTo) == false)
                {
                    BulletinBoardEventManager.Instance._ageTo = SearchCondition._ageTo;
                }

                if (string.IsNullOrEmpty(SearchCondition._heightFrom) == false)
                {
                    BulletinBoardEventManager.Instance._heightFrom = SearchCondition._heightFrom;
                }

                if (string.IsNullOrEmpty(SearchCondition._heightTo) == false)
                {
                    BulletinBoardEventManager.Instance._heightTo = SearchCondition._heightTo;
                }

                if (string.IsNullOrEmpty(SearchCondition._bodyType) == false)
                {
                    BulletinBoardEventManager.Instance._bodyType = SearchCondition._bodyType;
                }

                if (string.IsNullOrEmpty(SearchCondition._isImage) == false)
                {
                    BulletinBoardEventManager.Instance._isImage = SearchCondition._isImage;
                }

                if (string.IsNullOrEmpty(SearchCondition._radius) == false)
                {
                    BulletinBoardEventManager.Instance._radius = SearchCondition._radius;
                }

                if (string.IsNullOrEmpty(SearchCondition._keyword) == false)
                {
                    BulletinBoardEventManager.Instance._keyword = SearchCondition._keyword;
                }
            }


            new BoardListApi
            (
                AppStartLoadBalanceManager._userKey,
                BulletinBoardEventManager.Instance._CategoryID,
                BulletinBoardEventManager.Instance._lat,
                BulletinBoardEventManager.Instance._lng,
                BulletinBoardEventManager.Instance._sex,
                BulletinBoardEventManager.Instance._ageFrom,
                BulletinBoardEventManager.Instance._ageTo,
                BulletinBoardEventManager.Instance._heightFrom,
                BulletinBoardEventManager.Instance._heightTo,
                BulletinBoardEventManager.Instance._bodyType,
                BulletinBoardEventManager.Instance._isImage,
                BulletinBoardEventManager.Instance._radius,
                BulletinBoardEventManager.Instance._keyword,
                page_next.ToString()                //EventManager.BulletinBoardEventManager.Instance._nowShowPage
            );
            while (BoardListApi._success == false)
            {
                yield return(BoardListApi._success == true);
            }

            if (BoardListApi._httpCatchData.result.boards != null)
            {
                if (BoardListApi._httpCatchData.result.boards.Count > 0)
                {
                    _boardListInfiniteLimitScroll.GetComponent <BoardListInfiniteLimitScroll> ().Init();

                    // 更新後のリストの位置にバーをあわせる
                    if (ChangePage >= 0)
                    {
                        _boardListInfiniteLimitScrollBar.GetComponent <Scrollbar> ().value = 0.995f;
                    }
                    else
                    {
                        _boardListInfiniteLimitScrollBar.GetComponent <Scrollbar> ().value = 0.005f;
                    }

                    int page = int.Parse(EventManager.BulletinBoardEventManager.Instance._nowShowPage) + ChangePage;

                    if (page % 2 == 0)
                    {
                        System.GC.Collect();
                        Resources.UnloadUnusedAssets();
                    }

                    EventManager.BulletinBoardEventManager.Instance._nowShowPage = page.ToString();
                }
                else
                {
                    // リストのないページカウントになってるので 一旦通信とリストの更新をさせないようにする
                    _disablePageForNetworkCall = true;
                    _boardListInfiniteLimitScrollBar.GetComponent <Scrollbar> ().value = 0.995f;
                    Debug.Log("存在しないページにアクセスしようとしたのでやめる");
                }
            }
            else
            {
                _disablePageForNetworkCall = true;
                _boardListInfiniteLimitScrollBar.GetComponent <Scrollbar> ().value = 0.995f;
                Debug.Log("存在しないページにアクセスしようとしたのでやめる");
            }

            _loadingOverlay.SetActive(false);
        }
コード例 #3
0
        /// <summary>
        /// Naitives the init coroutine.
        /// </summary>
        /// <returns>The init coroutine.</returns>
        private IEnumerator NaitiveInitCoroutine()
        {
            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);
            }

            /// 検索条件をローカルに保存しているので、そこから引いてくる。
            BulletinBoardEventManager.SearchCondition SearchCondition = LocalFileHandler.Load <BulletinBoardEventManager.SearchCondition> (LocalFileConstants.BBS_SEARCH_CONDITION_KEY);



            /// ローカルに「掲示板カテゴリ」のデータが保存されている場合の処理。
            if (string.IsNullOrEmpty(SearchCondition._CategoryID) == false)
            {
                _categoryNative.transform.GetChild(0).gameObject.SetActive(false);
                _categoryNative.transform.GetChild(1).gameObject.SetActive(true);
                var category = CommonModelHandle.GetByIdBaseData(SearchCondition._CategoryID, CurrentProfSettingStateType.BoardCategory);

                if (category != null)
                {
                    _categoryNative.transform.GetChild(1).GetComponent <Text> ().text = category.name;
                    _categoryAPIThrow = category.id;
                }
                else
                {
                    _categoryNative.transform.GetChild(1).GetComponent <Text> ().text = "指定しない";
                    _categoryAPIThrow = "";
                }
            }
            else
            {
                _categoryNative.transform.GetChild(0).gameObject.SetActive(false);
                _categoryNative.transform.GetChild(1).gameObject.SetActive(true);
                _categoryNative.transform.GetChild(1).GetComponent <Text> ().text = "指定しない";
                _categoryAPIThrow = "";
            }
            /// 性別の条件の場合の処理
            if (string.IsNullOrEmpty(SearchCondition._sex) == false)
            {
                _genderNative.transform.GetChild(0).gameObject.SetActive(false);
                _genderNative.transform.GetChild(1).gameObject.SetActive(true);

                var genderText = CommonModelHandle.GetByIdBaseData(SearchCondition._sex, CurrentProfSettingStateType.Gender);

                if (genderText != null)
                {
                    _genderNative.transform.GetChild(1).GetComponent <Text> ().text = genderText.name;
                    _sexAPIThrow = genderText.id;
                }
                else
                {
                    _genderNative.transform.GetChild(1).GetComponent <Text> ().text = "指定しない";
                    _sexAPIThrow = "";
                }
            }
            else
            {
                _genderNative.transform.GetChild(0).gameObject.SetActive(false);
                _genderNative.transform.GetChild(1).gameObject.SetActive(true);
                _genderNative.transform.GetChild(1).GetComponent <Text> ().text = "指定しない";
                _sexAPIThrow = "";
            }

            /// 年齢のまでの場合の処理。
            if (string.IsNullOrEmpty(SearchCondition._ageTo) == false)
            {
                _ageToNative.transform.GetChild(0).gameObject.SetActive(false);
                _ageToNative.transform.GetChild(1).gameObject.SetActive(true);
                _ageToNative.transform.GetChild(1).GetComponent <Text> ().text = SearchCondition._ageTo;
                _ageHighAPIThrow = SearchCondition._ageTo;
            }
            else
            {
                _ageToNative.transform.GetChild(0).gameObject.SetActive(false);
                _ageToNative.transform.GetChild(1).gameObject.SetActive(true);
                _ageToNative.transform.GetChild(1).GetComponent <Text> ().text = "指定しない";
                _ageHighAPIThrow = "";
            }

            /// 年齢の〜からの場合の処理
            if (string.IsNullOrEmpty(SearchCondition._ageFrom) == false)
            {
                _ageFromNative.transform.GetChild(0).gameObject.SetActive(false);
                _ageFromNative.transform.GetChild(1).gameObject.SetActive(true);
                _ageFromNative.transform.GetChild(1).GetComponent <Text> ().text = SearchCondition._ageFrom;
                _ageLowAPIThrow = SearchCondition._ageFrom;
            }
            else
            {
                _ageFromNative.transform.GetChild(0).gameObject.SetActive(false);
                _ageFromNative.transform.GetChild(1).gameObject.SetActive(true);
                _ageFromNative.transform.GetChild(1).GetComponent <Text> ().text = "";
                _ageLowAPIThrow = "";
            }

            /// 身長のまでの場合の処理。
            if (string.IsNullOrEmpty(SearchCondition._heightTo) == false)
            {
                _heightToNative.transform.GetChild(0).gameObject.SetActive(false);
                _heightToNative.transform.GetChild(1).gameObject.SetActive(true);
                _heightToNative.transform.GetChild(1).GetComponent <Text> ().text = SearchCondition._heightTo;
                _heightToAPIThrow = SearchCondition._heightTo;
            }
            else
            {
                _heightToNative.transform.GetChild(0).gameObject.SetActive(false);
                _heightToNative.transform.GetChild(1).gameObject.SetActive(true);
                _heightToNative.transform.GetChild(1).GetComponent <Text> ().text = "指定しない";
                _heightToAPIThrow = "";
            }

            /// 身長の〜からの場合の処理。
            if (string.IsNullOrEmpty(SearchCondition._heightFrom) == false)
            {
                _heightFromNative.transform.GetChild(0).gameObject.SetActive(false);
                _heightFromNative.transform.GetChild(1).gameObject.SetActive(true);
                _heightFromNative.transform.GetChild(1).GetComponent <Text> ().text = SearchCondition._heightFrom;
                _heightFromAPIThrow = SearchCondition._heightFrom;
            }
            else
            {
                _heightFromNative.transform.GetChild(0).gameObject.SetActive(false);
                _heightFromNative.transform.GetChild(1).gameObject.SetActive(true);
                _heightFromNative.transform.GetChild(1).GetComponent <Text> ().text = "指定しない";
                _heightFromAPIThrow = "";
            }

            /// 体型の条件の場合の初期化処理
            if (string.IsNullOrEmpty(SearchCondition._bodyType) == false)
            {
                _bodyTypeNative.transform.GetChild(0).gameObject.SetActive(false);
                _bodyTypeNative.transform.GetChild(1).gameObject.SetActive(true);
                _bodyTypeNative.transform.GetChild(1).GetComponent <Text> ().text = SearchCondition._bodyType;
                _bodyTypeAPIThrow = SearchCondition._bodyType;
            }
            else
            {
                _bodyTypeNative.transform.GetChild(0).gameObject.SetActive(false);
                _bodyTypeNative.transform.GetChild(1).gameObject.SetActive(true);
                _bodyTypeNative.transform.GetChild(1).GetComponent <Text> ().text = "指定しない";
                _bodyTypeAPIThrow = "";
            }

            ///// 画像あり、なしの条件の場合の処理
            if (string.IsNullOrEmpty(SearchCondition._isImage) == false)
            {
                _isImageNative.transform.GetChild(0).gameObject.SetActive(false);
                _isImageNative.transform.GetChild(1).gameObject.SetActive(true);

                if (SearchCondition._isImage == "0")
                {
                    _isImageNative.transform.GetChild(1).GetComponent <Text> ().text = "画像なし";
                }
                else if (SearchCondition._isImage == "1")
                {
                    _isImageNative.transform.GetChild(1).GetComponent <Text> ().text = "画像あり";
                }
                else
                {
                    _isImageNative.transform.GetChild(1).GetComponent <Text> ().text = "指定しない";
                }
                _isImageAPIThrow = SearchCondition._isImage;
            }
            else
            {
                _isImageNative.transform.GetChild(0).gameObject.SetActive(false);
                _isImageNative.transform.GetChild(1).GetComponent <Text> ().text = "指定しない";
                _isImageAPIThrow = "";
            }

            ///// 距離の条件の場合の初期化処理。
            if (string.IsNullOrEmpty(SearchCondition._radius) == false)
            {
                _radiusNative.transform.GetChild(0).gameObject.SetActive(false);
                _radiusNative.transform.GetChild(1).gameObject.SetActive(true);

                var radiusText = CommonModelHandle.GetByIdBaseData(SearchCondition._radius, CurrentProfSettingStateType.Radius);

                if (radiusText != null)
                {
                    _radiusNative.transform.GetChild(1).GetComponent <Text> ().text = radiusText.name;
                }
                else
                {
                    _radiusNative.transform.GetChild(1).GetComponent <Text> ().text = "指定しない";
                }
            }
            else
            {
                _radiusNative.transform.GetChild(0).gameObject.SetActive(false);
                _radiusNative.transform.GetChild(1).gameObject.SetActive(true);
                _radiusNative.transform.GetChild(1).GetComponent <Text> ().text = "指定しない";
            }

            /// キーワード条件の場合の初期化処理
            if (string.IsNullOrEmpty(SearchCondition._keyword) == false)
            {
                _keyword.text = SearchCondition._keyword;
            }

            yield break;
        }