Beispiel #1
0
    public void OnUpdateItem(int itemCount, GameObject obj)
    {
        if (itemCount < 0 || itemCount >= max)
        {
            obj.SetActive(false);
        }
        else
        {
            obj.SetActive(true);

            if (obj.GetComponentInChildren <ProfileDataSetItem> () != null)
            {
                if (MypageEventManager.Instance != null)
                {
                    switch (MypageEventManager.Instance._currentProfSettingState)
                    {
                    case CurrentProfSettingStateType.Pref:
                        var pref = CommonModelHandle.GetPrefData();
                        id    = pref[itemCount].id;
                        value = pref[itemCount].name;
                        break;

                    case CurrentProfSettingStateType.City:
                        string prefId = MypageEventManager.Instance._prefId;
                        var    city   = CommonModelHandle.GetCityData(prefId);

                        if (city.Count > 0)
                        {
                            id    = city[itemCount].id;
                            value = city[itemCount].name;
                        }
                        break;

                    case CurrentProfSettingStateType.BloodType:
                        var bloodType = InitDataApi._httpCatchData.result.blood_type;
                        id    = bloodType [itemCount].id;
                        value = bloodType [itemCount].name;
                        break;

                    case CurrentProfSettingStateType.HairStyle:
                        var hairStyle = CommonModelHandle.GetNameMaster(
                            AppStartLoadBalanceManager._gender,
                            CurrentProfSettingStateType.HairStyle
                            );
                        id    = hairStyle [itemCount].name;
                        value = hairStyle [itemCount].name;
                        break;

                    case CurrentProfSettingStateType.BodyType:
                        var bodyType = CommonModelHandle.GetNameMaster(
                            AppStartLoadBalanceManager._gender,
                            CurrentProfSettingStateType.BodyType
                            );
                        id    = bodyType [itemCount].name;
                        value = bodyType [itemCount].name;
                        break;

                    case CurrentProfSettingStateType.Glasses:
                        var glasses = CommonModelHandle.GetNameMaster(
                            AppStartLoadBalanceManager._gender,
                            CurrentProfSettingStateType.Glasses
                            );
                        id    = glasses [itemCount].name;
                        value = glasses [itemCount].name;
                        break;

                    case CurrentProfSettingStateType.Type:
                        var type = CommonModelHandle.GetNameMaster(
                            AppStartLoadBalanceManager._gender,
                            CurrentProfSettingStateType.Type
                            );
                        id    = type [itemCount].name;
                        value = type [itemCount].name;
                        break;

                    case CurrentProfSettingStateType.Personality:
                        var personality = CommonModelHandle.GetNameMaster(
                            AppStartLoadBalanceManager._gender,
                            CurrentProfSettingStateType.Personality
                            );
                        id    = personality [itemCount].name;
                        value = personality [itemCount].name;
                        break;

                    case CurrentProfSettingStateType.Holiday:
                        var holiday = CommonModelHandle.GetNameMaster(
                            AppStartLoadBalanceManager._gender,
                            CurrentProfSettingStateType.Holiday
                            );
                        id    = holiday [itemCount].name;
                        value = holiday [itemCount].name;
                        break;

                    case CurrentProfSettingStateType.AnnualIncome:
                        var annualIncome = CommonModelHandle.GetNameMaster(
                            AppStartLoadBalanceManager._gender,
                            CurrentProfSettingStateType.AnnualIncome
                            );
                        id    = annualIncome [itemCount].name;
                        value = annualIncome [itemCount].name;
                        break;

                    case CurrentProfSettingStateType.Education:
                        var education = CommonModelHandle.GetNameMaster(
                            AppStartLoadBalanceManager._gender,
                            CurrentProfSettingStateType.Education
                            );
                        id    = education [itemCount].name;
                        value = education [itemCount].name;
                        break;

                    case CurrentProfSettingStateType.Housemate:
                        var housemate = CommonModelHandle.GetNameMaster(
                            AppStartLoadBalanceManager._gender,
                            CurrentProfSettingStateType.Housemate
                            );
                        id    = housemate [itemCount].name;
                        value = housemate [itemCount].name;
                        break;

                    case CurrentProfSettingStateType.Sibling:
                        var sibling = CommonModelHandle.GetNameMaster(
                            AppStartLoadBalanceManager._gender,
                            CurrentProfSettingStateType.Sibling
                            );
                        id    = sibling [itemCount].name;
                        value = sibling [itemCount].name;
                        break;

                    case CurrentProfSettingStateType.Alcohol:
                        var alcohol = CommonModelHandle.GetNameMaster(
                            AppStartLoadBalanceManager._gender,
                            CurrentProfSettingStateType.Alcohol
                            );
                        id    = alcohol [itemCount].name;
                        value = alcohol [itemCount].name;
                        break;

                    case CurrentProfSettingStateType.Tobacco:
                        var tobacco = CommonModelHandle.GetNameMaster(
                            AppStartLoadBalanceManager._gender,
                            CurrentProfSettingStateType.Tobacco
                            );
                        id    = tobacco [itemCount].name;
                        value = tobacco [itemCount].name;
                        break;

                    case CurrentProfSettingStateType.Car:
                        var car = CommonModelHandle.GetNameMaster(
                            AppStartLoadBalanceManager._gender,
                            CurrentProfSettingStateType.Car
                            );
                        id    = car [itemCount].name;
                        value = car [itemCount].name;
                        break;

                    case CurrentProfSettingStateType.Pet:
                        var pet = CommonModelHandle.GetNameMaster(
                            AppStartLoadBalanceManager._gender,
                            CurrentProfSettingStateType.Pet
                            );
                        id    = pet [itemCount].name;
                        value = pet [itemCount].name;
                        break;

                    case CurrentProfSettingStateType.Hobby:
                        var hobby = CommonModelHandle.GetNameMaster(
                            AppStartLoadBalanceManager._gender,
                            CurrentProfSettingStateType.Hobby
                            );
                        id    = hobby [itemCount].name;
                        value = hobby [itemCount].name;
                        break;

                    case CurrentProfSettingStateType.Interest:
                        var interest = CommonModelHandle.GetNameMaster(
                            AppStartLoadBalanceManager._gender,
                            CurrentProfSettingStateType.Interest
                            );
                        id    = interest [itemCount].name;
                        value = interest [itemCount].name;
                        break;

                    case CurrentProfSettingStateType.Marital:
                        var marital = CommonModelHandle.GetNameMaster(
                            AppStartLoadBalanceManager._gender,
                            CurrentProfSettingStateType.Marital
                            );
                        id    = marital [itemCount].name;
                        value = marital [itemCount].name;
                        break;

                    case CurrentProfSettingStateType.Gender:
                        var gender = InitDataApi._httpCatchData.result.sex_cd;
                        id    = gender[itemCount].id;
                        value = gender[itemCount].name;
                        break;

                    case CurrentProfSettingStateType.Radius:
                        var radius = InitDataApi._httpCatchData.result.radius;
                        id    = radius[itemCount].id;
                        value = radius[itemCount].name;
                        break;
                    }
                }

                if (PanelStartInputUserData.Instance != null)
                {
                    switch (PanelStartInputUserData.Instance._currentProfSettingState)
                    {
                    case CurrentProfSettingStateType.Pref:
                        var pref = CommonModelHandle.GetPrefData();
                        id    = pref [itemCount].id;
                        value = pref [itemCount].name;
                        break;

                    case CurrentProfSettingStateType.City:
                        string prefId = PanelStartInputUserData.Instance._prefId;
                        var    city   = CommonModelHandle.GetCityData(prefId);

                        if (city.Count > 0)
                        {
                            id    = city [itemCount].id;
                            value = city [itemCount].name;
                        }
                        break;
                    }
                }
                var item = obj.GetComponentInChildren <ProfileDataSetItem> ();
                item.UpdateItem(itemCount, id, value);
            }
        }
    }
        /// <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;
                        }
                    }
                }, () => {
                    //ピッカーをキャンセルにした場合。");
                });
            }
        }
