Example #1
0
    public static bool Initiate(bool reinit = true)
    {
        if (reinit || manager == null || !manager.IsInitialized)
        {
            manager = new MyIAPManager
                      (
                new ProductData()
            {
                id = Const.NonConsumable.ID_DISABLE_ADS, type = ProductType.NonConsumable
            },
                new ProductData()
            {
                id = Const.Consumable.ID_GOLD_1, type = ProductType.Consumable
            },
                new ProductData()
            {
                id = Const.Consumable.ID_GOLD_2, type = ProductType.Consumable
            },
                new ProductData()
            {
                id = Const.Consumable.ID_GOLD_3, type = ProductType.Consumable
            }
                      );
        }
        manager.OnPurchasingSuccess += CallOnPurchaseSucess;
        manager.OnInitiated         += Manager_OnInitiated;

        Manager_OnInitiated();

        return(manager.IsInitialized);
    }
Example #2
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        MyIAPManager myScript = (MyIAPManager)target;

        if (GUILayout.Button("Add Money"))
        {
            MyIAPManager.instance.AddCurrency(500);
        }

        if (GUILayout.Button("Clear Money"))
        {
            MyIAPManager.instance.ClearCurrency();
        }

        if (GUILayout.Button("Clear Purchases"))
        {
            MyIAPManager.instance.ClearPurchases();
        }
    }
Example #3
0
    void Awake()
    {
        if (instance != null)
        {
            Destroy(instance.gameObject);
        }
        instance = this;

        if (!PlayerPrefs.HasKey(CURRENCY_ID))
        {
            PlayerPrefs.SetInt(CURRENCY_ID, 0);
        }

        foreach (var entry in LEVEL_ITEMS)
        {
            if (!PlayerPrefs.HasKey(entry.ID))
            {
                PlayerPrefs.SetInt(entry.ID, 0);
            }

            LEVELED_ITEMS[entry.ID] = entry;
        }

        foreach (var entry in RAD_ITEMS)
        {
            if (!PlayerPrefs.HasKey(entry.ID))
            {
                PlayerPrefs.SetInt(entry.ID, entry.DEFAULT);
            }

            RADIO_ITEMS[entry.ID] = entry;
            entry.UnlockIndex(entry.DEFAULT);
        }

        foreach (var entry in CURR_ITEMS)
        {
            CURRENCY_ITEMS[entry.ID] = entry;
        }
    }
Example #4
0
 protected void Awake()
 {
     myIAPManager = new MyIAPManager();
     myIAPManager.OnPurchaseSuccess += MyIAPManager_OnPurchaseSuccess;
     myIAPManager.OnPurchaseFail    += MyIAPManager_OnPurchaseFail;
 }