private void SetSelection(ButtonSprite selection) { if (null != selection && m_timerSelection < DateTime.Now) { m_timerSelection = DateTime.Now + TimeSpan.FromMilliseconds(DELAY_MS); SelectedButton = selection; } }
public void UpdatePauseFocus(ButtonSprite pauseButton) { for (int index = 0; index < 4; ++index) { if (PausePressed((PlayerIndex)index)) { SetSelection(pauseButton); } } }
public void UpdatePauseFocus(ButtonSprite pauseButton) { for (int index = 0; index < 4; ++index) { if (PausePressed((PlayerIndex)index)) { SetSelection(pauseButton); } } }
private void SetSelection(ButtonSprite selection) { if (null != selection && m_timerSelection < DateTime.Now) { m_timerSelection = DateTime.Now + TimeSpan.FromMilliseconds(DELAY_MS); SelectedButton = selection; } }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { base.Initialize(); m_graphics.GraphicsDevice.DeviceReset += DeviceResetEvent; BtnRequestProducts = new ButtonSprite (); BtnRequestProducts.Position = new Vector2 (150, 200); BtnRequestProducts.TextureScale = new Vector2 (2.25f, 0.5f); BtnRequestProducts.Text = Activity1.GetLocalizedString("RequestProductList"); BtnRequestProducts.TextOffset = new Vector2 (40, 20); m_buttons.Add (BtnRequestProducts); BtnRequestPurchase = new ButtonSprite (); BtnRequestPurchase.Position = new Vector2 (500, 200); BtnRequestPurchase.TextureScale = new Vector2 (2f, 0.5f); BtnRequestPurchase.Text = Activity1.GetLocalizedString("RequestPurchase"); BtnRequestPurchase.TextOffset = new Vector2 (40, 20); m_buttons.Add (BtnRequestPurchase); BtnRequestReceipts = new ButtonSprite (); BtnRequestReceipts.Position = new Vector2 (800, 200); BtnRequestReceipts.TextureScale = new Vector2 (2f, 0.5f); BtnRequestReceipts.Text = Activity1.GetLocalizedString("RequestReceipts"); BtnRequestReceipts.TextOffset = new Vector2 (30, 20); m_buttons.Add (BtnRequestReceipts); BtnRequestGamerInfo = new ButtonSprite (); BtnRequestGamerInfo.Position = new Vector2 (1100, 200); BtnRequestGamerInfo.TextureScale = new Vector2 (2f, 0.5f); BtnRequestGamerInfo.Text = Activity1.GetLocalizedString("RequestGamerInfo"); BtnRequestGamerInfo.TextOffset = new Vector2 (30, 20); m_buttons.Add (BtnRequestGamerInfo); BtnExit = new ButtonSprite (); BtnExit.Position = new Vector2 (1400, 200); BtnExit.TextureScale = new Vector2 (1f, 0.5f); BtnExit.Text = Activity1.GetLocalizedString("Exit"); BtnExit.TextOffset = new Vector2 (30, 20); m_buttons.Add (BtnExit); BtnPause = new ButtonSprite (); BtnPause.Position = new Vector2 (1650, 200); BtnPause.TextureScale = new Vector2 (1f, 0.5f); BtnPause.Text = Activity1.GetLocalizedString("Pause"); BtnPause.TextOffset = new Vector2 (30, 20); m_buttons.Add (BtnPause); m_focusManager.SelectedButton = BtnRequestProducts; m_focusManager.Mappings [BtnRequestProducts] = new FocusManager.ButtonMapping () { Right = BtnRequestPurchase }; m_focusManager.Mappings [BtnRequestPurchase] = new FocusManager.ButtonMapping () { Left = BtnRequestProducts, Right = BtnRequestReceipts }; m_focusManager.Mappings [BtnRequestReceipts] = new FocusManager.ButtonMapping () { Left = BtnRequestPurchase, Right = BtnRequestGamerInfo, }; m_focusManager.Mappings [BtnRequestGamerInfo] = new FocusManager.ButtonMapping () { Left = BtnRequestReceipts, Right = BtnExit, }; m_focusManager.Mappings [BtnExit] = new FocusManager.ButtonMapping () { Left = BtnRequestGamerInfo, }; m_focusManager.Mappings [BtnPause] = new FocusManager.ButtonMapping () { Left = BtnExit, }; }
private void SetSelection(ButtonSprite selection) { SelectedButton = selection; }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // TODO: use this.Content to load your game content here font = Content.Load <SpriteFont>("spriteFont1"); BtnGetProducts = new ButtonSprite(); BtnGetProducts.Initialize(font, Content.Load <Texture2D>("Graphics\\ButtonActive"), Content.Load <Texture2D>("Graphics\\ButtonInactive")); BtnGetProducts.Position = new Vector2(150, 200); BtnGetProducts.TextureScale = new Vector2(2f, 0.5f); BtnGetProducts.Text = "Get Product List"; BtnGetProducts.TextOffset = new Vector2(40, 20); m_buttons.Add(BtnGetProducts); BtnPurchase = new ButtonSprite(); BtnPurchase.Initialize(font, Content.Load <Texture2D>("Graphics\\ButtonActive"), Content.Load <Texture2D>("Graphics\\ButtonInactive")); BtnPurchase.Position = new Vector2(600, 200); BtnPurchase.TextureScale = new Vector2(2f, 0.5f); BtnPurchase.Text = "Request Purchase"; BtnPurchase.TextOffset = new Vector2(40, 20); m_buttons.Add(BtnPurchase); BtnGetReceipts = new ButtonSprite(); BtnGetReceipts.Initialize(font, Content.Load <Texture2D>("Graphics\\ButtonActive"), Content.Load <Texture2D>("Graphics\\ButtonInactive")); BtnGetReceipts.Position = new Vector2(1100, 200); BtnGetReceipts.TextureScale = new Vector2(1.5f, 0.5f); BtnGetReceipts.Text = "Get Receipts"; BtnGetReceipts.TextOffset = new Vector2(30, 20); m_buttons.Add(BtnGetReceipts); BtnGetUUID = new ButtonSprite(); BtnGetUUID.Initialize(font, Content.Load <Texture2D>("Graphics\\ButtonActive"), Content.Load <Texture2D>("Graphics\\ButtonInactive")); BtnGetUUID.Position = new Vector2(1400, 200); BtnGetUUID.TextureScale = new Vector2(1.25f, 0.5f); BtnGetUUID.Text = "Get UUID"; BtnGetUUID.TextOffset = new Vector2(30, 20); m_buttons.Add(BtnGetUUID); BtnPause = new ButtonSprite(); BtnPause.Initialize(font, Content.Load <Texture2D>("Graphics\\ButtonActive"), Content.Load <Texture2D>("Graphics\\ButtonInactive")); BtnPause.Position = new Vector2(1650, 200); BtnPause.TextureScale = new Vector2(1f, 0.5f); BtnPause.Text = "Pause"; BtnPause.TextOffset = new Vector2(30, 20); m_buttons.Add(BtnPause); m_focusManager.SelectedButton = BtnGetProducts; m_focusManager.Mappings[BtnGetProducts] = new FocusManager.ButtonMapping() { Right = BtnPurchase }; m_focusManager.Mappings[BtnPurchase] = new FocusManager.ButtonMapping() { Left = BtnGetProducts, Right = BtnGetReceipts }; m_focusManager.Mappings[BtnGetReceipts] = new FocusManager.ButtonMapping() { Left = BtnPurchase, Right = BtnGetUUID, }; m_focusManager.Mappings[BtnGetUUID] = new FocusManager.ButtonMapping() { Left = BtnGetReceipts, }; m_focusManager.Mappings[BtnPause] = new FocusManager.ButtonMapping() { Left = BtnGetUUID, }; }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { base.Initialize(); m_graphics.GraphicsDevice.DeviceReset += DeviceResetEvent; BtnRequestProducts = new ButtonSprite(); BtnRequestProducts.Position = new Vector2(150, 200); BtnRequestProducts.TextureScale = new Vector2(2.25f, 0.5f); BtnRequestProducts.Text = Activity1.GetLocalizedString("RequestProductList"); BtnRequestProducts.TextOffset = new Vector2(40, 20); m_buttons.Add(BtnRequestProducts); BtnRequestPurchase = new ButtonSprite(); BtnRequestPurchase.Position = new Vector2(500, 200); BtnRequestPurchase.TextureScale = new Vector2(2f, 0.5f); BtnRequestPurchase.Text = Activity1.GetLocalizedString("RequestPurchase"); BtnRequestPurchase.TextOffset = new Vector2(40, 20); m_buttons.Add(BtnRequestPurchase); BtnRequestReceipts = new ButtonSprite(); BtnRequestReceipts.Position = new Vector2(800, 200); BtnRequestReceipts.TextureScale = new Vector2(2f, 0.5f); BtnRequestReceipts.Text = Activity1.GetLocalizedString("RequestReceipts"); BtnRequestReceipts.TextOffset = new Vector2(30, 20); m_buttons.Add(BtnRequestReceipts); BtnRequestGamerInfo = new ButtonSprite(); BtnRequestGamerInfo.Position = new Vector2(1100, 200); BtnRequestGamerInfo.TextureScale = new Vector2(2f, 0.5f); BtnRequestGamerInfo.Text = Activity1.GetLocalizedString("RequestGamerInfo"); BtnRequestGamerInfo.TextOffset = new Vector2(30, 20); m_buttons.Add(BtnRequestGamerInfo); BtnExit = new ButtonSprite(); BtnExit.Position = new Vector2(1400, 200); BtnExit.TextureScale = new Vector2(1f, 0.5f); BtnExit.Text = Activity1.GetLocalizedString("Exit"); BtnExit.TextOffset = new Vector2(30, 20); m_buttons.Add(BtnExit); BtnPause = new ButtonSprite(); BtnPause.Position = new Vector2(1650, 200); BtnPause.TextureScale = new Vector2(1f, 0.5f); BtnPause.Text = Activity1.GetLocalizedString("Pause"); BtnPause.TextOffset = new Vector2(30, 20); m_buttons.Add(BtnPause); m_focusManager.SelectedButton = BtnRequestProducts; m_focusManager.Mappings [BtnRequestProducts] = new FocusManager.ButtonMapping() { Right = BtnRequestPurchase }; m_focusManager.Mappings [BtnRequestPurchase] = new FocusManager.ButtonMapping() { Left = BtnRequestProducts, Right = BtnRequestReceipts }; m_focusManager.Mappings [BtnRequestReceipts] = new FocusManager.ButtonMapping() { Left = BtnRequestPurchase, Right = BtnRequestGamerInfo, }; m_focusManager.Mappings [BtnRequestGamerInfo] = new FocusManager.ButtonMapping() { Left = BtnRequestReceipts, Right = BtnExit, }; m_focusManager.Mappings [BtnExit] = new FocusManager.ButtonMapping() { Left = BtnRequestGamerInfo, }; m_focusManager.Mappings [BtnPause] = new FocusManager.ButtonMapping() { Left = BtnExit, }; }
private void SetSelection(ButtonSprite selection) { SelectedButton = selection; }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // TODO: use this.Content to load your game content here font = Content.Load<SpriteFont>("spriteFont1"); BtnGetProducts = new ButtonSprite(); BtnGetProducts.Initialize(font, Content.Load<Texture2D>("Graphics\\ButtonActive"), Content.Load<Texture2D>("Graphics\\ButtonInactive")); BtnGetProducts.Position = new Vector2(150, 200); BtnGetProducts.TextureScale = new Vector2(2f, 0.5f); BtnGetProducts.Text = "Get Product List"; BtnGetProducts.TextOffset = new Vector2(40, 20); m_buttons.Add(BtnGetProducts); BtnPurchase = new ButtonSprite(); BtnPurchase.Initialize(font, Content.Load<Texture2D>("Graphics\\ButtonActive"), Content.Load<Texture2D>("Graphics\\ButtonInactive")); BtnPurchase.Position = new Vector2(600, 200); BtnPurchase.TextureScale = new Vector2(2f, 0.5f); BtnPurchase.Text = "Request Purchase"; BtnPurchase.TextOffset = new Vector2(40, 20); m_buttons.Add(BtnPurchase); BtnGetReceipts = new ButtonSprite(); BtnGetReceipts.Initialize(font, Content.Load<Texture2D>("Graphics\\ButtonActive"), Content.Load<Texture2D>("Graphics\\ButtonInactive")); BtnGetReceipts.Position = new Vector2(1100, 200); BtnGetReceipts.TextureScale = new Vector2(1.5f, 0.5f); BtnGetReceipts.Text = "Get Receipts"; BtnGetReceipts.TextOffset = new Vector2(30, 20); m_buttons.Add(BtnGetReceipts); BtnGetUUID = new ButtonSprite(); BtnGetUUID.Initialize(font, Content.Load<Texture2D>("Graphics\\ButtonActive"), Content.Load<Texture2D>("Graphics\\ButtonInactive")); BtnGetUUID.Position = new Vector2(1400, 200); BtnGetUUID.TextureScale = new Vector2(1.25f, 0.5f); BtnGetUUID.Text = "Get UUID"; BtnGetUUID.TextOffset = new Vector2(30, 20); m_buttons.Add(BtnGetUUID); BtnPause = new ButtonSprite(); BtnPause.Initialize(font, Content.Load<Texture2D>("Graphics\\ButtonActive"), Content.Load<Texture2D>("Graphics\\ButtonInactive")); BtnPause.Position = new Vector2(1650, 200); BtnPause.TextureScale = new Vector2(1f, 0.5f); BtnPause.Text = "Pause"; BtnPause.TextOffset = new Vector2(30, 20); m_buttons.Add(BtnPause); m_focusManager.SelectedButton = BtnGetProducts; m_focusManager.Mappings[BtnGetProducts] = new FocusManager.ButtonMapping() { Right = BtnPurchase }; m_focusManager.Mappings[BtnPurchase] = new FocusManager.ButtonMapping() { Left = BtnGetProducts, Right = BtnGetReceipts }; m_focusManager.Mappings[BtnGetReceipts] = new FocusManager.ButtonMapping() { Left = BtnPurchase, Right = BtnGetUUID, }; m_focusManager.Mappings[BtnGetUUID] = new FocusManager.ButtonMapping() { Left = BtnGetReceipts, }; m_focusManager.Mappings[BtnPause] = new FocusManager.ButtonMapping() { Left = BtnGetUUID, }; }