Пример #1
0
    void Start()
    {
        #region Basic Information Initialization

        m_PurchaseListener     = new PurchaseListener();
        m_InitListener         = new InitListener();
        m_LicenseCheckListener = new LicenseCheckListener();

        #endregion

        #region Text Field Initialization

        GameObject gameObject = GameObject.Find("Information");
        m_TextField      = gameObject.GetComponent <Text>();
        m_TextField.text = "Please Click Init to Start";

        #endregion

        #region DropDown Initialization

        gameObject = GameObject.Find("Dropdown");

        m_Dropdown = gameObject.GetComponent <Dropdown>();
        m_Dropdown.ClearOptions();
        m_Dropdown.options.Add(new Dropdown.OptionData(Product1));
        m_Dropdown.options.Add(new Dropdown.OptionData(Product2));
        m_Dropdown.RefreshShownValue();

        #endregion

        InitUI();

        StoreService.LicenseCheck(m_LicenseCheckListener);
    }
    public void AddPurchaseListener(Purchase dlg, object userdata)
    {
        PurchaseListener item = new PurchaseListener();

        item.SetCallback(dlg);
        item.SetUserData(userdata);
        this.m_PurchaseListeners.Add(item);
    }
 public void OnInitialized(UserInfo userInfo)
 {
     Debug.Log("OnInitialized");
     purchaseListener = new PurchaseListener();
     StoreService.QueryInventory(purchaseListener);
     // EDIT StoreService.Purchase()
     // Purchase(<IAP product ID>, <Payload message>, <PurchaseListener instance>)
     StoreService.Purchase("in_app_item_non_consumable_1", "Information from buying user", purchaseListener);
 }
Пример #4
0
    void Start()
    {
        #region Basic Information Initialization

        purchaseListener = new PurchaseListener();
        initListener     = new InitListener();
        appInfo          = new AppInfo();

        /*
         * GameSettings.asset only supports Unity whose version is higher than 5.6.1 (inlcuded).
         * If developers are using older Unity, they should get these information from the developer portal and fill the AppInfo manually.
         */
        AppStoreSettings appStoreSettings = Resources.Load <AppStoreSettings>("GameSettings");
        appInfo.AppSlug      = appStoreSettings.AppSlug;
        appInfo.ClientId     = appStoreSettings.UnityClientID;
        appInfo.ClientKey    = appStoreSettings.UnityClientKey;
        appInfo.RSAPublicKey = appStoreSettings.UnityClientRSAPublicKey;

        Debug.Log("App Name: " + appStoreSettings.AppName);

        #endregion

        #region Text Field Initialization

        GameObject gameObject = GameObject.Find("Information");
        _textField      = gameObject.GetComponent <Text>();
        _textField.text = "Please Click Init to Start";

        #endregion

        #region DropDown Initialization

        gameObject = GameObject.Find("Dropdown");

        _dropdown = gameObject.GetComponent <Dropdown>();
        _dropdown.ClearOptions();
        _dropdown.options.Add(new Dropdown.OptionData(Product1));
        _dropdown.options.Add(new Dropdown.OptionData(Product2));
        _dropdown.RefreshShownValue();

        #endregion

        InitUI();
    }