예제 #1
0
        private void OnClick(object sender, FocusManager.ClickEventArgs clickEventArgs)
        {
            if (null == clickEventArgs ||
                null == clickEventArgs.Button)
            {
                return;
            }

            m_debugText = clickEventArgs.Button.Text;

            if (clickEventArgs.Button == BtnGetProducts)
            {
                m_debugText = "Fetching product list...";
                IList<Purchasable> purchasables = new List<Purchasable>()
                                                      {
                                                          new Purchasable("long_sword"),
                                                          new Purchasable("sharp_axe"),
                                                          new Purchasable("cool_level"),
                                                          new Purchasable("awesome_sauce"),
                                                          new Purchasable("__DECLINED__THIS_PURCHASE"),
                                                      };

                m_focusManager.SelectedProductIndex = 0;
                TaskRequestProducts = Activity1.PurchaseFacade.RequestProductListAsync(purchasables);
            }

            else if (clickEventArgs.Button == BtnPurchase)
            {
                if (null != TaskRequestProducts &&
                    m_focusManager.SelectedProductIndex < TaskRequestProducts.Result.Count)
                {
                    Product product = TaskRequestProducts.Result[m_focusManager.SelectedProductIndex];
                    TaskRequestPurchase = Activity1.PurchaseFacade.RequestPurchaseAsync(product);
                }
            }

            else if (clickEventArgs.Button == BtnGetReceipts)
            {
                m_focusManager.SelectedReceiptIndex = 0;
                TaskRequestReceipts = Activity1.PurchaseFacade.RequestReceiptsAsync();
            }

            else if (clickEventArgs.Button == BtnGetUUID)
            {
                m_debugText = "Requesting Gamer UUID...";
                TaskRequestGamer = Activity1.PurchaseFacade.RequestGamerUuidAsync();
            }

            else if (clickEventArgs.Button == BtnPause)
            {
                m_debugText = "Pause button detected.";
                m_focusManager.SelectedButton = BtnPause;
            }
        }
예제 #2
0
        private void OnClick(object sender, FocusManager.ClickEventArgs clickEventArgs)
        {
            if (null == clickEventArgs ||
                null == clickEventArgs.Button)
            {
                return;
            }

            m_debugText = clickEventArgs.Button.Text;

            if (clickEventArgs.Button == BtnGetProducts)
            {
                m_debugText = "Fetching product list...";
                List<string> purchasables = new List<string>()
                {
                    "long_sword",
                    "sharp_axe",
                    "cool_level",
                    "awesome_sauce",
                    "__DECLINED__THIS_PURCHASE",
                };

                m_focusManager.SelectedProductIndex = 0;

                m_debugText = "Requesting Product List...";
                m_products.Clear();
                PluginOuya.AsyncOuyaRequestProducts(m_callbacksRequestProducts, purchasables);
            }

            else if (clickEventArgs.Button == BtnPurchase)
            {
                if (m_products.Count == 0)
                {
                    m_debugText = "Request Products First...";
                }
                else if (m_focusManager.SelectedProductIndex < m_products.Count)
                {
                    m_debugText = "Requesting Purchase...";
                    Product product = m_products[m_focusManager.SelectedProductIndex];
                    PluginOuya.AsyncOuyaRequestPurchase(m_callbacksRequestPurchase, product.Identifier);
                }
            }

            else if (clickEventArgs.Button == BtnGetReceipts)
            {
                m_focusManager.SelectedReceiptIndex = 0;
                m_debugText = "Requesting Receipts...";
                m_receipts.Clear();
                PluginOuya.AsyncOuyaRequestReceipts(m_callbacksRequestReceipts);
            }

            else if (clickEventArgs.Button == BtnGetUUID)
            {
                m_debugText = "Requesting Gamer UUID...";
                PluginOuya.AsyncOuyaFetchGamerUUID(m_callbacksFetchGamerUUID);
            }

            else if (clickEventArgs.Button == BtnPause)
            {
                m_debugText = "Pause button detected.";
                m_focusManager.SelectedButton = BtnPause;
            }
        }