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()

View File

@@ -59,7 +59,7 @@ namespace Content.Client
{
var label = new PopupLabel {Text = message};
var minimumSize = label.CombinedMinimumSize;
label.InitialPos = label.Position = coordinates.Position - minimumSize / 2;
LayoutContainer.SetPosition(label, label.InitialPos = coordinates.Position - minimumSize / 2);
_userInterfaceManager.PopupRoot.AddChild(label);
_aliveLabels.Add(label);
}
@@ -94,7 +94,7 @@ namespace Content.Client
public void Update(FrameEventArgs eventArgs)
{
_timeLeft += eventArgs.DeltaSeconds;
Position = InitialPos - new Vector2(0, 20 * (_timeLeft * _timeLeft + _timeLeft));
LayoutContainer.SetPosition(this, InitialPos - (0, 20 * (_timeLeft * _timeLeft + _timeLeft)));
if (_timeLeft > 0.5f)
{
Modulate = Color.White.WithAlpha(1f - 0.2f * (float)Math.Pow(_timeLeft - 0.5f, 3f));

View File

@@ -41,10 +41,10 @@ namespace Content.Client.Construction
private List<CategoryNode> FlattenedCategories;
private readonly PlacementManager Placement;
protected override Vector2? CustomSize => (500, 350);
public ConstructionMenu()
{
Size = (500, 350);
IoCManager.InjectDependencies(this);
Placement = (PlacementManager) IoCManager.Resolve<IPlacementManager>();
Placement.PlacementCanceled += OnPlacementCanceled;

View File

@@ -124,8 +124,6 @@ namespace Content.Client.GameObjects.Components.Actor
{
_contentsVBox.AddChild(element.Scene);
}
Size = CombinedMinimumSize;
}
}
}

View File

@@ -42,7 +42,6 @@ namespace Content.Client.GameObjects.Components.Chemistry
_window = new ReagentDispenserWindow
{
Title = _localizationManager.GetString("Reagent dispenser"),
Size = (500, 600)
};
_window.OpenCenteredMinSize();

View File

@@ -55,6 +55,8 @@ namespace Content.Client.GameObjects.Components.Chemistry
[Dependency] private readonly ILocalizationManager _localizationManager;
#pragma warning restore 649
protected override Vector2? CustomSize => (500, 600);
/// <summary>
/// Create and initialize the dispenser UI client-side. Creates the basic layout,
/// actual data isn't filled in until the server sends data about the dispenser.
@@ -118,7 +120,6 @@ namespace Content.Client.GameObjects.Components.Chemistry
//Currently empty, when server sends state data this will have container contents and fill volume.
(ContainerInfo = new VBoxContainer
{
MarginLeft = 5.0f,
SizeFlagsHorizontal = SizeFlags.FillExpand,
Children =
{

View File

@@ -165,17 +165,16 @@ namespace Content.Client.GameObjects
const int width = ButtonSize * 4 + ButtonSeparation * 3 + RightSeparation;
const int height = ButtonSize * 4 + ButtonSeparation * 3;
var windowContents = new Control {CustomMinimumSize = (width, height)};
var windowContents = new LayoutContainer {CustomMinimumSize = (width, height)};
Contents.AddChild(windowContents);
void AddButton(Slots slot, string textureName, Vector2 position)
{
var texture = resourceCache.GetTexture($"/Textures/UserInterface/Inventory/{textureName}.png");
var storageTexture = resourceCache.GetTexture("/Textures/UserInterface/Inventory/back.png");
var button = new InventoryButton(slot, texture, storageTexture)
{
Position = position
};
var button = new InventoryButton(slot, texture, storageTexture);
LayoutContainer.SetPosition(button, position);
windowContents.AddChild(button);
buttonDict.Add(slot, button);
@@ -206,8 +205,6 @@ namespace Content.Client.GameObjects
AddButton(Slots.BELT, "belt", (rSep + 3 * (size + sep), size + sep));
AddButton(Slots.POCKET1, "pocket", (rSep + 3 * (size + sep), 2 * (size + sep)));
AddButton(Slots.POCKET2, "pocket", (rSep + 3 * (size + sep), 3 * (size + sep)));
Size = CombinedMinimumSize;
}
}
}

View File

@@ -171,8 +171,6 @@ namespace Content.Client.GameObjects.Components
};
facialHairButton.OnPressed += args => _facialHairPickerWindow.Open();
vBox.AddChild(facialHairButton);
Size = CombinedMinimumSize;
}
protected override void Dispose(bool disposing)

