public void AddNewPurchaseReceiptDetail(PurchaseReceiptDetail _detail) { if (listPurchaseReceiptDetail == null) { listPurchaseReceiptDetail = new List <PurchaseReceiptDetail>(); } listPurchaseReceiptDetail.Add(_detail); }
public void InitData(PurchaseReceiptDetail _purchaseReceiptDetail) { purchaseReceiptDetail = _purchaseReceiptDetail; txtTransactionID.text = purchaseReceiptDetail.transactionId; txtTimePurchase.text = string.Format("{0:00}/{1:00}/{2} - {3:00}:{4:00}", purchaseReceiptDetail.purchaseTime.Day, purchaseReceiptDetail.purchaseTime.Month, purchaseReceiptDetail.purchaseTime.Year, purchaseReceiptDetail.purchaseTime.Hour, purchaseReceiptDetail.purchaseTime.Minute); if (purchaseReceiptDetail.isDone) { btnReSend.gameObject.SetActive(false); panelSendSuccess.gameObject.SetActive(true); } else { btnReSend.gameObject.SetActive(true); panelSendSuccess.gameObject.SetActive(false); } timeCanPressReSend = System.DateTime.Now; }
IEnumerator WaitAndSendPurchareToSeverWhenLogin(PurchaseReceiptDetail _purchaseReceiptDetail, float _timeDelay) { yield return(Yielders.Get(_timeDelay)); _purchaseReceiptDetail.SendMessageToServer(null, null, null, true); }
void ApplyIAPPackage(string _productId, IPurchaseReceipt _productReceipt = null) { Debug.Log(">>> ApplyIAPPackage " + _productId); if (_productReceipt == null) { Debug.LogError(">>> _productReceipt is null"); return; } string _tokenPurchase = string.Empty; GooglePlayReceipt _google = _productReceipt as GooglePlayReceipt; if (_google != null) { _tokenPurchase = _google.purchaseToken; // Debug.Log(google.purchaseState); // Debug.Log(google.purchaseToken); } AppleInAppPurchaseReceipt _apple = _productReceipt as AppleInAppPurchaseReceipt; if (_apple != null) { // Debug.Log(_apple.originalTransactionIdentifier); // Debug.Log(_apple.subscriptionExpirationDate); // Debug.Log(_apple.cancellationDate); // Debug.Log(_apple.quantity); _tokenPurchase = _google.purchaseToken; } if (!string.IsNullOrEmpty(_tokenPurchase)) { byte _screenPurchase = (byte)IMySceneManager.Type.Home; if (CoreGameManager.instance.currentSceneManager != null) { _screenPurchase = (byte)CoreGameManager.instance.currentSceneManager.mySceneType; } PurchaseReceiptDetail _purchaseReceiptDetail = new PurchaseReceiptDetail(_screenPurchase, _productReceipt.transactionID, _productId, _tokenPurchase, _productReceipt.purchaseDate); DataManager.instance.purchaseReceiptData.AddNewPurchaseReceiptDetail(_purchaseReceiptDetail); SubServerDetail _serverDetail = GetGoldScreenController.instance.GetServerDetail(); LoadingCanvasController.instance.Show(-1f, true); _purchaseReceiptDetail.SendMessageToServer(_serverDetail, (_listRewarDetails) => { PopupManager.Instance.CreatePopupReward(_listRewarDetails); GetGoldScreenController.instance.RefreshMyGoldInfo(false); // StartCoroutine(CreatePopUpRewards(_listRewarDetails, null)); if (GetGoldScreenController.instance.currentState == UIHomeScreenController.State.Show && GetGoldScreenController.instance.currentTab == GetGoldScreenController.Tab.BuyGold) { ((GetGoldScreen_PanelBuyGold_Controller)GetGoldScreenController.instance.currentPanel).SetActiveIconWarningHasNewPurchase(true); } if (HomeManager.instance != null && HomeManager.instance.myCallbackManager != null && HomeManager.instance.myCallbackManager.onLoadDataGoldGemFinished != null) { HomeManager.instance.myCallbackManager.onLoadDataGoldGemFinished(); } }, () => { LoadingCanvasController.instance.Hide(); }); } else { Debug.LogError(">>> _tokenPurchase is null"); } }