Beispiel #1
0
    // Use this for initialization
    void Start()
    {
        Application.targetFrameRate = 60;
        QualitySettings.vSyncCount  = 0;

        m_eStep    = STEP.IDLE;
        m_eStep    = STEP.DATAMANAGER_SETUP;
        m_eStepPre = STEP.MAX;

        //m_SwitchSpriteBack.SetSprite ("garalley_003");
        m_SwitchSpriteBack.SetSprite("bg001");
        //m_SwitchSpriteBack.SetSprite ("tutorial777");

        SoundManager.Instance.PlayBGM("bgm_opening");

                #if UNITY_ANDROID
        GoogleIAB.enableLogging(true);
        string key = "your public key from the Android developer portal here";
        key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsqFXrg2t62dru/VFQYyxd2m1kORBbrAGxDxiSAkh3ybaXJtJWNcej/YAxKx7Orrtfq+pU965U2FnU3K54xddts2UGCI9O6TSU0AoKbwFYj+okfF21firsEqZd4aYtVYQ471flWj3ZEG9u2YpIzjGykUQadsxO4Y/OcRbdUn9289Mc0JAbdepmN9yRnvgBJWKZF/c0mBrM4ISfF5TVip2Tp+BXACqblOb+TQZjOB0OeVPxYpdy5k3eJTcQuwiLmYxgpEBL3tIT7grxVROgk8YYncncaZR7Q/wWlsFgFTNMRaF2bPI8apLiA7eIyKv5zbmhbE7YLBXUvkuoHbAqDQrLQIDAQAB";
        Debug.Log(key);
        //下はテスト用
        //key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArGLKSb92Imt43S40ArCXfTmQ31c+pFQTM0Dza3j/Tn4cqjwccjQ/jej68GgVyGXGC2gT/EtbcVVA+bHugXmyv73lGBgmQlzBL41WYTKolO8Z6pVWTeHBtsT7RcHKukoKiONZ7NiQ9P5t6CCPBB2sXQOp1y3ryVbv01xXlM+hB6HkkKxrT6lIjTbtiVXCHAJvqPexPbqVIfGjBaXH/oHKxEBxYDaa6PTUsU3OP3MTx63ycTEnEMsQlA1W6ZuTFIa5Jd3cVlfQI7uovEzAbIlUfwcnxVOUWASiYe81eQiD1BMl+JeCRhfd5e8D4n0LOA12rHm1F3fC9ZoIEjpNB+BRhwIDAQAB";
        GoogleIAB.init(key);
                #endif
    }
Beispiel #2
0
 static BillingManager()
 {
             #if UNITY_ANDROID
     string _key = "";
     GoogleIAB.init(_key);
             #endif
 }
Beispiel #3
0
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //En Android hay que hacer el init(), esperar a que termine y entonces hacer el QueryInventory
    //En iOS hacemos el RequestProductData directamente
    void Start()
    {
        DontDestroyOnLoad(gameObject);
        dictPrices = new Dictionary <string, string>();

#if UNITY_ANDROID
        GoogleIAB.init(androidPublicKey);
#elif UNITY_IPHONE
        //Request product data
        var androidSkus   = new string[] { item1, item2, item3, item4 };
        var iosProductIds = new string[] { item1, item2, item3, item4 };
        IAP.requestProductData(iosProductIds, androidSkus, productList =>
        {
            Debug.Log("IABManager: Product list received");
            Utils.logObject(productList);

            /*
             * foreach(IAPProduct product in productList){
             *      string s = product.currencyCode;
             *      dictPrices.Add(product.productId, product.currencyCode+" "+product.price);
             *      Debug.Log(product.productId + ": " + product.currencyCode+" "+product.price);
             * }*/
        });
#endif
    }
Beispiel #4
0
    void Start()
    {
        //Screen.fullScreen = false;
        instance          = this;
        EditingAlarmParam = new AlarmParam();
        m_iPagePre        = 0;

        string key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwoEtQFcqjLFQJ0wXu8mkFjowH8t4I7tcG1G6Ais7Vx8qZWYidwNPzdp2pvPCQS4/BZDgtRyk1+FsPbaCOndof2e4OlVmdlGUXVQOtJl5hT40xxmlotliBG9IzO1A5Huvy0tjv2pQ6Et0g72k1qxJPFI1O/L7mzQDHPzawYEqHv47U/yGD1GTE6jHK0u1apgxUI89UJsiYIhVlwdZ40390LGWAR8+LrUhk+q//NYjxfKBd3fotgV4QZecNPQks1fz9bk5oWOwOpOz2pQ3aZ62RInlueAk8ttsfow6+M4rmdfBDVGOkVKgScwhBjeCAcsXQaO+qwWdr1GhLPNuYck39wIDAQAB";

        GoogleIAB.init(key);

        if (m_AlarmData == null)
        {
            m_AlarmData = new AlarmData();
        }
        reserveTimeReset();

        kvs_data.Load(KvsData.FILE_NAME);
        int iTest = kvs_data.ReadInt("test");

        iTest += 1;
        kvs_data.WriteInt("test", iTest);
        kvs_data.Save();
        m_PageNow = m_PageBaseList [m_iPagePre];
        InitPage(m_PageNow);
    }
Beispiel #5
0
    /**마켓 결제용*/
    public void InitGoldShop(string title, int category, GetGoldShopEvent goldEvent)
    {
        mGoldList = goldEvent.Response.data;
        transform.FindChild("Top").FindChild("LblShop").GetComponent <UILabel>().text = title;
        mCategory = category;

        InitGoldList();

        if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            IOSMgr.InAppInit();
        }
        else if (Application.platform == RuntimePlatform.Android)
        {
                        #if (UNITY_ANDROID)
            if (UtilMgr.IsMLB())
            {
                GoogleIAB.init(Constants.GOOGLE_PUBLIC_KEY_MLB);
            }
            else
            {
                GoogleIAB.init(Constants.GOOGLE_PUBLIC_KEY_KBO);
            }
                        #endif
        }
    }
Beispiel #6
0
    static BillingManager()
    {
#if UNITY_ANDROID
        string _key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkDWcF/KohRYKAtN/egO7gCm3yL8kHThrqFk0kDu7DaEWK9cfbbHCk3t9+S3x1SBNiDSDrWekMFLwtlkLcyjcfiROA3fHcw8s1yb5xhLhPpgE8bQcrBycmyZPUjj5ott1Ua+o/LCIcUtTzVM/dx8URKqGBDRe4e9Jz5PDOVI6OhQj9Vm0K7u66MJo9cgh15R4P++b6vkZxDHFg8pZU6bqJCzQFl7XVUD2g1mtinpxtlmCLYju5SNvf0rlVPysIv9umJuH3AWHEtQkOVGxZT1K/NlZh/NIPnMlKRgdcDkPj8FmwIIemIuTzCpfB3KSP+ZpaQcj+wCHVhPfqNKzu1aLYQIDAQAB";

        GoogleIAB.init(_key);
#endif
    }