View File

@@ -18,7 +18,6 @@ namespace Content.Client.GameObjects.Components.MedicalScanner
_window = new MedicalScannerWindow
{
Title = Owner.Owner.Name,
Size = (485, 90),
};
_window.OnClose += Close;
_window.OpenCentered();

View File

@@ -4,12 +4,15 @@ using Robust.Shared.Utility;
using System.Text;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.Maths;
using static Content.Shared.GameObjects.Components.Medical.SharedMedicalScannerComponent;
namespace Content.Client.GameObjects.Components.MedicalScanner
{
public class MedicalScannerWindow : SS14Window
{
protected override Vector2? CustomSize => (485, 90);
public void Populate(MedicalScannerBoundUserInterfaceState state)
{
Contents.RemoveAllChildren();

View File

@@ -21,10 +21,7 @@ namespace Content.Client.GameObjects.Components.Power
{
base.Open();
_window = new ApcWindow
{
MarginRight = 426.0f, MarginBottom = 270.0f
};
_window = new ApcWindow();
_window.OnClose += Close;
_window.OpenCenteredMinSize();

View File

@@ -36,10 +36,10 @@ namespace Content.Client.GameObjects.Components.Research
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand,
MarginTop = 5f,
/*MarginTop = 5f,
MarginLeft = 5f,
MarginRight = -5f,
MarginBottom = -5f,
MarginBottom = -5f,*/
};
margin.AddChild(_servers);

View File

@@ -101,10 +101,10 @@ namespace Content.Client.GameObjects.Components.Storage
private Label Information;
public ClientStorageComponent StorageEntity;
protected override Vector2? CustomSize => (180, 320);
public StorageWindow()
{
Size = (180, 320);
Title = "Storage Item";
RectClipContent = true;
@@ -239,14 +239,14 @@ namespace Content.Client.GameObjects.Components.Storage
SizeFlagsVertical = SizeFlags.ShrinkCenter,
Text = "Size 6",
Align = Label.AlignMode.Right,
AnchorLeft = 1.0f,
/*AnchorLeft = 1.0f,
AnchorRight = 1.0f,
AnchorBottom = 0.5f,
AnchorTop = 0.5f,
MarginLeft = -38.0f,
MarginTop = -7.0f,
MarginRight = -5.0f,
MarginBottom = 7.0f
MarginBottom = 7.0f*/
};
EntityControl.AddChild(EntitySize);

View File

@@ -86,7 +86,7 @@ namespace Content.Client.GameObjects.EntitySystems
panel.AddStyleClass(StyleClassEntityTooltip);
panel.ModulateSelfOverride = Color.LightGray.WithAlpha(0.90f);
_examineTooltipOpen.AddChild(panel);
panel.SetAnchorAndMarginPreset(Control.LayoutPreset.Wide);
//panel.SetAnchorAndMarginPreset(Control.LayoutPreset.Wide);
var vBox = new VBoxContainer();
panel.AddChild(vBox);
var hBox = new HBoxContainer { SeparationOverride = 5};
@@ -145,7 +145,7 @@ namespace Content.Client.GameObjects.EntitySystems
}
}
_examineTooltipOpen.Position += Vector2.ComponentMin(Vector2.Zero,_userInterfaceManager.StateRoot.Size - (panel.Size + _examineTooltipOpen.Position));
//_examineTooltipOpen.Position += Vector2.ComponentMin(Vector2.Zero,_userInterfaceManager.StateRoot.Size - (panel.Size + _examineTooltipOpen.Position));
}
public void CloseTooltip()

View File

