예제 #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);
    }
예제 #2
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);
    }