UI Layout v2. (#489)

* UI Layout v2.

* Lobby fixed.
This commit is contained in:
Pieter-Jan Briers
2019-12-05 16:00:03 +01:00
committed by GitHub
parent 4cf8e18d1f
commit 26da24c3c5
37 changed files with 220 additions and 229 deletions

View File

@@ -50,13 +50,13 @@ namespace Content.Client.Chat
public ChatBox()
{
MarginLeft = -475.0f;
/*MarginLeft = -475.0f;
MarginTop = 10.0f;
MarginRight = -10.0f;
MarginBottom = 235.0f;
AnchorLeft = 1.0f;
AnchorRight = 1.0f;
AnchorRight = 1.0f;*/
var outerVBox = new VBoxContainer();

View File

@@ -81,11 +81,11 @@ namespace Content.Client.Chat
{
_netManager.RegisterNetMessage<MsgChatMessage>(MsgChatMessage.NAME, _onChatMessage);
_speechBubbleRoot = new Control
_speechBubbleRoot = new LayoutContainer
{
MouseFilter = Control.MouseFilterMode.Ignore
};
_speechBubbleRoot.SetAnchorPreset(Control.LayoutPreset.Wide);
LayoutContainer.SetAnchorPreset(_speechBubbleRoot, LayoutContainer.LayoutPreset.Wide);
_userInterfaceManager.StateRoot.AddChild(_speechBubbleRoot);
_speechBubbleRoot.SetPositionFirst();
}

View File

@@ -31,8 +31,6 @@ namespace Content.Client.Chat
private readonly IEntity _senderEntity;
private readonly IChatManager _chatManager;
private readonly Control _panel;
private float _timeLeft = TotalTime;
public float VerticalOffset { get; set; }
@@ -57,7 +55,7 @@ namespace Content.Client.Chat
};
label.SetMessage(text);
_panel = new PanelContainer
var panel = new PanelContainer
{
StyleClasses = { "tooltipBox" },
Children = { label },
@@ -65,16 +63,19 @@ namespace Content.Client.Chat
ModulateSelfOverride = Color.White.WithAlpha(0.75f)
};
AddChild(_panel);
AddChild(panel);
ForceRunStyleUpdate();
_panel.Size = _panel.CombinedMinimumSize;
ContentHeight = _panel.Height;
Size = (_panel.Width, 0);
ContentHeight = panel.CombinedMinimumSize.Y;
_verticalOffsetAchieved = -ContentHeight;
}
protected override Vector2 CalculateMinimumSize()
{
return (base.CalculateMinimumSize().X, 0);
}
protected override void FrameUpdate(FrameEventArgs args)
{
base.FrameUpdate(args);
@@ -109,10 +110,10 @@ namespace Content.Client.Chat
var lowerCenter = _eyeManager.WorldToScreen(worldPos) / UIScale;
var screenPos = lowerCenter - (Width / 2, ContentHeight + _verticalOffsetAchieved);
Position = screenPos;
LayoutContainer.SetPosition(this, screenPos);
var height = (lowerCenter.Y - screenPos.Y).Clamp(0, ContentHeight);
Size = (Size.X, height);
LayoutContainer.SetSize(this, (Size.X, height));
}
private void Die()