@@ -198,14 +198,14 @@ namespace Content.Client.GameObjects.EntitySystems
vBox.AddChild(panel);
}
_currentPopup.Size = vBox.CombinedMinimumSize;
//_currentPopup.Size = vBox.CombinedMinimumSize;
// If we're at the bottom of the window and the menu would go below the bottom of the window,
// shift it up so it extends UP.
var bottomCoords = vBox.CombinedMinimumSize.Y + _currentPopup.Position.Y;
if (bottomCoords > _userInterfaceManager.StateRoot.Size.Y)
{
_currentPopup.Position = _currentPopup.Position - new Vector2(0, vBox.CombinedMinimumSize.Y);
// _currentPopup.Position = _currentPopup.Position - new Vector2(0, vBox.CombinedMinimumSize.Y);
}
}

View File

@@ -14,6 +14,7 @@ using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.Interfaces.UserInterface;
using Robust.Client.Player;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Input;
using Robust.Shared.Interfaces.Network;
using Robust.Shared.IoC;
@@ -191,7 +192,7 @@ namespace Content.Client.GameTicking
_lobby = new LobbyGui(_localization, _resourceCache);
_userInterfaceManager.StateRoot.AddChild(_lobby);
_lobby.SetAnchorAndMarginPreset(Control.LayoutPreset.Wide, margin: 20);
LayoutContainer.SetAnchorPreset(_lobby, LayoutContainer.LayoutPreset.Wide);
_chatManager.SetChatBox(_lobby.Chat);
_lobby.Chat.DefaultChatFormat = "ooc \"{0}\"";
@@ -246,6 +247,11 @@ namespace Content.Client.GameTicking
_gameChat = new ChatBox();
_userInterfaceManager.StateRoot.AddChild(_gameChat);
LayoutContainer.SetAnchorAndMarginPreset(_gameChat, LayoutContainer.LayoutPreset.TopRight, margin: 10);
LayoutContainer.SetAnchorAndMarginPreset(_gameChat, LayoutContainer.LayoutPreset.TopRight, margin: 10);
LayoutContainer.SetMarginLeft(_gameChat, -475);
LayoutContainer.SetMarginBottom(_gameChat, 235);
_userInterfaceManager.StateRoot.AddChild(_gameHud.RootControl);
_chatManager.SetChatBox(_gameChat);
_gameChat.DefaultChatFormat = "say \"{0}\"";
@@ -261,6 +267,7 @@ namespace Content.Client.GameTicking
{
return;
}
chat.Input.IgnoreNext = true;
chat.Input.GrabKeyboardFocus();
}

View File

@@ -37,22 +37,14 @@ namespace Content.Client.Instruments
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand,
MarginTop = 5f,
MarginLeft = 5f,
MarginRight = -5f,
MarginBottom = -5f,
};
margin.SetAnchorAndMarginPreset(LayoutPreset.Wide);
var vBox = new VBoxContainer()
{
SizeFlagsVertical = SizeFlags.FillExpand,
SeparationOverride = 5,
};
vBox.SetAnchorAndMarginPreset(LayoutPreset.Wide);
var hBoxTopButtons = new HBoxContainer()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,

View File

@@ -47,22 +47,14 @@ namespace Content.Client.Research
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand,
MarginTop = 5f,
MarginLeft = 5f,
MarginRight = -5f,
MarginBottom = -5f,
};
margin.SetAnchorAndMarginPreset(LayoutPreset.Wide);
var vBox = new VBoxContainer()
{
SizeFlagsVertical = SizeFlags.FillExpand,
SeparationOverride = 5,
};
vBox.SetAnchorAndMarginPreset(LayoutPreset.Wide);
var hBoxButtons = new HBoxContainer()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
@@ -100,8 +92,6 @@ namespace Content.Client.Research
SizeFlagsStretchRatio = 3,
};
spacer.SetAnchorAndMarginPreset(LayoutPreset.Wide);
var hBoxFilter = new HBoxContainer()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,

View File

@@ -27,24 +27,24 @@ namespace Content.Client.Research
var margin = new MarginContainer()
{
MarginTop = 5f,
/*MarginTop = 5f,
MarginLeft = 5f,
MarginRight = -5f,
MarginBottom = -5f,
MarginBottom = -5f,*/
};
margin.SetAnchorAndMarginPreset(LayoutPreset.Wide);
// margin.SetAnchorAndMarginPreset(LayoutPreset.Wide);
var vBox = new VBoxContainer();
vBox.SetAnchorAndMarginPreset(LayoutPreset.Wide);
// vBox.SetAnchorAndMarginPreset(LayoutPreset.Wide);
var descMargin = new MarginContainer()
{
MarginTop = 5f,
/*MarginTop = 5f,
MarginLeft = 5f,
MarginRight = -5f,
MarginBottom = -5f,
MarginBottom = -5f,*/
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsStretchRatio = 2,
};