Beispiel #7
0
    IEnumerator InitializeIAB()
    {
        yield return(null);

        var key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1o/JdLP5MWZkfgNB1lVmtw0IoTpRT37qiKsYGkNR/w8jFvQh43v9m6LFyacj6v5PomHDTsVFN/2zCfMW4iI9ev8ok6JKUVe0y9oroJpcR+ifUR2s+YthTog6WI+Ihk1CzQfHfh5jUZbbdiJNqcyKq0aH3La3hYwDqsN8bVpil1VwoNOkoz+FDn3ftPI7Wkw0cij5mqq9HyKqTHx5WXF6ubTeB/IVr3DYWbAXmiyRNDC5jrwPU81+jW+yOEudGCWIwQDlLatlzm6vnrA5HpD/mPdqsBP5YTavHw1Sy8BEiQurf0vw6A4ZfTve4NmhQgK80uklnXETIhVncj6nQbqDMQIDAQAB";

        GoogleIAB.init(key);
    }
Beispiel #8
0
    //TODO Adding Public key to IAP
    void Awake()
    {
        #if UNITY_ANDROID
        GoogleIAB.init("add_pubic_key_here");
        #endif

        #if UNITY_IOS
        #endif
    }
Beispiel #9
0
    protected override void PlatformRequestProductList(string[] products)
    {
#if UNITY_ANDROID
        GoogleIABManager.billingSupportedEvent    += OnBillingSupported;
        GoogleIABManager.billingNotSupportedEvent += OnBillingNotSupported;

        GoogleIAB.init(key);
#endif
    }
Beispiel #10
0
 public override void Start()
 {
     base.Start();
     Debug.Log("Android billing is starting.");
     SubscribeToEvents();
     GoogleIAB.enableLogging(true);
     GoogleIAB.init(KEY);
     GoogleIAB.queryInventory(MarketLot.AllLots.Select(l => l.ProductAndroidIdentifier).ToArray());
 }
Beispiel #11
0
    private void initialize()
    {
        DontDestroyOnLoad(gameObject);

                #if UNITY_ANDROID
        GoogleIAB.enableLogging(true);
        GoogleIAB.init("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArGLKSb92Imt43S40ArCXfTmQ31c+pFQTM0Dza3j/Tn4cqjwccjQ/jej68GgVyGXGC2gT/EtbcVVA+bHugXmyv73lGBgmQlzBL41WYTKolO8Z6pVWTeHBtsT7RcHKukoKiONZ7NiQ9P5t6CCPBB2sXQOp1y3ryVbv01xXlM+hB6HkkKxrT6lIjTbtiVXCHAJvqPexPbqVIfGjBaXH/oHKxEBxYDaa6PTUsU3OP3MTx63ycTEnEMsQlA1W6ZuTFIa5Jd3cVlfQI7uovEzAbIlUfwcnxVOUWASiYe81eQiD1BMl+JeCRhfd5e8D4n0LOA12rHm1F3fC9ZoIEjpNB+BRhwIDAQAB");
                #endif
    }
    /// <summary>
    /// Point
    /// </summary>
    ///
    void InitInAppPurchaseIOSnADR()
    {
#if UNITY_ANDROID
        var key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzTm3Kt267irxsdP52FN/drPBS/CD8+RGyH7DRQhE6d3UZKrm1FObbzSEfS6tm//h2oeLbb5iyBv8sVWd3E9sR6vhPYLkUPbTPlYR1OvuipHOqvN+J7YYQVdUFiqMkST+t3DuXt58Zu+vmmYfgwwooXtoh1yrTzCJAGCT93J9oX1zJcMpzcLQPstJ8WwO8hRDicTnhXzYNznXvbVsy7FtgWJcSqRhp+FJ37+4e0TcpDxyDc6T95Tk6BPBl05Z/jVp8HNODTDNw8MJCgp6qsGhF6/yQ9GYj7qUDElpyYO/BiQ/XViodAFNBk2/qc10LPkrkxCj+d8el5IBXihC+Vp4HQIDAQAB";
        GoogleIAB.init(key);
#endif
#if UNITY_IPHONE
        AgStt.mIAP.ProductRequest();
#endif
    }
Beispiel #13
0
    public void initialize()
    {
        if (!IsInitialized)
        {
            DontDestroyOnLoad(gameObject);

            m_bPurchased = false;

                        #if UNITY_IPHONE
            //You do not have to add products by code if you already did it in seetings guid
            //Windows -> IOS Native -> Edit Settings
            //Billing tab.
            IOSInAppPurchaseManager.Instance.AddProductId(TICKET_010);
            IOSInAppPurchaseManager.Instance.AddProductId(TICKET_055);
            IOSInAppPurchaseManager.Instance.AddProductId(TICKET_125);
            IOSInAppPurchaseManager.Instance.AddProductId(TICKET_350);
            IOSInAppPurchaseManager.Instance.AddProductId(TICKET_800);

            IOSInAppPurchaseManager.OnVerificationComplete += HandleOnVerificationComplete;
            IOSInAppPurchaseManager.OnStoreKitInitComplete += OnStoreKitInitComplete;

            IOSInAppPurchaseManager.OnTransactionComplete += OnTransactionComplete;
            IOSInAppPurchaseManager.OnRestoreComplete     += OnRestoreComplete;
            IOSInAppPurchaseManager.instance.LoadStore();
                        #elif UNITY_ANDROID
            GoogleIABManager.billingSupportedEvent        += billingSupportedEvent;
            GoogleIABManager.billingNotSupportedEvent     += billingNotSupportedEvent;
            GoogleIABManager.queryInventorySucceededEvent += queryInventorySucceededEvent;
            GoogleIABManager.queryInventoryFailedEvent    += queryInventoryFailedEvent;
            GoogleIABManager.purchaseCompleteAwaitingVerificationEvent += purchaseCompleteAwaitingVerificationEvent;
            GoogleIABManager.purchaseSucceededEvent        += purchaseSucceededEvent;
            GoogleIABManager.purchaseFailedEvent           += purchaseFailedEvent;
            GoogleIABManager.consumePurchaseSucceededEvent += consumePurchaseSucceededEvent;
            GoogleIABManager.consumePurchaseFailedEvent    += consumePurchaseFailedEvent;
            GoogleIAB.enableLogging(true);

            string key = "your public key from the Android developer portal here";
            // jp.app.bokunozoo
            key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsqFXrg2t62dru/VFQYyxd2m1kORBbrAGxDxiSAkh3ybaXJtJWNcej/YAxKx7Orrtfq+pU965U2FnU3K54xddts2UGCI9O6TSU0AoKbwFYj+okfF21firsEqZd4aYtVYQ471flWj3ZEG9u2YpIzjGykUQadsxO4Y/OcRbdUn9289Mc0JAbdepmN9yRnvgBJWKZF/c0mBrM4ISfF5TVip2Tp+BXACqblOb+TQZjOB0OeVPxYpdy5k3eJTcQuwiLmYxgpEBL3tIT7grxVROgk8YYncncaZR7Q/wWlsFgFTNMRaF2bPI8apLiA7eIyKv5zbmhbE7YLBXUvkuoHbAqDQrLQIDAQAB";
            // jp.app.bokuno.zoo
            key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3xplcFnhYvPYqsxu5D2hP/DwOYHTOUgy59ZUhLaUyEKyK9HZ5hpeDFFe2WqopiR2tM5aD6zRs1WFJqLKjoqoeMi4BwbtAcGOK1I5BDAe9YmDlGN+YEkG6nBPwEm+IZ1C9pLkAi9EoCc28xS/pUlwIPP8/PSMjTpTixO5S0lbKk5tY3VJyt454khCE/XFJMZd6C0j2sBiLwxi7vpZ3i5X0bl75sMr3fvIFdS7WT+m9slwsEZ9qDw/H0Uh01yA5gJn8CkNQ0x04gw+OrtepalTDvE4Lb/nzs6+1QwAi7jbvzPwCD9KDyhfEfLjjj/iOI9nkfjDMXt9d6+n6TCKROfsUwIDAQAB";
            Debug.Log(key);
            //下はテスト用
            //key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArGLKSb92Imt43S40ArCXfTmQ31c+pFQTM0Dza3j/Tn4cqjwccjQ/jej68GgVyGXGC2gT/EtbcVVA+bHugXmyv73lGBgmQlzBL41WYTKolO8Z6pVWTeHBtsT7RcHKukoKiONZ7NiQ9P5t6CCPBB2sXQOp1y3ryVbv01xXlM+hB6HkkKxrT6lIjTbtiVXCHAJvqPexPbqVIfGjBaXH/oHKxEBxYDaa6PTUsU3OP3MTx63ycTEnEMsQlA1W6ZuTFIa5Jd3cVlfQI7uovEzAbIlUfwcnxVOUWASiYe81eQiD1BMl+JeCRhfd5e8D4n0LOA12rHm1F3fC9ZoIEjpNB+BRhwIDAQAB";
            GoogleIAB.init(key);
                        #endif
        }
        IsInitialized = true;
    }
