Exemple #1
0
    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);
    }
Exemple #2
0
    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);
    }
Exemple #3
0
    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);
    }
Exemple #4
0
 public void OnPurchaseFailed(Product i, PurchaseFailureReason p)
 {
     UILoadingTips.HideAsyn();
     Debug.LogError("IAP OnPurchaseFailed error:" + i.transactionID + "," + p.ToString());
 }