Exemplo n.º 1
0
        void OnPurchaseSuccess(string[] items)
        {
            if (_pendingPurchase == null)
            {
                Debug.LogErrorFormat(
                    "Received purchase success notification when no purchase was in progress: {0}",
                    string.Join(", ", items));
                return;
            }

            // When the purchase succeeds, request an updated list of user items from
            // Kongregate. The purchase items flow doesn't return the metadata for the
            // purchased item, so we need to request the items ourself to finish the
            // purchase flow.
            KongregateWeb.RequestUserItemList();
        }
Exemplo n.º 2
0
    public void TestUserItems()
    {
        bool userItemsRecieved = false;

        KongregateWeb.UserItemsReceived += items =>
        {
            userItemsRecieved = true;
            Assert.AreEqual(
                new UserItem[]
            {
                new UserItem(123, "cool_item", "some metadata goes here", 1),
            },
                items);
        };

        KongregateWeb.RequestUserItemList();
        _kongWebInstance.SendMessage("OnUserItems", UserItemJson);
        Assert.IsTrue(userItemsRecieved);
    }
Exemplo n.º 3
0
        public void RetrieveProducts(ReadOnlyCollection <ProductDefinition> products)
        {
            Debug.Assert(
                _pendingPurchase == null,
                "Attempting to update store products while purchase is in progress");

            _pendingProducts = products;

            // Wait for the API to become ready, then request the list of store items
            // and the user's items.
            //
            // NOTE: BecameReady is invoked immediately if the API is already ready, so
            // the callback will still be invoked even if the API is already ready.
            KongregateWeb.BecameReady += () =>
            {
                KongregateWeb.RequestItemList();
                KongregateWeb.RequestUserItemList();
            };
        }