Beispiel #14
0
    // Use this for initialization
    void Start()
    {
        Application.targetFrameRate = 60;
        PlayerPrefs.EnableEncryption(true);
        Instance.isTutorial = PlayerPrefs.GetBool(Constants.TUTORIAL, true);
        Instance.bestScore  = PlayerPrefs.GetInt(Constants.BEST_SCORE, 0);
        Instance.starsCnt   = PlayerPrefs.GetInt(Constants.STAR_TOTAL, 0);
        Instance.totalGames = PlayerPrefs.GetInt(Constants.GAME_COUNT, 0);
        Instance.playerID   = PlayerPrefs.GetInt(Constants.PLAYER_ID, 0);
        Instance.isSound    = PlayerPrefs.GetBool(Constants.SOUND, true);
        Instance.isNoads    = PlayerPrefs.GetBool(Constants.NO_ADS, false);
        Instance.isFBLiked  = PlayerPrefs.GetBool(Constants.FB_LIKE, false);

        audioSource = transform.GetComponent <AudioSource>();
                #if UNITY_ANDROID
        PlayGamesPlatform.Activate();
        EtceteraAndroid.cancelNotification(Constants.H4);
        EtceteraAndroid.cancelNotification(Constants.H8);
        EtceteraAndroid.cancelNotification(Constants.D1);
        EtceteraAndroid.cancelNotification(Constants.D3);
        EtceteraAndroid.cancelNotification(Constants.D7);
        EtceteraAndroid.cancelNotification(Constants.D14);
        EtceteraAndroid.cancelNotification(Constants.D30);
        var key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA19JDG1hIuDeEDYaOxZyqYlv4OgX5+7+/+AcTRNMMhImND9UZsa2Ymh7xzQVUPYlyXOVSBW3RbenhZXWJPA3ZXZvk68hMACGIWGe2ZEFZqYiSELnk1C4XmKeTReC8Z5Y/NgSpSyzI++rvsSuA4j3Xe6SL3lbGUa+eOzmi42yJFU91zWdje6nA2XQFmMk6KqyaRT4Dwh2ntssPP0mQl6JiwJ8nSfp8JodIepYndBgNQ/OLBcko5ktFl1fIzqHJU0ZP6K7kF6i+vPe8H5M3Oal2Mw15/zfLIN+nE1R2IbauOQS7DmCKrMxTqPjUbajbOXJ4An77IhtwSrMkksDjet3/2wIDAQAB";
        GoogleIAB.init(key);
                #elif UNITY_IOS
        UnityEngine.iOS.NotificationServices.RegisterForNotifications(UnityEngine.iOS.NotificationType.Alert | UnityEngine.iOS.NotificationType.Badge);

        UnityEngine.iOS.NotificationServices.ClearLocalNotifications();
        UnityEngine.iOS.NotificationServices.CancelAllLocalNotifications();

        // clear badge number
        UnityEngine.iOS.LocalNotification temp = new UnityEngine.iOS.LocalNotification();
        temp.fireDate = DateTime.Now;
        temp.applicationIconBadgeNumber = -1;
        temp.alertBody = "";
        UnityEngine.iOS.NotificationServices.ScheduleLocalNotification(temp);
                #endif

        //Initialize Heyzap
        HeyzapAds.Start("790edd987b2facf1eb7117dfc97d354b", HeyzapAds.FLAG_NO_OPTIONS);

        Invoke("SignIn", 0.5f);
        Invoke("Play", splashHoldTime);
        DontDestroyOnLoad(gameObject);
    }
Beispiel #15
0
   void SetupPurchases()
   {
       Debug.Log("KongStoreKitDemo: Setting up purchases...");
 #if UNITY_IPHONE
       Debug.Log("KongStoreKitDemo: requesting products");
       StoreKitBinding.requestProductData(new string[] { "com.kongregate.mobile.games.angryBots.t05_coins" });
 #elif UNITY_ANDROID
       GoogleIABManager.billingSupportedEvent += () => {
           Debug.Log("KongStoreKitDemo: billing is supported query inventory");
           mPurchaseReady = true;
           var skus = new string[] { "com.kongregate.android.games.angrybots.t03_hard" };
           GoogleIAB.queryInventory(skus);
       };
       GoogleIABManager.queryInventorySucceededEvent += (purchases, skus) => {
           Debug.Log("KongStoreKitDemo: queryInventory succeeded");
           foreach (GooglePurchase purchase in purchases)
           {
               Debug.Log("KongStoreKitDemo: queryInventory succeeded: " + purchase.productId);
               verifyGoogleReceipt(purchase);
           }
       };
       GoogleIABManager.queryInventoryFailedEvent += (sku) => {
           Debug.Log("KongStoreKitDemo: queryInventoryFailedEvent: " + sku);
       };
       GoogleIABManager.purchaseSucceededEvent += purchase => {
           Debug.Log("Google IAB callback - purchased product: " + purchase);
           verifyGoogleReceipt(purchase);
       };
       GoogleIABManager.purchaseFailedEvent += message => {
           Debug.Log("Google IAB callback - purchase failed: " + message);
           KongregateAPI.GetAPI().Analytics.FinishPurchase(KongregateAPI.PURCHASE_FAIL,
                                                           message, getPurchaseFields());
           mPurchaseReady = true;
       };
       GoogleIABManager.consumePurchaseSucceededEvent += purchase => {
           Debug.Log("KongStoreKitDemo: Google IAB callback - consume succeeded: " + purchase);
       };
       GoogleIABManager.consumePurchaseFailedEvent += message => {
           Debug.Log("Google IAB callback - consume failed: " + message);
       };
       GoogleIAB.init(_GooglePublicKey);
 #elif UNITY_WEBPLAYER || UNITY_WEBGL
       mPurchaseReady = true;
 #endif
   }