View File

@@ -38,8 +38,6 @@ namespace Content.Client.Sandbox
SpawnTilesButton
}
});
Size = CombinedMinimumSize;
}
}
}

View File

@@ -59,15 +59,9 @@ namespace Content.Client.UserInterface.Cargo
else
Title = _loc.GetString("Cargo Shuttle Console");
var rows = new VBoxContainer
{
MarginTop = 0
};
var rows = new VBoxContainer();
var accountName = new HBoxContainer()
{
MarginTop = 0
};
var accountName = new HBoxContainer();
var accountNameLabel = new Label {
Text = _loc.GetString("Account Name: "),
StyleClasses = { NanoStyle.StyleClassLabelKeyText }

View File

@@ -38,10 +38,6 @@ namespace Content.Client.UserInterface.Cargo
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand,
MarginTop = 5f,
MarginLeft = 5f,
MarginRight = -5f,
MarginBottom = -5f,
};
margin.AddChild(_accounts);

View File

@@ -73,8 +73,6 @@ namespace Content.Client.UserInterface
QuitButton = new Button {Text = "Quit"};
QuitButton.OnPressed += OnQuitButtonClicked;
vBox.AddChild(QuitButton);
Size = CombinedMinimumSize;
}
private void OnQuitButtonClicked(BaseButton.ButtonEventArgs args)

View File

