Better inventory window, inventory buttons on game HUD.

Part of #272
This commit is contained in:
Pieter-Jan Briers
2019-07-23 23:24:47 +02:00
parent 4d202a7678
commit 1fbb5915aa
12 changed files with 431 additions and 252 deletions

View File

@@ -45,6 +45,9 @@ namespace Content.Client.UserInterface
bool SandboxButtonVisible { get; set; }
Action<bool> SandboxButtonToggled { get; set; }
Control HandsContainer { get; }
Control InventoryQuickButtonContainer { get; }
// Init logic.
void Initialize();
}
@@ -66,6 +69,9 @@ namespace Content.Client.UserInterface
[Dependency] private readonly IInputManager _inputManager;
#pragma warning restore 649
public Control HandsContainer { get; private set; }
public Control InventoryQuickButtonContainer { get; private set; }
public void Initialize()
{
RootControl = new Control {MouseFilter = Control.MouseFilterMode.Ignore};
@@ -156,7 +162,33 @@ namespace Content.Client.UserInterface
_tutorialWindow.OnClose += () => _buttonTutorial.Pressed = false;
_inputManager.SetInputCommand(ContentKeyFunctions.OpenTutorial, InputCmdHandler.FromDelegate(s => ButtonTutorialOnOnToggled()));
_inputManager.SetInputCommand(ContentKeyFunctions.OpenTutorial,
InputCmdHandler.FromDelegate(s => ButtonTutorialOnOnToggled()));
var inventoryContainer = new HBoxContainer
{
GrowHorizontal = Control.GrowDirection.Begin,
GrowVertical = Control.GrowDirection.Begin,
SeparationOverride = 10
};
RootControl.AddChild(inventoryContainer);
inventoryContainer.SetAnchorAndMarginPreset(Control.LayoutPreset.BottomRight);
InventoryQuickButtonContainer = new MarginContainer
{
GrowHorizontal = Control.GrowDirection.Begin,
GrowVertical = Control.GrowDirection.Begin,
};
HandsContainer = new MarginContainer
{
GrowHorizontal = Control.GrowDirection.Both,
GrowVertical = Control.GrowDirection.Begin
};
inventoryContainer.Children.Add(HandsContainer);
inventoryContainer.Children.Add(InventoryQuickButtonContainer);
}
private void ButtonTutorialOnOnToggled()