示例#1
0
        public async Task <T> HttpsGetJSON <T>(string uri)
        {
            string responseText = await HttpsGet(uri);

            SeembaResponse <T> response = JsonConvert.DeserializeObject <SeembaResponse <T> >(responseText);

            return(response.data);
        }
        public async Task <LeaderBoardItem[]> GetLeaberboard(string period)
        {
            string  url      = Endpoint.classesURL + "/analytics/leaderboard-" + period + "/" + GamesManager.GAME_ID;
            WWWForm form     = new WWWForm();
            var     response = await SeembaWebRequest.Get.HttpsPost(url, form);

            SeembaResponse <LeaderBoardItem[]> responseData = JsonConvert.DeserializeObject <SeembaResponse <LeaderBoardItem[]> >(response);

            return(responseData.data);
        }
        public async Task <bool> BuyGiftAsync()
        {
            string  url  = Endpoint.classesURL + "/products/order";
            WWWForm form = new WWWForm();

            form.AddField("product", mCurrentGiftCard.product);
            var response = await SeembaWebRequest.Get.HttpsPost(url, form);

            SeembaResponse <OrderResponse> responseData = JsonConvert.DeserializeObject <SeembaResponse <OrderResponse> >(response);

            Debug.LogWarning(responseData.data.code);
            if (responseData.data.code.Equals("su"))
            {
                PopupManager.Get.PopupController.ShowPopup(PopupType.POPUP_GIFT_CARD_SUCCESS, PopupsText.Get.GiftCardSuccess());
            }
            else
            {
                if (responseData.data.code.Equals("if"))
                {
                    PopupManager.Get.PopupController.ShowPopup(PopupType.POPUP_GIFT_CARD_SUCCESS, PopupsText.Get.GiftCardSuccess());
                }
            }
            return(true);
        }