Beispiel #1
0
 public GuiHotbarBlock(int index, InventoryHotbar hotbar, Gui2dElement background)
     : base("hotbar_" + index, Vector2.Zero, Vector3.Zero, null, AspectRatioMode.Modify)
 {
     _hotbar     = hotbar;
     _background = background;
     _index      = index;
     _position   = background.Position + new Vector2(background.Size.X * (index) / 5, 0.05f);
     Snapshot    = _hotbar[index, 0];
     _selected   = false;
 }
Beispiel #2
0
        public void GenerateDefault()
        {
            var hotbarBackground = new Gui2dElement("hotbar", new Vector2(0.3f, -0.9f), new Vector2(0.4f, 0.1f) * 1.5f,
                                                    CMine.TextureManager.GetOrCreateTexture("hotbar", Textures.gui_hotbar),
                                                    AspectRatioMode.PreserveXModifyY);

            Add2dElement(hotbarBackground);


            var hotbar = _world.Player.Inventory.Hotbar;

            for (var i = 0; i < 5; i++)
            {
                AddBlockElement(new GuiHotbarBlock(i, hotbar, hotbarBackground));
            }
        }
Beispiel #3
0
 public void Add2dElement(Gui2dElement element)
 {
     _2dElements.Add(element.Name, element);
 }