Beispiel #16
0
    public virtual void init()
    {
        if (!paymentSystemAdded)
        {
#if PURCHASE_USE_APPLE_ITUNES
            productManager       = gameObject.AddComponent <StoreKitManager>();
            productEventListener = gameObject.AddComponent <StoreKitEventListener>();

            LogUtil.Log("ProductPurchase::InitPaymentSystem StoreKit/iOS added...");

            GetProducts();
#elif PURCHASE_USE_AMAZON
            productManager       = gameObject.AddComponent <AmazonIAPManager>();
            productEventListener = gameObject.AddComponent <AmazonIAPEventListener>();

            LogUtil.LogProduct("ProductPurchase::InitPaymentSystem Amazon IAP/Android added...");
#elif PURCHASE_USE_GOOGLE_PLAY
            productManager       = gameObject.AddComponent <GoogleIABManager>();
            productEventListener = gameObject.AddComponent <GoogleIABEventListener>();

            LogUtil.LogProduct("ProductPurchase::InitPaymentSystem Google Play IAB/Android added...");

            GoogleIAB.init(AppConfigs.productGoogleKey);
#elif UNITY_WEBPLAYER
            LogUtil.LogProduct("ProductPurchase::InitPaymentSystem none added...");
#else
            LogUtil.LogProduct("ProductPurchase::InitPaymentSystem none added...");
#endif

            if (productManagerObject != null)
            {
                DontDestroyOnLoad(productManagerObject);
            }

            if (productEventListenerObject != null)
            {
                DontDestroyOnLoad(productEventListenerObject);
            }

            paymentSystemAdded = true;
        }
    }
    public void init(string key, string[] skus)
    {
#if UNITY_ANDROID
        GoogleIAB.init(key);
        //copiedSkus = new string[skus.Length];
        copiedSkus = skus;
        //GoogleIAB.queryInventory(skus);
#elif UNITY_IPHONE
        bool canMakePayments = StoreKitBinding.canMakePayments();
        if (canMakePayments)
        {
            StoreKitBinding.requestProductData(skus);
        }
        else
        {
            ShowMessages sm = new ShowMessages();
            sm.ShowMessageWindow("ERROR ACCESSING APPLE STORE", "You can't connect to Apple Store, network error detected");
        }
#endif
    }
Beispiel #18
0
    void Init()
    {
        GoogleIABManager.billingSupportedEvent        += billingSupportedEvent;
        GoogleIABManager.billingNotSupportedEvent     += billingNotSupportedEvent;
        GoogleIABManager.queryInventorySucceededEvent += queryInventorySucceededEvent;
        GoogleIABManager.queryInventoryFailedEvent    += queryInventoryFailedEvent;
        GoogleIABManager.purchaseCompleteAwaitingVerificationEvent += purchaseCompleteAwaitingVerificationEvent;
        GoogleIABManager.purchaseSucceededEvent        += purchaseSucceededEvent;
        GoogleIABManager.purchaseFailedEvent           += purchaseFailedEvent;
        GoogleIABManager.consumePurchaseSucceededEvent += consumePurchaseSucceededEvent;
        GoogleIABManager.consumePurchaseFailedEvent    += consumePurchaseFailedEvent;

        var key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAiAuaxUVegwS7YpWKYta7BluTgyLuh9wMR/ThKaVh8saH7Xl/eK0of3ilILzc/cs9LhW07uQeijQmxcMTiZI8pO5TfHuQCNSUZoK9dXJ1W0AzAj4He+Ur/XNEI3w0XSEUKAxQiFTbZ5x1/IoKH7LnvFWNqTKOmdRVSh45+G11qguABmHiT4PS0YTuUEfij1N4pkzJtNnfvTpwkx9mnCuO1e38659moGihHcwviKlv0W2ddb8te28iv5UxWSR2h9SWqHpjYFfv2Y2V9s1+F0MLb1fwbreAFocqmE+bHhV/oHVLBRv3Qsuwqej9CwRWU6YAwefjxmt0tEeDwHn2DF7gWQIDAQAB";

        GoogleIAB.init(key);

        var skus = new string[] { "one.coin", "nineteen.coin", "three.coin", "five.coin", "nine.coin", "intotheblack.vip", "intotheblack.venus", "intotheblack.shield" };

        GoogleIAB.queryInventory(skus);
    }
Beispiel #19
0
    void ruby()
    {
        if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
//			EventDelegate eventd = new EventDelegate(this, "purchaseInit");
//			string prodList = "";
//			foreach(ItemShopRubyInfo rubyInfo in getruby.Response.data){
//				prodList += rubyInfo.productCode + ";";
//			}
            IOSMgr.InAppInit();
        }
        else if (Application.platform == RuntimePlatform.Android)
        {
                        #if (UNITY_ANDROID)
            GoogleIAB.init(Constants.GOOGLE_PUBLIC_KEY);
                        #endif
        }

//		} else{
        GetAblePP();
//		}
    }
