private SimpleHUDWindow CreateEquipmentWindow(SpriteFont font, ContentManager content, Texture2D border, Rectangle screenRectangle, InventoryManager inventoryManager) { SimpleHUDWindow equipmentWindow = new SimpleHUDWindow(font); //TODO: hardcoded title equipmentWindow.Title = "Equipment"; EquipmentWindowComponent equipmentComponent = new EquipmentWindowComponent(font, content, inventoryManager); equipmentComponent.RegisterUnequip(OnUnequip); equipmentComponent.RegisterReplace(OnUnequip); equipmentWindow.BorderTexture = border; //TODO: hardcoded size equipmentWindow.Size = new Vector2(400, 600); float positionOffset = (screenRectangle.Width / 2 >= equipmentWindow.Size.X) ? (screenRectangle.Width / 2 - equipmentWindow.Size.X) / 2 : 0; Vector2 position = new Vector2(positionOffset, (screenRectangle.Height - equipmentWindow.Size.Y) / 2); equipmentWindow.Position = position; equipmentWindow.Component = equipmentComponent; equipmentComponent.RepositionHolders(); return(equipmentWindow); }
public void ShowEquipment() { if (!Enabled) { Show(); } EquipmentWindowComponent equipment = equipmentWindow.Component as EquipmentWindowComponent; equipment.SetEnabled(true); equipmentWindow.Show(); }
public void HideEquipment() { if (!inventoryWindow.Enabled) { Hide(); } EquipmentWindowComponent equipment = equipmentWindow.Component as EquipmentWindowComponent; equipment.SetEnabled(false); equipmentWindow.Hide(); }
public void OnEquip(object sender, EventArgs args) { if (!(sender is InventoryItem)) { return; } else { InventoryItem item = (InventoryItem)sender; EquipmentWindowComponent equipment = equipmentWindow.Component as EquipmentWindowComponent; equipment.EquipItem(item); } }
public void EquipItem(InventoryItem item) { EquipmentWindowComponent equipment = equipmentWindow.Component as EquipmentWindowComponent; equipment.EquipItem(item); }
public void RegisterStatChangeEvent(EventHandler evnt) { EquipmentWindowComponent equipment = (EquipmentWindowComponent)equipmentWindow.Component; equipment.Equipped += evnt; }