Exemplo n.º 1
0
        public ItemInventory(ItemScreen ui, UiSkinComponent skin, Texture2D texture, int x, int y, int width, int height, float sourceScale) : base(texture, x, y, width, height, sourceScale)
        {
            _itemui       = ui;
            TopRect       = new UiRectangle(this, skin.GetSkin("test"), PanelExt.SizeToBounds(Bounds, 0f, 0f, 1f, 0.1f), 0.5f);
            TopRect.Color = Microsoft.Xna.Framework.Color.Silver;


            _itemText = new TextPanel(this, ui.ParantMenu.StandardFont, "Item", TextSortMode.LEFT)
            {
                Color    = Color.Black,
                Position = PanelExt.PositionToBounds(TopRect.Bounds, 0.05f, 0.5f)
            };


            PanelGrid = new GridPanel(this, 4, 4, PanelExt.SizeToBounds(Bounds, 0f, 0.1f, 1f, 0.9f), 10, 10);
            for (int i = 0; i < 16; i++)
            {
                PanelGrid.AddGridChilde(new UiRectangle(skin.GetSkin("item"), new Rectangle(0, 0, 100, 100), 2)
                {
                    PanelCode = i
                });
            }

            _exit = new ImagePanel(this, "UI\\exit");
            _exit.SetPosition(PanelExt.PositionToBounds(Bounds, 0.95f, 0.05f));
            _exit.Scale = 1.5f;
            _exit.Recalculate();

            SelectOnEvent += ItemPanel_SelectOnEvent;
        }