public GiftHeader(GiftItemData giftItem, IProfile profile, bool isCurrentUser) { this.IsCurrentUser = isCurrentUser; this.Id = giftItem.id; this.FromId = giftItem.from_id; this.GiftHash = giftItem.gift_hash; this.Name = (profile != null ? profile.name : null) ?? CommonResources.AnonymousGift; this.Photo = profile != null ? profile.photo_max : null; this.Date = UIStringFormatterHelper.FormatDateTimeForUI(giftItem.date); Gift gift = giftItem.gift; this.GiftImage = gift != null ? gift.thumb_256 : null; this.Message = giftItem.message; this.FirstName = profile != null ? profile.first_name : null; this.FirstNameGen = profile != null ? profile.first_name_gen : null; string str = GiftHeader._currentCulture == CultureName.KZ ? this.FirstName : this.FirstNameGen; this.UsersGiftsStr = string.IsNullOrWhiteSpace(str) ? "" : string.Format(CommonResources.UsersGiftsFrm, str); this.NameTilt = this.FromId != 0L ? 1.5 : 0.0; this.CanSeeGifts = profile != null && profile.can_see_gifts == 1; this.IsMoreActionsVisible = this.IsCurrentUser || this.CanSeeGifts; this.MessageVisiblity = (!string.IsNullOrEmpty(this.Message)).ToVisiblity(); this.PrivacyDescriptionVisibility = (this.IsCurrentUser && giftItem.Privacy == GiftPrivacy.VisibleToRecipient).ToVisiblity(); this.MessageOrPrivacyDescriptionVisibility = (this.MessageVisiblity == System.Windows.Visibility.Visible || this.PrivacyDescriptionVisibility == 0).ToVisiblity(); this.SendBackVisibility = (this.IsCurrentUser && giftItem.from_id > 0L).ToVisiblity(); this.MoreActionsVisibility = this.IsMoreActionsVisible.ToVisiblity(); this.LightThemeVisibility = GiftHeader._themeHelper.PhoneLightThemeVisibility; this.DarkThemeVisibility = GiftHeader._themeHelper.PhoneDarkThemeVisibility; }
IEnumerator Loading() { WWWForm form = new WWWForm(); //check ID = 7 for test form.AddField("user_receive_id", UserCommonData.pGlobal.user.user_id); loader = new WWW(ShowGiftURL, form); yield return(loader); if (loader.error != null) { Debug.Log("HTTP ERROR"); LoadingScript.HideLoading(); yield break; } Debug.Log(loader.text); if (loader.text == "") { LoadingScript.HideLoading(); yield break; } yield return(new WaitForSeconds(3.0f)); JSONObject json = new JSONObject(loader.text); //Casting Data if (json["msg"].str == "OK") { //get Gift list JSONObject arr = json["gift"]; if (arr.list != null) { giftList = new GiftItemData[arr.list.Count]; } else { giftList = null; } int i = 0; foreach (JSONObject content in arr.list) { GiftItemData data = new GiftItemData(); data.GiftKey = content["user_gift_id"].str; data.name = StringUtil.ParseUnicodeEscapes(content["user_name"].str); data.id = int.Parse(content["GiftId"].str); data.giftName = StringUtil.ParseUnicodeEscapes(content["GiftName"].str); giftList[i] = data; i++; } } isFinish = true; if (postDownloaded != null) { postDownloaded(); } }
public void SetGiftItem(int idx, float Height, GiftItemData data) { NameText.text = data.name; GiftID = data.GiftKey; transform.localPosition = new Vector3(0, idx * -Height, 0); }