@@ -82,6 +82,7 @@ namespace Content.Client.UserInterface
public Control HandsContainer { get; private set; }
public Control InventoryQuickButtonContainer { get; private set; }
public bool CombatPanelVisible
{
get => _combatPanelContainer.Visible;
@@ -105,9 +106,8 @@ namespace Content.Client.UserInterface
public void Initialize()
{
RootControl = new Control {MouseFilter = Control.MouseFilterMode.Ignore};
RootControl.SetAnchorPreset(Control.LayoutPreset.Wide);
RootControl = new LayoutContainer {MouseFilter = Control.MouseFilterMode.Ignore};
LayoutContainer.SetAnchorPreset(RootControl, LayoutContainer.LayoutPreset.Wide);
var escapeTexture = _resourceCache.GetTexture("/Textures/UserInterface/hamburger.svg.96dpi.png");
var characterTexture = _resourceCache.GetTexture("/Textures/UserInterface/character.svg.96dpi.png");
@@ -122,7 +122,9 @@ namespace Content.Client.UserInterface
};
RootControl.AddChild(_topButtonsContainer);
_topButtonsContainer.SetAnchorAndMarginPreset(Control.LayoutPreset.TopLeft, margin: 10);
LayoutContainer.SetAnchorAndMarginPreset(_topButtonsContainer, LayoutContainer.LayoutPreset.TopLeft,
margin: 10);
// TODO: Pull key names here from the actual key binding config.
// Escape
@@ -198,25 +200,22 @@ namespace Content.Client.UserInterface
var inventoryContainer = new HBoxContainer
{
GrowHorizontal = Control.GrowDirection.Begin,
GrowVertical = Control.GrowDirection.Begin,
SeparationOverride = 10
};
RootControl.AddChild(inventoryContainer);
inventoryContainer.SetAnchorAndMarginPreset(Control.LayoutPreset.BottomRight);
LayoutContainer.SetGrowHorizontal(inventoryContainer, LayoutContainer.GrowDirection.Begin);
LayoutContainer.SetGrowVertical(inventoryContainer, LayoutContainer.GrowDirection.Begin);
LayoutContainer.SetAnchorAndMarginPreset(inventoryContainer, LayoutContainer.LayoutPreset.BottomRight);
InventoryQuickButtonContainer = new MarginContainer
{
GrowHorizontal = Control.GrowDirection.Begin,
GrowVertical = Control.GrowDirection.Begin,
SizeFlagsVertical = Control.SizeFlags.ShrinkEnd
};
HandsContainer = new MarginContainer
{
GrowHorizontal = Control.GrowDirection.Both,
GrowVertical = Control.GrowDirection.Begin,
SizeFlagsVertical = Control.SizeFlags.ShrinkEnd
};
@@ -337,7 +336,6 @@ namespace Content.Client.UserInterface
private static readonly Color ColorHovered = Color.FromHex("#9699bb");
private static readonly Color ColorPressed = Color.FromHex("#789B8C");
private readonly VBoxContainer _container;
private readonly TextureRect _textureRect;
private readonly Label _label;
@@ -345,9 +343,18 @@ namespace Content.Client.UserInterface
{
ToggleMode = true;
_container = new VBoxContainer {MouseFilter = MouseFilterMode.Ignore};
AddChild(_container);
_container.AddChild(_textureRect = new TextureRect
AddChild(new MarginContainer
{
MouseFilter = MouseFilterMode.Ignore,
MarginTopOverride = 4,
Children =
{
new VBoxContainer
{
MouseFilter = MouseFilterMode.Ignore,
Children =
{
(_textureRect = new TextureRect
{
Texture = texture,
SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
@@ -356,27 +363,27 @@ namespace Content.Client.UserInterface
ModulateSelfOverride = ColorNormal,
CustomMinimumSize = (0, 32),
Stretch = TextureRect.StretchMode.KeepCentered
});
_container.AddChild(_label = new Label
}),
(_label = new Label
{
Text = keyName,
SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
MouseFilter = MouseFilterMode.Ignore,
ModulateSelfOverride = ColorNormal
ModulateSelfOverride = ColorNormal,
StyleClasses = {StyleClassLabelTopButton}
})
}
}
}
});
_label.AddStyleClass(StyleClassLabelTopButton);
_container.SetAnchorAndMarginPreset(LayoutPreset.Wide);
DrawModeChanged();
}
protected override Vector2 CalculateMinimumSize()
{
var styleSize = ActualStyleBox?.MinimumSize ?? Vector2.Zero;
return (0, 4) + styleSize + _container?.CombinedMinimumSize ?? Vector2.Zero;
return (0, 4) + styleSize + base.CalculateMinimumSize();
}
protected override void Draw(DrawingHandleScreen handle)
@@ -420,21 +427,15 @@ namespace Content.Client.UserInterface
}
}
protected override void StylePropertiesChanged()
protected override void LayoutUpdateOverride()
{
base.StylePropertiesChanged();
if (_container == null)
{
return;
}
var box = ActualStyleBox ?? new StyleBoxEmpty();
var contentBox = box.GetContentBox(PixelSizeBox);
_container.MarginLeft = box.GetContentMargin(StyleBox.Margin.Left);
_container.MarginRight = -box.GetContentMargin(StyleBox.Margin.Right);
_container.MarginTop = box.GetContentMargin(StyleBox.Margin.Top) + 4;
_container.MarginBottom = -box.GetContentMargin(StyleBox.Margin.Bottom);
foreach (var child in Children)
{
FitChildInPixelBox(child, (UIBox2i) contentBox);
}
}
}
}

View File

