Improved Inventory / Hand Slots UI (#2965)

This commit is contained in:
chairbender
2021-01-20 00:32:44 -08:00
committed by GitHub
parent 02ea6ce57c
commit f9670d36c4
15 changed files with 304 additions and 152 deletions

View File

@@ -66,7 +66,8 @@ namespace Content.Client.UserInterface
Control HandsContainer { get; }
Control SuspicionContainer { get; }
Control InventoryQuickButtonContainer { get; }
Control RightInventoryQuickButtonContainer { get; }
Control LeftInventoryQuickButtonContainer { get; }
bool CombatPanelVisible { get; set; }
bool CombatModeActive { get; set; }
@@ -100,7 +101,8 @@ namespace Content.Client.UserInterface
public Control HandsContainer { get; private set; }
public Control SuspicionContainer { get; private set; }
public Control InventoryQuickButtonContainer { get; private set; }
public Control RightInventoryQuickButtonContainer { get; private set; }
public Control LeftInventoryQuickButtonContainer { get; private set; }
public bool CombatPanelVisible
{
@@ -260,21 +262,6 @@ namespace Content.Client.UserInterface
_inputManager.SetInputCommand(ContentKeyFunctions.OpenTutorial,
InputCmdHandler.FromDelegate(s => ButtonTutorialOnOnToggled()));
var inventoryContainer = new HBoxContainer
{
SeparationOverride = 10
};
RootControl.AddChild(inventoryContainer);
LayoutContainer.SetGrowHorizontal(inventoryContainer, LayoutContainer.GrowDirection.Begin);
LayoutContainer.SetGrowVertical(inventoryContainer, LayoutContainer.GrowDirection.Begin);
LayoutContainer.SetAnchorAndMarginPreset(inventoryContainer, LayoutContainer.LayoutPreset.BottomRight);
InventoryQuickButtonContainer = new MarginContainer
{
SizeFlagsVertical = Control.SizeFlags.ShrinkEnd
};
_combatPanelContainer = new VBoxContainer
{
@@ -289,23 +276,40 @@ namespace Content.Client.UserInterface
}
};
LayoutContainer.SetGrowHorizontal(_combatPanelContainer, LayoutContainer.GrowDirection.Begin);
LayoutContainer.SetGrowVertical(_combatPanelContainer, LayoutContainer.GrowDirection.Begin);
LayoutContainer.SetAnchorAndMarginPreset(_combatPanelContainer, LayoutContainer.LayoutPreset.BottomRight);
LayoutContainer.SetMarginBottom(_combatPanelContainer, -10f);
RootControl.AddChild(_combatPanelContainer);
_combatModeButton.OnToggled += args => OnCombatModeChanged?.Invoke(args.Pressed);
_targetingDoll.OnZoneChanged += args => OnTargetingZoneChanged?.Invoke(args);
inventoryContainer.Children.Add(InventoryQuickButtonContainer);
inventoryContainer.Children.Add(_combatPanelContainer);
var centerBottomContainer = new HBoxContainer
{
SeparationOverride = 5
};
LayoutContainer.SetAnchorAndMarginPreset(centerBottomContainer, LayoutContainer.LayoutPreset.CenterBottom);
LayoutContainer.SetGrowHorizontal(centerBottomContainer, LayoutContainer.GrowDirection.Both);
LayoutContainer.SetGrowVertical(centerBottomContainer, LayoutContainer.GrowDirection.Begin);
LayoutContainer.SetMarginBottom(centerBottomContainer, -10f);
RootControl.AddChild(centerBottomContainer);
HandsContainer = new MarginContainer
{
SizeFlagsVertical = Control.SizeFlags.ShrinkEnd
};
RootControl.AddChild(HandsContainer);
LayoutContainer.SetAnchorAndMarginPreset(HandsContainer, LayoutContainer.LayoutPreset.CenterBottom);
LayoutContainer.SetGrowHorizontal(HandsContainer, LayoutContainer.GrowDirection.Both);
LayoutContainer.SetGrowVertical(HandsContainer, LayoutContainer.GrowDirection.Begin);
RightInventoryQuickButtonContainer = new MarginContainer
{
SizeFlagsVertical = Control.SizeFlags.ShrinkEnd
};
LeftInventoryQuickButtonContainer = new MarginContainer
{
SizeFlagsVertical = Control.SizeFlags.ShrinkEnd
};
centerBottomContainer.AddChild(LeftInventoryQuickButtonContainer);
centerBottomContainer.AddChild(HandsContainer);
centerBottomContainer.AddChild(RightInventoryQuickButtonContainer);
SuspicionContainer = new MarginContainer
{