public override void OnWebServiceResponse(WebServiceCode.Code code, WebServiceStatus.Status status, string data) { switch (code) { case WebServiceCode.Code.GetVipPoint: if (status == WebServiceStatus.Status.OK) { Debug.Log(data); VipPoint vp = JsonConvert.DeserializeObject <VipPoint>(data); if (vp.Code == 0) { isGetData = true; ShowContent(vp); } else { LPopup.OpenPopupTop("Thông báo", "Đã xảy ra lỗi. Hãy thử lại!"); } } else { LPopup.OpenPopupTop("Thông báo", "Đã xảy ra lỗi. Hãy thử lại!"); } break; } }
public void SetValueText(VipPoint vp) { try { for (int i = 0; i < vp.ListVippoint.Count; i++) { string textValue = ""; if (vp.ListVippoint[i].Status == 0) { textValue = "NHẬN QUÀ"; int rewardID = vp.ListVippoint[i].RewardID; int index = i; BtnPoints[i].onClick.AddListener(() => { OnClickReward(rewardID, index); }); BtnPoints[i].interactable = true; } else if (vp.ListVippoint[i].Status == 1) { textValue = "<color=white>ĐÃ NHẬN QUÀ</color>"; } else { textValue = vp.ListVippoint[i].LevelPoint.ToString(); } Points[i].text = textValue; Points[i + 9].text = vp.ListVippoint[i].LevelPoint.ToString(); } string[] lvPoints = vp.LevelPoint.Split('/'); curPoint.text = lvPoints[0]; nextPoint.text = lvPoints[1]; sumPoint.text = lvPoints[2]; int idxIcon = getIndexIcon(vp.Vippoint); iconVip.sprite = iconVips[idxIcon]; iconVip.gameObject.SetActive(true); SetValueSlider(int.Parse(lvPoints[2])); } catch (Exception ex) { VKDebug.Log(ex.Message); } }
private void ShowContent(VipPoint vPoint) { this.vp = vPoint; element.gameObject.SetActive(true); element.SetValueText(vPoint); }