Esempio n. 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;
                        }
                    }
                }, () => {
                    //ピッカーをキャンセルにした場合。");
                });
            }
        }