public void giftResponse(ClientResponse response) { callBack = true; JsonData data = JsonMapper.ToObject <JsonData> (response.message); if (int.Parse(data ["type"].ToString()) == 2) { TipsManager.getInstance().setTips("抽奖活动暂时没有开放,3秒后将关闭对话框"); Invoke("closeDialog", 3f); } else { try { list = JsonMapper.ToObject <GiftList> (response.message); if (list.type == "0") { for (int i = 0; i < list.data.Count; i++) { GiftItemVO gvo = list.data [i]; lotteryItems [i].setData(gvo); } } } catch (Exception e) { Debug.Log(e.ToString()); if (GlobalData.getInstance().myAvatarVO.account.prizecount > 0) { GlobalData.getInstance().myAvatarVO.account.prizecount--; choujiangNum.text = GlobalData.getInstance().myAvatarVO.account.prizecount + ""; } Drawl returndata = JsonMapper.ToObject <Drawl> (response.message); StopIndex = returndata.data; MyDebug.Log("StopIndex" + StopIndex); if (action == false) { float a = UnityEngine.Random.Range(-2, 2f); end = Math.Abs(StopIndex * 36 - 34 + a); MyDebug.Log("end = " + end); x = 0; action = true; callBack = true; } } } }
public void setData(GiftItemVO gvo) { nameTxt.text = gvo.prizeName; imgUrl = gvo.imageUrl; StartCoroutine(loadImg()); }