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

@@ -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);
}
}