예제 #1
0
 public void Show(SRSTaiXiuEvent data)
 {
     gameObject.SetActive(true);
     txtMaxWin.text  = data.MaxWin.ToString();
     txtMaxLose.text = data.MaxLose.ToString();
 }
예제 #2
0
    private void OnWebServiceResponse(WebServiceCode.Code code, WebServiceStatus.Status status, string data)
    {
        switch (code)
        {
        case WebServiceCode.Code.GetTaiXiuHistory:
            if (status == WebServiceStatus.Status.OK)
            {
                if (VKCommon.StringIsNull(data))
                {
                    NotifyController.Instance.Open("Không có lịch sử", NotifyController.TypeNotify.Other);
                }
                else
                {
                    _taixiu.Histories = JsonConvert.DeserializeObject <List <SRSTaiXiuDice> >(data);
                    _taixiu.Histories = _taixiu.Histories.OrderByDescending(a => a.SessionId).ToList();
                    LoadHistory();
                }
            }
            else
            {
                SendRequest.SendGetTaiXiuHistory(_API, _taixiu.MoneyType);
            }
            break;

        case WebServiceCode.Code.GetTaiXiuTransactionHistory:
            UILayerController.Instance.HideLoading();
            if (status == WebServiceStatus.Status.OK)
            {
                if (VKCommon.StringIsNull(data))
                {
                    NotifyController.Instance.Open("Không có lịch sử", NotifyController.TypeNotify.Other);
                }
                else
                {
                    SRSTaiXiuTransactionHistory trans = JsonConvert.DeserializeObject <SRSTaiXiuTransactionHistory>(VKCommon.ConvertJsonDatas("data", data));

                    var layerTemp = UILayerController.Instance.GetLayer <LGameTaiXiuBetInfo>();
                    if (layerTemp != null)
                    {
                        layerTemp.LoadData(trans.data);
                    }
                    else
                    {
                        UILayerController.Instance.ShowLayer(UILayerKey.LGameTaiXiuBetInfo, _assetBundleConfig.name, (layer) =>
                        {
                            ((LGameTaiXiuBetInfo)layer).Init(trans.data, _taixiu.MoneyType, SendGetTransactionHistory);
                        });
                    }
                }
            }
            break;

        case WebServiceCode.Code.GetTaiXiuSessionInfo:
            UILayerController.Instance.HideLoading();
            if (status == WebServiceStatus.Status.OK)
            {
                if (VKCommon.StringIsNull(data))
                {
                    NotifyController.Instance.Open("Không có lịch sử", NotifyController.TypeNotify.Other);
                }
                else
                {
                    SRSTaiXiuSessionLog log = JsonConvert.DeserializeObject <SRSTaiXiuSessionLog>(data);

                    var layerTemp = UILayerController.Instance.GetLayer <LGameTaiXiuGameInfo>();
                    if (layerTemp != null)
                    {
                        layerTemp.LoadData(log);
                    }
                    else
                    {
                        UILayerController.Instance.ShowLayer(UILayerKey.LGameTaiXiuGameInfo, _assetBundleConfig.name, (layer) =>
                        {
                            ((LGameTaiXiuGameInfo)layer).Init(log, _taixiu, _taixiu.MoneyType, SendGetSessionInfo);
                        });
                    }
                }
            }
            break;

        case WebServiceCode.Code.GetTaiXiuRank:
            UILayerController.Instance.HideLoading();
            if (status == WebServiceStatus.Status.OK)
            {
                if (VKCommon.StringIsNull(data))
                {
                    NotifyController.Instance.Open("Không có lịch sử", NotifyController.TypeNotify.Other);
                }
                else
                {
                    SRSTaiXiuRank rankData  = JsonConvert.DeserializeObject <SRSTaiXiuRank>(VKCommon.ConvertJsonDatas("data", data));
                    var           layerTemp = UILayerController.Instance.GetLayer <LGameTaiXiuRank>();
                    if (layerTemp != null)
                    {
                        layerTemp.LoadData(rankData.data);
                    }
                    else
                    {
                        UILayerController.Instance.ShowLayer(UILayerKey.LGameTaiXiuRank, _assetBundleConfig.name, (layer) =>
                        {
                            ((LGameTaiXiuRank)layer).Init(rankData.data, _taixiu.MoneyType, SendGetRank);
                        });
                    }
                }
            }
            break;

        case WebServiceCode.Code.CheckTaiXiuEvent:
            if (status == WebServiceStatus.Status.OK)
            {
                if (VKCommon.StringBoolIsTrue(data))
                {
                    if (string.IsNullOrEmpty(strEventTime))
                    {
                        SendRequest.SendGetTaiXiuEventTime(_APIEVENT);
                    }
                    SendRequest.SendGetTaiXiuEventAccount(_APIEVENT);
                }
                else
                {
                    _event.Hide();
                }
            }
            else
            {
                _event.Hide();
            }
            break;

        case WebServiceCode.Code.GetTaiXiuEventAccount:
            if (status == WebServiceStatus.Status.OK)
            {
                if (!VKCommon.StringIsNull(data))
                {
                    SRSTaiXiuEvent taiXiuEvent = JsonConvert.DeserializeObject <SRSTaiXiuEvent>(data);
                    _event.Show(taiXiuEvent);
                }
            }
            break;

        case WebServiceCode.Code.GetTaiXiuEventTime:
            if (status == WebServiceStatus.Status.OK)
            {
                if (!VKCommon.StringIsNull(data))
                {
                    _taixiu.AddEventTime(JsonConvert.DeserializeObject <SRSTaiXiuEventTime>(data));
                    strEventTime = _taixiu.taiXiuEventTime.Time;
                }
            }
            break;

        case WebServiceCode.Code.GetTaiXiuEventTop:
            UILayerController.Instance.HideLoading();
            if (status == WebServiceStatus.Status.OK)
            {
                if (VKCommon.StringIsNull(data))
                {
                    NotifyController.Instance.Open("Không có lịch sử", NotifyController.TypeNotify.Other);
                }
                else
                {
                    var log = JsonConvert.DeserializeObject <List <SRSTaiXiuEventTopItem> >(data);

                    var layerTemp = UILayerController.Instance.GetLayer <LGameTaiXiuEventTop>();
                    if (layerTemp != null)
                    {
                        layerTemp.LoadData(log);
                    }
                    else
                    {
                        UILayerController.Instance.ShowLayer(UILayerKey.LGameTaiXiuEventTop, _assetBundleConfig.name, (layer) =>
                        {
                            ((LGameTaiXiuEventTop)layer).Init(log, _taixiu, SendGetEventTop);
                        });
                    }
                }
            }
            break;
        }
    }