@@ -52,6 +52,9 @@ namespace Content.Client.UserInterface
private readonly TextureRect CooldownCircleLeft;
private readonly TextureRect CooldownCircleRight;
private readonly Control _leftContainer;
private readonly Control _rightContainer;
public HandsGui()
{
IoCManager.InjectDependencies(this);
@@ -72,30 +75,35 @@ namespace Content.Client.UserInterface
_resourceCache.GetTexture($"/Textures/UserInterface/Inventory/cooldown-{i}.png");
}
AddChild(new TextureRect
_leftContainer = new Control {MouseFilter = MouseFilterMode.Ignore};
_rightContainer = new Control {MouseFilter = MouseFilterMode.Ignore};
var hBox = new HBoxContainer
{
SeparationOverride = 0,
Children = {_rightContainer, _leftContainer},
MouseFilter = MouseFilterMode.Ignore
};
AddChild(hBox);
_leftContainer.AddChild(new TextureRect
{
MouseFilter = MouseFilterMode.Ignore,
Texture = TextureHandLeft,
Size = _handL.Size,
Position = _handL.TopLeft,
TextureScale = (2, 2)
});
AddChild(new TextureRect
_rightContainer.AddChild(new TextureRect
{
MouseFilter = MouseFilterMode.Ignore,
Texture = TextureHandRight,
Size = _handR.Size,
Position = _handR.TopLeft,
TextureScale = (2, 2)
});
AddChild(ActiveHandRect = new TextureRect
_leftContainer.AddChild(ActiveHandRect = new TextureRect
{
MouseFilter = MouseFilterMode.Ignore,
Texture = TextureHandActive,
Size = _handL.Size,
Position = _handL.TopLeft,
TextureScale = (2, 2)
});
@@ -104,43 +112,31 @@ namespace Content.Client.UserInterface
MouseFilter = MouseFilterMode.Ignore,
Scale = (2, 2)
};
AddChild(LeftSpriteView);
LeftSpriteView.Size = _handL.Size;
LeftSpriteView.Position = _handL.TopLeft;
_leftContainer.AddChild(LeftSpriteView);
RightSpriteView = new SpriteView
{
MouseFilter = MouseFilterMode.Ignore,
Scale = (2, 2)
};
AddChild(RightSpriteView);
RightSpriteView.Size = _handR.Size;
RightSpriteView.Position = _handR.TopLeft;
_rightContainer.AddChild(RightSpriteView);
// Cooldown circles.
AddChild(CooldownCircleLeft = new TextureRect
_leftContainer.AddChild(CooldownCircleLeft = new TextureRect
{
MouseFilter = MouseFilterMode.Ignore,
Position = _handL.TopLeft + (8, 8),
TextureScale = (2, 2),
Visible = false,
});
AddChild(CooldownCircleRight = new TextureRect
_rightContainer.AddChild(CooldownCircleRight = new TextureRect
{
MouseFilter = MouseFilterMode.Ignore,
Position = _handR.TopLeft + (8, 8),
TextureScale = (2, 2),
Visible = false
});
}
protected override Vector2 CalculateMinimumSize()
{
return new Vector2(BoxSize * 2 + BoxSpacing, BoxSize) * UIScale;
}
/// <summary>
/// Gets the hands component controling this gui, returns true if successful and false if failure
/// </summary>
@@ -169,7 +165,9 @@ namespace Content.Client.UserInterface
var left = hands.GetEntity("left");
var right = hands.GetEntity("right");
ActiveHandRect.Position = hands.ActiveIndex == "left" ? _handL.TopLeft : _handR.TopLeft;
ActiveHandRect.Parent.RemoveChild(ActiveHandRect);
var parent = hands.ActiveIndex == "left" ? _leftContainer : _rightContainer;
parent.AddChild(ActiveHandRect);
if (left != null)
{
@@ -328,7 +326,7 @@ namespace Content.Client.UserInterface
var length = (end - start).TotalSeconds;
var progress = (_gameTiming.CurTime - start).TotalSeconds;
var ratio = (float)(progress / length);
var ratio = (float) (progress / length);
var textureIndex = CalculateCooldownLevel(ratio);
if (textureIndex == CooldownLevels)

View File

@@ -22,6 +22,16 @@ namespace Content.Client.UserInterface
public LobbyGui(ILocalizationManager localization, IResourceCache resourceCache)
{
var margin = new MarginContainer
{
MarginBottomOverride = 20,
MarginLeftOverride = 20,
MarginRightOverride = 20,
MarginTopOverride = 20,
};
AddChild(margin);
var panelTex = resourceCache.GetTexture("/Nano/button.svg.96dpi.png");
var back = new StyleBoxTexture
{
@@ -30,53 +40,58 @@ namespace Content.Client.UserInterface
};
back.SetPatchMargin(StyleBox.Margin.All, 10);
var panel = new Panel
var panel = new PanelContainer
{
PanelOverride = back
};
AddChild(panel);
panel.SetAnchorAndMarginPreset(LayoutPreset.Wide);
margin.AddChild(panel);
var vBox = new VBoxContainer {SeparationOverride = 0};
vBox.SetAnchorAndMarginPreset(LayoutPreset.Wide);
margin.AddChild(vBox);
vBox.MarginTop = 40;
AddChild(vBox);
AddChild(new Label
var topHBox = new HBoxContainer
{
CustomMinimumSize = (0, 40),
Children =
{
new MarginContainer
{
MarginLeftOverride = 8,
Children =
{
new Label
{
Text = localization.GetString("Lobby"),
StyleClasses = {NanoStyle.StyleClassLabelHeadingBigger},
MarginBottom = 40,
MarginLeft = 8,
/*MarginBottom = 40,
MarginLeft = 8,*/
VAlign = Label.VAlignMode.Center
});
AddChild(ServerName = new Label
}
}
},
(ServerName = new Label
{
StyleClasses = {NanoStyle.StyleClassLabelHeadingBigger},
MarginBottom = 40,
GrowHorizontal = GrowDirection.Both,
VAlign = Label.VAlignMode.Center
});
ServerName.SetAnchorAndMarginPreset(LayoutPreset.CenterTop);
AddChild(LeaveButton = new Button
/*MarginBottom = 40,
GrowHorizontal = GrowDirection.Both,*/
VAlign = Label.VAlignMode.Center,
SizeFlagsHorizontal = SizeFlags.Expand | SizeFlags.ShrinkCenter
}),
(LeaveButton = new Button
{
SizeFlagsHorizontal = SizeFlags.ShrinkEnd,
Text = localization.GetString("Leave"),
StyleClasses = {NanoStyle.StyleClassButtonBig},
GrowHorizontal = GrowDirection.Begin
});
//GrowHorizontal = GrowDirection.Begin
})
}
};
LeaveButton.SetAnchorAndMarginPreset(LayoutPreset.TopRight);
vBox.AddChild(topHBox);
vBox.AddChild(new Panel
vBox.AddChild(new PanelContainer
{
PanelOverride = new StyleBoxFlat
{
@@ -131,7 +146,7 @@ namespace Content.Client.UserInterface
SizeFlagsHorizontal = SizeFlags.FillExpand,
Align = Label.AlignMode.Right,
FontColorOverride = Color.DarkGray,
StyleClasses = { NanoStyle.StyleClassLabelBig }
StyleClasses = {NanoStyle.StyleClassLabelBig}
}),
(ReadyButton = new Button
{
@@ -164,7 +179,7 @@ namespace Content.Client.UserInterface
}
});
hBox.AddChild(new Panel
hBox.AddChild(new PanelContainer
{
PanelOverride = new StyleBoxFlat {BackgroundColor = NanoStyle.NanoGold}, CustomMinimumSize = (2, 0)
});

View File

@@ -33,7 +33,7 @@ namespace Content.Client.UserInterface
return _panel.CombinedMinimumSize;
}
protected override void SortChildren()
protected override void LayoutUpdateOverride()
{
FitChildInBox(_panel, SizeBox);
}

View File

@@ -49,6 +49,7 @@ namespace Content.Client.UserInterface
Texture = windowHeaderTex,
PatchMarginBottom = 3,
ExpandMarginBottom = 3,
ContentMarginBottomOverride = 0
};
var windowBackgroundTex = resCache.GetTexture("/Nano/window_background.png");
var windowBackground = new StyleBoxTexture
@@ -223,14 +224,14 @@ namespace Content.Client.UserInterface
new SelectorElement(null, new[] {SS14Window.StyleClassWindowPanel}, null, null),
new[]
{
new StyleProperty(Panel.StylePropertyPanel, windowBackground),
new StyleProperty(PanelContainer.StylePropertyPanel, windowBackground),
}),
// Window header.
new StyleRule(
new SelectorElement(typeof(Panel), new[] {SS14Window.StyleClassWindowHeader}, null, null),
new SelectorElement(typeof(PanelContainer), new[] {SS14Window.StyleClassWindowHeader}, null, null),
new[]
{
new StyleProperty(Panel.StylePropertyPanel, windowHeader),
new StyleProperty(PanelContainer.StylePropertyPanel, windowHeader),
}),
// Window close button base texture.
new StyleRule(

View File

@@ -13,11 +13,13 @@ namespace Content.Client.UserInterface
public StatusEffectsUI()
{
_vBox = new VBoxContainer {GrowHorizontal = GrowDirection.Begin};
_vBox = new VBoxContainer();
MouseFilter = Control.MouseFilterMode.Ignore;
AddChild(_vBox);
SetAnchorAndMarginPreset(LayoutPreset.TopRight);
MarginTop = 250;
MarginRight = 10;
LayoutContainer.SetGrowHorizontal(this, LayoutContainer.GrowDirection.Begin);
LayoutContainer.SetAnchorAndMarginPreset(this, LayoutContainer.LayoutPreset.TopRight, margin: 10);
LayoutContainer.SetMarginTop(this, 250);
}
}
}

