public EquipmentPanel(GameState state) : base((int)Renderer.GetResoultion().X - 400, 0, 400, 0, BarMode.Empty, state) { Instance = this; _gameState = state; SetContentSize(GetContentWidth(), (GetContentWidth() / 5) * 6); SetPosition((int)GetBodyPosition().X, (int)(Renderer.GetResoultion().Y - 60 - GetBodySize().Y)); _buttons = new List <Button>(); int y = 0; int width = GetContentWidth() / 3; for (int i = 0; i < (int)EquipmentSlot.Ring + 1; i++) { y = 10 + (i * 32) + (i * 10); string text = ((EquipmentSlot)i).ToString() + ":"; Label label = new Label(width - Renderer.GetFont().GetTextWidth(text), 10 + (i * 32) + (i * 10), 100, 32, state); label.SetText(text); this.AddControl(label); Button removeButton = new Button("Remove", GetContentWidth() - width + 10, y, width - 20, 32, state); removeButton.OnTrigger += RemoveEquipment; _buttons.Add(removeButton); this.AddControl(removeButton); } y += 42; string text2 = "Ammo:"; Label label2 = new Label(width - Renderer.GetFont().GetTextWidth(text2), y, 100, 32, state); label2.SetText(text2); this.AddControl(label2); _removeAmmoButton = new Button("Remove", GetContentWidth() - width + 10, y, width - 20, 32, state); _removeAmmoButton.OnTrigger += RemoveAmmo; this.AddControl(_removeAmmoButton); }
public override void Close() { Instance = null; base.Close(); }