Make examination of items in hand possible (#459)

This commit is contained in:
L.E.D
2019-11-23 15:57:44 -05:00
committed by Pieter-Jan Briers
parent 17b31c417b
commit 35f9de3366
2 changed files with 18 additions and 4 deletions

View File

@@ -73,7 +73,9 @@ namespace Content.Client.GameObjects.EntitySystems
{ {
CloseTooltip(); CloseTooltip();
var mousePos = _inputManager.MouseScreenPosition; var popupPos = _inputManager.MouseScreenPosition;
// Actually open the tooltip. // Actually open the tooltip.
_examineTooltipOpen = new Popup(); _examineTooltipOpen = new Popup();
@@ -100,7 +102,10 @@ namespace Content.Client.GameObjects.EntitySystems
const float minWidth = 300; const float minWidth = 300;
var size = Vector2.ComponentMax((minWidth, 0), panel.CombinedMinimumSize); var size = Vector2.ComponentMax((minWidth, 0), panel.CombinedMinimumSize);
_examineTooltipOpen.Open(UIBox2.FromDimensions(mousePos, size));
popupPos += Vector2.ComponentMin(Vector2.Zero, _userInterfaceManager.StateRoot.Size - (size + popupPos));
_examineTooltipOpen.Open(UIBox2.FromDimensions(popupPos, size));
if (entity.Uid.IsClientSide()) if (entity.Uid.IsClientSide())
{ {
@@ -130,6 +135,8 @@ namespace Content.Client.GameObjects.EntitySystems
var richLabel = new RichTextLabel(); var richLabel = new RichTextLabel();
richLabel.SetMessage(response.Message); richLabel.SetMessage(response.Message);
vBox.AddChild(richLabel); vBox.AddChild(richLabel);
_examineTooltipOpen.Position += Vector2.ComponentMin(Vector2.Zero,_userInterfaceManager.StateRoot.Size - (panel.Size + _examineTooltipOpen.Position));
} }
public void CloseTooltip() public void CloseTooltip()

View File

@@ -56,8 +56,6 @@ namespace Content.Client.UserInterface
{ {
IoCManager.InjectDependencies(this); IoCManager.InjectDependencies(this);
ToolTip = _loc.GetString("Your hands");
_handR = new UIBox2i(0, 0, BoxSize, BoxSize); _handR = new UIBox2i(0, 0, BoxSize, BoxSize);
_handL = _handR.Translated((BoxSize + BoxSpacing, 0)); _handL = _handR.Translated((BoxSize + BoxSpacing, 0));
@@ -277,6 +275,15 @@ namespace Content.Client.UserInterface
} }
} }
else if (args.Function == ContentKeyFunctions.ExamineEntity)
{
var examine = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<ExamineSystem>();
if (leftHandContains)
examine.DoExamine(LeftHand);
else if (rightHandContains)
examine.DoExamine(RightHand);
}
else if (args.Function == ContentKeyFunctions.MouseMiddle) else if (args.Function == ContentKeyFunctions.MouseMiddle)
{ {
SendSwitchHandTo(handIndex); SendSwitchHandTo(handIndex);