public override void Update(GameTime gameTime) { if (DragAndDropEquipment == null) { foreach (IUIElement ActiveButton in ArrayMenuButton) { ActiveButton.Update(gameTime); } if (MouseHelper.InputLeftButtonPressed()) { WeaponMenuEquipment SelectedEquipment = GetOwnedWeaponUnderMouse(MouseHelper.MouseStateCurrent.X, MouseHelper.MouseStateCurrent.Y); if (SelectedEquipment != null) { StartDragDrop(SelectedEquipment); } else { WeaponMenuEquipment EquipmentToBuy = GetShopWeaponUnderMouse(MouseHelper.MouseStateCurrent.X, MouseHelper.MouseStateCurrent.Y); if (EquipmentToBuy != null) { PushScreen(new BuyWeapon(EquipmentToBuy, Owner)); } } } } else { DoDragDrop(); } }
public ShopWeaponsScreen(Player Owner) { this.Owner = Owner; PlayerInventory = Owner.Equipment; ListShopEquipment = new List <WeaponMenuEquipment>(); DragAndDropEquipment = null; }
public void SetPrimaryWeapon(WeaponMenuEquipment WeaponToEquip, int Index) { if (ArrayEquipedPrimaryWeapon[Index] != null) { ListWeapon.Add(ArrayEquipedPrimaryWeapon[Index]); } ArrayEquipedPrimaryWeapon[Index] = WeaponToEquip; ListWeapon.Remove(WeaponToEquip); }
private void LoadPrimaryWeapons(BinaryReader BR, ContentManager Content) { int ListWeaponCount = BR.ReadInt32(); for (int C = 0; C < ListWeaponCount; ++C) { string WeaponName = BR.ReadString(); string WeaponCategory = BR.ReadString(); int WeaponLevel = BR.ReadInt32(); if (!string.IsNullOrEmpty(WeaponName)) { ArrayEquipedPrimaryWeapon[C] = new WeaponMenuEquipment(WeaponName, WeaponCategory, WeaponLevel, 150, Content.Load <Texture2D>("Triple Thunder/Menus/Shop/Weapons/" + WeaponName + " Text"), Content.Load <Texture2D>("Triple Thunder/Menus/Shop/Weapons/" + WeaponName + " Icon"), Content.Load <Texture2D>("Triple Thunder/Menus/Shop/Weapons/" + WeaponName + " Full")); } } }
private void DoDragDrop() { if (InputHelper.InputConfirmReleased()) { int XOffset = MyWeaponOutline.SpriteWidth / 2; int YOffset = MyWeaponOutline.SpriteHeight / 2; if (MouseHelper.MouseStateCurrent.X >= 700 - XOffset && MouseHelper.MouseStateCurrent.X < 700 + XOffset && MouseHelper.MouseStateCurrent.Y >= 140 - YOffset && MouseHelper.MouseStateCurrent.Y < 140 + YOffset) { PlayerInventory.SetPrimaryWeapon(DragAndDropEquipment, 0); } if (MouseHelper.MouseStateCurrent.X >= 700 - XOffset && MouseHelper.MouseStateCurrent.X < 700 + XOffset && MouseHelper.MouseStateCurrent.Y >= 200 - YOffset && MouseHelper.MouseStateCurrent.Y < 200 + YOffset) { PlayerInventory.SetPrimaryWeapon(DragAndDropEquipment, 1); } DragAndDropEquipment = null; } }
private void StartDragDrop(WeaponMenuEquipment EquipmentToDrag) { DragAndDropEquipment = EquipmentToDrag; }
public BuyWeapon(WeaponMenuEquipment EquipmentToBuy, Player Owner) { this.EquipmentToBuy = EquipmentToBuy; this.Owner = Owner; PlayerInventory = Owner.Equipment; }