Exemple #1
0
    public void giftResponse(ClientResponse response)
    {
        //TipsManagerScript.getInstance().setTips("----:" + response.message);
        JsonData data = JsonMapper.ToObject(response.message);

        if (int.Parse(data ["type"].ToString()) == 2)
        {
            TipsManagerScript.getInstance().setTips("抽奖活动暂时没有开放,3秒后将关闭对话框");
            Invoke("closeDialog", 3f);
        }
        else if (int.Parse(data ["type"].ToString()) == 3)
        {
            TipsManagerScript.getInstance().setTips("您今天未玩过游戏还不能抽奖");
            //Invoke ("closeDialog",3f);
        }
        else
        {
            try
            {
                giftDes = JsonMapper.ToObject <GiftList> (response.message);

                if (giftDes.type == "0")  //所有
                                          //ruleText.text = giftDes.data[0].notice;
                {
                    for (int i = 0; i < giftDes.data.Count; i++)
                    {
                        GiftItemVo itemData = giftDes.data [i];
                        lotteryItems [i].nameTxt.text = itemData.prizeName;
                        lotteryItems [i].setPic(itemData.imageUrl);
                    }
                }
            }catch (Exception e) {
                if (GlobalDataScript.loginResponseData.account.prizecount > 0)
                {
                    GlobalDataScript.loginResponseData.account.prizecount--;
                    choujiangNum.text = GlobalDataScript.loginResponseData.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;
                }
            }
        }

        callBack = true;
    }
Exemple #2
0
    public void GiftReply(ClientResponse response)
    {
        callBack = true;
        JsonData data = JsonMapper.ToObject <JsonData>(response.message);

        if (int.Parse(data["type"].ToString()) == 2)
        {
            TipsManagerScript.getInstance.setTips(LocalizationManager.GetInstance.GetValue("KEY>11050"));
            Invoke("closeDialog", 3f);
        }
        else
        {
            try
            {
                giftDes = JsonMapper.ToObject <GiftList>(response.message);
                if (giftDes.type == "0")
                {
                    //所有
                    //ruleText.text = giftDes.data[0].notice;
                    for (int i = 0; i < giftDes.data.Count; i++)
                    {
                        GiftItemVo itemData = giftDes.data[i];
                        lotteryItems[i].nameTxt.text = itemData.prizeName;
                        lotteryItems[i].SetPic(itemData.imageUrl);
                    }
                }
            }
            catch (Exception e)
            {
                if (GlobalDataScript.loginResponseData.account.prizecount > 0)
                {
                    GlobalDataScript.loginResponseData.account.prizecount--;
                    choujiangNum.text = GlobalDataScript.loginResponseData.account.prizecount + "";
                }

                Drawl returndata = JsonMapper.ToObject <Drawl>(response.message);
                StopIndex = returndata.data;
                MyDebug.Log("StopIndex" + StopIndex);
                if (!action)
                {
                    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 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;
                }
            }
        }
    }