Beispiel #20
0
    public void SetIABListener()
    {
        GameObject gameObject = GameObject.Find("GoogleIABEventListener");

        if (gameObject == null)
        {
            gameObject = new GameObject("GoogleIABEventListener");
            gameObject.AddComponent <GoogleIABEventListener>();
        }
        eSERVICE_AREA currentServiceArea = NrTSingleton <NrGlobalReference> .Instance.GetCurrentServiceArea();

        if (TsPlatform.IsBand)
        {
            this._key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlcgaV+vJy5E2k/rPt5bqyL/c+0w+zomsHSYehTqDJKjLAmJb4Xa0TDTjGWs5s13LiH8P92pM8CgQ4H66evBarLAOnsGay218MsgxNFcoMQk3zr0zH0rYuR74/gVK0c2XEuipaqVRCtgFZxbjjmua80p49x0QEErHVOAbhOgNJFhTdS/JzWZY6hphkkfrJP5okwp9gV9dQOMxQFKJuGENx0Of7PxZ9aamZBipAWCX6bv2mAKUTZNLFR9uuiSnKb155hEKvfdzU7gJhFcUCEVIIVEpzM8NEDpGgiuxZVPS2vtBc2wrcDxbsCdGe/1jSyH/Gv6u1gIGZFSVMvMUyEfTDwIDAQAB";
        }
        if (currentServiceArea == eSERVICE_AREA.SERVICE_ANDROID_KORGOOGLE)
        {
            this._key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAiXp63SWTrJxRCsSR40TTSpo59MmdM4PKoEWCzfX9u4ZQmTGkZdZTYiIJ6Ti6T8JRW0x5J4aSDFLhnRCXZ/FpVABBiAJrMdaw5wtL7OLlY+aWplYBcfSvN/oodlaEl/ZMO1qfUWdmB3yn16ufKDUtQDKW56wDlsv5rT9vLJb1M6ySAXwY8WRu7LsatpWdciqU1NynwyIAtwwjqWTw9Fkh0tRHRjw+4cJhlzZRaoPKXeV255Qk83+hZ5MKiZveQZJy/SEYIa/CN3wCjmqJcMtgkbahv8lRc2XdCpiuevW++Rsrv6g9SNB4qUbLnh6+yO6DZsmbj4k60NaLjbusAj78mQIDAQAB";
        }
        if (currentServiceArea == eSERVICE_AREA.SERVICE_ANDROID_KORQA)
        {
            this._key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjBAxIJFyvjdhpQm3BPkwR9qbmPSZU6vXnffk/CC42kaIdsJCAiyy+NoZOnqycKOsdVcCsoXI0gRlxmRo1OnZy3l7X6Z11dl9bNZeeZSzs6ra4pf/SGKxA/RqL2PyfO12O44hriPBuW2SzGGPWp9MoQgOREw8Tl0blRFjj6Qo6TGL+fkLsON67wZbOQInrP61ucOmumGdQ+14/agSrmPmRtLfNPelUzxEBGiM15vjjJtBd4vmD+1lqrLZBLlamT3adnpkqyu/qCeF5+i8qPW5yLLoOkpkvz6Mgbew9/NzlEWL/iPau38ylHb1YlToKEonzQYB8wURBviepFUBapYBiwIDAQAB";
        }
        if (currentServiceArea == eSERVICE_AREA.SERVICE_ANDROID_KORKAKAO)
        {
            this._key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnGI8L7RnBfN/dKGdq4d2LfazJTMezVFksm+jJaEQBdSkz+WznSv8tROvRYO48LlZr891SjiKr4ucLu4CXmYAoMJ3ZrDSPz4p6uG3idjG9KBPLnQeC5CiKcxiZMAs3VkrhLMbds4My8+n8Fuw+caXGW9AwqhIX2jzs4OXHApOW7JK28erhp2AXKshD7z99vB82gz095Pa8X+eIGBhsLnYPP+eidCs+CFPtt9i1upuS3txG6VzvJgTSh3dFKsoFylaW/UIzLZJW7RY907QYNhgonmL/WwOesGUfjQdcjwurvmo0o7wPFvjkD3zoyZ+/UbMiYUE9io9r4rNKVbEkqK8GwIDAQAB";
        }
        if (currentServiceArea == eSERVICE_AREA.SERVICE_ANDROID_USGOOGLE)
        {
            this._key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArcHJBFJXvvTCJ3Qaxqmj8r7btZHucb0UYyHxTv4sf7PAmNmKjwh03pSUz7vKZwxCIQdHcEcIzMuWbbhTFOyR8G3CqDsVZVmHzG1/F0m9iAvZ3mNcyuSzBf04gG6WpTjmJDEv8OEotBaAr9KH3akx20lmq4SxlknvWp7y36Xzv7IYfoX8lgdYn2hP2/qKCf0YwpMqngC7OCjA7Qol/3r9wP5JLSVQXM0ui2FiQJCAKYWmk2meL0FNBYLyk0v+FhnSxquG6JBeAmSSUwRkpR3EYqjh+Yq8rbKYfl8gQjX3uIyG5r1brtlC83d5Ycpvmj2v5CWqgslcrJcDSi/Z15O06QIDAQAB";
        }
        if (currentServiceArea == eSERVICE_AREA.SERVICE_ANDROID_USQA)
        {
            this._key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnJ6vmwk1CUm5TsgY9UiWTHshNqz8hsu1swCrmHMNOb5WpKX/DLCy0g5imZSfKxe/3uMzwsuibA4EUNHmiHQBgaYhTPNxFd5o14IVSi4/KnMJyrP6qn7OfKdGV2hy/i8lfXUSrfgWUC+APkLvRxrQy2zzvPjfWoWiA+DsZ6i8KfIyyEIXJhEdi1RkH7rLwF3ZTJGWWQ4Ijdco5aQEbbRKP6SrX0weCkagQIRFmgKK4iMsVjwLvZbn7e8rlQTmr+nyfvjiMggS9OgL0/B5+NKpibL2LxN5/95PNqlhw6plDdGpIpuFdtXA7y4XavTzD6X/HQdtyvANcnJJReq/B1xAcQIDAQAB";
        }
        UnityEngine.Object.DontDestroyOnLoad(gameObject);
        GoogleIAB.init(this._key);
    }
Beispiel #21
0
        void Start()
        {
            GetInAppIdsArrayForIOS();

            #region iOS Methods
#if UNITY_IOS && STOREKIT && !UNITY_EDITOR
            InvokeRepeating("RequestProduct", 0f, 15f);
#endif
            #endregion
            //
            #region Android => Google Play Mathods
#if UNITY_ANDROID && !AMAZONSTORE && !UNITY_EDITOR && GOOGLEIAB
            GoogleIAB.init("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAg1PP4V7cVb2kBIfWYcLYxx9OAXkT6/1EbfOxyI+hkvJN07mP/U1pmdfn8QIvCnCHA6gual2H1tUOu4DHUtwISnVWwSZqzNPYMsgVHEDMV+nC9/K09k+PNkL8PUaSRfg/wcUYyjOlRBNPXgNdzJ+KSYPrsFxdcY5pIdQYzYoO8kOCTfhJFTukPF+vtXMjtZBt2QppgMWtqSOGL79qk5buv9q15YLG6HN0XBTrK+dE2/2KbDZA58tiMMaGTqTTmHFRWZxtkvdosUf5xVofSsoR/3pevhJ9nZ2nhnFjzQiHUooKeUmCrsOzzWk6e80rXCPwrfWJaa1RKe0fgXz2wqCi8QIDAQAB");
#endif
            #endregion
            //
            #region Android => Amazon Store Methods
#if UNITY_ANDROID && AMAZONSTORE && !UNITY_EDITOR
            iapService.GetUserData();
            SkusInput sin = new SkusInput();
            sin.Skus = new List <string>();
            supportedMarketplaces = "USA, UK, Germany, Frane,\nSpain, Italy, Japan, Canada, Brazil, Australia";
#if UNDERGROUND
            supportedMarketplaces = "USA, UK, Germany, Frane";
#endif
            string sku = string.Empty;
            foreach (string s in InAppIDs)
            {
                sku = s;
#if UNDERGROUND
                sku = sku.Replace("supercell.", "supercell.underground.");
#endif
                sin.Skus.Add(sku);
            }
            iapService.GetProductData(sin);
#endif
            #endregion
        }
    public virtual void init()
    {
        if (!paymentSystemAdded)
        {
#if PURCHASE_USE_APPLE_ITUNES_PRIME31
            productManager       = gameObject.Set <StoreKitManager>();
            productEventListener = gameObject.Set <StoreKitEventListener>();

            LogUtil.Log("ProductNetworks::InitPaymentSystem StoreKit/iOS added...");

            GetProducts();
#elif PURCHASE_USE_AMAZON_PRIME31
            productManager       = gameObject.Set <AmazonIAPManager>();
            productEventListener = gameObject.Set <AmazonIAPEventListener>();

            LogUtil.LogProduct("ProductNetworks::InitPaymentSystem Amazon IAP/Android added...");
#elif PURCHASE_USE_GOOGLE_PLAY_PRIME31
            productManager       = gameObject.Set <GoogleIABManager>();
            productEventListener = gameObject.Set <GoogleIABEventListener>();

            LogUtil.LogProduct("ProductNetworks::InitPaymentSystem Google Play IAB/Android added...");

            GoogleIAB.init(AppConfigs.productGoogleKey);
#elif UNITY_WEBPLAYER
            LogUtil.LogProduct("ProductNetworks::InitPaymentSystem none added...");
#elif PURCHASE_USE_UNITY
            productManager = gameObject.Set <ProductNetworkUnity>();

            LogUtil.LogProduct("ProductNetworks::InitPaymentSystem Unity added...");
#else
            LogUtil.LogProduct("ProductNetworks::InitPaymentSystem none added...");
#endif

            paymentSystemAdded = true;
        }
    }
    void OnEnable()
    {
        // Listen to all events for illustration purposes
        GoogleIABManager.billingSupportedEvent        += billingSupportedEvent;
        GoogleIABManager.billingNotSupportedEvent     += billingNotSupportedEvent;
        GoogleIABManager.queryInventorySucceededEvent += queryInventorySucceededEvent;
        GoogleIABManager.queryInventoryFailedEvent    += queryInventoryFailedEvent;
        GoogleIABManager.purchaseCompleteAwaitingVerificationEvent += purchaseCompleteAwaitingVerificationEvent;
        GoogleIABManager.purchaseSucceededEvent        += purchaseSucceededEvent;
        GoogleIABManager.purchaseFailedEvent           += purchaseFailedEvent;
        GoogleIABManager.consumePurchaseSucceededEvent += consumePurchaseSucceededEvent;
        GoogleIABManager.consumePurchaseFailedEvent    += consumePurchaseFailedEvent;


        lossLists.Clear();
        purchaseIds.Clear();
        //var key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1a3Da+i2nrPjYWPhFv065Qp+24xlP+hUcfkw/E1lDVCVq4z+Lu00tj3rR6sRUYTa5WsACxpFcFEtYJQWeRhNjdAXeyIZpbEOw0+5gyPRjQavLBQ6b1VHXXaAefAeVlCz0QfUv/DlW0zzFrlHN3O2z2Z5wWwzIvKzmJ/Euiev1KCvo6kMrawPXwAqWgur5c+fHBP58h2FKym2qbInSLN9tZdfoaTF7tDBDLl+Hrh8qwrLgwuJ9HzYRzD/oQ8Jh4VxgROBfMEh19U3/mLLc220J0lrqc5s+E2Mbl6V5kiq7lARyJGVVy29LR6Jm+Jbd9LbV+BwDOeOUdPTlE7POg1BzwIDAQAB";
        var key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm7QgZALTxa3KEHECIUKA4OKP9jf4D3mEYNyy01ikPjQFWQsl7tjgyiKMExroijekPx+GmdDmRNZzcYC/+QMNhet0MVmaxJprHZWv2vOuwZNW+a877obJhvDeNEz+x1fn4p6yNMntII+ZXZOihO5Lq54nHeoXDK67b58YOQ0YS4sEnQvoDlUjypAWY7f46BVDgxTOP+3oznF1yWavk7+M3Z+uV3SvJ0yKAoRErZVc/k9iJXHydzVgMM2n5QBr1sOJzJY1ip1VThLuXOu9brl0Dpl3PFlknK5dOyeDvMPw/nYcm//qEH5trwGp8Sk0pgy0bUE1MjE/J3PddhTuMxXvlQIDAQAB";

        GoogleIAB.init(key);

        GoogleIAB.enableLogging(true);
        Debug.Log("add google play in application billing");
    }
