IEnumerator WaitForAd() { while (!Advertisement.IsReady(_VideoPlacementID)) { if (_PreparingAD) { if (!UILoadingTips.IsShowing()) { UILoadingTips.ShowAsyn(5); } } yield return(null); } _PreparingAD = false; UILoadingTips.HideAsyn(); Advertisement.AddListener(this); Advertisement.Show(_VideoPlacementID); }
public void PurchFinish(string idx) { //yield return new WaitForSeconds(1.0f); UILoadingTips.HideAsyn(); if (_PurchCallback != null) { _PurchCallback.Invoke(); } var chargeRecord = Tables.TableReader.Recharge.GetRecord(idx); PlayerDataPack.Instance.AddMoney(PlayerDataPack.MoneyDiamond, chargeRecord.Num); Hashtable eventHash = new Hashtable(); eventHash.Add("OrderID", idx); eventHash.Add("PurchID", idx); eventHash.Add("PurchPrice", chargeRecord.Price); GameCore.Instance.EventController.PushEvent(EVENT_TYPE.EVENT_LOGIC_IAP_SUCESS, this, eventHash); }
public void Purch(string idx, Action callBack) { try { string bundleID = Tables.TableReader.Recharge.GetRecord(idx).BundleName; Debug.Log("Purch:" + bundleID); #if UNITY_PURCHASING controller.InitiatePurchase(bundleID); #endif _PurchCallback = callBack; //watch movie var chargeRecord = Tables.TableReader.Recharge.GetRecord(idx); Hashtable eventHash = new Hashtable(); eventHash.Add("OrderID", idx); eventHash.Add("PurchID", idx); eventHash.Add("PurchPrice", chargeRecord.Price); GameCore.Instance.EventController.PushEvent(EVENT_TYPE.EVENT_LOGIC_IAP_REQ, this, eventHash); UILoadingTips.ShowAsyn(); } catch (Exception e) { Debug.Log("Purch error:" + e.ToString()); UILoadingTips.HideAsyn(); } #if UNITY_EDITOR UILoadingTips.HideAsyn(); PurchFinish(idx); #endif //GameCore.Instance.StartCoroutine(PurchFinish(idx)); //PurchFinish(idx); }
public void OnPurchaseFailed(Product i, PurchaseFailureReason p) { UILoadingTips.HideAsyn(); Debug.LogError("IAP OnPurchaseFailed error:" + i.transactionID + "," + p.ToString()); }