View File

@@ -57,7 +57,7 @@ namespace Content.Client.UserInterface
return size;
}
protected override void SortChildren()
protected override void LayoutUpdateOverride()
{
var box = SizeBox;

View File

@@ -1,5 +1,6 @@
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.Maths;
using Robust.Shared.Utility;
namespace Content.Client.UserInterface
@@ -30,6 +31,8 @@ You can't attack anybody with it off, so no more hitting yourself with your own
If you have any feedback, questions, bug reports, etc..., do not be afraid to tell us!
You can ask on Discord or heck, just write it in OOC! We'll catch it.";
protected override Vector2? CustomSize => (300, 400);
public TutorialWindow()
{
Title = "The Tutorial!";

View File

@@ -9,13 +9,13 @@
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
id="svg8"
version="1.1"
viewBox="0 0 53.436268 53.436275"
height="53.436275mm"
width="53.436268mm"
viewBox="0 0 5.8212397 5.8208341"
height="22.000004"
width="22"
sodipodi:docname="cross.svg"
inkscape:export-filename="/home/pj/Projects/space-station-14-content/Resources/Nano/cross.svg.png"
inkscape:export-xdpi="15.21"
inkscape:export-ydpi="15.21"
inkscape:export-filename="/home/pj/Projects/space-station-14/Resources/Nano/cross.svg.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
inkscape:version="0.92.4 5da689c313, 2019-01-14">
<sodipodi:namedview
pagecolor="#ffffff"
@@ -26,17 +26,19 @@
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1347"
inkscape:window-height="915"
inkscape:window-width="1920"
inkscape:window-height="1043"
id="namedview9"
showgrid="false"
inkscape:zoom="1.1685258"
inkscape:cx="100.12614"
inkscape:cy="100.98194"
inkscape:zoom="13.22036"
inkscape:cx="6.117966"
inkscape:cy="7.5630971"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="0"
inkscape:current-layer="svg8" />
inkscape:window-maximized="1"
inkscape:current-layer="layer1"
units="px"
inkscape:pagecheckerboard="true" />
<defs
id="defs2" />
<metadata
@@ -47,16 +49,16 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="translate(-71.839158,-135.34432)"
transform="matrix(0.16766605,0,0,0.16766605,-13.535398,-24.198299)"
id="layer1">
<g
style="fill:#4b596a;fill-opacity:1"
transform="rotate(90,69.900258,191.53805)"
transform="matrix(0,0.93152169,-0.93152169,0,249.95318,124.23435)"
id="g9787">
<rect
ry="3.5718751"
@@ -66,18 +68,19 @@
height="10.583333"
width="46.302082"
id="rect9783"
style="fill:#4b596a;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.17499995;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.17499995;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal"
transform="rotate(135)" />
<rect
transform="rotate(45)"
style="fill:#4b596a;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.17499995;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.17499995;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal"
id="rect10332"
width="46.302082"
height="10.583333"
x="120.55424"
y="81.56115"
rx="0"
ry="3.5718751" />
ry="3.5718751"
inkscape:label="rect10332" />
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 447 B

After

Width:  |  Height:  |  Size: 372 B

View File

@@ -406,7 +406,7 @@ namespace SS14.Launcher
visitWebsiteButton.OnPressed += _ => _uriOpener.OpenUri("https://spacestation14.io");
RootControl.SetAnchorPreset(LayoutPreset.Wide);
//RootControl.SetAnchorPreset(LayoutPreset.Wide);
}
}
}