Esempio n. 1
0
    public override void Initialize()
    {
        if (this.m_ProductsDict == null)
        {
            this.InitialProductItems();
        }

        string unconfirmedPurchaseID = PlayerPrefs.GetString(UNCONFIRMED_PURCHASE_ID_KEY, string.Empty);

        if (string.IsNullOrEmpty(unconfirmedPurchaseID))
        {
            string unconfirmedProductID = PlayerPrefs.GetString(UNCONFIRMED_PRODUCT_ID_KEY, string.Empty);
            if (string.IsNullOrEmpty(unconfirmedProductID))
            {
                NdIdleContext idleContext = new NdIdleContext();
                this.ChangeContext(idleContext);
                this.State = ShopActionState.Idle;
            }
            else
            {
                this.m_CurrentPurchaseID = unconfirmedProductID;
                NdRequestPurchaseIDContext requestContext = new NdRequestPurchaseIDContext();
                this.ChangeContext(requestContext);
                this.State = ShopActionState.Operating;
            }
        }
        else
        {
            NdConfirmContext confirmContext = new NdConfirmContext();
            this.ChangeContext(confirmContext);
            this.State = ShopActionState.Operating;
        }
    }
Esempio n. 2
0
    public void PurchaseProduct(string productID)
    {
        Debug.Log("start buying!");

        PlayerPrefs.SetString(NdShopUtility.UNCONFIRMED_PRODUCT_ID_KEY, productID);
        PlayerPrefs.Save();
        CommunicationUtility.Instance.GetPurchaseID(this.ShopModule, "ReceivedPurchaseID", true);
        NdRequestPurchaseIDContext requestContext = new NdRequestPurchaseIDContext();

        this.ShopModule.ChangeContext(requestContext);
    }