Exemplo n.º 1
0
        private SimpleHUDWindow CreateInventoryWindow(SpriteFont font, ContentManager content, Texture2D border, Rectangle screenRectangle, InventoryManager inventoryManager)
        {
            SimpleHUDWindow inventoryWindow = new SimpleHUDWindow(font);

            //TODO: hardcoded title
            inventoryWindow.Title = "Inventory";
            InventoryWindowComponent inventoryComponent = new InventoryWindowComponent(font, content, inventoryManager);

            inventoryComponent.RegisterEquip(OnEquip);
            inventoryWindow.BorderTexture = border;
            //TODO: hardcoded size
            inventoryWindow.Size = new Vector2(400, 600);

            float positionOffset = (screenRectangle.Width / 2 >= inventoryWindow.Size.X) ?
                                   (screenRectangle.Width / 2 - inventoryWindow.Size.X) / 2 :
                                   0;
            Vector2 position = new Vector2(screenRectangle.Width / 2 + positionOffset, (screenRectangle.Height - inventoryWindow.Size.Y) / 2);

            inventoryWindow.Position  = position;
            inventoryWindow.Component = inventoryComponent;

            return(inventoryWindow);
        }