Beispiel #24
0
    // Initializes the billing system. Call this at app launch to prepare the IAP system.
    public static void init(string androidPublicKey)
    {
#if UNITY_ANDROID
        GoogleIAB.init(androidPublicKey);
#endif
    }
    // Demonstrate how you might setup purchases using the Prime31 Plugin, and notify our SDK of the results.
    void DemoSetupPurchases()
    {
        mTransactionsInVerification = new Dictionary <string, object>(); //queue of transactions needing to be verified
#if UNITY_IPHONE && PRIME31_STOREKIT
        StoreKitManager.productListReceivedEvent += allProducts => {
            Debug.Log("received total products: " + allProducts.Count);
            mPurchaseReady = true;
        };

        // the following handles receipt verification
        StoreKitManager.autoConfirmTransactions = false;                                  //don't autoconfirm transactions until we have verified the receipt
        StoreKitManager.productPurchaseAwaitingConfirmationEvent += transaction => {
            mTransactionsInVerification[transaction.transactionIdentifier] = transaction; //add this transaction to the queue
            KongregateAPI.GetAPI().Mtx.VerifyTransactionId(transaction.transactionIdentifier);
        };

        StoreKitManager.purchaseFailedEvent += errorMsg => {
            Debug.Log("purchase failed: " + errorMsg);
            // pass null, if you do not have the transaction id.
            KongregateAPI.GetAPI().Analytics.FinishPurchase(KongregateAPI.PURCHASE_FAIL, null,
                                                            getPurchaseFields());
            mPurchaseReady = true;
        };

        StoreKitManager.purchaseCancelledEvent += errorMsg => {
            Debug.Log("purchase cancelled: " + errorMsg);
            // pass null, if you do not have the transaction id.
            KongregateAPI.GetAPI().Analytics.FinishPurchase(KongregateAPI.PURCHASE_FAIL, null,
                                                            getPurchaseFields());
            mPurchaseReady = true;
        };

        StoreKitBinding.requestProductData(new string[] { "com.kongregate.mobile.games.angryBots.t05_coins" });
#elif UNITY_ANDROID && PRIME31_STOREKIT
        GoogleIABManager.billingSupportedEvent += () => {
            Debug.Log("billing is supported");
            mPurchaseReady = true;
            var skus = new string[] { "com.kongregate.android.games.angrybots.t03_hard" };
            GoogleIAB.queryInventory(skus);
        };
        GoogleIABManager.queryInventorySucceededEvent += (purchases, skus) => {
            foreach (GooglePurchase purchase in purchases)
            {
                verifyGoogleReceipt(purchase);
            }
        };
        GoogleIABManager.purchaseSucceededEvent += purchase => {
            Debug.Log("Google IAB callback - purchased product: " + purchase);
            verifyGoogleReceipt(purchase);
        };
        GoogleIABManager.purchaseFailedEvent += message => {
            Debug.Log("Google IAB callback - purchase failed: " + message);
            KongregateAPI.GetAPI().Analytics.FinishPurchase(KongregateAPI.PURCHASE_FAIL,
                                                            message, getPurchaseFields());
            mPurchaseReady = true;
        };
        GoogleIABManager.consumePurchaseSucceededEvent += purchase => {
            Debug.Log("Google IAB callback - consume succeeded: " + purchase);
        };
        GoogleIABManager.consumePurchaseFailedEvent += message => {
            Debug.Log("Google IAB callback - consume failed: " + message);
        };
        GoogleIAB.init(GetGooglePublicKey());
#else
        mPurchaseReady = true;
#endif
    }
