Exemple #1
0
        public static InitDataEntity.FixedPropertyIdBase GetByIdBaseData(string id, CurrentProfSettingStateType type)
        {
            List <InitDataEntity.FixedPropertyIdBase> tmpSets = new List <InitDataEntity.FixedPropertyIdBase> ();

            InitDataEntity.FixedPropertyIdBase data = new InitDataEntity.FixedPropertyIdBase();

            if (type == CurrentProfSettingStateType.BloodType)
            {
                tmpSets = InitDataApi._httpCatchData.result.blood_type;
            }
            else if (type == CurrentProfSettingStateType.Radius)
            {
                tmpSets = InitDataApi._httpCatchData.result.radius;
            }
            else if (type == CurrentProfSettingStateType.Gender)
            {
                tmpSets = InitDataApi._httpCatchData.result.sex_cd;
            }

            foreach (var item in tmpSets)
            {
                if (item.id == id)
                {
                    data = item;
                    break;
                }
            }
            Debug.Log(data.name + " data.name data.name data.name ");
            return(data);
        }
        /// <summary>
        /// Gets the name master.
        /// 男女別じゃない、ID付きのマスターデータをリストで取得する用。
        /// </summary>
        /// <returns>The name master.</returns>
        /// <param name="type">Type.</param>
        public static List <InitDataEntity.FixedPropertyIdBase> GetNameMaster(CurrentProfSettingStateType type)
        {
            List <InitDataEntity.FixedPropertyIdBase> tmpList = new List <InitDataEntity.FixedPropertyIdBase> ();

            if (type == CurrentProfSettingStateType.BloodType)
            {
                tmpList = InitDataApi._httpCatchData.result.blood_type;
            }
            else if (type == CurrentProfSettingStateType.Radius)
            {
                tmpList = InitDataApi._httpCatchData.result.radius;
            }
            else if (type == CurrentProfSettingStateType.Gender)
            {
                tmpList = InitDataApi._httpCatchData.result.sex_cd;
            }
            else if (type == CurrentProfSettingStateType.BoardCategory)
            {
                tmpList = InitDataApi._httpCatchData.result.board_category;
            }
            else if (type == CurrentProfSettingStateType.UserSort)
            {
                tmpList = InitDataApi._httpCatchData.result.user_sort;
            }

            return(tmpList);
        }
        /// <summary>
        /// Inits the wait.
        /// </summary>
        /// <returns>The wait.</returns>
        private IEnumerator InitWait()
        {
            _currentProfSettingState = CurrentProfSettingStateType.None;
#if UNITY_EDITOR
            _birthdayObj.SetActive(true);
            _birthdayObjNative.SetActive(false);
            _dropdownYear.ClearOptions();
            _dropdownYear.options.Clear();

            _dropdownMonth.ClearOptions();
            _dropdownMonth.options.Clear();

            _dropdownDays.ClearOptions();
            _dropdownDays.options.Clear();

            //Year「年」設定 //マジックナンバーなんとかする
            _birthYear.Add("");
            for (int i = (System.DateTime.Now.Year - 18); i >= 1930; i--)
            {
                _birthYear.Add(i.ToString());
            }

            //Month「月」設定
            _birthMonth.Add("");
            for (int i = 1; i <= 12; i++)
            {
                _birthMonth.Add(i.ToString());
            }
            //Day「日」設定
            _birthDays.Add("");
            for (int i = 1; i <= 31; i++)
            {
                _birthDays.Add(i.ToString());
            }

            if (_dropdownYear != null && _birthYear != null)
            {
                _dropdownYear.AddOptions(_birthYear);
            }

            if (_dropdownMonth != null && _birthMonth != null)
            {
                _dropdownMonth.AddOptions(_birthMonth);
            }

            if (_dropdownDays != null && _birthDays != null)
            {
                _dropdownDays.AddOptions(_birthDays);
            }
#elif UNITY_IOS || UNITY_ANDROID
            _birthdayObj.SetActive(false);
            _birthdayObjNative.SetActive(true);

            float width  = Screen.width / 2;
            float height = Screen.width / 14;
            _drawRect = new Rect((Screen.width - width) / 2, height, width, height);
#endif
            yield break;
        }
 /// <summary>
 /// Places the of origin.
 /// 市区町村パネルのオープン
 /// </summary>
 public void PlaceOfOriginDetailOpen(GameObject animObj)
 {
     HeaderPanel.Instance.BackButtonSwitch(true, PlaceOfOriginDetailCloseEvent);
     _currentProfSettingState = CurrentProfSettingStateType.City;
     _profTemplatefInfiniteLimitScroll.Init();
     _backSwipe.EventMessageTarget = _panelProfileSetTemplate;
     PanelAnimate(animObj);
 }
        /// <summary>
        /// Backs the animate to destory.
        /// </summary>
        /// <returns>The animate to destory.</returns>
        private IEnumerator BackAnimateToDestory(GameObject go)
        {
            BackButton(go);
            while (go.transform.localPosition.x <= 1000f)
            {
                yield return(go.transform.localPosition.x >= 1000f);
            }
            Destroy(go);

            _cpsTypeSliderWeight = CurrentProfSettingStateType.None;
            _cpsTypeSliderHeight = CurrentProfSettingStateType.None;
        }
        /// <summary>
        /// Profiles the update API wait.
        /// </summary>
        /// <returns>The update API wait.</returns>
        private IEnumerator ProfileUpdateApiWait(GameObject animObj)
        {
            _loadingOverlay.SetActive(true);

            while (ProfileUpdateApi._success == false)
            {
                yield return(ProfileUpdateApi._success == true);
            }

            new GetUserApi();
            while (GetUserApi._success == false)
            {
                yield return(GetUserApi._success == true);
            }

            _loadingOverlay.SetActive(false);

            if (MypageEventManager.Instance != null)
            {
                MypageEventManager.Instance._userDataBasic = GetUserApi._httpCatchData.result.user;
            }

            //基本プロフィール作成OK♪
            AppStartLoadBalanceManager._isBaseProfile = true;
            AppStartLoadBalanceManager._gender        = GetUserApi._httpCatchData.result.user.sex_cd;
            _currentProfSettingState = CurrentProfSettingStateType.None;

            if (PanelChatDescripton.Instance != null)
            {
                //レビュー状態の時はランダムメッセージを送らないようにする
                if (PreRegistUser._httpCatchData.result.review == "false")
                {
                    PanelAnimate(PanelChatDescripton.Instance.gameObject);
                }
                else
                {
                    StarFinished();
                }
            }
            else
            {
                BackButton(animObj);
            }

            if (MypageEventManager.Instance != null)
            {
                //リロード
                SceneHandleManager.NextSceneRedirect(CommonConstants.MYPAGE_SCENE);
            }
        }
        /// <summary>
        /// Panels the edit open.
        /// </summary>
        /// <param name="animObj">Animation object.</param>
        public void PanelEditOpen(string state)
        {
            CurrentProfSettingStateType sType = (CurrentProfSettingStateType)System.Enum.Parse(typeof(CurrentProfSettingStateType), state);

            #if !UNITY_EDITOR && (UNITY_IOS || UNITY_ANDROID)
            NativePickerSet(sType);
            #elif UNITY_EDITOR
            HeaderPanel.Instance.BackButtonSwitch(false);
            HeaderPanel.Instance.BackButtonSwitch(true, EditCloseEvent);
            GameObject.FindGameObjectWithTag(CommonConstants.BACK_SWIPE).GetComponent <SwipeRecognizer>().EventMessageTarget = PanelProfileSetTemplate.Instance.gameObject;
            this.GetComponent <BoxCollider2D> ().enabled = false;

            MypageEventManager.Instance._currentProfSettingState = sType;
            _profTemplatefInfiniteLimitScroll.Init();

            MypageEventManager.Instance.PanelAnimate(PanelProfileSetTemplate.Instance.gameObject);
            #endif
        }
        /// <summary>
        /// Displaies the data set.
        /// </summary>
        /// <returns>The data set.</returns>
        /// <param name="stateType">State type.</param>
        /// <param name="setData">Set data.</param>
        private void DisplayDataSet(CurrentProfSettingStateType stateType, int key, string value)
        {
            switch (stateType)
            {
            case CurrentProfSettingStateType.Pref:
                _pref.text = value;
            #if UNITY_IOS
                MypageEventManager.Instance._prefId = (key).ToString();
            #else
                MypageEventManager.Instance._prefId = (key + 1).ToString();
            #endif

                break;

            case CurrentProfSettingStateType.City:
                var city = CommonModelHandle.GetCityDataByName(value);
                _city.text = value;
                MypageEventManager.Instance._cityId = city.id;
                break;

            case CurrentProfSettingStateType.BloodType:
                _bloodType.text = value + LocalMsgConst.BLOOD_TYPE_JA;
#if UNITY_IOS
                MypageEventManager.Instance._bloodType = (key).ToString();
#else
                MypageEventManager.Instance._bloodType = (key + 1).ToString();
#endif
                break;

            case CurrentProfSettingStateType.HairStyle:
                _hairStyle.text = value;
                MypageEventManager.Instance._hairStyle[0] = value;
                break;

            case CurrentProfSettingStateType.BodyType:
                _bodyType.text = value;
                MypageEventManager.Instance._bodyType [0] = value;
                break;

            case CurrentProfSettingStateType.Glasses:
                _glasses.text = value;
                MypageEventManager.Instance._glasses [0] = value;
                break;

            case CurrentProfSettingStateType.Type:
                _type.text = value;
                MypageEventManager.Instance._type [0] = value;
                break;

            case CurrentProfSettingStateType.Personality:
                _personality.text = value;
                MypageEventManager.Instance._personality [0] = value;
                break;

            case CurrentProfSettingStateType.Holiday:
                _holiday.text = value;
                MypageEventManager.Instance._holiday [0] = value;
                break;

            case CurrentProfSettingStateType.AnnualIncome:
                _annualIncome.text = value;
                MypageEventManager.Instance._annualIncome [0] = value;
                break;

            case CurrentProfSettingStateType.Education:
                _education.text = value;
                MypageEventManager.Instance._education [0] = value;
                break;

            case CurrentProfSettingStateType.Housemate:
                _housemate.text = value;
                MypageEventManager.Instance._housemate [0] = value;
                break;

            case CurrentProfSettingStateType.Sibling:
                _sibling.text = value;
                MypageEventManager.Instance._sibling [0] = value;
                break;

            case CurrentProfSettingStateType.Alcohol:
                _alcohol.text = value;
                MypageEventManager.Instance._alcohol [0] = value;
                break;

            case CurrentProfSettingStateType.Tobacco:
                _tobacco.text = value;
                MypageEventManager.Instance._tobacco [0] = value;
                break;

            case CurrentProfSettingStateType.Car:
                _car.text = value;
                MypageEventManager.Instance._car[0] = value;
                break;

            case CurrentProfSettingStateType.Pet:
                _pet.text = value;
                MypageEventManager.Instance._pet [0] = value;
                break;

            case CurrentProfSettingStateType.Hobby:
                _hobby.text = value;
                MypageEventManager.Instance._hobby [0] = value;
                break;

            case CurrentProfSettingStateType.Interest:
                _interest.text = value;
                MypageEventManager.Instance._interest [0] = value;
                break;

            case CurrentProfSettingStateType.Marital:
                _marital.text = value;
                MypageEventManager.Instance._marital[0] = value;
                break;
            }
        }
        /// <summary>
        /// Natives the picker set.
        /// </summary>
        /// <returns>The picker set.</returns>
        /// <param name="stateType">State type.</param>
        private void NativePickerSet(CurrentProfSettingStateType stateType)
        {
            string []     itemList = { "" };
            List <string> list     = new List <string> ();

            #if UNITY_IOS
            list.Add("");
            #endif


            switch (stateType)
            {
            case CurrentProfSettingStateType.Pref:
                var pref = CommonModelHandle.GetPrefData();
                foreach (var p in pref)
                {
                    list.Add(p.Value.name);
                }

                //都道府県選択のスキームに入るから市区町村のデータをリセット。
                MypageEventManager.Instance._cityId = "";
                _city.text = "";

                break;

            case CurrentProfSettingStateType.City:
                var city = CommonModelHandle.GetCityData(MypageEventManager.Instance._prefId);
                foreach (var c in city)
                {
                    list.Add(c.Value.name);
                }
                break;

            case CurrentProfSettingStateType.BloodType:
                foreach (var b in InitDataApi._httpCatchData.result.blood_type)
                {
                    list.Add(b.name);
                }
                break;

            case CurrentProfSettingStateType.Profile:

                break;

            case CurrentProfSettingStateType.HairStyle:
            case CurrentProfSettingStateType.BodyType:
            case CurrentProfSettingStateType.Glasses:
            case CurrentProfSettingStateType.Type:
            case CurrentProfSettingStateType.Personality:
            case CurrentProfSettingStateType.Holiday:
            case CurrentProfSettingStateType.AnnualIncome:
            case CurrentProfSettingStateType.Education:
            case CurrentProfSettingStateType.Housemate:
            case CurrentProfSettingStateType.Sibling:
            case CurrentProfSettingStateType.Alcohol:
            case CurrentProfSettingStateType.Tobacco:
            case CurrentProfSettingStateType.Car:
            case CurrentProfSettingStateType.Pet:
            case CurrentProfSettingStateType.Hobby:
            case CurrentProfSettingStateType.Interest:
            case CurrentProfSettingStateType.Marital:
                var item = CommonModelHandle.GetNameMaster(AppStartLoadBalanceManager._gender, stateType);
                foreach (var i in item)
                {
                    list.Add(i.name);
                }
                break;
            }

            if (list.Count > 0)
            {
                itemList = list.ToArray();

                NativePicker.Instance.ShowCustomPicker(toScreenRect(_drawRect), itemList, 0, (long val) => {
                    //プロフィールの変更がある事を通知する用
                    _isProfileChangeState = true;
                    for (int i = 0; i < list.Count; i++)
                    {
                        if ((int)val == i)
                        {
                            DisplayDataSet(stateType, i, list[i]);
                            break;
                        }
                    }
                }, () => {
                    //ピッカーをキャンセルにした場合。");
                });
            }
        }
        /// <summary>
        /// Gets the name master.
        /// 男女別にリスト取得するデータ群の取得用。
        /// </summary>
        /// <returns>The name master.</returns>
        /// <param name="gender">Gender.</param>
        /// <param name="type">Type.</param>
        public static List <InitDataEntity.NameOrSexCd> GetNameMaster(string gender, CurrentProfSettingStateType type)
        {
            List <InitDataEntity.NameOrSexCd> tmpList    = new List <InitDataEntity.NameOrSexCd> ();
            List <InitDataEntity.NameOrSexCd> returnData = new List <InitDataEntity.NameOrSexCd> ();

            switch (type)
            {
            case CurrentProfSettingStateType.BodyType:
                tmpList = InitDataApi._httpCatchData.result.body_type.list;
                break;

            case CurrentProfSettingStateType.HairStyle:
                tmpList = InitDataApi._httpCatchData.result.hair_style.list;
                break;

            case CurrentProfSettingStateType.Glasses:
                tmpList = InitDataApi._httpCatchData.result.glasses.list;
                break;

            case CurrentProfSettingStateType.Type:
                tmpList = InitDataApi._httpCatchData.result.type.list;
                break;

            case CurrentProfSettingStateType.Personality:
                tmpList = InitDataApi._httpCatchData.result.personality.list;
                break;

            case CurrentProfSettingStateType.Holiday:
                tmpList = InitDataApi._httpCatchData.result.holiday.list;
                break;

            case CurrentProfSettingStateType.AnnualIncome:
                tmpList = InitDataApi._httpCatchData.result.annual_income.list;
                break;

            case CurrentProfSettingStateType.Education:
                tmpList = InitDataApi._httpCatchData.result.education.list;
                break;

            case CurrentProfSettingStateType.Housemate:
                tmpList = InitDataApi._httpCatchData.result.housemate.list;
                break;

            case CurrentProfSettingStateType.Sibling:
                tmpList = InitDataApi._httpCatchData.result.sibling.list;
                break;

            case CurrentProfSettingStateType.Alcohol:
                tmpList = InitDataApi._httpCatchData.result.alcohol.list;
                break;

            case CurrentProfSettingStateType.Tobacco:
                tmpList = InitDataApi._httpCatchData.result.tobacco.list;
                break;

            case CurrentProfSettingStateType.Car:
                tmpList = InitDataApi._httpCatchData.result.car.list;
                break;

            case CurrentProfSettingStateType.Pet:
                tmpList = InitDataApi._httpCatchData.result.pet.list;
                break;

            case CurrentProfSettingStateType.Hobby:
                tmpList = InitDataApi._httpCatchData.result.hobby.list;
                break;

            case CurrentProfSettingStateType.Interest:
                tmpList = InitDataApi._httpCatchData.result.interest.list;
                break;

            case CurrentProfSettingStateType.Marital:
                tmpList = InitDataApi._httpCatchData.result.marital.list;
                break;
            }

            foreach (var item in tmpList)
            {
                if (item.sex_cd == gender)
                {
                    returnData.Add(item);
                }
            }
            return(returnData);
        }
        /// <summary>
        /// Gets the by name base data.
        /// </summary>
        /// <returns>The by name base data.</returns>
        /// <param name="name">Name.</param>
        /// <param name="type">Type.</param>
        public static InitDataEntity.FixedPropertyIdBase GetByNameBaseData(string name, CurrentProfSettingStateType type)
        {
            List <InitDataEntity.FixedPropertyIdBase> tmpSets = new List <InitDataEntity.FixedPropertyIdBase> ();

            InitDataEntity.FixedPropertyIdBase data = new InitDataEntity.FixedPropertyIdBase();

            if (type == CurrentProfSettingStateType.BloodType)
            {
                tmpSets = InitDataApi._httpCatchData.result.blood_type;
            }
            else if (type == CurrentProfSettingStateType.Radius)
            {
                tmpSets = InitDataApi._httpCatchData.result.radius;
            }
            else if (type == CurrentProfSettingStateType.Gender)
            {
                tmpSets = InitDataApi._httpCatchData.result.sex_cd;
            }
            else if (type == CurrentProfSettingStateType.BoardCategory)
            {
                tmpSets = InitDataApi._httpCatchData.result.board_category;
            }
            else if (type == CurrentProfSettingStateType.UserSort)
            {
                tmpSets = InitDataApi._httpCatchData.result.user_sort;
            }

            foreach (var item in tmpSets)
            {
                if (item.name == name)
                {
                    data = item;
                    break;
                }
            }
            return(data);
        }
        /// <summary>
        /// Places the of origin.
        /// 都道府県設定(出身地設定), 市区町村設定(出身地詳細)パネルのオープン
        /// </summary>
        public void PlaceOfOriginOpen(bool isPref)
        {
#if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IOS)
            //#if !UNITY_EDITOR && (UNITY_IOS)
            //Native Picker方式に変更。
            if (InitDataApi._httpCatchData != null)
            {
                List <string> tmpDataList = new List <string> ();
                string []     itemList    = { "" };

#if UNITY_IOS
                tmpDataList.Add("");
#endif

                //都道府県、選択。
                if (isPref == true)
                {
                    System.DateTime defaultSetDate = GetDateTimeByAge(18);

                    foreach (var tmpItem in InitDataApi._httpCatchData.result.pref)
                    {
                        tmpDataList.Add(tmpItem.name);
                    }
                    itemList = tmpDataList.ToArray();

                    //市区町村、選択。
                }
                else if (isPref == false && string.IsNullOrEmpty(_prefId) == false)
                {
                    foreach (var tmpItem in CommonModelHandle.GetCityData(_prefId))
                    {
                        tmpDataList.Add(tmpItem.Value.name);
                    }
                    itemList = tmpDataList.ToArray();
                }
                else
                {
                    Debug.Log(" 例外の処理。 ");
                    return;
                }

                //ここでイベントを「OKかキャンセル」のイベントをキャッチ。
                NativePicker.Instance.ShowCustomPicker(toScreenRect(_drawRect), itemList, (long val) =>
                {
                    if (isPref == true)
                    {
                        _currentProfSettingState = CurrentProfSettingStateType.Pref;
                        _cityId           = "";
                        _city.text        = "";
                        _userData.city_id = "";
                        _pref.text        = itemList[val];
#if UNITY_IOS
                        _prefId = ((int)val).ToString();
#else
                        _prefId = ((int)val + 1).ToString();
#endif

                        _userData.pref = _prefId;
                    }
                    else if (isPref == false)
                    {
                        _currentProfSettingState = CurrentProfSettingStateType.City;
                        _city.text        = itemList [val];
                        var city          = CommonModelHandle.GetCityDataByName(_city.text);
                        _cityId           = city.id;
                        _userData.city_id = _cityId;
                    }
                }, () => {
                    if (isPref == true)
                    {
                        _pref.text     = "指定しない";
                        _prefId        = "";
                        _userData.pref = _prefId;
                    }
                    else if (isPref == false)
                    {
                        if (string.IsNullOrEmpty(_prefId) == false)
                        {
                            _city.text        = "";
                            _cityId           = "";
                            _userData.city_id = _cityId;
                        }
                        else
                        {
                            Debug.Log("都道府県を先に選択してください的なポップアップが親切。");
                        }
                    }
                });
            }
#else
            HeaderPanel.Instance.BackButtonSwitch(false);
            HeaderPanel.Instance.BackButtonSwitch(true, PlaceOfOriginCloseEvent);
            if (isPref == true)
            {
                _currentProfSettingState = CurrentProfSettingStateType.Pref;
                _cityId           = "";
                _city.text        = "";
                _userData.city_id = "";
            }
            else if (isPref == false)
            {
                _currentProfSettingState = CurrentProfSettingStateType.City;
            }

            _profTemplatefInfiniteLimitScroll.Init();
            _backSwipe.EventMessageTarget = _panelProfileSetTemplate;

            PanelAnimate(_panelProfileSetTemplate);
                        #endif
        }