Beispiel #3
0
    /// <summary>
    /// Set this instance.
    /// </summary>
    private IEnumerator Set()
    {
        var controllers = GetComponents <MonoBehaviour>()
                          .Where(item => item is IInfiniteScrollSetup)
                          .Select(item => item as IInfiniteScrollSetup)
                          .ToList();

        if (MypageEventManager.Instance)
        {
            switch (MypageEventManager.Instance._currentProfSettingState)
            {
            case CurrentProfSettingStateType.Pref:
                max = InitDataApi._httpCatchData.result.pref.Count;
                break;

            case CurrentProfSettingStateType.City:
                string prefId = MypageEventManager.Instance._prefId;
                max = CommonModelHandle.GetCityData(prefId).Count;
                break;

            case CurrentProfSettingStateType.BloodType:
                max = InitDataApi._httpCatchData.result.blood_type.Count;
                break;

            case CurrentProfSettingStateType.HairStyle:
                max = CommonModelHandle.GetNameMaster(
                    AppStartLoadBalanceManager._gender,
                    CurrentProfSettingStateType.HairStyle
                    ).Count;
                break;

            case CurrentProfSettingStateType.BodyType:
                max = CommonModelHandle.GetNameMaster(
                    AppStartLoadBalanceManager._gender,
                    CurrentProfSettingStateType.BodyType
                    ).Count;
                break;

            case CurrentProfSettingStateType.Glasses:
                max = CommonModelHandle.GetNameMaster(
                    AppStartLoadBalanceManager._gender,
                    CurrentProfSettingStateType.Glasses
                    ).Count;
                break;

            case CurrentProfSettingStateType.Type:
                max = CommonModelHandle.GetNameMaster(
                    AppStartLoadBalanceManager._gender,
                    CurrentProfSettingStateType.Type
                    ).Count;
                break;

            case CurrentProfSettingStateType.Personality:
                max = CommonModelHandle.GetNameMaster(
                    AppStartLoadBalanceManager._gender,
                    CurrentProfSettingStateType.Personality
                    ).Count;
                break;

            case CurrentProfSettingStateType.Holiday:
                max = CommonModelHandle.GetNameMaster(
                    AppStartLoadBalanceManager._gender,
                    CurrentProfSettingStateType.Holiday
                    ).Count;
                break;

            case CurrentProfSettingStateType.AnnualIncome:
                max = CommonModelHandle.GetNameMaster(
                    AppStartLoadBalanceManager._gender,
                    CurrentProfSettingStateType.AnnualIncome
                    ).Count;
                break;

            case CurrentProfSettingStateType.Education:
                max = CommonModelHandle.GetNameMaster(
                    AppStartLoadBalanceManager._gender,
                    CurrentProfSettingStateType.Education
                    ).Count;
                break;

            case CurrentProfSettingStateType.Housemate:
                max = CommonModelHandle.GetNameMaster(
                    AppStartLoadBalanceManager._gender,
                    CurrentProfSettingStateType.Housemate
                    ).Count;
                break;

            case CurrentProfSettingStateType.Sibling:
                max = CommonModelHandle.GetNameMaster(
                    AppStartLoadBalanceManager._gender,
                    CurrentProfSettingStateType.Sibling
                    ).Count;
                break;

            case CurrentProfSettingStateType.Alcohol:
                max = CommonModelHandle.GetNameMaster(
                    AppStartLoadBalanceManager._gender,
                    CurrentProfSettingStateType.Alcohol
                    ).Count;
                break;

            case CurrentProfSettingStateType.Tobacco:
                max = CommonModelHandle.GetNameMaster(
                    AppStartLoadBalanceManager._gender,
                    CurrentProfSettingStateType.Tobacco
                    ).Count;
                break;

            case CurrentProfSettingStateType.Car:
                max = CommonModelHandle.GetNameMaster(
                    AppStartLoadBalanceManager._gender,
                    CurrentProfSettingStateType.Car
                    ).Count;
                break;

            case CurrentProfSettingStateType.Pet:
                max = CommonModelHandle.GetNameMaster(
                    AppStartLoadBalanceManager._gender,
                    CurrentProfSettingStateType.Pet
                    ).Count;
                break;

            case CurrentProfSettingStateType.Hobby:
                max = CommonModelHandle.GetNameMaster(
                    AppStartLoadBalanceManager._gender,
                    CurrentProfSettingStateType.Hobby
                    ).Count;
                break;

            case CurrentProfSettingStateType.Interest:
                max = CommonModelHandle.GetNameMaster(
                    AppStartLoadBalanceManager._gender,
                    CurrentProfSettingStateType.Interest
                    ).Count;
                break;

            case CurrentProfSettingStateType.Marital:
                max = CommonModelHandle.GetNameMaster(
                    AppStartLoadBalanceManager._gender,
                    CurrentProfSettingStateType.Marital
                    ).Count;
                break;

            case CurrentProfSettingStateType.Gender:
                max = InitDataApi._httpCatchData.result.sex_cd.Count;
                break;

            case CurrentProfSettingStateType.Radius:
                max = InitDataApi._httpCatchData.result.radius.Count;
                break;
            }
        }

        if (PanelStartInputUserData.Instance != null)
        {
            switch (PanelStartInputUserData.Instance._currentProfSettingState)
            {
            case CurrentProfSettingStateType.Pref:
                max = InitDataApi._httpCatchData.result.pref.Count;
                break;

            case CurrentProfSettingStateType.City:
                string prefId = PanelStartInputUserData.Instance._prefId;
                max = CommonModelHandle.GetCityData(prefId).Count;
                break;
            }
        }

        for (int i = 0; i < m_instantateItemCount; i++)
        {
            var item = Instantiate(m_ItemBase) as RectTransform;
            item.SetParent(transform, false);
            item.name             = i.ToString();
            item.anchoredPosition =
                (direction == Direction.Vertical) ?
                new Vector2(0, -ItemScale * (i)) :
                new Vector2(ItemScale * (i), 0);
            m_itemList.Add(item);

            item.gameObject.SetActive(true);

            foreach (var controller in controllers)
            {
                controller.OnUpdateItem(i, item.gameObject);
            }
        }

        foreach (var controller in controllers)
        {
            controller.OnPostSetupItems();
        }
        _isUpdateTrigger = true;
        yield break;
    }
        /// <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
        }