/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { //Log.Info(TAG, string.Format("BUTTON_O is {0}", OuyaInput.GetButton(OuyaController.BUTTON_O))); if (OuyaInput.GetButtonUp(0, OuyaController.BUTTON_A)) { Exit(); } // TODO: Add your update logic here m_focusManager.UpdateFocus(); foreach (ButtonSprite button in m_buttons) { // button is active if the selected button is true button.m_isActive = (button == m_focusManager.SelectedButton); } if (OuyaInput.GetButtonUp(OuyaController.BUTTON_MENU)) { m_debugText = "Pause button detected."; m_focusManager.SelectedButton = BtnPause; } if (OuyaInput.GetButtonUp(OuyaController.BUTTON_O)) { if (m_focusManager.SelectedButton == BtnRequestProducts) { s_productIndex = 0; s_products.Clear(); m_debugText = "Requesting products..."; Activity1.RequestProducts(); } else if (m_focusManager.SelectedButton == BtnRequestPurchase) { if (s_productIndex < s_products.Count) { Purchasable purchasable = new Purchasable(s_products [s_productIndex].Identifier); m_debugText = "Requesting purchase..."; Activity1.RequestPurchase(purchasable); } else { m_debugText = "Be sure to request products to select a purchase..."; } } else if (m_focusManager.SelectedButton == BtnRequestReceipts) { m_debugText = "Requesting receipts..."; Activity1.RequestReceipts(); } else if (m_focusManager.SelectedButton == BtnRequestGamerInfo) { m_debugText = "Requesting GamerInfo..."; Activity1.RequestGamerInfo(); } else if (m_focusManager.SelectedButton == BtnExit) { m_debugText = "Exiting..."; Activity1.Quit(); } else if (m_focusManager.SelectedButton == BtnPause) { m_debugText = "Pause button detected..."; m_focusManager.SelectedButton = BtnPause; } } if (m_focusManager.SelectedButton == BtnRequestProducts || m_focusManager.SelectedButton == BtnRequestPurchase) { if (OuyaInput.GetButtonUp(OuyaController.BUTTON_DPAD_UP)) { if (s_productIndex > 0) { --s_productIndex; } } if (OuyaInput.GetButtonUp(OuyaController.BUTTON_DPAD_DOWN)) { if ((s_productIndex + 1) < s_products.Count) { ++s_productIndex; } } } base.Update(gameTime); OuyaInput.ClearButtonStates(); }