Beispiel #26
0
    void OnGUI()
    {
        beginColumn();

        if (GUILayout.Button("Initialize IAB"))
        {
            var key = "your public key from the Android developer portal here";
            key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmffbbQPr/zqRjP3vkxr1601/eKsXm5kO2NzQge8m7PeUj5V+saeounyL34U8WoZ3BvCRKbw6DrRLs2DMoVuCLq7QtJggBHT/bBSHGczEXGIPjWpw6OQb24EWM0PaTRTH2x2mC/X6RwIKcPLJFmy68T38Eh0DXnF4jjiIoaD0W8AYLjLzv0WvbIfgtJlvmmwvI2/Kta1LRnW3/Ggi5jb9UmXZAUIBz8kQtSH5FUCmFOQHMzekfg8rQ4VO1nlWhnB58UPwsxWt/DNyDfqv2VMeA2+VJG0fkiMl/6vWA7+ianVTU3owXcvxJHseEDUVYo1wEKfhK7ErGB7sxDJx5wHXAwIDAQAB";
            GoogleIAB.init(key);
        }


        if (GUILayout.Button("Query Inventory"))
        {
            // enter all the available skus from the Play Developer Console in this array so that item information can be fetched for them
            var skus = new string[] { "com.prime31.testproduct", "android.test.purchased", "com.prime31.managedproduct", "com.prime31.testsubscription" };
            GoogleIAB.queryInventory(skus);
        }


        if (GUILayout.Button("Are subscriptions supported?"))
        {
            Debug.Log("subscriptions supported: " + GoogleIAB.areSubscriptionsSupported());
        }


        if (GUILayout.Button("Purchase Test Product"))
        {
            GoogleIAB.purchaseProduct("android.test.purchased");
        }


        if (GUILayout.Button("Consume Test Purchase"))
        {
            GoogleIAB.consumeProduct("android.test.purchased");
        }


        if (GUILayout.Button("Test Unavailable Item"))
        {
            GoogleIAB.purchaseProduct("android.test.item_unavailable");
        }


        endColumn(true);


        if (GUILayout.Button("Purchase Real Product"))
        {
            GoogleIAB.purchaseProduct("com.prime31.testproduct", "payload that gets stored and returned");
        }


        if (GUILayout.Button("Purchase Real Subscription"))
        {
            GoogleIAB.purchaseProduct("com.prime31.testsubscription", "subscription payload");
        }


        if (GUILayout.Button("Consume Real Purchase"))
        {
            GoogleIAB.consumeProduct("com.prime31.testproduct");
        }


        if (GUILayout.Button("Enable High Details Logs"))
        {
            GoogleIAB.enableLogging(true);
        }


        if (GUILayout.Button("Consume Multiple Purchases"))
        {
            var skus = new string[] { "com.prime31.testproduct", "android.test.purchased" };
            GoogleIAB.consumeProducts(skus);
        }

        endColumn();
    }
    void OnGUI()
    {
        beginColumn();

        if (GUILayout.Button("Initialize IAB"))
        {
            var key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr4RxjBkG9CEW7Z/ug+F739LXkLiTO6+Igv/2h4WqsYzLUzJJC0RBG4EsKT5LepByCSZ3AD+mBIe13kKQJisLmgtlTspkiEwCqX+oJEpm7FN2iRZX9h7EtE/p/2B2K/hFCUJqe44nliRwUhnmTo7+5v8jy2osNASATAwU4CWr+RlCZ+DnWiDM0WqnIqSiSkluSnay4zYfKzD9zsv7tfj1EYyV96RefYDV+xaBP7F43z9//SfZ5EwNtt/pjzY3y/F5hOCY0YM2foMp5JELZOHHLtTFXMtBvuO5RW62ze+h10T1kcwWAzf19aXHr3AwuKByD94C5ghPVUm/p4M1ZXdEAwIDAQAB";
            //key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmffbbQPr/zqRjP3vkxr1601/eKsXm5kO2NzQge8m7PeUj5V+saeounyL34U8WoZ3BvCRKbw6DrRLs2DMoVuCLq7QtJggBHT/bBSHGczEXGIPjWpw6OQb24EWM0PaTRTH2x2mC/X6RwIKcPLJFmy68T38Eh0DXnF4jjiIoaD0W8AYLjLzv0WvbIfgtJlvmmwvI2/Kta1LRnW3/Ggi5jb9UmXZAUIBz8kQtSH5FUCmFOQHMzekfg8rQ4VO1nlWhnB58UPwsxWt/DNyDfqv2VMeA2+VJG0fkiMl/6vWA7+ianVTU3owXcvxJHseEDUVYo1wEKfhK7ErGB7sxDJx5wHXAwIDAQAB";
            GoogleIAB.init(key);
        }


        if (GUILayout.Button("Query Inventory"))
        {
            // enter all the available skus from the Play Developer Console in this array so that item information can be fetched for them
            var skus = new string[] { "com.prime31.testproduct", "android.test.purchased", "com.prime31.managedproduct", "com.prime31.testsubscription" };
            GoogleIAB.queryInventory(skus);
        }


        if (GUILayout.Button("Are subscriptions supported?"))
        {
            Debug.Log("subscriptions supported: " + GoogleIAB.areSubscriptionsSupported());
        }


        if (GUILayout.Button("Purchase Test Product"))
        {
            GoogleIAB.purchaseProduct("test003");
        }


        if (GUILayout.Button("Consume Test Purchase"))
        {
            GoogleIAB.consumeProduct("test003");
        }


        if (GUILayout.Button("Test Unavailable Item"))
        {
            GoogleIAB.purchaseProduct("android.test.item_unavailable");
        }


        endColumn(true);


        if (GUILayout.Button("Purchase Real Product"))
        {
            GoogleIAB.purchaseProduct("com.prime31.testproduct", "payload that gets stored and returned");
        }


        if (GUILayout.Button("Purchase Real Subscription"))
        {
            GoogleIAB.purchaseProduct("com.prime31.testsubscription", "subscription payload");
        }


        if (GUILayout.Button("Consume Real Purchase"))
        {
            GoogleIAB.consumeProduct("com.prime31.testproduct");
        }


        if (GUILayout.Button("Enable High Details Logs"))
        {
            GoogleIAB.enableLogging(true);
        }


        if (GUILayout.Button("Consume Multiple Purchases"))
        {
            var skus = new string[] { "com.prime31.testproduct", "android.test.purchased" };
            GoogleIAB.consumeProducts(skus);
        }

        endColumn();
    }
Beispiel #28
0
 public void InitPurchase()
 {
             #if UNITY_ANDROID
     GoogleIAB.init(key);
             #endif
 }
Beispiel #29
0
    void OnGUI()
    {
        beginColumn();

        if (GUILayout.Button("Initialize IAB"))
        {
            var key = "your public key from the Android developer portal here";
            key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAu6jn+Es/Lp/MaC6HsFY1XDVd7ZRU19b7NnOmjKN4Zs/kgb1/A8g0tlrgs85/yfzmroPIp66SnTsvtuV1bbbNcIwaecswCTHNOAksokZtLlOc7B/90cp1EdNM1ERKxmcLy3nsaCvWkTDSP/+MD0jdI1KLwCTnjsbcNAUy+zSlIu0xmw+lGSoB/0l4xiniF701yLjWct0OMNljOoSOVRiq5/mhXrt8UWHpB/F4JNJB3CbqODALPII5fcg7KNXo7P0Zov+ndAF2UjzSCru1H97bWoQYScdrtCgnrBGuNtInbSw5qUZFaPDouKaRHOgbSU+4a4+7ZcvjEmXpY9AlNAEZrQIDAQAB";
            GoogleIAB.init(key);
        }


        if (GUILayout.Button("Query Inventory"))
        {
            // enter all the available skus from the Play Developer Console in this array so that item information can be fetched for them
            var skus = new string[] { "com.prime31.testproduct", "android.test.purchased", "com.prime31.managedproduct", "com.prime31.testsubscription" };
            GoogleIAB.queryInventory(skus);
        }


        if (GUILayout.Button("Are subscriptions supported?"))
        {
            Debug.Log("subscriptions supported: " + GoogleIAB.areSubscriptionsSupported());
        }


        if (GUILayout.Button("Purchase Test Product"))
        {
            GoogleIAB.purchaseProduct("android.test.purchased");
        }


        if (GUILayout.Button("Consume Test Purchase"))
        {
            GoogleIAB.consumeProduct("android.test.purchased");
        }


        if (GUILayout.Button("Test Unavailable Item"))
        {
            GoogleIAB.purchaseProduct("android.test.item_unavailable");
        }


        endColumn(true);


        if (GUILayout.Button("Purchase Real Product"))
        {
            GoogleIAB.purchaseProduct("ruby_50", "payload that gets stored and returned");
        }


        if (GUILayout.Button("Purchase Real Subscription"))
        {
            GoogleIAB.purchaseProduct("com.prime31.testsubscription", "subscription payload");
        }


        if (GUILayout.Button("Consume Real Purchase"))
        {
            GoogleIAB.consumeProduct("com.prime31.testproduct");
        }


        if (GUILayout.Button("Enable High Details Logs"))
        {
            GoogleIAB.enableLogging(true);
        }


        if (GUILayout.Button("Consume Multiple Purchases"))
        {
            var skus = new string[] { "com.prime31.testproduct", "android.test.purchased" };
            GoogleIAB.consumeProducts(skus);
        }

        endColumn();
    }
    public List <StoreKitTransaction> storekitTracs             = new List <StoreKitTransaction>();             // 소모되지 않아 다시 소모 처리 시도된 상품
