void back_OnClick(UIBase sender, MouseClickArgs e) { selectedUpgrade--; if (selectedUpgrade < 0) selectedUpgrade = Player.GetEquipmentList.Count - 1; updateSelected(); ContentHandler.PlaySFX("switch"); }
void buy_OnClick(UIBase sender, MouseClickArgs e) { var temp = Player.GetEquipmentList; if (Player.StoredOre >= temp[selectedUpgrade].Value.OreCost) { switch (Player.ActiveSlot) { case Slots.Slot1: Player.Slot1 = temp[selectedUpgrade].Key; Player.StoredOre -= temp[selectedUpgrade].Value.OreCost; updateSlots(sender, EventArgs.Empty); break; case Slots.Slot2: Player.Slot2 = temp[selectedUpgrade].Key; Player.StoredOre -= temp[selectedUpgrade].Value.OreCost; updateSlots(sender, EventArgs.Empty); break; default: throw new ArgumentOutOfRangeException(); } ContentHandler.PlaySFX("switch"); } else ContentHandler.PlaySFX("error"); }
void start_OnClick(UIBase sender, MouseClickArgs e) { ContentHandler.StopAll(); SwitchGameState(last); }
void return_OnClick(UIBase sender, MouseClickArgs e) { ContentHandler.PlaySFX("switch"); return_MouseAway(null, EventArgs.Empty); SwitchGameState(GameState.Menu); }
//UPGRADE UI - SLOTS void slot2_OnClick(UIBase sender, MouseClickArgs e) { UpgradeUI["slot2"].Color = Color.Red; UpgradeUI["slot2"].Scale = HIGHLIGHT_SCALE; Player.ActiveSlot = Slots.Slot2; UpgradeUI["slot1"].Color = NORMAL_COLOR; UpgradeUI["slot1"].Scale = NORMAL_SCALE; ContentHandler.PlaySFX("switch"); }
void next_OnClick(UIBase sender, MouseClickArgs e) { selectedUpgrade++; selectedUpgrade %= Player.GetEquipmentList.Count; updateSelected(); ContentHandler.PlaySFX("switch"); }
void repair_OnClick(UIBase sender, MouseClickArgs e) { if (Player.RepairCost <= Player.StoredOre) { Player.StoredOre -= Player.RepairCost; Player.Health = Player.STARTING_HEALTH; ContentHandler.PlaySFX("click"); } else ContentHandler.PlaySFX("error"); updateSelected(); }
//HELP UI - ENTER/EXIT void help_OnClick(UIBase sender, MouseClickArgs e) { help_MouseAway(null, EventArgs.Empty); ContentHandler.PlaySFX("switch"); SwitchGameState(GameState.Help); }
void exit_OnClick(UIBase sender, MouseClickArgs e) { if(ContentHandler.ShouldPlaySFX) { SoundEffectInstance tempClick = ContentHandler.SFX["click"].CreateInstance(); tempClick.Play(); while (tempClick.State == SoundState.Playing) ; //wait until click is done playing } this.Exit(); //then exit }
void exitToMenu_OnClick(UIBase sender, MouseClickArgs e) { ContentHandler.PlaySFX("switch"); SwitchGameState(GameState.Menu); }
//UPGRADE UI - CONTINUE void continue_OnClick(UIBase sender, MouseClickArgs e) { Player.ActiveSlot = Slots.Slot1; ContentHandler.PlaySFX("switch"); SwitchGameState(GameState.Game); }
public virtual void Update(GameTime gameTime) { if (Active) { if (MouseOver != null && InputHandler.IsMouseOverObject(this.GetBoundingBox())) //if mouse is in the bounding box MouseOver(this, new EventArgs()); if (MouseAway != null && InputHandler.HasLeftObject(this.GetBoundingBox())) //if mouse WAS in the bounding box MouseAway(this, new EventArgs()); if (OnClick != null) //determine mouse button clicked and invoke event { MouseClickArgs e = new MouseClickArgs(); if (InputHandler.IsClickingObject(this.GetBoundingBox(), MouseButtons.LeftMouseButton)) e.Button = MouseButtons.LeftMouseButton; if (InputHandler.IsClickingObject(this.GetBoundingBox(), MouseButtons.RightMouseButton)) e.Button = MouseButtons.RightMouseButton; if (InputHandler.IsClickingObject(this.GetBoundingBox(), MouseButtons.MiddleMouseButton)) e.Button = MouseButtons.MiddleMouseButton; if (e.Button != MouseButtons.None) OnClick(this, e); } } }