/// <summary> /// Sets the data. /// 登録する用にセット。 /// </summary> /// <returns>The data.</returns> public void SetData() { string prefId = ""; string cityId = ""; prefId = _prefId; cityId = _cityId; _userData.user_key = AppStartLoadBalanceManager._userKey; _userData.pref = prefId; _userData.city_id = cityId; _userData.name = _nickName.GetComponent <InputField> ().text; #if UNITY_EDITOR string birthDate = ""; if ( string.IsNullOrEmpty(_dropdownYear.GetComponentInChildren <Text> ().text) == false && string.IsNullOrEmpty(_dropdownMonth.GetComponentInChildren <Text> ().text) == false && string.IsNullOrEmpty(_dropdownDays.GetComponentInChildren <Text> ().text) == false ) { birthDate = _dropdownYear.GetComponentInChildren <Text> ().text + "-" + _dropdownMonth.GetComponentInChildren <Text> ().text + "-" + _dropdownDays.GetComponentInChildren <Text> ().text; } _userData.birth_date = birthDate; #endif _userData.sex_cd = AppStartLoadBalanceManager._gender; if (string.IsNullOrEmpty(CommonModelHandle.GetPrefDataById(prefId).name) == false) { _pref.text = CommonModelHandle.GetPrefDataById(prefId).name; } if (string.IsNullOrEmpty(CommonModelHandle.GetCityDataById(cityId).name) == false) { _city.text = CommonModelHandle.GetCityDataById(cityId).name; } }
/// <summary> /// Sets the data. /// マスターデータから動的に値が変更する所用 /// </summary> public void SetData() { string prefId = MypageEventManager.Instance._prefId; string cityId = MypageEventManager.Instance._cityId; string bloodTypeId = MypageEventManager.Instance._bloodType; string birthDate = ""; #if UNITY_EDITOR //生年月日 if (_dropdownYear.value != 0 && _dropdownMonth.value != 0 && _dropdownDays.value != 0) { birthDate = _birthYear [_dropdownYear.value] + "-" + _birthMonth [_dropdownMonth.value] + "-" + _birthDays [_dropdownDays.value]; } else if (_dropdownYear.GetComponentInChildren <Text>().text != null && _dropdownMonth.GetComponentInChildren <Text>().text != null && _dropdownDays.GetComponentInChildren <Text>().text != null ) { birthDate = _dropdownYear.GetComponentInChildren <Text>().text + "-" + _dropdownMonth.GetComponentInChildren <Text>().text + "-" + _dropdownDays.GetComponentInChildren <Text>().text; } #elif !UNITY_EDITOR && UNITY_IOS || UNITY_ANDROID //IOSとアンドロイドの場合の処理。 if (string.IsNullOrEmpty(MypageEventManager.Instance._birthDate) == false) { birthDate = MypageEventManager.Instance._birthDate; string[] bdArray = MypageEventManager.Instance._birthDate.Split('-'); _birthdayObjNative.transform.GetChild(0).gameObject.SetActive(false); _birthdayObjNative.transform.GetChild(1).GetComponent <Text> ().text = string.Format("{0}年{1}月{2}日", bdArray[0], bdArray[1], bdArray[2]); } #endif //プロフ更新APIに送信するデータをセット。 //データをセットする箇所 MypageEventManager.Instance._userDataBasic.user_key = AppStartLoadBalanceManager._userKey; //性別は規定、変えれない。 MypageEventManager.Instance._userDataBasic.sex_cd = AppStartLoadBalanceManager._gender; MypageEventManager.Instance._userDataBasic.name = _nickName.GetComponent <InputField> ().text; MypageEventManager.Instance._userDataBasic.birth_date = birthDate; MypageEventManager.Instance._userDataBasic.height = _tall.text; MypageEventManager.Instance._userDataBasic.weight = _weight.text; MypageEventManager.Instance._userDataBasic.pref = prefId; if (MypageEventManager.Instance._prefChange == true) { MypageEventManager.Instance._userDataBasic.city_id = ""; } else { MypageEventManager.Instance._userDataBasic.city_id = cityId; } MypageEventManager.Instance._userDataBasic.blood_type = bloodTypeId; MypageEventManager.Instance._userDataBasic.profile = MypageEventManager.Instance._profile; MypageEventManager.Instance._userDataBasic.hair_style = MypageEventManager.Instance._hairStyle; MypageEventManager.Instance._userDataBasic.body_type = MypageEventManager.Instance._bodyType; MypageEventManager.Instance._userDataBasic.glasses = MypageEventManager.Instance._glasses; MypageEventManager.Instance._userDataBasic.type = MypageEventManager.Instance._type; //TODO: 複数選択可・対応 MypageEventManager.Instance._userDataBasic.personality = MypageEventManager.Instance._personality; //TODO: 複数選択可・対応 MypageEventManager.Instance._userDataBasic.holiday = MypageEventManager.Instance._holiday; MypageEventManager.Instance._userDataBasic.annual_income = MypageEventManager.Instance._annualIncome; MypageEventManager.Instance._userDataBasic.education = MypageEventManager.Instance._education; MypageEventManager.Instance._userDataBasic.housemate = MypageEventManager.Instance._housemate; MypageEventManager.Instance._userDataBasic.hair_style = MypageEventManager.Instance._hairStyle; MypageEventManager.Instance._userDataBasic.sibling = MypageEventManager.Instance._sibling; MypageEventManager.Instance._userDataBasic.alcohol = MypageEventManager.Instance._alcohol; MypageEventManager.Instance._userDataBasic.tobacco = MypageEventManager.Instance._tobacco; MypageEventManager.Instance._userDataBasic.car = MypageEventManager.Instance._car; MypageEventManager.Instance._userDataBasic.pet = MypageEventManager.Instance._pet; MypageEventManager.Instance._userDataBasic.hobby = MypageEventManager.Instance._hobby; MypageEventManager.Instance._userDataBasic.interest = MypageEventManager.Instance._interest; MypageEventManager.Instance._userDataBasic.marital = MypageEventManager.Instance._marital; //選択、入力した項目をヴューにセットするデータ。 if (string.IsNullOrEmpty(prefId) == false) { _pref.text = CommonModelHandle.GetPrefDataById(prefId).name; } if (MypageEventManager.Instance._prefChange == true) { _city.text = ""; MypageEventManager.Instance._prefChange = false; } else if (string.IsNullOrEmpty(cityId) == false) { _city.text = CommonModelHandle.GetCityDataById(cityId).name; } if (MypageEventManager.Instance._hairStyle != null && MypageEventManager.Instance._hairStyle.Count > 0) { _hairStyle.text = MypageEventManager.Instance._hairStyle[0]; } if (MypageEventManager.Instance._bodyType != null && MypageEventManager.Instance._bodyType.Count > 0) { _bodyType.text = MypageEventManager.Instance._bodyType[0]; } if (MypageEventManager.Instance._glasses != null && MypageEventManager.Instance._glasses.Count > 0) { _glasses.text = MypageEventManager.Instance._glasses[0]; } if (MypageEventManager.Instance._type != null && MypageEventManager.Instance._type.Count > 0) { _type.text = MypageEventManager.Instance._type[0]; //TODO: 複数選択可・対応 } if (MypageEventManager.Instance._personality != null && MypageEventManager.Instance._personality.Count > 0) { _personality.text = MypageEventManager.Instance._personality[0]; //TODO: 複数選択可・対応 } if (MypageEventManager.Instance._holiday != null && MypageEventManager.Instance._holiday.Count > 0) { _holiday.text = MypageEventManager.Instance._holiday[0]; } if (MypageEventManager.Instance._annualIncome != null && MypageEventManager.Instance._annualIncome.Count > 0) { _annualIncome.text = MypageEventManager.Instance._annualIncome[0]; } if (MypageEventManager.Instance._education != null && MypageEventManager.Instance._education.Count > 0) { _education.text = MypageEventManager.Instance._education[0]; } if (MypageEventManager.Instance._housemate != null && MypageEventManager.Instance._housemate.Count > 0) { _housemate.text = MypageEventManager.Instance._housemate[0]; } if (MypageEventManager.Instance._sibling != null && MypageEventManager.Instance._sibling.Count > 0) { _sibling.text = MypageEventManager.Instance._sibling[0]; } if (MypageEventManager.Instance._alcohol != null && MypageEventManager.Instance._alcohol.Count > 0) { _alcohol.text = MypageEventManager.Instance._alcohol[0]; } if (MypageEventManager.Instance._tobacco != null && MypageEventManager.Instance._tobacco.Count > 0) { _tobacco.text = MypageEventManager.Instance._tobacco[0]; } if (MypageEventManager.Instance._car != null && MypageEventManager.Instance._car.Count > 0) { _car.text = MypageEventManager.Instance._car[0]; } if (MypageEventManager.Instance._pet != null && MypageEventManager.Instance._pet.Count > 0) { _pet.text = MypageEventManager.Instance._pet[0]; } if (MypageEventManager.Instance._hobby != null && MypageEventManager.Instance._hobby.Count > 0) { _hobby.text = MypageEventManager.Instance._hobby[0]; } if (MypageEventManager.Instance._interest != null && MypageEventManager.Instance._interest.Count > 0) { _interest.text = MypageEventManager.Instance._interest[0]; } if (MypageEventManager.Instance._marital != null && MypageEventManager.Instance._marital.Count > 0) { _marital.text = MypageEventManager.Instance._marital[0]; } _nickName.GetComponent <InputField> ().text = MypageEventManager.Instance._nickName; if (MypageEventManager.Instance._cpsTypeSliderWeight == CurrentProfSettingStateType.None) { _weight.text = MypageEventManager.Instance._weight; _weightSlider.value = float.Parse(MypageEventManager.Instance._weight); } if (MypageEventManager.Instance._cpsTypeSliderHeight == CurrentProfSettingStateType.None) { _tall.text = MypageEventManager.Instance._tall; _tallSlider.value = float.Parse(MypageEventManager.Instance._tall); } if (AppStartLoadBalanceManager._gender == ((int)GenderType.FeMale).ToString()) { _gender.text = LocalMsgConst.GENDER_FEMALE; } else if (AppStartLoadBalanceManager._gender == ((int)GenderType.Male).ToString()) { _gender.text = LocalMsgConst.GENDER_MALE; } if (MypageEventManager.Instance._profile.Length == 0) { _profile.text = "未入力"; } else if (MypageEventManager.Instance._profile.Length >= 20) { _profile.text = MypageEventManager.Instance._profile.Substring(0, 20) + "…"; } else { _profile.text = MypageEventManager.Instance._profile.Substring(0, MypageEventManager.Instance._profile.Length) + "…"; } _profileInput.GetComponent <InputField> ().text = MypageEventManager.Instance._profile; if (string.IsNullOrEmpty(bloodTypeId) == false) { string bloodTypeMsg = CommonModelHandle.GetByIdBaseData(bloodTypeId, CurrentProfSettingStateType.BloodType).name; _bloodType.text = bloodTypeMsg + LocalMsgConst.BLOOD_TYPE_JA; } }
/// <summary> /// Updates the item. /// </summary> /// <returns>The item.</returns> /// <param name="">.</param> //public void UpdateItem (int count, MessageUserListEntity.UserList user) public void UpdateItem(int count, UserDataEntity.Basic user = null) { _userPict.gameObject.name = user.id; this.transform.GetComponent <Button> ().onClick.AddListener(NomalClick); _titleBg.SetActive(true); _prTextBg.SetActive(false); //リストの間に広告バナーを導入。 if (user.is_banner == "1") { if (CommonConstants.IS_AD_NEND == true) { _titleBg.SetActive(false); _prTextBg.SetActive(true); AppStartLoadBalanceManager.m_NendAdClient.LoadNativeAd((INativeAd ad, int code, string message) => { if (null != ad) { _prNendUrl = ad.PromotionUrl; this.transform.GetComponent <Button> ().onClick.RemoveAllListeners(); this.transform.GetComponent <Button> ().onClick.AddListener(NendAdClick); // 広告明示のテキストを取得します _read.text = ad.GetAdvertisingExplicitlyText(AdvertisingExplicitly.AD); _read.color = new Color(128 / 255.0f, 128 / 255.0f, 128 / 255.0f, 255); // 広告見出しを取得します _userName.text = "<size=40>" + ad.ShortText + "</size>"; _prText.text = ad.LongText; // 広告画像のTextureをダウンロードします new HTTPRequest(new Uri(ad.AdImageUrl), (request, response) => { if (_userPict != null && response != null) { _userPict.texture = response.DataAsTexture2D; } }).Send(); // インプレッションの計測とクリック処理の登録を行います ad.Activate(this.gameObject, _userName.gameObject); } else { Debug.Log("Failed to load ad. code =" + code + ", message = " + message); } }); } else { _addView.SetActive(true); _addView.name = user.url; new HTTPRequest(new Uri(user.image_url), (request, response) => _addRawImage.texture = response.DataAsTexture2D).Send(); return; } return; } if (_userName != null) { string userNameStr = user.name.Replace("\n", ""); if (userNameStr.Length > 15) { _userName.text = userNameStr.Substring(0, 15) + "..."; } else { _userName.text = userNameStr; } } if (_userPlace != null) { string pref = ""; string city = ""; if (string.IsNullOrEmpty(user.pref) == false) { pref = CommonModelHandle.GetPrefDataById(user.pref).name; } if (string.IsNullOrEmpty(user.city_id) == false) { city = CommonModelHandle.GetCityDataById(user.city_id).name; } string place = string.Format("{0} {1} {2}", user.distance, pref, city); _userPlace.text = place; } if (_eazyTitle != null) { string bodyStr = user.profile.Replace("\n", ""); if (bodyStr.Length > 15) { _eazyTitle.text = bodyStr.Substring(0, 15) + "..."; } else { _eazyTitle.text = bodyStr; } } if (_dateTime != null) { _dateTime.text = user.time_ago; } if (_read != null) { _read.text = ""; //"未読"; } //プロフ表示。 if (_userPict != null && string.IsNullOrEmpty(user.profile_image_url) == false) { if (SearchEventManager.Instance._profTexCaches.ContainsKey(user.profile_image_url) == true) { _userPict.gameObject.SetActive(true); _userPict.texture = SearchEventManager.Instance._profTexCaches[user.profile_image_url]; return; } else { StartCoroutine(WwwToRendering(user.profile_image_url, _userPict)); } } }
/// <summary> /// Updates the item. /// </summary> /// <param name="count">Count.</param> /// <param name="id">Identifier.</param> /// <param name="itemName">Item name.</param> public void UpdateItem(int count, UserDataEntity.Basic user) { if (user != null) { this.gameObject.name = user.id; _userName.text = user.name; string userNameStr = user.name.Replace("\n", ""); if (userNameStr.Length > 15) { _userName.text = userNameStr.Substring(0, 15) + "..."; } else { _userName.text = userNameStr + "( " + user.age + LocalMsgConst.AGE_TEXT + " )"; } string bodyStr = user.profile.Replace("\n", ""); if (bodyStr.Length > 15) { _eazyTitle.text = bodyStr.Substring(0, 15) + "..."; } else { _eazyTitle.text = bodyStr; } _dateTime.text = user.time_ago; _userPlace.text = CommonModelHandle.GetPrefDataById(user.pref).name + " " + CommonModelHandle.GetCityDataById(user.city_id).name; _read.text = ""; if (string.IsNullOrEmpty(user.profile_image_url) == false && _userPict != null) { StartCoroutine(WwwToRendering(user.profile_image_url, _userPict)); } } }
/// <summary> /// Gets the profile API. /// </summary> /// <returns>The profile API.</returns> /// <param name="toUserId">To user identifier.</param> private IEnumerator GetProfileApi(string toUserId) { _profImage.texture = Resources.Load("Texture/noimage_user") as Texture; _coverImage.texture = Resources.Load("Texture/noimage_cover") as Texture; _loadingOverlay.SetActive(true); while (GetUserApi._success == false) { yield return(GetUserApi._success == true); } string isFavorite = GetUserApi._httpOtherUserCatchData.is_favorite; string isBlock = GetUserApi._httpOtherUserCatchData.is_block; if (isBlock == "true") { _blockButton.GetChild(0).gameObject.SetActive(true); } else if (isBlock == "false") { _blockButton.GetChild(0).gameObject.SetActive(false); } if (isFavorite == "true") { _favoriteButton.GetChild(0).gameObject.SetActive(true); } else if (isFavorite == "false") { _favoriteButton.GetChild(0).gameObject.SetActive(false); } string islimitrelease = GetUserApi._httpOtherUserCatchData.is_limit_release; if (islimitrelease == "true") { _LimitMessageButton.GetComponent <Button> ().enabled = false; _LimitMessageButton.GetComponent <Image> ().color = new Color(147 / 255.0f, 147 / 255.0f, 147 / 255.0f, 255); } else if (islimitrelease == "false") { _LimitMessageButton.GetComponent <Image> ().color = new Color(247 / 255.0f, 117 / 255.0f, 133 / 255.0f, 255); _LimitMessageButton.GetComponent <Button> ().enabled = true; } _loadingOverlay.SetActive(false); var user = GetUserApi._httpOtherUserCatchData; if (string.IsNullOrEmpty(user.profile_image_url) == false && _profImage != null) { StartCoroutine(WwwToRendering(user.profile_image_url, _profImage)); } else { _profImage.texture = Resources.Load("Texture/noimage_user") as Texture; } if (string.IsNullOrEmpty(user.cover_image_url) == false && _coverImage != null) { StartCoroutine(WwwToRendering(user.cover_image_url, _coverImage)); } else { _coverImage.texture = Resources.Load("Texture/noimage_cover") as Texture; } if (_name != null) { _name.text = user.name; } if (_sex_cd != null) { if (user.sex_cd == ((int)GenderType.FeMale).ToString()) { _sex_cd.text = LocalMsgConst.GENDER_FEMALE; } else if (user.sex_cd == ((int)GenderType.Male).ToString()) { _sex_cd.text = LocalMsgConst.GENDER_MALE; } } if (_blood_type != null) { string bloodText = user.blood_type; if (bloodText == "0") { _blood_type.text = "秘密"; } else { string bloodTypeMsg = CommonModelHandle.GetByIdBaseData(user.blood_type, CurrentProfSettingStateType.BloodType).name; _blood_type.text = bloodTypeMsg + LocalMsgConst.BLOOD_TYPE_JA; } } if (_prefAndCity != null) { string prefName = CommonModelHandle.GetPrefDataById(user.pref).name; string cityName = CommonModelHandle.GetCityDataById(user.city_id).name; _prefAndCity.text = prefName + "" + cityName; } if (_birth_date != null) { if (user.age == "0") { _birth_date.text = "秘密"; } else { _birth_date.text = user.age + "歳"; } } if (_height != null) { if (user.height == "0") { _height.text = "秘密"; } else { _height.text = user.height + "cm"; } } if (_weight != null) { if (user.weight == "0") { _weight.text = "秘密"; } else { _weight.text = user.weight + "kg"; } } if (_profile != null) { _profile.text = user.profile; } if (_body_type != null && user.body_type != null && user.body_type.Count > 0) { _body_type.text = user.body_type[0]; } if (_hair_style != null && user.hair_style != null && user.hair_style.Count > 0) { _hair_style.text = user.hair_style[0]; } if (_glasses != null && user.glasses != null && user.glasses.Count > 0) { _glasses.text = user.glasses[0]; } if (_type != null && user.type != null && user.type.Count > 0) { _type.text = user.type[0];//TODO: 複数選択可・対応 } if (_personality != null && user.personality != null && user.personality.Count > 0) { _personality.text = user.personality[0];//TODO: 複数選択可・対応 } if (_holiday != null && user.holiday != null && user.holiday.Count > 0) { _holiday.text = user.holiday[0]; } if (_annual_income && user.annual_income != null && user.annual_income.Count > 0) { _annual_income.text = user.annual_income[0]; } if (_education != null && user.education != null && user.education.Count > 0) { _education.text = user.education[0]; } if (_housemate != null && user.housemate != null && user.housemate.Count > 0) { _housemate.text = user.housemate[0]; } if (_sibling != null && user.sibling != null && user.sibling.Count > 0) { _sibling.text = user.sibling[0]; } if (_alcohol != null && user.alcohol != null && user.alcohol.Count > 0) { _alcohol.text = user.alcohol[0]; } if (_tobacco != null && user.tobacco != null && user.tobacco.Count > 0) { _tobacco.text = user.tobacco[0]; } if (_car != null && user.car != null && user.car.Count > 0) { _car.text = user.car[0]; } if (_pet != null && user.pet != null && user.pet.Count > 0) { _pet.text = user.pet[0]; } if (_hobby != null && user.hobby != null && user.hobby.Count > 0) { _hobby.text = user.hobby[0]; } if (_interest != null && user.interest != null && user.interest.Count > 0) { _interest.text = user.interest[0]; } if (_marital != null && user.marital != null && user.marital.Count > 0) { _marital.text = user.marital[0]; } _headerTitle.GetComponent <Text> ().text = GetUserApi._httpOtherUserCatchData.name; }
/// <summary> /// Updates the item. /// </summary> /// <returns>The item.</returns> /// <param name="">.</param> /// public void UpdateItem (int count, MessageUserListEntity.UserList user) public void UpdateItem(int count, MessageUserListEntity.UserList user, bool isInfo = false) { if (isInfo == true) { this.gameObject.name = "info_" + user.user.id + "-" + user.time_ago; } else { this.gameObject.name = user.user.id; } _delObj.name = user.user.id; if (PanelTalkList.Instance._displayState == PanelTalkList.DisplayState.ListShow) { _delObj.GetComponent <Toggle> ().isOn = false; this.GetComponent <Button> ().enabled = true; } else { if (PanelTalkList.Instance._msgDeleteList.Count > 0) { if (PanelTalkList.Instance._msgDeleteList.Contains(_delObj.name) == false) { _delObj.GetComponent <Toggle> ().isOn = false; } else if (PanelTalkList.Instance._msgDeleteList.Contains(_delObj.name) == true) { _delObj.GetComponent <Toggle> ().isOn = true; } } } if (_userPict != null && string.IsNullOrEmpty(user.user.profile_image_url) == false) { StartCoroutine(WwwToRendering(user.user.profile_image_url, _userPict)); } if (_userName != null) { string userNameStr = user.user.name.Replace("\n", ""); if (userNameStr.Length > 15) { _userName.text = userNameStr.Substring(0, 15) + "..."; } else { _userName.text = userNameStr + "( " + user.user.age + LocalMsgConst.AGE_TEXT + " )"; } } if (_userPlace != null) { _userPlace.text = CommonModelHandle.GetPrefDataById(user.user.pref).name + " " + CommonModelHandle.GetCityDataById(user.user.city_id).name; } if (_eazyTitle != null) { if (user.message.Length > 20) { _eazyTitle.text = user.message.Substring(0, 20) + "…"; } else { _eazyTitle.text = user.message; } } if (_dateTime != null) { _dateTime.text = user.time_ago; } if (_read != null) { if (EventManager.MessageEventManager.Instance._msgReads.Contains(user.user.id)) { _read.text = ""; } else { _read.text = user.status; } } }