#endif



    //결제 관련 정보위해 초기화
    public void Init_Payment()
    {
        ////상품이름이 없으면 초기화 진행하자
        if (Dic_productIDs == null)
        {
            Dic_productIDs = new Dictionary <ushort, string>()
            {
                { 201, "com.cle.dy.suddenground.gem_200" },
                { 202, "com.cle.dy.suddenground.gem_1000" },
                { 203, "com.cle.dy.suddenground.gem_2000" },
                { 204, "com.cle.dy.suddenground.gem_6000" },
                { 205, "com.cle.dy.suddenground.gem_12000" },
                { 301, "com.cle.dy.suddenground.cash_1" },
                { 302, "com.cle.dy.suddenground.cash_2" },
                { 303, "com.cle.dy.suddenground.cash_3" },
                { 304, "com.cle.dy.suddenground.cash_4" },
                { 305, "com.cle.dy.suddenground.cash_5" },
                { 306, "com.cle.dy.suddenground.cash_6" },
                { 307, "com.cle.dy.suddenground.cash_7" },
                { 308, "com.cle.dy.suddenground.cash_8" },
            };

            productIDs = new string[Dic_productIDs.Count];
            int idx = 0;
            foreach (var pId in Dic_productIDs)
            {
                productIDs[idx] = pId.Value;
                idx++;
            }

            //productIDs = new string[] { "com.cle.dy.suddenground.gem_200", "com.cle.dy.suddenground.gem_1000","com.cle.dy.suddenground.gem_2000"
            //,"com.cle.dy.suddenground.gem_6000","com.cle.dy.suddenground.gem_12000", "com.cle.dy.suddenground.cash_1",
            //"com.cle.dy.suddenground.cash_2","com.cle.dy.suddenground.cash_3",/*"com.cle.dy.suddenground.cash_4",*/"com.cle.dy.suddenground.cash_5"};



            //int _productCount = productIDs.Length;
            //int idx = 0;
            //
            //foreach (var shopItem in TableDataManager.instance.Infos_shops)
            //{
            //	if (idx < _productCount)
            //	{
            //		if (shopItem.Value.ShopIdx / 100 == 2 || shopItem.Value.ShopIdx / 100 == 3 || shopItem.Value.ShopIdx / 100 == 4) //상품인덱스가 200 번대 이거나 300번대 이거나 400번대
            //		{
            //			Dic_productIDs[shopItem.Value.ShopIdx] = productIDs[idx];
            //			idx++;
            //		}
            //
            //	}
            //}

            Debug.Log("초기화~~~~~~~~~~~~~Dic_productIDs");
            Prime31.Utils.logObject(Dic_productIDs);

            //에디터는 IsGetQueryInventory 값 true
#if UNITY_EDITOR
            IsGetQueryInventory = true;
#endif


            //각 플랫폼별로 인앱결제초기화하기
#if UNITY_ANDROID
            //구글개발자 센터에서받은 어플리케이션 라이센스키 (구글콘솔개발자센터 -> 개발도구 -> 서비스및 API ->어플리케이션 라이센스키 )
            string key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqADPACKXd7+ygFtcAnh5wrpULFbK9cbPch2v0EOfzzsn1mOTJk3lFT432GKcFUpj01oGEha2bIt8e6YEFVgbYIIo3JRPYfrUMsqRGf82ItyGLwzZm2DNodnGJpRXvI0hqHrH0Z1aTpME6cgu9GrtbaqZ8t3pqZ38/w1nKUDfGzJ0FurS9zyWW+x7e4tTRnrBAxnQFk5OXmazW2LIT1+9vq9AI5ad6MntT7ZufubbTbbzX6kwzEUaiWRJQjZhCQzyq/MgsXCCgHTJ1GjzZZY2Zal9w/kX7s+z3T61ElT65zrz1rKBJRhFzp/CdGetrBFJvmYB3vfpxnIABu2EgF7jQQIDAQAB";
            GoogleIABManager.billingSupportedEvent        += billingSupportedEvent;
            GoogleIABManager.billingNotSupportedEvent     += billingNotSupportedEvent;
            GoogleIABManager.queryInventorySucceededEvent += queryInventorySucceededEvent;

            GoogleIABManager.queryInventoryFailedEvent += queryInventoryFailedEvent;

            GoogleIABManager.purchaseCompleteAwaitingVerificationEvent += purchaseCompleteAwaitingVerificationEvent;

            //상품 구매 성공 콜백함수
            GoogleIABManager.purchaseSucceededEvent += purchaseSucceededEvent;
            //상품 구매 실패 콜백함수
            GoogleIABManager.purchaseFailedEvent += purchaseFailedEvent;

            //상품 컨슘(소모)처리 성공 콜백함수
            GoogleIABManager.consumePurchaseSucceededEvent += consumePurchaseSucceededEvent;
            //상품 컨슘(소모)처리 실패 콜백함수
            GoogleIABManager.consumePurchaseFailedEvent += consumePurchaseFailedEvent;

            // 인앱결제 초기화
            GoogleIAB.init(key);
            UserEditor.Getsingleton.EditLog("안드로이드 인앱결제 초기화완료");
#elif UNITY_IOS
            UserEditor.Getsingleton.EditLog("IOS 인앱결제 초기화");

            StoreKitManager.transactionUpdatedEvent += transactionUpdatedEvent;
            StoreKitManager.productPurchaseAwaitingConfirmationEvent += productPurchaseAwaitingConfirmationEvent;
            StoreKitManager.purchaseSuccessfulEvent           += purchaseSuccessfulEvent;
            StoreKitManager.purchaseCancelledEvent            += purchaseCancelledEvent;
            StoreKitManager.purchaseFailedEvent               += purchaseFailedEvent;
            StoreKitManager.productListReceivedEvent          += productListReceivedEvent;
            StoreKitManager.productListRequestFailedEvent     += productListRequestFailedEvent;
            StoreKitManager.restoreTransactionsFailedEvent    += restoreTransactionsFailedEvent;
            StoreKitManager.restoreTransactionsFinishedEvent  += restoreTransactionsFinishedEvent;
            StoreKitManager.paymentQueueUpdatedDownloadsEvent += paymentQueueUpdatedDownloadsEvent;

            StoreKitManager.productListReceivedEvent += allProducts =>
            {
                UserEditor.Getsingleton.EditLog("received total products: " + allProducts.Count);
                Products = allProducts;
            };

            //자동 컨슘처리 비활성화 -> 내가 컨슘처리할것이기 때문
            StoreKitManager.autoConfirmTransactions = false;

            StoreKitBinding.requestProductData(productIDs);
#endif
        }
    }