WPF layout (#3346)

This commit is contained in:
Pieter-Jan Briers
2021-02-21 12:38:56 +01:00
committed by GitHub
parent 33d6975c25
commit b898443f28
121 changed files with 1420 additions and 2069 deletions

View File

@@ -90,8 +90,8 @@ namespace Content.Client.Arcade
_highscoresRootContainer = new PanelContainer
{
PanelOverride = rootBack,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
SizeFlagsHorizontal = SizeFlags.ShrinkCenter
VerticalAlignment = VAlignment.Center,
HorizontalAlignment = HAlignment.Center
};
var c = new Color(OverlayBackgroundColor.R,OverlayBackgroundColor.G,OverlayBackgroundColor.B,220);
@@ -104,20 +104,20 @@ namespace Content.Client.Arcade
var menuInnerPanel = new PanelContainer
{
PanelOverride = innerBack,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
SizeFlagsHorizontal = SizeFlags.ShrinkCenter
VerticalAlignment = VAlignment.Center,
HorizontalAlignment = HAlignment.Center
};
_highscoresRootContainer.AddChild(menuInnerPanel);
var menuContainer = new VBoxContainer()
{
SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
SizeFlagsVertical = SizeFlags.ShrinkCenter
HorizontalAlignment = HAlignment.Center,
VerticalAlignment = VAlignment.Center
};
menuContainer.AddChild(new Label{Text = Loc.GetString("Highscores")});
menuContainer.AddChild(new Control{CustomMinimumSize = new Vector2(1,10)});
menuContainer.AddChild(new Control{MinSize = new Vector2(1,10)});
var highScoreBox = new HBoxContainer();
@@ -126,14 +126,14 @@ namespace Content.Client.Arcade
Align = Label.AlignMode.Center
};
highScoreBox.AddChild(_localHighscoresLabel);
highScoreBox.AddChild(new Control{CustomMinimumSize = new Vector2(40,1)});
highScoreBox.AddChild(new Control{MinSize = new Vector2(40,1)});
_globalHighscoresLabel = new Label
{
Align = Label.AlignMode.Center
};
highScoreBox.AddChild(_globalHighscoresLabel);
menuContainer.AddChild(highScoreBox);
menuContainer.AddChild(new Control{CustomMinimumSize = new Vector2(1,10)});
menuContainer.AddChild(new Control{MinSize = new Vector2(1,10)});
_highscoreBackButton = new Button
{
Text = Loc.GetString("Back"),
@@ -156,8 +156,8 @@ namespace Content.Client.Arcade
_gameOverRootContainer = new PanelContainer
{
PanelOverride = rootBack,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
SizeFlagsHorizontal = SizeFlags.ShrinkCenter
VerticalAlignment = VAlignment.Center,
HorizontalAlignment = HAlignment.Center
};
var innerBack = new StyleBoxTexture
@@ -169,25 +169,25 @@ namespace Content.Client.Arcade
var menuInnerPanel = new PanelContainer
{
PanelOverride = innerBack,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
SizeFlagsHorizontal = SizeFlags.ShrinkCenter
VerticalAlignment = VAlignment.Center,
HorizontalAlignment = HAlignment.Center
};
_gameOverRootContainer.AddChild(menuInnerPanel);
var menuContainer = new VBoxContainer
{
SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
SizeFlagsVertical = SizeFlags.ShrinkCenter
HorizontalAlignment = HAlignment.Center,
VerticalAlignment = VAlignment.Center
};
menuContainer.AddChild(new Label{Text = Loc.GetString("Gameover!"),Align = Label.AlignMode.Center});
menuContainer.AddChild(new Control{CustomMinimumSize = new Vector2(1,10)});
menuContainer.AddChild(new Control{MinSize = new Vector2(1,10)});
_finalScoreLabel = new Label{Align = Label.AlignMode.Center};
menuContainer.AddChild(_finalScoreLabel);
menuContainer.AddChild(new Control{CustomMinimumSize = new Vector2(1,10)});
menuContainer.AddChild(new Control{MinSize = new Vector2(1,10)});
_finalNewGameButton = new Button
{
@@ -214,8 +214,8 @@ namespace Content.Client.Arcade
_menuRootContainer = new PanelContainer
{
PanelOverride = rootBack,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
SizeFlagsHorizontal = SizeFlags.ShrinkCenter
VerticalAlignment = VAlignment.Center,
HorizontalAlignment = HAlignment.Center
};
var innerBack = new StyleBoxTexture
@@ -227,8 +227,8 @@ namespace Content.Client.Arcade
var menuInnerPanel = new PanelContainer
{
PanelOverride = innerBack,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
SizeFlagsHorizontal = SizeFlags.ShrinkCenter
VerticalAlignment = VAlignment.Center,
HorizontalAlignment = HAlignment.Center
};
_menuRootContainer.AddChild(menuInnerPanel);
@@ -236,8 +236,8 @@ namespace Content.Client.Arcade
var menuContainer = new VBoxContainer
{
SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
SizeFlagsVertical = SizeFlags.ShrinkCenter
HorizontalAlignment = HAlignment.Center,
VerticalAlignment = VAlignment.Center
};
_newGameButton = new Button
@@ -250,7 +250,7 @@ namespace Content.Client.Arcade
_owner.SendAction(BlockGamePlayerAction.NewGame);
};
menuContainer.AddChild(_newGameButton);
menuContainer.AddChild(new Control{CustomMinimumSize = new Vector2(1,10)});
menuContainer.AddChild(new Control{MinSize = new Vector2(1,10)});
_scoreBoardButton = new Button
{
@@ -259,7 +259,7 @@ namespace Content.Client.Arcade
};
_scoreBoardButton.OnPressed += (e) => _owner.SendAction(BlockGamePlayerAction.ShowHighscores);
menuContainer.AddChild(_scoreBoardButton);
_unpauseButtonMargin = new Control {CustomMinimumSize = new Vector2(1, 10), Visible = false};
_unpauseButtonMargin = new Control {MinSize = new Vector2(1, 10), Visible = false};
menuContainer.AddChild(_unpauseButtonMargin);
_unpauseButton = new Button
@@ -301,35 +301,35 @@ namespace Content.Client.Arcade
_levelLabel = new Label
{
Align = Label.AlignMode.Center,
SizeFlagsHorizontal = SizeFlags.FillExpand
HorizontalExpand = true
};
_gameRootContainer.AddChild(_levelLabel);
_gameRootContainer.AddChild(new Control
{
CustomMinimumSize = new Vector2(1,5)
MinSize = new Vector2(1,5)
});
_pointsLabel = new Label
{
Align = Label.AlignMode.Center,
SizeFlagsHorizontal = SizeFlags.FillExpand
HorizontalExpand = true
};
_gameRootContainer.AddChild(_pointsLabel);
_gameRootContainer.AddChild(new Control
{
CustomMinimumSize = new Vector2(1,10)
MinSize = new Vector2(1,10)
});
var gameBox = new HBoxContainer();
gameBox.AddChild(SetupHoldBox(backgroundTexture));
gameBox.AddChild(new Control
{
CustomMinimumSize = new Vector2(10,1)
MinSize = new Vector2(10,1)
});
gameBox.AddChild(SetupGameGrid(backgroundTexture));
gameBox.AddChild(new Control
{
CustomMinimumSize = new Vector2(10,1)
MinSize = new Vector2(10,1)
});
gameBox.AddChild(SetupNextBox(backgroundTexture));
@@ -337,7 +337,7 @@ namespace Content.Client.Arcade
_gameRootContainer.AddChild(new Control
{
CustomMinimumSize = new Vector2(1,10)
MinSize = new Vector2(1,10)
});
_pauseButton = new Button
@@ -369,7 +369,7 @@ namespace Content.Client.Arcade
var gamePanel = new PanelContainer
{
PanelOverride = back,
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
SizeFlagsStretchRatio = 60
};
var backgroundPanel = new PanelContainer
@@ -393,16 +393,16 @@ namespace Content.Client.Arcade
var grid = new GridContainer
{
Columns = 1,
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
SizeFlagsStretchRatio = 20
};
var nextBlockPanel = new PanelContainer
{
PanelOverride = previewBack,
CustomMinimumSize = BlockSize * 6.5f,
SizeFlagsHorizontal = SizeFlags.None,
SizeFlagsVertical = SizeFlags.None
MinSize = BlockSize * 6.5f,
HorizontalAlignment = HAlignment.Left,
VerticalAlignment = VAlignment.Top
};
var nextCenterContainer = new CenterContainer();
_nextBlockGrid = new GridContainer
@@ -431,16 +431,16 @@ namespace Content.Client.Arcade
var grid = new GridContainer
{
Columns = 1,
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
SizeFlagsStretchRatio = 20
};
var holdBlockPanel = new PanelContainer
{
PanelOverride = previewBack,
CustomMinimumSize = BlockSize * 6.5f,
SizeFlagsHorizontal = SizeFlags.None,
SizeFlagsVertical = SizeFlags.None
MinSize = BlockSize * 6.5f,
HorizontalAlignment = HAlignment.Left,
VerticalAlignment = VAlignment.Top
};
var holdCenterContainer = new CenterContainer();
_holdBlockGrid = new GridContainer
@@ -625,7 +625,7 @@ namespace Content.Client.Arcade
_nextBlockGrid.AddChild(new PanelContainer
{
PanelOverride = new StyleBoxFlat {BackgroundColor = c},
CustomMinimumSize = BlockSize,
MinSize = BlockSize,
RectDrawClipMargin = 0
});
}
@@ -647,7 +647,7 @@ namespace Content.Client.Arcade
_holdBlockGrid.AddChild(new PanelContainer
{
PanelOverride = new StyleBoxFlat {BackgroundColor = c},
CustomMinimumSize = BlockSize,
MinSize = BlockSize,
RectDrawClipMargin = 0
});
}
@@ -665,7 +665,7 @@ namespace Content.Client.Arcade
_gameGrid.AddChild(new PanelContainer
{
PanelOverride = new StyleBoxFlat {BackgroundColor = c},
CustomMinimumSize = BlockSize,
MinSize = BlockSize,
RectDrawClipMargin = 0
});
}

View File

@@ -9,7 +9,6 @@ namespace Content.Client.Arcade
{
public class SpaceVillainArcadeMenu : SS14Window
{
protected override Vector2? CustomSize => (400, 200);
public SpaceVillainArcadeBoundUserInterface Owner { get; set; }
private readonly Label _enemyNameLabel;
@@ -21,6 +20,7 @@ namespace Content.Client.Arcade
private readonly Button[] _gameButtons = new Button[3]; //used to disable/enable all game buttons
public SpaceVillainArcadeMenu(SpaceVillainArcadeBoundUserInterface owner)
{
MinSize = SetSize = (400, 200);
Title = Loc.GetString("Space Villain");
Owner = owner;

View File

@@ -9,7 +9,7 @@ using Robust.Shared.Utility;
namespace Content.Client.Chat
{
public class ChatBox : MarginContainer
public class ChatBox : Control
{
public delegate void TextSubmitHandler(ChatBox chatBox, string text);
@@ -23,7 +23,7 @@ namespace Content.Client.Chat
public Button LocalButton { get; }
public Button OOCButton { get; }
public Button AdminButton { get; }
public Button DeadButton { get; }
public Button DeadButton { get; }
/// <summary>
/// Default formatting string for the ClientChatConsole.
@@ -36,13 +36,6 @@ namespace Content.Client.Chat
public ChatBox()
{
/*MarginLeft = -475.0f;
MarginTop = 10.0f;
MarginRight = -10.0f;
MarginBottom = 235.0f;
AnchorLeft = 1.0f;
AnchorRight = 1.0f;*/
MouseFilter = MouseFilterMode.Stop;
var outerVBox = new VBoxContainer();
@@ -50,7 +43,7 @@ namespace Content.Client.Chat
var panelContainer = new PanelContainer
{
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#25252aaa")},
SizeFlagsVertical = SizeFlags.FillExpand
VerticalExpand = true
};
var vBox = new VBoxContainer();
panelContainer.AddChild(vBox);
@@ -59,15 +52,8 @@ namespace Content.Client.Chat
outerVBox.AddChild(panelContainer);
outerVBox.AddChild(hBox);
var contentMargin = new MarginContainer
{
MarginLeftOverride = 4, MarginRightOverride = 4,
SizeFlagsVertical = SizeFlags.FillExpand
};
Contents = new OutputPanel();
contentMargin.AddChild(Contents);
vBox.AddChild(contentMargin);
Contents = new OutputPanel {Margin = new Thickness(4, 0), VerticalExpand = true};
vBox.AddChild(Contents);
Input = new HistoryLineEdit();
Input.OnKeyBindDown += InputKeyBindDown;
@@ -78,7 +64,8 @@ namespace Content.Client.Chat
{
Text = Loc.GetString("All"),
Name = "ALL",
SizeFlagsHorizontal = SizeFlags.ShrinkEnd | SizeFlags.Expand,
HorizontalExpand = true,
HorizontalAlignment = HAlignment.Right,
ToggleMode = true,
};

View File

@@ -74,17 +74,13 @@ namespace Content.Client.Chat
ForceRunStyleUpdate();
ContentHeight = bubble.CombinedMinimumSize.Y;
bubble.Measure(Vector2.Infinity);
ContentHeight = bubble.DesiredSize.Y;
_verticalOffsetAchieved = -ContentHeight;
}
protected abstract Control BuildBubble(string text);
protected override Vector2 CalculateMinimumSize()
{
return (base.CalculateMinimumSize().X, 0);
}
protected override void FrameUpdate(FrameEventArgs args)
{
base.FrameUpdate(args);
@@ -122,7 +118,7 @@ namespace Content.Client.Chat
LayoutContainer.SetPosition(this, screenPos);
var height = MathHelper.Clamp(lowerCenter.Y - screenPos.Y, 0, ContentHeight);
LayoutContainer.SetSize(this, (Size.X, height));
SetHeight = height;
}
private void Die()

View File

@@ -102,7 +102,8 @@ namespace Content.Client
};
_userInterfaceManager.PopupRoot.AddChild(label);
var minimumSize = label.CombinedMinimumSize;
label.Measure(Vector2.Infinity);
var minimumSize = label.DesiredSize;
label.InitialPos = (coordinates.Position / _userInterfaceManager.UIScale) - minimumSize / 2;
LayoutContainer.SetPosition(label, label.InitialPos);
@@ -149,7 +150,7 @@ namespace Content.Client
var position = Entity == null
? InitialPos
: (_eyeManager.CoordinatesToScreen(Entity.Transform.Coordinates).Position / UIScale) - CombinedMinimumSize / 2;
: (_eyeManager.CoordinatesToScreen(Entity.Transform.Coordinates).Position / UIScale) - DesiredSize / 2;
LayoutContainer.SetPosition(this, position - (0, 20 * (TimeLeft * TimeLeft + TimeLeft)));

View File

@@ -12,8 +12,6 @@ namespace Content.Client.Command
{
public class CommunicationsConsoleMenu : SS14Window
{
protected override Vector2? CustomSize => new Vector2(600, 400);
private CommunicationsConsoleBoundUserInterface Owner { get; set; }
private readonly CancellationTokenSource _timerCancelTokenSource = new();
public readonly Button EmergencyShuttleButton;
@@ -21,25 +19,26 @@ namespace Content.Client.Command
public CommunicationsConsoleMenu(CommunicationsConsoleBoundUserInterface owner)
{
SetSize = MinSize = (600, 400);
IoCManager.InjectDependencies(this);
Title = Loc.GetString("Communications Console");
Owner = owner;
_countdownLabel = new RichTextLabel(){CustomMinimumSize = new Vector2(0, 200)};
_countdownLabel = new RichTextLabel(){MinSize = new Vector2(0, 200)};
EmergencyShuttleButton = new Button();
EmergencyShuttleButton.OnPressed += (_) => Owner.EmergencyShuttleButtonPressed();
EmergencyShuttleButton.Disabled = !owner.CanCall;
var vbox = new VBoxContainer() {SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.FillExpand};
var vbox = new VBoxContainer() {HorizontalExpand = true, VerticalExpand = true};
vbox.AddChild(_countdownLabel);
vbox.AddChild(EmergencyShuttleButton);
var hbox = new HBoxContainer() {SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.FillExpand};
hbox.AddChild(new Control(){CustomMinimumSize = new Vector2(100,0), SizeFlagsHorizontal = SizeFlags.FillExpand});
var hbox = new HBoxContainer() {HorizontalExpand = true, VerticalExpand = true};
hbox.AddChild(new Control(){MinSize = new Vector2(100,0), HorizontalExpand = true});
hbox.AddChild(vbox);
hbox.AddChild(new Control(){CustomMinimumSize = new Vector2(100,0), SizeFlagsHorizontal = SizeFlags.FillExpand});
hbox.AddChild(new Control(){MinSize = new Vector2(100,0), HorizontalExpand = true});
Contents.AddChild(hbox);

View File

@@ -1,27 +1,27 @@
<SS14Window xmlns="https://spacestation14.io">
<HBoxContainer SizeFlagsHorizontal="FillExpand">
<VBoxContainer SizeFlagsHorizontal="FillExpand" SizeFlagsStretchRatio="0.45">
<HBoxContainer SizeFlagsHorizontal="FillExpand" SizeFlagsVertical="FillExpand" SizeFlagsStretchRatio="0.1">
<LineEdit Name="SearchBar" PlaceHolder="Search" SizeFlagsHorizontal="FillExpand" SizeFlagsStretchRatio="0.6"/>
<OptionButton Name="Category" SizeFlagsHorizontal="FillExpand" SizeFlagsStretchRatio="0.4"/>
<HBoxContainer HorizontalExpand="True">
<VBoxContainer HorizontalExpand="True" SizeFlagsStretchRatio="0.45">
<HBoxContainer HorizontalExpand="True" VerticalExpand="True" SizeFlagsStretchRatio="0.1">
<LineEdit Name="SearchBar" PlaceHolder="Search" HorizontalExpand="True" SizeFlagsStretchRatio="0.6"/>
<OptionButton Name="Category" HorizontalExpand="True" SizeFlagsStretchRatio="0.4"/>
</HBoxContainer>
<ItemList Name="RecipesList" SelectMode="Single" SizeFlagsVertical="FillExpand" SizeFlagsStretchRatio="0.9"/>
<ItemList Name="RecipesList" SelectMode="Single" VerticalExpand="True" SizeFlagsStretchRatio="0.9"/>
</VBoxContainer>
<Control SizeFlagsHorizontal="FillExpand" SizeFlagsStretchRatio="0.05"/>
<VBoxContainer SizeFlagsHorizontal="FillExpand" SizeFlagsStretchRatio="0.45">
<HBoxContainer Align="Center" SizeFlagsVertical="FillExpand" SizeFlagsStretchRatio="0.25">
<TextureRect Name="TargetTexture" SizeFlagsHorizontal="FillExpand" SizeFlagsStretchRatio="0.15" Stretch="KeepCentered"/>
<VBoxContainer SizeFlagsHorizontal="FillExpand" SizeFlagsStretchRatio="0.85">
<RichTextLabel Name="TargetName" SizeFlagsVertical="FillExpand" SizeFlagsStretchRatio="0.1"/>
<RichTextLabel Name="TargetDesc" SizeFlagsVertical="FillExpand" SizeFlagsStretchRatio="0.9"/>
<Control HorizontalExpand="True" SizeFlagsStretchRatio="0.05"/>
<VBoxContainer HorizontalExpand="True" SizeFlagsStretchRatio="0.45">
<HBoxContainer Align="Center" VerticalExpand="True" SizeFlagsStretchRatio="0.25">
<TextureRect Name="TargetTexture" HorizontalExpand="True" SizeFlagsStretchRatio="0.15" Stretch="KeepCentered"/>
<VBoxContainer HorizontalExpand="True" SizeFlagsStretchRatio="0.85">
<RichTextLabel Name="TargetName" VerticalExpand="True" SizeFlagsStretchRatio="0.1"/>
<RichTextLabel Name="TargetDesc" VerticalExpand="True" SizeFlagsStretchRatio="0.9"/>
</VBoxContainer>
</HBoxContainer>
<ItemList Name="StepList" SizeFlagsVertical="FillExpand" SizeFlagsStretchRatio="0.1"/>
<VBoxContainer SizeFlagsVertical="FillExpand" SizeFlagsStretchRatio="0.1">
<Button Name="BuildButton" Disabled="True" ToggleMode="True" SizeFlagsVertical="FillExpand" SizeFlagsStretchRatio="0.5"/>
<HBoxContainer SizeFlagsVertical="FillExpand" SizeFlagsStretchRatio="0.5">
<Button Name="EraseButton" ToggleMode="True" SizeFlagsHorizontal="FillExpand" SizeFlagsStretchRatio="0.7"/>
<Button Name="ClearButton" SizeFlagsHorizontal="FillExpand" SizeFlagsStretchRatio="0.3"/>
<ItemList Name="StepList" VerticalExpand="True" SizeFlagsStretchRatio="0.1"/>
<VBoxContainer VerticalExpand="True" SizeFlagsStretchRatio="0.1">
<Button Name="BuildButton" Disabled="True" ToggleMode="True" VerticalExpand="True" SizeFlagsStretchRatio="0.5"/>
<HBoxContainer VerticalExpand="True" SizeFlagsStretchRatio="0.5">
<Button Name="EraseButton" ToggleMode="True" HorizontalExpand="True" SizeFlagsStretchRatio="0.7"/>
<Button Name="ClearButton" HorizontalExpand="True" SizeFlagsStretchRatio="0.3"/>
</HBoxContainer>
</VBoxContainer>
</VBoxContainer>

View File

@@ -6,7 +6,6 @@ using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Maths;
#nullable enable
@@ -57,8 +56,6 @@ namespace Content.Client.Construction
[GenerateTypedNameReferences]
public partial class ConstructionMenu : SS14Window, IConstructionMenuView
{
protected override Vector2? CustomSize => (720, 320);
public bool BuildButtonPressed
{
get => BuildButton.Pressed;
@@ -82,6 +79,8 @@ namespace Content.Client.Construction
public ConstructionMenu()
{
SetSize = MinSize = (720, 320);
IoCManager.InjectDependencies(this);
RobustXamlLoader.Load(this);

View File

@@ -34,10 +34,9 @@ namespace Content.Client.GameObjects.Components.Access
private string _lastFullName;
private string _lastJobTitle;
protected override Vector2? CustomSize => (650, 270);
public IdCardConsoleWindow(IdCardConsoleBoundUserInterface owner, IPrototypeManager prototypeManager)
{
MinSize = SetSize = (650, 270);
_owner = owner;
var vBox = new VBoxContainer();
@@ -60,7 +59,7 @@ namespace Content.Client.GameObjects.Components.Access
_targetIdButton.OnPressed += _ => _owner.ButtonPressed(UiButton.TargetId);
// Separator
vBox.AddChild(new Control {CustomMinimumSize = (0, 8)});
vBox.AddChild(new Control {MinSize = (0, 8)});
// Name and job title line edits.
vBox.AddChild(new GridContainer
@@ -76,7 +75,7 @@ namespace Content.Client.GameObjects.Components.Access
}),
(_fullNameLineEdit = new LineEdit
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
}),
(_fullNameSaveButton = new Button
{
@@ -91,7 +90,7 @@ namespace Content.Client.GameObjects.Components.Access
}),
(_jobTitleLineEdit = new LineEdit
{
SizeFlagsHorizontal = SizeFlags.FillExpand
HorizontalExpand = true
}),
(_jobTitleSaveButton = new Button
{
@@ -116,13 +115,13 @@ namespace Content.Client.GameObjects.Components.Access
_jobTitleSaveButton.OnPressed += _ => SubmitData();
// Separator
vBox.AddChild(new Control {CustomMinimumSize = (0, 8)});
vBox.AddChild(new Control {MinSize = (0, 8)});
{
var grid = new GridContainer
{
Columns = 5,
SizeFlagsHorizontal = SizeFlags.ShrinkCenter
HorizontalAlignment = HAlignment.Center
};
vBox.AddChild(grid);

View File

@@ -76,13 +76,13 @@ namespace Content.Client.GameObjects.Components.Actor
(SpriteView = new SpriteView { Scale = (2, 2)}),
new VBoxContainer
{
SizeFlagsVertical = SizeFlags.None,
VerticalAlignment = VAlignment.Top,
Children =
{
(NameLabel = new Label()),
(SubText = new Label
{
SizeFlagsVertical = SizeFlags.None,
VerticalAlignment = VAlignment.Top,
StyleClasses = {StyleNano.StyleClassLabelSubText},
})
@@ -99,7 +99,7 @@ namespace Content.Client.GameObjects.Components.Actor
AddChild(new Label
{
Text = Loc.GetString("Objectives"),
SizeFlagsHorizontal = SizeFlags.ShrinkCenter
HorizontalAlignment = HAlignment.Center
});
ObjectivesContainer = new VBoxContainer();
AddChild(ObjectivesContainer);
@@ -135,11 +135,11 @@ namespace Content.Client.GameObjects.Components.Actor
{
Texture = objectiveCondition.SpriteSpecifier.Frame0(),
Progress = objectiveCondition.Progress,
SizeFlagsVertical = SizeFlags.ShrinkCenter
VerticalAlignment = VAlignment.Center
});
hbox.AddChild(new Control
{
CustomMinimumSize = (10,0)
MinSize = (10,0)
});
hbox.AddChild(new VBoxContainer
{

View File

@@ -29,7 +29,7 @@ namespace Content.Client.GameObjects.Components.Atmos
var resourceCache = IoCManager.Resolve<IResourceCache>();
Owner = owner;
var rootContainer = new LayoutContainer { Name = "WireRoot" };
var rootContainer = new LayoutContainer {Name = "WireRoot"};
AddChild(rootContainer);
MouseFilter = MouseFilterMode.Stop;
@@ -66,7 +66,7 @@ namespace Content.Client.GameObjects.Components.Atmos
Children =
{
(_topContainer = new VBoxContainer()),
new Control {CustomMinimumSize = (0, 110)}
new Control {MinSize = (0, 110)}
}
};
@@ -78,42 +78,33 @@ namespace Content.Client.GameObjects.Components.Atmos
var fontSmall = resourceCache.GetFont("/Fonts/Boxfont-round/Boxfont Round.ttf", 10);
Button refreshButton;
var topRow = new MarginContainer
var topRow = new HBoxContainer
{
MarginLeftOverride = 4,
MarginTopOverride = 2,
MarginRightOverride = 12,
MarginBottomOverride = 2,
Margin = new Thickness(4, 4, 12, 2),
Children =
{
new HBoxContainer
(_nameLabel = new Label
{
Children =
{
(_nameLabel = new Label
{
Text = Loc.GetString("Gas Analyzer"),
FontOverride = font,
FontColorOverride = StyleNano.NanoGold,
SizeFlagsVertical = SizeFlags.ShrinkCenter
}),
new Control
{
CustomMinimumSize = (20, 0),
SizeFlagsHorizontal = SizeFlags.Expand
},
(refreshButton = new Button {Text = "Refresh"}), //TODO: refresh icon?
new Control
{
CustomMinimumSize = (2, 0),
},
(CloseButton = new TextureButton
{
StyleClasses = {SS14Window.StyleClassWindowCloseButton},
SizeFlagsVertical = SizeFlags.ShrinkCenter
})
}
}
Text = Loc.GetString("Gas Analyzer"),
FontOverride = font,
FontColorOverride = StyleNano.NanoGold,
VerticalAlignment = VAlignment.Center
}),
new Control
{
MinSize = (20, 0),
HorizontalExpand = true,
},
(refreshButton = new Button {Text = "Refresh"}), //TODO: refresh icon?
new Control
{
MinSize = (2, 0),
},
(CloseButton = new TextureButton
{
StyleClasses = {SS14Window.StyleClassWindowCloseButton},
VerticalAlignment = VAlignment.Center
})
}
};
@@ -124,37 +115,30 @@ namespace Content.Client.GameObjects.Components.Atmos
var middle = new PanelContainer
{
PanelOverride = new StyleBoxFlat { BackgroundColor = Color.FromHex("#202025") },
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#202025")},
Children =
{
new MarginContainer
(_statusContainer = new VBoxContainer
{
MarginLeftOverride = 8,
MarginRightOverride = 8,
MarginTopOverride = 4,
MarginBottomOverride = 4,
Children =
{
(_statusContainer = new VBoxContainer())
}
}
Margin = new Thickness(8, 8, 4, 4)
})
}
};
_topContainer.AddChild(topRow);
_topContainer.AddChild(new PanelContainer
{
CustomMinimumSize = (0, 2),
PanelOverride = new StyleBoxFlat { BackgroundColor = Color.FromHex("#525252ff") }
MinSize = (0, 2),
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#525252ff")}
});
_topContainer.AddChild(middle);
_topContainer.AddChild(new PanelContainer
{
CustomMinimumSize = (0, 2),
PanelOverride = new StyleBoxFlat { BackgroundColor = Color.FromHex("#525252ff") }
MinSize = (0, 2),
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#525252ff")}
});
CloseButton.OnPressed += _ => Close();
LayoutContainer.SetSize(this, (300, 200));
SetSize = (300, 200);
}
@@ -177,17 +161,19 @@ namespace Content.Client.GameObjects.Components.Atmos
});
_statusContainer.AddChild(new Label
{
Text = Loc.GetString("Temperature: {0:0.#}K ({1:0.#}°C)", state.Temperature, TemperatureHelpers.KelvinToCelsius(state.Temperature))
Text = Loc.GetString("Temperature: {0:0.#}K ({1:0.#}°C)", state.Temperature,
TemperatureHelpers.KelvinToCelsius(state.Temperature))
});
// Return here cause all that stuff down there is gas stuff (so we don't get the seperators)
if (state.Gases.Length == 0)
{
return;
}
// Seperator
_statusContainer.AddChild(new Control
{
CustomMinimumSize = new Vector2(0, 10)
MinSize = new Vector2(0, 10)
});
// Add a table with all the gases
@@ -200,7 +186,7 @@ namespace Content.Client.GameObjects.Components.Atmos
tableKey,
new Control
{
CustomMinimumSize = new Vector2(20, 0)
MinSize = new Vector2(20, 0)
},
tableVal
}
@@ -210,13 +196,13 @@ namespace Content.Client.GameObjects.Components.Atmos
var minSize = 24; // This basically allows gases which are too small, to be shown properly
var gasBar = new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
CustomMinimumSize = new Vector2(0, height)
HorizontalExpand = true,
MinSize = new Vector2(0, height)
};
// Seperator
_statusContainer.AddChild(new Control
{
CustomMinimumSize = new Vector2(0, 10)
MinSize = new Vector2(0, 10)
});
var totalGasAmount = 0f;
@@ -244,8 +230,9 @@ namespace Content.Client.GameObjects.Components.Atmos
var right = (i == state.Gases.Length - 1) ? 0f : 2f;
gasBar.AddChild(new PanelContainer
{
ToolTip = Loc.GetString("{0}: {1:0.##} mol ({2:0.#}%)", gas.Name, gas.Amount, (gas.Amount / totalGasAmount) * 100),
SizeFlagsHorizontal = SizeFlags.FillExpand,
ToolTip = Loc.GetString("{0}: {1:0.##} mol ({2:0.#}%)", gas.Name, gas.Amount,
(gas.Amount / totalGasAmount) * 100),
HorizontalExpand = true,
SizeFlagsStretchRatio = gas.Amount,
MouseFilter = MouseFilterMode.Pass,
PanelOverride = new StyleBoxFlat
@@ -254,9 +241,10 @@ namespace Content.Client.GameObjects.Components.Atmos
PaddingLeft = left,
PaddingRight = right
},
CustomMinimumSize = new Vector2(minSize, 0)
MinSize = new Vector2(minSize, 0)
});
}
_statusContainer.AddChild(gasBar);
}

View File

@@ -31,10 +31,9 @@ namespace Content.Client.GameObjects.Components.Atmos
public List<ReleasePressureButton> ReleasePressureButtons { get; private set; }
protected override Vector2? CustomSize => (300, 200);
public GasCanisterWindow()
{
SetSize = MinSize = (300, 200);
HBoxContainer releasePressureButtons;
Contents.AddChild(new VBoxContainer
@@ -51,7 +50,7 @@ namespace Content.Client.GameObjects.Components.Atmos
{
new Label(){ Text = Loc.GetString("Label: ") },
(LabelInput = new LineEdit() { Text = Name, Editable = false,
CustomMinimumSize = new Vector2(200, 30)}),
MinSize = new Vector2(200, 30)}),
(EditLabelBtn = new Button()),
}
},

View File

@@ -34,7 +34,7 @@ namespace Content.Client.GameObjects.Components.Body.Scanner
// Left half
new ScrollContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
Children =
{
(BodyPartList = new ItemList())
@@ -43,13 +43,13 @@ namespace Content.Client.GameObjects.Components.Body.Scanner
// Right half
new VBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
Children =
{
// Top half of the right half
new VBoxContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
Children =
{
(BodyPartLabel = new Label()),
@@ -66,7 +66,7 @@ namespace Content.Client.GameObjects.Components.Body.Scanner
},
new ScrollContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
Children =
{
(MechanismList = new ItemList())
@@ -77,7 +77,7 @@ namespace Content.Client.GameObjects.Components.Body.Scanner
// Bottom half of the right half
(MechanismInfoLabel = new RichTextLabel
{
SizeFlagsVertical = SizeFlags.FillExpand
VerticalExpand = true
})
}
}
@@ -88,12 +88,11 @@ namespace Content.Client.GameObjects.Components.Body.Scanner
BodyPartList.OnItemSelected += BodyPartOnItemSelected;
MechanismList.OnItemSelected += MechanismOnItemSelected;
MinSize = SetSize = (800, 600);
}
public BodyScannerBoundUserInterface Owner { get; }
protected override Vector2? CustomSize => (800, 600);
private ItemList BodyPartList { get; }
private Label BodyPartLabel { get; }

View File

@@ -15,10 +15,9 @@ namespace Content.Client.GameObjects.Components.Body.Surgery
private readonly VBoxContainer _optionsBox;
private OptionSelectedCallback _optionSelectedCallback;
protected override Vector2? CustomSize => (300, 400);
public SurgeryWindow()
{
MinSize = SetSize = (300, 400);
Title = Loc.GetString("Surgery");
RectClipContent = true;
@@ -28,15 +27,15 @@ namespace Content.Client.GameObjects.Components.Body.Surgery
{
new ScrollContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand,
VerticalExpand = true,
HorizontalExpand = true,
HScrollEnabled = true,
VScrollEnabled = true,
Children =
{
(_optionsBox = new VBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand
HorizontalExpand = true
})
}
}
@@ -87,8 +86,8 @@ namespace Content.Client.GameObjects.Components.Body.Surgery
Button = new Button
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
HorizontalExpand = true,
VerticalExpand = true,
ToggleMode = true,
MouseFilter = MouseFilterMode.Stop
};
@@ -101,16 +100,16 @@ namespace Content.Client.GameObjects.Components.Body.Surgery
{
(SpriteView = new SpriteView
{
CustomMinimumSize = new Vector2(32.0f, 32.0f)
MinSize = new Vector2(32.0f, 32.0f)
}),
(DisplayText = new Label
{
SizeFlagsVertical = SizeFlags.ShrinkCenter,
VerticalAlignment = VAlignment.Center,
Text = "N/A",
}),
(new Control
{
SizeFlagsHorizontal = SizeFlags.FillExpand
HorizontalExpand = true
})
}
});

View File

@@ -47,14 +47,13 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
public Button CreatePills { get; }
public Button CreateBottles { get; }
protected override Vector2? CustomSize => (400, 200);
/// <summary>
/// Create and initialize the chem master UI client-side. Creates the basic layout,
/// actual data isn't filled in until the server sends data about the chem master.
/// </summary>
public ChemMasterWindow()
{
MinSize = SetSize = (400, 200);
IoCManager.InjectDependencies(this);
Contents.AddChild(new VBoxContainer
@@ -67,16 +66,16 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
Children =
{
new Label {Text = Loc.GetString("Container")},
new Control {SizeFlagsHorizontal = SizeFlags.FillExpand},
new Control {HorizontalExpand = true},
(EjectButton = new Button {Text = Loc.GetString("Eject")})
}
},
//Wrap the container info in a PanelContainer so we can color it's background differently.
new PanelContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
SizeFlagsStretchRatio = 6,
CustomMinimumSize = (0, 200),
MinSize = (0, 200),
PanelOverride = new StyleBoxFlat
{
BackgroundColor = new Color(27, 27, 30)
@@ -86,7 +85,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
//Currently empty, when server sends state data this will have container contents and fill volume.
(ContainerInfo = new VBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
Children =
{
new Label
@@ -99,7 +98,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
},
//Padding
new Control {CustomMinimumSize = (0.0f, 10.0f)},
new Control {MinSize = (0.0f, 10.0f)},
//Buffer
new HBoxContainer
@@ -107,7 +106,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
Children =
{
new Label {Text = Loc.GetString("Buffer")},
new Control {SizeFlagsHorizontal = SizeFlags.FillExpand},
new Control {HorizontalExpand = true},
(BufferTransferButton = new Button {Text = Loc.GetString("Transfer"), Pressed = BufferModeTransfer, StyleClasses = { StyleBase.ButtonOpenRight }}),
(BufferDiscardButton = new Button {Text = Loc.GetString("Discard"), Pressed = !BufferModeTransfer, StyleClasses = { StyleBase.ButtonOpenLeft }})
}
@@ -116,9 +115,9 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
//Wrap the buffer info in a PanelContainer so we can color it's background differently.
new PanelContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
SizeFlagsStretchRatio = 6,
CustomMinimumSize = (0, 100),
MinSize = (0, 100),
PanelOverride = new StyleBoxFlat
{
BackgroundColor = new Color(27, 27, 30)
@@ -128,7 +127,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
//Buffer reagent list
(BufferInfo = new VBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
Children =
{
new Label
@@ -141,7 +140,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
},
//Padding
new Control {CustomMinimumSize = (0.0f, 10.0f)},
new Control {MinSize = (0.0f, 10.0f)},
//Packaging
new HBoxContainer
@@ -155,9 +154,9 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
//Wrap the packaging info in a PanelContainer so we can color it's background differently.
new PanelContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
SizeFlagsStretchRatio = 6,
CustomMinimumSize = (0, 100),
MinSize = (0, 100),
PanelOverride = new StyleBoxFlat
{
BackgroundColor = new Color(27, 27, 30)
@@ -167,7 +166,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
//Packaging options
(PackagingInfo = new VBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
}),
}
@@ -190,12 +189,12 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
};
PackagingInfo.AddChild(PillInfo);
var pillPadding = new Control {SizeFlagsHorizontal = SizeFlags.FillExpand};
var pillPadding = new Control {HorizontalExpand = true};
PillInfo.AddChild(pillPadding);
PillAmount = new SpinBox
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
Value = 1
};
PillAmount.InitDefaultButtons();
@@ -227,12 +226,12 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
};
PackagingInfo.AddChild(BottleInfo);
var bottlePadding = new Control {SizeFlagsHorizontal = SizeFlags.FillExpand};
var bottlePadding = new Control {HorizontalExpand = true};
BottleInfo.AddChild(bottlePadding);
BottleAmount = new SpinBox
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
Value = 1
};
BottleAmount.InitDefaultButtons();
@@ -351,7 +350,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
},
//Padding
new Control {SizeFlagsHorizontal = SizeFlags.FillExpand},
new Control {HorizontalExpand = true},
MakeChemButton("1", ReagentUnit.New(1), reagent.ReagentId, false, StyleBase.ButtonOpenRight),
MakeChemButton("5", ReagentUnit.New(5), reagent.ReagentId, false, StyleBase.ButtonOpenBoth),
@@ -407,7 +406,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ChemMaster
},
//Padding
new Control {SizeFlagsHorizontal = SizeFlags.FillExpand},
new Control {HorizontalExpand = true},
MakeChemButton("1", ReagentUnit.New(1), reagent.ReagentId, true, StyleBase.ButtonOpenRight),
MakeChemButton("5", ReagentUnit.New(5), reagent.ReagentId, true, StyleBase.ButtonOpenBoth),

View File

@@ -61,14 +61,13 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser
/// <summary>A grid of buttons for each reagent which can be dispensed.</summary>
public GridContainer ChemicalList { get; }
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.
/// </summary>
public ReagentDispenserWindow()
{
SetSize = MinSize = (500, 600);
IoCManager.InjectDependencies(this);
var dispenseAmountGroup = new ButtonGroup();
@@ -84,7 +83,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser
{
new Label {Text = Loc.GetString("Amount")},
//Padding
new Control {CustomMinimumSize = (20, 0)},
new Control {MinSize = (20, 0)},
(DispenseButton1 = new Button {Text = "1", Group = dispenseAmountGroup, StyleClasses = { StyleBase.ButtonOpenRight }}),
(DispenseButton5 = new Button {Text = "5", Group = dispenseAmountGroup, StyleClasses = { StyleBase.ButtonOpenBoth }}),
(DispenseButton10 = new Button {Text = "10", Group = dispenseAmountGroup, StyleClasses = { StyleBase.ButtonOpenBoth }}),
@@ -97,14 +96,14 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser
}
},
//Padding
new Control {CustomMinimumSize = (0.0f, 10.0f)},
new Control {MinSize = (0.0f, 10.0f)},
//Grid of which reagents can be dispensed.
(ChemicalList = new GridContainer
{
Columns = 5
}),
//Padding
new Control {CustomMinimumSize = (0.0f, 10.0f)},
new Control {MinSize = (0.0f, 10.0f)},
new HBoxContainer
{
Children =
@@ -117,9 +116,9 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser
//Wrap the container info in a PanelContainer so we can color it's background differently.
new PanelContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
SizeFlagsStretchRatio = 6,
CustomMinimumSize = (0, 150),
MinSize = (0, 150),
PanelOverride = new StyleBoxFlat
{
BackgroundColor = new Color(27, 27, 30)
@@ -129,7 +128,7 @@ namespace Content.Client.GameObjects.Components.Chemistry.ReagentDispenser
//Currently empty, when server sends state data this will have container contents and fill volume.
(ContainerInfo = new VBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
Children =
{
new Label

View File

@@ -1,5 +1,4 @@
#nullable enable
using System;
using System.Collections.Generic;
using System.Diagnostics;
using Robust.Client.UserInterface;
@@ -7,8 +6,6 @@ using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.Localization;
using Robust.Shared.Maths;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
using static Content.Shared.GameObjects.Components.Medical.SharedCloningPodComponent;
namespace Content.Client.GameObjects.Components.CloningPod
@@ -17,68 +14,36 @@ namespace Content.Client.GameObjects.Components.CloningPod
{
private Dictionary<int, string> _scanManager;
private readonly VBoxContainer _mainVBox;
private readonly ScanListContainer _scanList;
private readonly LineEdit _searchBar;
private readonly Button _clearButton;
private readonly VBoxContainer _scanList;
public readonly Button CloneButton;
public readonly Button EjectButton;
private readonly CloningScanButton _measureButton;
private CloningScanButton? _selectedButton;
private readonly Label _progressLabel;
private readonly ProgressBar _cloningProgressBar;
private readonly Label _mindState;
protected override Vector2 ContentsMinimumSize => _mainVBox?.CombinedMinimumSize ?? Vector2.Zero;
private CloningPodBoundUserInterfaceState _lastUpdate = null!;
// List of scans that are visible based on current filter criteria.
private readonly Dictionary<int, string> _filteredScans = new();
// The indices of the visible scans last time UpdateVisibleScans was ran.
// This is inclusive, so end is the index of the last scan, not right after it.
private (int start, int end) _lastScanIndices;
public int? SelectedScan;
protected override Vector2? CustomSize => (250, 300);
public CloningPodWindow(
Dictionary<int, string> scanManager)
public CloningPodWindow(Dictionary<int, string> scanManager)
{
SetSize = MinSize = (250, 300);
_scanManager = scanManager;
Title = Loc.GetString("Cloning Machine");
Contents.AddChild(_mainVBox = new VBoxContainer
Contents.AddChild(new VBoxContainer
{
Children =
{
new HBoxContainer
{
Children =
{
(_searchBar = new LineEdit
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
PlaceHolder = Loc.GetString("Search")
}),
(_clearButton = new Button
{
Disabled = true,
Text = Loc.GetString("Clear"),
})
}
},
new ScrollContainer
{
CustomMinimumSize = new Vector2(200.0f, 0.0f),
SizeFlagsVertical = SizeFlags.FillExpand,
MinSize = new Vector2(200.0f, 0.0f),
VerticalExpand = true,
Children =
{
(_scanList = new ScanListContainer())
(_scanList = new VBoxContainer())
}
},
new VBoxContainer
@@ -91,11 +56,9 @@ namespace Content.Client.GameObjects.Components.CloningPod
})
}
},
(_measureButton = new CloningScanButton {Visible = false}),
(_cloningProgressBar = new ProgressBar
{
CustomMinimumSize = (200, 20),
SizeFlagsHorizontal = SizeFlags.Fill,
MinSize = (200, 20),
MinValue = 0,
MaxValue = 10,
Page = 0,
@@ -127,13 +90,7 @@ namespace Content.Client.GameObjects.Components.CloningPod
}
});
_searchBar.OnTextChanged += OnSearchBarTextChanged;
_clearButton.OnPressed += OnClearButtonPressed;
BuildEntityList();
_searchBar.GrabKeyboardFocus();
BuildCloneList();
}
public void Populate(CloningPodBoundUserInterfaceState state)
@@ -143,7 +100,7 @@ namespace Content.Client.GameObjects.Components.CloningPod
if (_lastUpdate == null || _lastUpdate.MindIdName.Count != state.MindIdName.Count)
{
_scanManager = state.MindIdName;
BuildEntityList();
BuildCloneList();
_lastUpdate = state;
}
@@ -155,130 +112,31 @@ namespace Content.Client.GameObjects.Components.CloningPod
_mindState.FontColorOverride = state.MindPresent ? Color.Green : Color.Red;
}
private void OnSearchBarTextChanged(LineEdit.LineEditEventArgs args)
private void BuildCloneList()
{
BuildEntityList(args.Text);
_clearButton.Disabled = string.IsNullOrEmpty(args.Text);
}
private void OnClearButtonPressed(BaseButton.ButtonEventArgs args)
{
_searchBar.Clear();
BuildEntityList("");
}
private void BuildEntityList(string? searchStr = null)
{
_filteredScans.Clear();
_scanList.RemoveAllChildren();
// Reset last scan indices so it automatically updates the entire list.
_lastScanIndices = (0, -1);
_scanList.RemoveAllChildren();
_selectedButton = null;
searchStr = searchStr?.ToLowerInvariant();
foreach (var scan in _scanManager)
{
if (searchStr != null && !_doesScanMatchSearch(scan.Value, searchStr))
var button = new CloningScanButton
{
continue;
Scan = scan.Value,
Id = scan.Key
};
button.ActualButton.OnToggled += OnItemButtonToggled;
var entityLabelText = scan.Value;
button.EntityLabel.Text = entityLabelText;
if (scan.Key == SelectedScan)
{
_selectedButton = button;
_selectedButton.ActualButton.Pressed = true;
}
_filteredScans.Add(scan.Key, scan.Value);
}
//TODO: set up sort
//_filteredScans.Sort((a, b) => string.Compare(a.ToString(), b.ToString(), StringComparison.Ordinal));
_scanList.TotalItemCount = _filteredScans.Count;
}
private void UpdateVisibleScans()
{
// Update visible buttons in the scan list.
// Calculate index of first scan to render based on current scroll.
var height = _measureButton.CombinedMinimumSize.Y + ScanListContainer.Separation;
var offset = -_scanList.Position.Y;
var startIndex = (int) Math.Floor(offset / height);
_scanList.ItemOffset = startIndex;
var (prevStart, prevEnd) = _lastScanIndices;
// Calculate index of final one.
var endIndex = startIndex - 1;
var spaceUsed = -height; // -height instead of 0 because else it cuts off the last button.
while (spaceUsed < _scanList.Parent!.Height)
{
spaceUsed += height;
endIndex += 1;
}
endIndex = Math.Min(endIndex, _filteredScans.Count - 1);
if (endIndex == prevEnd && startIndex == prevStart)
{
// Nothing changed so bye.
return;
}
_lastScanIndices = (startIndex, endIndex);
// Delete buttons at the start of the list that are no longer visible (scrolling down).
for (var i = prevStart; i < startIndex && i <= prevEnd; i++)
{
var control = (CloningScanButton) _scanList.GetChild(0);
DebugTools.Assert(control.Index == i);
_scanList.RemoveChild(control);
}
// Delete buttons at the end of the list that are no longer visible (scrolling up).
for (var i = prevEnd; i > endIndex && i >= prevStart; i--)
{
var control = (CloningScanButton) _scanList.GetChild(_scanList.ChildCount - 1);
DebugTools.Assert(control.Index == i);
_scanList.RemoveChild(control);
}
var array = _filteredScans.ToArray();
// Create buttons at the start of the list that are now visible (scrolling up).
for (var i = Math.Min(prevStart - 1, endIndex); i >= startIndex; i--)
{
InsertEntityButton(array[i], true, i);
}
// Create buttons at the end of the list that are now visible (scrolling down).
for (var i = Math.Max(prevEnd + 1, startIndex); i <= endIndex; i++)
{
InsertEntityButton(array[i], false, i);
}
}
// Create a spawn button and insert it into the start or end of the list.
private void InsertEntityButton(KeyValuePair<int, string> scan, bool insertFirst, int index)
{
var button = new CloningScanButton
{
Scan = scan.Value,
Id = scan.Key,
Index = index // We track this index purely for debugging.
};
button.ActualButton.OnToggled += OnItemButtonToggled;
var entityLabelText = scan.Value;
button.EntityLabel.Text = entityLabelText;
if (scan.Key == SelectedScan)
{
_selectedButton = button;
_selectedButton.ActualButton.Pressed = true;
}
//TODO: replace with body's face
/*var tex = IconComponent.GetScanIcon(scan, resourceCache);
//TODO: replace with body's face
/*var tex = IconComponent.GetScanIcon(scan, resourceCache);
var rect = button.EntityTextureRect;
if (tex != null)
{
@@ -292,16 +150,11 @@ namespace Content.Client.GameObjects.Components.CloningPod
rect.Dispose();
*/
_scanList.AddChild(button);
if (insertFirst)
{
button.SetPositionInParent(0);
_scanList.AddChild(button);
}
}
private static bool _doesScanMatchSearch(string scan, string searchStr)
{
return scan.ToLowerInvariant().Contains(searchStr);
//TODO: set up sort
//_filteredScans.Sort((a, b) => string.Compare(a.ToString(), b.ToString(), StringComparison.Ordinal));
}
private void OnItemButtonToggled(BaseButton.ButtonToggledEventArgs args)
@@ -325,76 +178,6 @@ namespace Content.Client.GameObjects.Components.CloningPod
SelectedScan = item.Id;
}
protected override void FrameUpdate(FrameEventArgs args)
{
base.FrameUpdate(args);
UpdateVisibleScans();
}
private class ScanListContainer : Container
{
// Quick and dirty container to do virtualization of the list.
// Basically, get total item count and offset to put the current buttons at.
// Get a constant minimum height and move the buttons in the list up to match the scrollbar.
private int _totalItemCount;
private int _itemOffset;
public int TotalItemCount
{
get => _totalItemCount;
set
{
_totalItemCount = value;
MinimumSizeChanged();
}
}
public int ItemOffset
{
get => _itemOffset;
set
{
_itemOffset = value;
UpdateLayout();
}
}
public const float Separation = 2;
protected override Vector2 CalculateMinimumSize()
{
if (ChildCount == 0)
{
return Vector2.Zero;
}
var first = GetChild(0);
var (minX, minY) = first.CombinedMinimumSize;
return (minX, minY * TotalItemCount + (TotalItemCount - 1) * Separation);
}
protected override void LayoutUpdateOverride()
{
if (ChildCount == 0)
{
return;
}
var first = GetChild(0);
var height = first.CombinedMinimumSize.Y;
var offset = ItemOffset * height + (ItemOffset - 1) * Separation;
foreach (var child in Children)
{
FitChildInBox(child, UIBox2.FromDimensions(0, offset, Width, height));
offset += Separation + height;
}
}
}
[DebuggerDisplay("cloningbutton {" + nameof(Index) + "}")]
private class CloningScanButton : Control
{
@@ -409,8 +192,8 @@ namespace Content.Client.GameObjects.Components.CloningPod
{
AddChild(ActualButton = new Button
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
HorizontalExpand = true,
VerticalExpand = true,
ToggleMode = true,
});
@@ -420,16 +203,16 @@ namespace Content.Client.GameObjects.Components.CloningPod
{
(EntityTextureRect = new TextureRect
{
CustomMinimumSize = (32, 32),
SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
MinSize = (32, 32),
HorizontalAlignment = HAlignment.Center,
VerticalAlignment = VAlignment.Center,
Stretch = TextureRect.StretchMode.KeepAspectCentered,
CanShrink = true
}),
(EntityLabel = new Label
{
SizeFlagsVertical = SizeFlags.ShrinkCenter,
SizeFlagsHorizontal = SizeFlags.FillExpand,
VerticalAlignment = VAlignment.Center,
HorizontalExpand = true,
Text = "",
ClipText = true
})

View File

@@ -19,80 +19,52 @@ namespace Content.Client.GameObjects.Components.Wires
private readonly List<(string name, LineEdit input)> _inputs;
protected override Vector2? CustomSize => (300, 250);
public ConfigurationMenu(ConfigurationBoundUserInterface owner)
{
MinSize = SetSize = (300, 250);
Owner = owner;
_inputs = new List<(string name, LineEdit input)>();
Title = Loc.GetString("Device Configuration");
var margin = new MarginContainer
{
MarginBottomOverride = 8,
MarginLeftOverride = 8,
MarginRightOverride = 8,
MarginTopOverride = 8
};
_baseContainer = new VBoxContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand
VerticalExpand = true,
HorizontalExpand = true
};
_column = new VBoxContainer
{
Margin = new Thickness(8),
SeparationOverride = 16,
SizeFlagsVertical = SizeFlags.Fill
};
_row = new HBoxContainer
{
SeparationOverride = 16,
SizeFlagsHorizontal = SizeFlags.FillExpand
};
var buttonRow = new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand
};
var spacer1 = new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.Expand
};
var spacer2 = new HBoxContainer()
{
SizeFlagsHorizontal = SizeFlags.Expand
HorizontalExpand = true
};
var confirmButton = new Button
{
Text = Loc.GetString("Confirm"),
SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
SizeFlagsVertical = SizeFlags.ShrinkCenter
HorizontalAlignment = HAlignment.Center,
VerticalAlignment = VAlignment.Center
};
confirmButton.OnButtonUp += OnConfirm;
buttonRow.AddChild(spacer1);
buttonRow.AddChild(confirmButton);
buttonRow.AddChild(spacer2);
var outerColumn = new ScrollContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand,
VerticalExpand = true,
HorizontalExpand = true,
ModulateSelfOverride = Color.FromHex("#202025")
};
margin.AddChild(_column);
outerColumn.AddChild(margin);
outerColumn.AddChild(_column);
_baseContainer.AddChild(outerColumn);
_baseContainer.AddChild(buttonRow);
_baseContainer.AddChild(confirmButton);
Contents.AddChild(_baseContainer);
}
@@ -103,19 +75,15 @@ namespace Content.Client.GameObjects.Components.Wires
foreach (var field in state.Config)
{
var margin = new MarginContainer
{
MarginRightOverride = 8
};
var label = new Label
{
Margin = new Thickness(0, 0, 8, 0),
Name = field.Key,
Text = field.Key + ":",
SizeFlagsVertical = SizeFlags.ShrinkCenter,
SizeFlagsHorizontal = SizeFlags.FillExpand,
VerticalAlignment = VAlignment.Center,
HorizontalExpand = true,
SizeFlagsStretchRatio = .2f,
CustomMinimumSize = new Vector2(60, 0)
MinSize = new Vector2(60, 0)
};
var input = new LineEdit
@@ -123,7 +91,7 @@ namespace Content.Client.GameObjects.Components.Wires
Name = field.Key + "-input",
Text = field.Value,
IsValid = Validate,
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
SizeFlagsStretchRatio = .8f
};
@@ -132,8 +100,7 @@ namespace Content.Client.GameObjects.Components.Wires
var row = new HBoxContainer();
CopyProperties(_row, row);
margin.AddChild(label);
row.AddChild(margin);
row.AddChild(label);
row.AddChild(input);
_column.AddChild(row);
}

View File

@@ -20,10 +20,9 @@ namespace Content.Client.GameObjects.Components.Crayon
private string _selected;
private Color _color;
protected override Vector2? CustomSize => (250, 300);
public CrayonWindow(CrayonBoundUserInterface owner)
{
MinSize = SetSize = (250, 300);
Title = Loc.GetString("Crayon");
Owner = owner;
@@ -40,7 +39,7 @@ namespace Content.Client.GameObjects.Components.Crayon
};
var gridScroll = new ScrollContainer()
{
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
Children =
{
_grid

View File

@@ -26,189 +26,167 @@ namespace Content.Client.GameObjects.Components.Disposal
public List<string> TargetList;
private readonly Label _tagLabel;
protected override Vector2? CustomSize => (460, 220);
public DisposalMailingUnitWindow()
{
MinSize = SetSize = (460, 220);
TargetList = new List<string>();
Contents.AddChild(new HBoxContainer
{
Children =
{
new MarginContainer
new VBoxContainer
{
MarginLeftOverride = 8,
MarginRightOverride = 8,
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
Margin = new Thickness(8, 0),
Children =
{
new VBoxContainer
new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
Children =
{
new HBoxContainer
new Label {Text = Loc.GetString("State: ")},
new Control {MinSize = (4, 0)},
(_unitState = new Label {Text = Loc.GetString("Ready")})
}
},
new Control {MinSize = (0, 10)},
new HBoxContainer
{
HorizontalExpand = true,
Children =
{
new Label {Text = Loc.GetString("Pressure:")},
new Control {MinSize = (4, 0)},
(_pressureBar = new ProgressBar
{
MinSize = (100, 20),
HorizontalExpand = true,
MinValue = 0,
MaxValue = 1,
Page = 0,
Value = 0.5f,
Children =
{
new Label {Text = Loc.GetString("State: ")},
new Control {CustomMinimumSize = (4, 0)},
(_unitState = new Label {Text = Loc.GetString("Ready")})
(_pressurePercentage = new Label())
}
})
}
},
new Control {MinSize = (0, 10)},
new HBoxContainer
{
HorizontalExpand = true,
Children =
{
new Label {Text = Loc.GetString("Handle:")},
new Control
{
MinSize = (4, 0),
HorizontalExpand = true
},
new Control {CustomMinimumSize = (0, 10)},
new HBoxContainer
(Engage = new Button
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
Children =
{
new Label {Text = Loc.GetString("Pressure:")},
new Control {CustomMinimumSize = (4, 0)},
(_pressureBar = new ProgressBar
{
CustomMinimumSize = (100, 20),
SizeFlagsHorizontal = SizeFlags.FillExpand,
MinValue = 0,
MaxValue = 1,
Page = 0,
Value = 0.5f,
Children =
{
(_pressurePercentage = new Label())
}
})
}
MinSize = (16, 0),
Text = Loc.GetString("Engage"),
ToggleMode = true,
Disabled = true
})
}
},
new Control {MinSize = (0, 10)},
new HBoxContainer
{
HorizontalExpand = true,
Children =
{
new Label {Text = Loc.GetString("Eject:")},
new Control
{
MinSize = (4, 0),
HorizontalExpand = true
},
new Control {CustomMinimumSize = (0, 10)},
new HBoxContainer
(Eject = new Button
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
Children =
{
new Label {Text = Loc.GetString("Handle:")},
new Control {
CustomMinimumSize = (4, 0),
SizeFlagsHorizontal = SizeFlags.FillExpand
},
(Engage = new Button
{
CustomMinimumSize = (16, 0),
Text = Loc.GetString("Engage"),
ToggleMode = true,
Disabled = true
})
}
},
new Control {CustomMinimumSize = (0, 10)},
new HBoxContainer
MinSize = (16, 0),
Text = Loc.GetString("Eject Contents"),
//HorizontalAlignment = HAlignment.Right
})
}
},
new Control {MinSize = (0, 10)},
new HBoxContainer
{
Children =
{
(Power = new CheckButton {Text = Loc.GetString("Power")}),
}
}
}
},
new VBoxContainer
{
Margin = new Thickness(12, 0, 8, 0),
Children =
{
new HBoxContainer
{
Children =
{
new Label
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
Children =
{
new Label {Text = Loc.GetString("Eject:")},
new Control {
CustomMinimumSize = (4, 0),
SizeFlagsHorizontal = SizeFlags.FillExpand
},
(Eject = new Button {
CustomMinimumSize = (16, 0),
Text = Loc.GetString("Eject Contents"),
//SizeFlagsHorizontal = SizeFlags.ShrinkEnd
})
}
},
new Control {CustomMinimumSize = (0, 10)},
new HBoxContainer
{
Children =
{
(Power = new CheckButton {Text = Loc.GetString("Power")}),
}
Text = Loc.GetString("Select a destination:")
}
}
},
}
},
new MarginContainer
{
MarginLeftOverride = 12,
MarginRightOverride = 8,
SizeFlagsHorizontal = SizeFlags.FillExpand,
Children =
{
new VBoxContainer
new Control {MinSize = new Vector2(0, 8)},
new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.Fill,
VerticalExpand = true,
Children =
{
new HBoxContainer
(TargetListContainer = new ItemList
{
SelectMode = ItemList.ItemListSelectMode.Single,
HorizontalExpand = true,
VerticalExpand = true
})
}
},
new PanelContainer
{
PanelOverride = new StyleBoxFlat
{
BackgroundColor = Color.FromHex("#ACBDBA")
},
HorizontalExpand = true,
MinSize = new Vector2(0, 1),
},
new HBoxContainer
{
Children =
{
new VBoxContainer
{
Children =
{
new Label
{
Text = Loc.GetString("Select a destination:")
}
}
},
new Control { CustomMinimumSize = new Vector2(0, 8) },
new HBoxContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
Children =
{
(TargetListContainer = new ItemList
{
SelectMode = ItemList.ItemListSelectMode.Single,
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand
})
}
},
new PanelContainer
{
PanelOverride = new StyleBoxFlat
{
BackgroundColor = Color.FromHex("#ACBDBA")
},
SizeFlagsHorizontal = SizeFlags.FillExpand,
CustomMinimumSize = new Vector2(0, 1),
},
new HBoxContainer
{
Children =
{
new VBoxContainer
new HBoxContainer
{
Margin = new Thickness(4, 0, 0, 0),
Children =
{
new MarginContainer
new Label
{
MarginLeftOverride = 4,
Children =
{
new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
Children =
{
new Label
{
Text = Loc.GetString("This unit:")
},
new Control
{
CustomMinimumSize = new Vector2(4, 0)
},
(_tagLabel = new Label
{
Text = "-",
SizeFlagsVertical = SizeFlags.ShrinkEnd
})
}
}
}
Text = Loc.GetString("This unit:")
},
new Control
{
MinSize = new Vector2(4, 0)
},
(_tagLabel = new Label
{
Text = "-",
VerticalAlignment = VAlignment.Bottom
})
}
}
}

View File

@@ -16,10 +16,9 @@ namespace Content.Client.GameObjects.Components.Disposal
public readonly LineEdit TagInput;
public readonly Button Confirm;
protected override Vector2? CustomSize => (400, 80);
public DisposalRouterWindow()
{
MinSize = SetSize = (400, 80);
Title = Loc.GetString("Disposal Router");
Contents.AddChild(new VBoxContainer
@@ -27,14 +26,19 @@ namespace Content.Client.GameObjects.Components.Disposal
Children =
{
new Label {Text = Loc.GetString("Tags:")},
new Control {CustomMinimumSize = (0, 10)},
new Control {MinSize = (0, 10)},
new HBoxContainer
{
Children =
{
(TagInput = new LineEdit {SizeFlagsHorizontal = SizeFlags.Expand, CustomMinimumSize = (320, 0),
ToolTip = Loc.GetString("A comma separated list of tags"), IsValid = tags => TagRegex.IsMatch(tags)}),
new Control {CustomMinimumSize = (10, 0)},
(TagInput = new LineEdit
{
HorizontalExpand = true,
MinSize = (320, 0),
ToolTip = Loc.GetString("A comma separated list of tags"),
IsValid = tags => TagRegex.IsMatch(tags)
}),
new Control {MinSize = (10, 0)},
(Confirm = new Button {Text = Loc.GetString("Confirm")})
}
}

View File

@@ -16,10 +16,9 @@ namespace Content.Client.GameObjects.Components.Disposal
public readonly LineEdit TagInput;
public readonly Button Confirm;
protected override Vector2? CustomSize => (400, 80);
public DisposalTaggerWindow()
{
MinSize = SetSize = (400, 80);
Title = Loc.GetString("Disposal Tagger");
Contents.AddChild(new VBoxContainer
@@ -27,14 +26,18 @@ namespace Content.Client.GameObjects.Components.Disposal
Children =
{
new Label {Text = Loc.GetString("Tag:")},
new Control {CustomMinimumSize = (0, 10)},
new Control {MinSize = (0, 10)},
new HBoxContainer
{
Children =
{
(TagInput = new LineEdit {SizeFlagsHorizontal = SizeFlags.Expand, CustomMinimumSize = (320, 0),
IsValid = tag => TagRegex.IsMatch(tag)}),
new Control {CustomMinimumSize = (10, 0)},
(TagInput = new LineEdit
{
HorizontalExpand = true,
MinSize = (320, 0),
IsValid = tag => TagRegex.IsMatch(tag)
}),
new Control {MinSize = (10, 0)},
(Confirm = new Button {Text = Loc.GetString("Confirm")})
}
}

View File

@@ -21,10 +21,10 @@ namespace Content.Client.GameObjects.Components.Disposal
public readonly Button Eject;
public readonly Button Power;
protected override Vector2? CustomSize => (300, 200);
public DisposalUnitWindow()
{
MinSize = SetSize = (300, 200);
Contents.AddChild(new VBoxContainer
{
Children =
@@ -37,7 +37,7 @@ namespace Content.Client.GameObjects.Components.Disposal
(_unitState = new Label {Text = Loc.GetString("Ready")})
}
},
new Control {CustomMinimumSize = (0, 10)},
new Control {MinSize = (0, 10)},
new HBoxContainer
{
Children =
@@ -45,8 +45,8 @@ namespace Content.Client.GameObjects.Components.Disposal
new Label {Text = Loc.GetString("Pressure:")},
(_pressureBar = new ProgressBar
{
CustomMinimumSize = (200, 20),
SizeFlagsHorizontal = SizeFlags.ShrinkEnd,
MinSize = (200, 20),
HorizontalAlignment = HAlignment.Right,
MinValue = 0,
MaxValue = 1,
Page = 0,
@@ -58,7 +58,7 @@ namespace Content.Client.GameObjects.Components.Disposal
})
}
},
new Control {CustomMinimumSize = (0, 10)},
new Control {MinSize = (0, 10)},
new HBoxContainer
{
Children =
@@ -71,7 +71,7 @@ namespace Content.Client.GameObjects.Components.Disposal
})
}
},
new Control {CustomMinimumSize = (0, 10)},
new Control {MinSize = (0, 10)},
new HBoxContainer
{
Children =
@@ -80,7 +80,7 @@ namespace Content.Client.GameObjects.Components.Disposal
(Eject = new Button {Text = Loc.GetString("Eject Contents")})
}
},
new Control {CustomMinimumSize = (0, 10)},
new Control {MinSize = (0, 10)},
new HBoxContainer
{
Children =

View File

@@ -73,7 +73,7 @@ namespace Content.Client.GameObjects.Components.Gravity
var vBox = new VBoxContainer
{
CustomMinimumSize = new Vector2(250, 100)
MinSize = new Vector2(250, 100)
};
Status = new Label
{
@@ -84,7 +84,7 @@ namespace Content.Client.GameObjects.Components.Gravity
{
Text = Loc.GetString(Owner.IsOn ? "Turn Off" : "Turn On"),
TextAlign = Label.AlignMode.Center,
CustomMinimumSize = new Vector2(150, 60)
MinSize = new Vector2(150, 60)
};
vBox.AddChild(Status);

View File

@@ -87,7 +87,7 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
_hudButtonPocket1,
_hudButtonPocket2,
// keeps this "balanced" with the left, so the hands will appear perfectly in the center
new Control{CustomMinimumSize = (64, 64)}
new Control{MinSize = (64, 64)}
},
SeparationOverride = 5
};
@@ -226,7 +226,7 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
const int width = ButtonSize * 4 + ButtonSeparation * 3 + RightSeparation;
const int height = ButtonSize * 4 + ButtonSeparation * 3;
var windowContents = new LayoutContainer {CustomMinimumSize = (width, height)};
var windowContents = new LayoutContainer {MinSize = (width, height)};
Contents.AddChild(windowContents);
void AddButton(Slots slot, string textureName, Vector2 position)

View File

@@ -57,14 +57,14 @@ namespace Content.Client.GameObjects.Components
var wrapper = new HBoxContainer
{
SeparationOverride = 4,
SizeFlagsHorizontal = SizeFlags.ShrinkCenter
HorizontalAlignment = HAlignment.Center
};
AddChild(wrapper);
for (var i = 0; i < _sections.Length; i++)
{
var panel = new PanelContainer {CustomMinimumSize = (20, 20)};
var panel = new PanelContainer {MinSize = (20, 20)};
wrapper.AddChild(panel);
_sections[i] = panel;
}

View File

@@ -139,8 +139,6 @@ namespace Content.Client.GameObjects.Components.Kitchen
}
protected override Vector2? CustomSize => (512, 256);
private MicrowaveBoundUserInterface Owner { get; set; }
public event Action<BaseButton.ButtonEventArgs, int> OnCookTimeSelected;
@@ -165,54 +163,49 @@ namespace Content.Client.GameObjects.Components.Kitchen
public MicrowaveMenu(MicrowaveBoundUserInterface owner = null)
{
SetSize = MinSize = (512, 256);
Owner = owner;
Title = Loc.GetString("Microwave");
DisableCookingPanelOverlay = new PanelContainer
{
MouseFilter = MouseFilterMode.Stop,
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.Black.WithAlpha(0.60f)},
SizeFlagsHorizontal = SizeFlags.Fill,
SizeFlagsVertical = SizeFlags.Fill,
};
var hSplit = new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.Fill,
SizeFlagsVertical = SizeFlags.Fill
};
var hSplit = new HBoxContainer();
IngredientsListReagents = new ItemList
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand,
VerticalExpand = true,
HorizontalExpand = true,
SelectMode = ItemList.ItemListSelectMode.Button,
SizeFlagsStretchRatio = 2,
CustomMinimumSize = (100, 128)
MinSize = (100, 128)
};
IngredientsList = new ItemList
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand,
VerticalExpand = true,
HorizontalExpand = true,
SelectMode = ItemList.ItemListSelectMode.Button,
SizeFlagsStretchRatio = 2,
CustomMinimumSize = (100, 128)
MinSize = (100, 128)
};
hSplit.AddChild(IngredientsListReagents);
//Padding between the lists.
hSplit.AddChild(new Control
{
CustomMinimumSize = (0, 5),
MinSize = (0, 5),
});
hSplit.AddChild(IngredientsList);
var vSplit = new VBoxContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand,
VerticalExpand = true,
HorizontalExpand = true,
};
hSplit.AddChild(vSplit);
@@ -243,14 +236,13 @@ namespace Content.Client.GameObjects.Components.Kitchen
//Padding
vSplit.AddChild(new Control
{
CustomMinimumSize = (0, 15),
SizeFlagsVertical = SizeFlags.Fill,
MinSize = (0, 15),
});
CookTimeButtonGroup = new ButtonGroup();
CookTimeButtonVbox = new VBoxContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
Align = BoxContainer.AlignMode.Center,
};
@@ -284,14 +276,14 @@ namespace Content.Client.GameObjects.Components.Kitchen
Text = Loc.GetString("COOK TIME: 1"),
Align = Label.AlignMode.Center,
Modulate = Color.White,
SizeFlagsVertical = SizeFlags.ShrinkCenter
VerticalAlignment = VAlignment.Center
};
var innerTimerPanel = new PanelContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
ModulateSelfOverride = Color.Red,
CustomMinimumSize = (100, 128),
MinSize = (100, 128),
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.Black.WithAlpha(0.5f)},
Children =
@@ -312,7 +304,7 @@ namespace Content.Client.GameObjects.Components.Kitchen
new ScrollContainer()
{
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
Children =
{
@@ -326,8 +318,8 @@ namespace Content.Client.GameObjects.Components.Kitchen
TimerFacePlate = new PanelContainer()
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand,
VerticalExpand = true,
HorizontalExpand = true,
Children =
{
innerTimerPanel

View File

@@ -156,7 +156,6 @@ namespace Content.Client.GameObjects.Components.Kitchen
*/
private ReagentGrinderBoundUserInterface Owner { get; set; }
protected override Vector2? CustomSize => (512, 256);
//We'll need 4 buttons, grind, juice, eject beaker, eject the chamber contents.
//The other 2 are referenced in the Open function.
@@ -202,11 +201,11 @@ namespace Content.Client.GameObjects.Components.Kitchen
AddChild(vSplit);
BoxContents = new ItemList
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand,
VerticalExpand = true,
HorizontalExpand = true,
SelectMode = ItemList.ItemListSelectMode.Button,
SizeFlagsStretchRatio = 2,
CustomMinimumSize = (100, 128)
MinSize = (100, 128)
};
AddChild(BoxContents);
}
@@ -214,47 +213,44 @@ namespace Content.Client.GameObjects.Components.Kitchen
public GrinderMenu(ReagentGrinderBoundUserInterface owner = null)
{
SetSize = MinSize = (512, 256);
Owner = owner;
Title = Loc.GetString("All-In-One Grinder 3000");
var hSplit = new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.Fill,
SizeFlagsVertical = SizeFlags.Fill
};
var hSplit = new HBoxContainer();
var vBoxGrindJuiceButtonPanel = new VBoxContainer
{
SizeFlagsVertical = SizeFlags.ShrinkCenter
VerticalAlignment = VAlignment.Center
};
GrindButton = new Button
{
Text = Loc.GetString("Grind"),
TextAlign = Label.AlignMode.Center,
CustomMinimumSize = (64, 64)
MinSize = (64, 64)
};
JuiceButton = new Button
{
Text = Loc.GetString("Juice"),
TextAlign = Label.AlignMode.Center,
CustomMinimumSize = (64, 64)
MinSize = (64, 64)
};
vBoxGrindJuiceButtonPanel.AddChild(GrindButton);
//inner button padding
vBoxGrindJuiceButtonPanel.AddChild(new Control
{
CustomMinimumSize = (0, 16),
MinSize = (0, 16),
});
vBoxGrindJuiceButtonPanel.AddChild(JuiceButton);
ChamberContentBox = new LabelledContentBox(Loc.GetString("Chamber"), Loc.GetString("Eject Contents"))
{
//Modulate = Color.Red,
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand,
VerticalExpand = true,
HorizontalExpand = true,
SizeFlagsStretchRatio = 2,
};
@@ -262,8 +258,8 @@ namespace Content.Client.GameObjects.Components.Kitchen
BeakerContentBox = new LabelledContentBox(Loc.GetString("Beaker"), Loc.GetString("Eject Beaker"))
{
//Modulate = Color.Blue,
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand,
VerticalExpand = true,
HorizontalExpand = true,
SizeFlagsStretchRatio = 2,
};
@@ -272,14 +268,14 @@ namespace Content.Client.GameObjects.Components.Kitchen
//Padding between the g/j buttons panel and the itemlist boxes panel.
hSplit.AddChild(new Control
{
CustomMinimumSize = (16, 0),
MinSize = (16, 0),
});
hSplit.AddChild(ChamberContentBox);
//Padding between the two itemlists.
hSplit.AddChild(new Control
{
CustomMinimumSize = (8, 0),
MinSize = (8, 0),
});
hSplit.AddChild(BeakerContentBox);
Contents.AddChild(hSplit);

View File

@@ -136,8 +136,8 @@ namespace Content.Client.GameObjects.Components
Items = new ItemList
{
SizeFlagsVertical = SizeFlags.FillExpand,
CustomMinimumSize = (300, 250)
VerticalExpand = true,
MinSize = (300, 250)
};
vBox.AddChild(Items);
Items.OnItemSelected += ItemSelected;
@@ -202,13 +202,13 @@ namespace Content.Client.GameObjects.Components
_slider = new Slider
{
StyleClasses = {styleClass},
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
HorizontalExpand = true,
VerticalAlignment = VAlignment.Center,
MaxValue = byte.MaxValue
};
_textBox = new LineEdit
{
CustomMinimumSize = (50, 0)
MinSize = (50, 0)
};
AddChild(new HBoxContainer
@@ -261,18 +261,17 @@ namespace Content.Client.GameObjects.Components
private readonly HairStylePicker _hairStylePicker;
private readonly FacialHairStylePicker _facialHairStylePicker;
protected override Vector2? CustomSize => (500, 360);
public MagicMirrorWindow(MagicMirrorBoundUserInterface owner)
{
SetSize = MinSize = (500, 360);
Title = Loc.GetString("Magic Mirror");
_hairStylePicker = new HairStylePicker {SizeFlagsHorizontal = SizeFlags.FillExpand};
_hairStylePicker = new HairStylePicker {HorizontalExpand = true};
_hairStylePicker.Populate();
_hairStylePicker.OnHairStylePicked += newStyle => owner.HairSelected(newStyle, false);
_hairStylePicker.OnHairColorPicked += newColor => owner.HairColorSelected(newColor, false);
_facialHairStylePicker = new FacialHairStylePicker {SizeFlagsHorizontal = SizeFlags.FillExpand};
_facialHairStylePicker = new FacialHairStylePicker {HorizontalExpand = true};
_facialHairStylePicker.Populate();
_facialHairStylePicker.OnHairStylePicked += newStyle => owner.HairSelected(newStyle, true);
_facialHairStylePicker.OnHairColorPicked += newColor => owner.HairColorSelected(newColor, true);

View File

@@ -14,10 +14,10 @@ namespace Content.Client.GameObjects.Components.MedicalScanner
{
public readonly Button ScanButton;
private readonly Label _diagnostics;
protected override Vector2? CustomSize => (485, 90);
public MedicalScannerWindow()
{
MinSize = SetSize = (485, 90);
Contents.AddChild(new VBoxContainer
{
Children =

View File

@@ -40,7 +40,7 @@ namespace Content.Client.GameObjects.Components.Observer
(new Control()
{
CustomMinimumSize = (20, 0)
MinSize = (20, 0)
}),
(DenyButton = new Button

View File

@@ -3,7 +3,7 @@
<RichTextLabel Name="Title" />
<HBoxContainer SeparationOverride="10">
<RichTextLabel Name="Description" SizeFlagsHorizontal="FillExpand" />
<RichTextLabel Name="Description" HorizontalExpand="True" />
<Button Name="RequestButton" Text="Request" TextAlign="Center" SizeFlagsHorizontal="ShrinkEnd" />
</HBoxContainer>
</VBoxContainer>

View File

@@ -1,10 +1,10 @@
<SS14Window Title="Ghost Roles"
xmlns="https://spacestation14.io">
<CenterContainer Name="NoRolesMessage" SizeFlagsVertical="FillExpand" SizeFlagsHorizontal="FillExpand">
xmlns="https://spacestation14.io" MinSize="350 275">
<CenterContainer Name="NoRolesMessage" VerticalExpand="True" HorizontalExpand="True">
<Label Text="There are currently no available ghost roles." />
</CenterContainer>
<ScrollContainer SizeFlagsHorizontal="FillExpand" SizeFlagsVertical="FillExpand">
<VBoxContainer Name="EntryContainer" SizeFlagsHorizontal="FillExpand" SizeFlagsVertical="FillExpand" />
<ScrollContainer HorizontalExpand="True" VerticalExpand="True">
<VBoxContainer Name="EntryContainer" HorizontalExpand="True" VerticalExpand="True" />
</ScrollContainer>
</SS14Window>

View File

@@ -12,8 +12,6 @@ namespace Content.Client.GameObjects.Components.Observer.GhostRoles
{
public event Action<uint> RoleRequested;
protected override Vector2 CalculateMinimumSize() => (350, 275);
public void ClearEntries()
{
EntryContainer.DisposeAllChildren();

View File

@@ -8,11 +8,11 @@
</HBoxContainer>
<HBoxContainer>
<Label Name="RoleNameLabel" Text="Role Name" />
<LineEdit Name="RoleName" SizeFlagsHorizontal="FillExpand" />
<LineEdit Name="RoleName" HorizontalExpand="True" />
</HBoxContainer>
<HBoxContainer>
<Label Name="RoleDescriptionLabel" Text="Role Description" />
<LineEdit Name="RoleDescription" SizeFlagsHorizontal="FillExpand" />
<LineEdit Name="RoleDescription" HorizontalExpand="True" />
</HBoxContainer>
<HBoxContainer>
<Label Name="MakeSentientLabel" Text="Make Sentient" />

View File

@@ -16,12 +16,12 @@ namespace Content.Client.GameObjects.Components.Observer.GhostRoles
{
RobustXamlLoader.Load(this);
MakeSentientLabel.CustomMinimumSize = (150, 0);
RoleEntityLabel.CustomMinimumSize = (150, 0);
RoleNameLabel.CustomMinimumSize = (150, 0);
RoleName.CustomMinimumSize = (300, 0);
RoleDescriptionLabel.CustomMinimumSize = (150, 0);
RoleDescription.CustomMinimumSize = (300, 0);
MakeSentientLabel.MinSize = (150, 0);
RoleEntityLabel.MinSize = (150, 0);
RoleNameLabel.MinSize = (150, 0);
RoleName.MinSize = (300, 0);
RoleDescriptionLabel.MinSize = (150, 0);
RoleDescription.MinSize = (300, 0);
MakeButton.OnPressed += OnPressed;
}

View File

@@ -221,8 +221,6 @@ namespace Content.Client.GameObjects.Components.PDA
private class PDAMenu : SS14Window
{
protected override Vector2? CustomSize => (512, 256);
private PDABoundUserInterface _owner { get; }
public Button FlashLightToggleButton { get; }
@@ -275,6 +273,8 @@ namespace Content.Client.GameObjects.Components.PDA
public PDAMenu(PDABoundUserInterface owner, IPrototypeManager prototypeManager)
{
MinSize = SetSize = (512, 256);
_owner = owner;
_prototypeManager = prototypeManager;
Title = Loc.GetString("PDA");
@@ -287,20 +287,20 @@ namespace Content.Client.GameObjects.Components.PDA
IDInfoLabel = new RichTextLabel()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
};
EjectIDButton = new Button
{
Text = Loc.GetString("Eject ID"),
SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
SizeFlagsVertical = SizeFlags.ShrinkCenter
HorizontalAlignment = HAlignment.Center,
VerticalAlignment = VAlignment.Center
};
EjectPenButton = new Button
{
Text = Loc.GetString("Eject Pen"),
SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
SizeFlagsVertical = SizeFlags.ShrinkCenter
HorizontalAlignment = HAlignment.Center,
VerticalAlignment = VAlignment.Center
};
var innerHBoxContainer = new HBoxContainer
@@ -315,7 +315,6 @@ namespace Content.Client.GameObjects.Components.PDA
IDInfoContainer = new PanelContainer
{
SizeFlagsHorizontal = SizeFlags.Fill,
Children =
{
innerHBoxContainer,
@@ -330,9 +329,9 @@ namespace Content.Client.GameObjects.Components.PDA
var mainMenuTabContainer = new VBoxContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand,
CustomMinimumSize = (50, 50),
VerticalExpand = true,
HorizontalExpand = true,
MinSize = (50, 50),
Children =
{
@@ -352,36 +351,36 @@ namespace Content.Client.GameObjects.Components.PDA
BalanceInfo = new RichTextLabel
{
SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
HorizontalAlignment = HAlignment.Center,
};
//Red background container.
var masterPanelContainer = new PanelContainer
{
PanelOverride = new StyleBoxFlat { BackgroundColor = Color.Black },
SizeFlagsVertical = SizeFlags.FillExpand
VerticalExpand = true
};
//This contains both the panel of the category buttons and the listings box.
CategoryAndListingsContainer = new HSplitContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
};
var uplinkShopScrollContainer = new ScrollContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
HorizontalExpand = true,
VerticalExpand = true,
SizeFlagsStretchRatio = 2,
CustomMinimumSize = (100, 256)
MinSize = (100, 256)
};
//Add the category list to the left side. The store items to center.
var categoryListContainerBackground = new PanelContainer
{
PanelOverride = new StyleBoxFlat { BackgroundColor = Color.Gray.WithAlpha(0.02f) },
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
Children =
{
CategoryListContainer
@@ -395,16 +394,16 @@ namespace Content.Client.GameObjects.Components.PDA
//Actual list of buttons for buying a listing from the uplink.
UplinkListingsContainer = new VBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
HorizontalExpand = true,
VerticalExpand = true,
SizeFlagsStretchRatio = 2,
CustomMinimumSize = (100, 256),
MinSize = (100, 256),
};
uplinkShopScrollContainer.AddChild(UplinkListingsContainer);
var innerVboxContainer = new VBoxContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
Children =
{
@@ -472,7 +471,7 @@ namespace Content.Client.GameObjects.Components.PDA
{
Text = listing.ListingName == string.Empty ? prototype.Name : listing.ListingName,
ToolTip = listing.Description == string.Empty ? prototype.Description : listing.Description,
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
Modulate = _loggedInUplinkAccount.DataBalance >= listing.Price
? Color.White
: Color.Gray.WithAlpha(0.30f)
@@ -481,7 +480,7 @@ namespace Content.Client.GameObjects.Components.PDA
var priceLabel = new Label
{
Text = $"{listing.Price} TC",
SizeFlagsHorizontal = SizeFlags.ShrinkEnd,
HorizontalAlignment = HAlignment.Right,
Modulate = _loggedInUplinkAccount.DataBalance >= listing.Price
? weightedColor
: Color.Gray.WithAlpha(0.30f)
@@ -490,8 +489,7 @@ namespace Content.Client.GameObjects.Components.PDA
//Padding for the price lable.
var pricePadding = new HBoxContainer
{
CustomMinimumSize = (32, 1),
SizeFlagsHorizontal = SizeFlags.Fill,
MinSize = (32, 1),
};
//Contains the name of the item and its price. Used for spacing item name and price.
@@ -516,7 +514,6 @@ namespace Content.Client.GameObjects.Components.PDA
var pdaUplinkListingButton = new PDAUplinkItemButton
{
ButtonListing = listing,
SizeFlagsVertical = SizeFlags.Fill,
Children =
{
listingButtonPanelContainer

View File

@@ -10,10 +10,10 @@ namespace Content.Client.GameObjects.Components.Paper
{
private readonly RichTextLabel _label;
public readonly LineEdit Input;
protected override Vector2? CustomSize => (300, 300);
public PaperWindow()
{
MinSize = SetSize = (300, 300);
var container = new VBoxContainer();
_label = new RichTextLabel();
Input = new LineEdit {Visible = false};

View File

@@ -151,7 +151,7 @@ namespace Content.Client.GameObjects.Components.Power
var chargeLabel = new Label {Text = "Charge:"};
ChargeBar = new ProgressBar
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
MinValue = 0.0f,
MaxValue = 1.0f,
Page = 0.0f,

View File

@@ -139,18 +139,14 @@ namespace Content.Client.GameObjects.Components.Power
rows.AddChild(new Label {Text = "Press Enter to confirm."});
rows.AddChild(new Label {Text = ""});
PanelRotation.SizeFlagsHorizontal = SizeFlags.FillExpand;
PanelVelocity.SizeFlagsHorizontal = SizeFlags.FillExpand;
rows.SizeFlagsHorizontal = SizeFlags.Fill;
rows.SizeFlagsVertical = SizeFlags.Fill;
PanelRotation.HorizontalExpand = true;
PanelVelocity.HorizontalExpand = true;
NotARadar = new SolarControlNotARadar(igt);
var outerColumns = new HBoxContainer();
outerColumns.AddChild(rows);
outerColumns.AddChild(NotARadar);
outerColumns.SizeFlagsHorizontal = SizeFlags.Fill;
outerColumns.SizeFlagsVertical = SizeFlags.Fill;
Contents.AddChild(outerColumns);
Resizable = false;
}
@@ -173,6 +169,7 @@ namespace Content.Client.GameObjects.Components.Power
public SolarControlNotARadar(IGameTiming igt)
{
_gameTiming = igt;
MinSize = (SizeFull, SizeFull);
}
public void UpdateState(SolarControlConsoleBoundInterfaceState ls)
@@ -181,11 +178,6 @@ namespace Content.Client.GameObjects.Components.Power
_lastStateTime = _gameTiming.CurTime;
}
protected override Vector2 CalculateMinimumSize()
{
return (SizeFull, SizeFull);
}
protected override void Draw(DrawingHandleScreen handle)
{
int point = SizeFull / 2;

View File

@@ -14,11 +14,11 @@ namespace Content.Client.GameObjects.Components.Research
private int[] _serverIds = new int[]{};
private int _selectedServerId = -1;
protected override Vector2? CustomSize => (300, 300);
public ResearchClientBoundUserInterface Owner { get; set; }
public ResearchClientServerSelectionMenu()
{
MinSize = SetSize = (300, 300);
IoCManager.InjectDependencies(this);
Title = Loc.GetString("Research Server Selection");
@@ -28,19 +28,7 @@ namespace Content.Client.GameObjects.Components.Research
_servers.OnItemSelected += OnItemSelected;
_servers.OnItemDeselected += OnItemDeselected;
var margin = new MarginContainer()
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand,
/*MarginTop = 5f,
MarginLeft = 5f,
MarginRight = -5f,
MarginBottom = -5f,*/
};
margin.AddChild(_servers);
Contents.AddChild(margin);
Contents.AddChild(_servers);
}
public void OnItemSelected(ItemList.ItemListSelectedEventArgs itemListSelectedEventArgs)

View File

@@ -186,25 +186,20 @@ namespace Content.Client.GameObjects.Components.Storage
private readonly StyleBoxFlat _hoveredBox = new() { BackgroundColor = Color.Black.WithAlpha(0.35f) };
private readonly StyleBoxFlat _unHoveredBox = new() { BackgroundColor = Color.Black.WithAlpha(0.0f) };
protected override Vector2? CustomSize => (180, 320);
public StorageWindow()
{
MinSize = SetSize = (180, 320);
Title = "Storage Item";
RectClipContent = true;
var containerButton = new ContainerButton
{
SizeFlagsHorizontal = SizeFlags.Fill,
SizeFlagsVertical = SizeFlags.Fill,
MouseFilter = MouseFilterMode.Pass,
};
var innerContainerButton = new PanelContainer
{
PanelOverride = _unHoveredBox,
SizeFlagsHorizontal = SizeFlags.Fill,
SizeFlagsVertical = SizeFlags.Fill,
};
@@ -227,20 +222,20 @@ namespace Content.Client.GameObjects.Components.Storage
_information = new Label
{
Text = "Items: 0 Volume: 0/0 Stuff",
SizeFlagsVertical = SizeFlags.ShrinkCenter
VerticalAlignment = VAlignment.Center
};
VSplitContainer.AddChild(_information);
var listScrollContainer = new ScrollContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand,
VerticalExpand = true,
HorizontalExpand = true,
HScrollEnabled = true,
VScrollEnabled = true,
};
_entityList = new VBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand
HorizontalExpand = true
};
listScrollContainer.AddChild(_entityList);
VSplitContainer.AddChild(listScrollContainer);
@@ -342,8 +337,8 @@ namespace Content.Client.GameObjects.Components.Storage
{
ActualButton = new Button
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
HorizontalExpand = true,
VerticalExpand = true,
ToggleMode = true,
MouseFilter = MouseFilterMode.Stop
};
@@ -352,11 +347,11 @@ namespace Content.Client.GameObjects.Components.Storage
var hBoxContainer = new HBoxContainer();
EntitySpriteView = new SpriteView
{
CustomMinimumSize = new Vector2(32.0f, 32.0f)
MinSize = new Vector2(32.0f, 32.0f)
};
EntityName = new Label
{
SizeFlagsVertical = SizeFlags.ShrinkCenter,
VerticalAlignment = VAlignment.Center,
Text = "Backpack",
};
hBoxContainer.AddChild(EntitySpriteView);
@@ -364,11 +359,11 @@ namespace Content.Client.GameObjects.Components.Storage
EntityControl = new Control
{
SizeFlagsHorizontal = SizeFlags.FillExpand
HorizontalExpand = true
};
EntitySize = new Label
{
SizeFlagsVertical = SizeFlags.ShrinkCenter,
VerticalAlignment = VAlignment.Center,
Text = "Size 6",
Align = Label.AlignMode.Right,
/*AnchorLeft = 1.0f,

View File

@@ -63,23 +63,24 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
public StatusControl(ClientBatteryBarrelComponent parent)
{
MinHeight = 15;
_parent = parent;
SizeFlagsHorizontal = SizeFlags.FillExpand;
SizeFlagsVertical = SizeFlags.ShrinkCenter;
HorizontalExpand = true;
VerticalAlignment = VAlignment.Center;
AddChild(new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
Children =
{
new Control
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
Children =
{
(_bulletsList = new HBoxContainer
{
SizeFlagsVertical = SizeFlags.ShrinkCenter,
VerticalAlignment = VAlignment.Center,
SeparationOverride = 4
}),
(_noBatteryLabel = new Label
@@ -89,11 +90,11 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
})
}
},
new Control() { CustomMinimumSize = (5,0) },
new Control() { MinSize = (5,0) },
(_ammoCount = new Label
{
StyleClasses = {StyleNano.StyleClassItemStatus},
SizeFlagsHorizontal = SizeFlags.ShrinkEnd,
HorizontalAlignment = HAlignment.Right,
}),
}
});
@@ -134,7 +135,7 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
{
BackgroundColor = colorGone,
},
CustomMinimumSize = (10, 15),
MinSize = (10, 15),
});
}
@@ -148,15 +149,10 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
{
BackgroundColor = color,
},
CustomMinimumSize = (10, 15),
MinSize = (10, 15),
});
}
}
protected override Vector2 CalculateMinimumSize()
{
return Vector2.ComponentMax((0, 15), base.CalculateMinimumSize());
}
}
}
}

View File

@@ -73,30 +73,31 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
public StatusControl(ClientBoltActionBarrelComponent parent)
{
MinHeight = 15;
_parent = parent;
SizeFlagsHorizontal = SizeFlags.FillExpand;
SizeFlagsVertical = SizeFlags.ShrinkCenter;
HorizontalExpand = true;
VerticalAlignment = VAlignment.Center;
AddChild(new VBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
HorizontalExpand = true,
VerticalAlignment = VAlignment.Center,
SeparationOverride = 0,
Children =
{
(_bulletsListTop = new HBoxContainer {SeparationOverride = 0}),
new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
Children =
{
new Control
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
Children =
{
(_bulletsListBottom = new HBoxContainer
{
SizeFlagsVertical = SizeFlags.ShrinkCenter,
VerticalAlignment = VAlignment.Center,
SeparationOverride = 0
}),
(_noMagazineLabel = new Label
@@ -109,8 +110,8 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
(_chamberedBullet = new TextureRect
{
Texture = StaticIoC.ResC.GetTexture("/Textures/Interface/ItemStatus/Bullets/chambered.png"),
SizeFlagsVertical = SizeFlags.ShrinkCenter,
SizeFlagsHorizontal = SizeFlags.ShrinkEnd | SizeFlags.Fill,
VerticalAlignment = VAlignment.Center,
HorizontalAlignment = HAlignment.Right,
})
}
}
@@ -198,11 +199,6 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
altColor ^= true;
}
}
protected override Vector2 CalculateMinimumSize()
{
return Vector2.ComponentMax((0, 15), base.CalculateMinimumSize());
}
}
}
}

View File

@@ -146,30 +146,31 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
public StatusControl(ClientMagazineBarrelComponent parent)
{
MinHeight = 15;
_parent = parent;
SizeFlagsHorizontal = SizeFlags.FillExpand;
SizeFlagsVertical = SizeFlags.ShrinkCenter;
HorizontalExpand = true;
VerticalAlignment = VAlignment.Center;
AddChild(new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
Children =
{
(_chamberedBullet = new TextureRect
{
Texture = StaticIoC.ResC.GetTexture("/Textures/Interface/ItemStatus/Bullets/chambered_rotated.png"),
SizeFlagsVertical = SizeFlags.ShrinkCenter,
SizeFlagsHorizontal = SizeFlags.ShrinkEnd | SizeFlags.Fill,
VerticalAlignment = VAlignment.Center,
HorizontalAlignment = HAlignment.Right,
}),
new Control() { CustomMinimumSize = (5,0) },
new Control() { MinSize = (5,0) },
new Control
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
Children =
{
(_bulletsList = new HBoxContainer
{
SizeFlagsVertical = SizeFlags.ShrinkCenter,
VerticalAlignment = VAlignment.Center,
SeparationOverride = 0
}),
(_noMagazineLabel = new Label
@@ -179,11 +180,11 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
})
}
},
new Control() { CustomMinimumSize = (5,0) },
new Control() { MinSize = (5,0) },
(_ammoCount = new Label
{
StyleClasses = {StyleNano.StyleClassItemStatus},
SizeFlagsHorizontal = SizeFlags.ShrinkEnd,
HorizontalAlignment = HAlignment.Right,
}),
}
});
@@ -232,8 +233,6 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
{
Texture = texture,
ModulateSelfOverride = altColor ? colorGoneA : colorGoneB,
SizeFlagsHorizontal = SizeFlags.Fill,
SizeFlagsVertical = SizeFlags.Fill,
Stretch = TextureRect.StretchMode.KeepCentered
});
@@ -248,8 +247,6 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
{
Texture = texture,
ModulateSelfOverride = altColor ? colorA : colorB,
SizeFlagsHorizontal = SizeFlags.Fill,
SizeFlagsVertical = SizeFlags.Fill,
Stretch = TextureRect.StretchMode.KeepCentered
});
@@ -257,11 +254,6 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
}
}
protected override Vector2 CalculateMinimumSize()
{
return Vector2.ComponentMax((0, 15), base.CalculateMinimumSize());
}
public void PlayAlarmAnimation()
{
var animation = _parent._isLmgAlarmAnimation ? AlarmAnimationLmg : AlarmAnimationSmg;

View File

@@ -73,30 +73,31 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
public StatusControl(ClientPumpBarrelComponent parent)
{
MinHeight = 15;
_parent = parent;
SizeFlagsHorizontal = SizeFlags.FillExpand;
SizeFlagsVertical = SizeFlags.ShrinkCenter;
HorizontalExpand = true;
VerticalAlignment = VAlignment.Center;
AddChild(new VBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
HorizontalExpand = true,
VerticalAlignment = VAlignment.Center,
SeparationOverride = 0,
Children =
{
(_bulletsListTop = new HBoxContainer {SeparationOverride = 0}),
new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
Children =
{
new Control
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
Children =
{
(_bulletsListBottom = new HBoxContainer
{
SizeFlagsVertical = SizeFlags.ShrinkCenter,
VerticalAlignment = VAlignment.Center,
SeparationOverride = 0
}),
(_noMagazineLabel = new Label
@@ -109,8 +110,8 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
(_chamberedBullet = new TextureRect
{
Texture = StaticIoC.ResC.GetTexture("/Textures/Interface/ItemStatus/Bullets/chambered.png"),
SizeFlagsVertical = SizeFlags.ShrinkCenter,
SizeFlagsHorizontal = SizeFlags.ShrinkEnd | SizeFlags.Fill,
VerticalAlignment = VAlignment.Center,
HorizontalAlignment = HAlignment.Right,
})
}
}
@@ -198,11 +199,6 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
altColor ^= true;
}
}
protected override Vector2 CalculateMinimumSize()
{
return Vector2.ComponentMax((0, 15), base.CalculateMinimumSize());
}
}
}
}

View File

@@ -64,13 +64,14 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
public StatusControl(ClientRevolverBarrelComponent parent)
{
MinHeight = 15;
_parent = parent;
SizeFlagsHorizontal = SizeFlags.FillExpand;
SizeFlagsVertical = SizeFlags.ShrinkCenter;
HorizontalExpand = true;
VerticalAlignment = VAlignment.Center;
AddChild((_bulletsList = new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
HorizontalExpand = true,
VerticalAlignment = VAlignment.Center,
SeparationOverride = 0
}));
}
@@ -119,7 +120,7 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
// Add a outline
var box = new Control()
{
CustomMinimumSize = texture.Size * scale,
MinSize = texture.Size * scale,
};
if (i == _parent.CurrentSlot)
{
@@ -152,8 +153,6 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
box.AddChild(new TextureRect
{
SizeFlagsHorizontal = SizeFlags.Fill,
SizeFlagsVertical = SizeFlags.Fill,
Stretch = TextureRect.StretchMode.KeepCentered,
Texture = bulletTexture,
ModulateSelfOverride = color,
@@ -162,11 +161,6 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
container.AddChild(box);
}
}
protected override Vector2 CalculateMinimumSize()
{
return Vector2.ComponentMax((0, 15), base.CalculateMinimumSize());
}
}
}
}

View File

@@ -72,30 +72,30 @@ namespace Content.Client.GameObjects.Components.Wires
{
new PanelContainer
{
CustomMinimumSize = (2, 0),
MinSize = (2, 0),
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#525252ff")}
},
new PanelContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
MouseFilter = MouseFilterMode.Stop,
Name = "Shadow",
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.Black.WithAlpha(0.5f)}
},
new PanelContainer
{
CustomMinimumSize = (2, 0),
MinSize = (2, 0),
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#525252ff")}
},
}
};
var wrappingHBox = new HBoxContainer();
_wiresHBox = new HBoxContainer {SeparationOverride = 4, SizeFlagsVertical = SizeFlags.ShrinkEnd};
_wiresHBox = new HBoxContainer {SeparationOverride = 4, VerticalAlignment = VAlignment.Bottom};
wrappingHBox.AddChild(new Control {CustomMinimumSize = (20, 0)});
wrappingHBox.AddChild(new Control {MinSize = (20, 0)});
wrappingHBox.AddChild(_wiresHBox);
wrappingHBox.AddChild(new Control {CustomMinimumSize = (20, 0)});
wrappingHBox.AddChild(new Control {MinSize = (20, 0)});
bottomWrap.AddChild(bottomPanel);
@@ -128,7 +128,7 @@ namespace Content.Client.GameObjects.Components.Wires
Children =
{
(_topContainer = new VBoxContainer()),
new Control {CustomMinimumSize = (0, 110)}
new Control {MinSize = (0, 110)}
}
};
@@ -140,53 +140,38 @@ namespace Content.Client.GameObjects.Components.Wires
var fontSmall = _resourceCache.GetFont("/Fonts/Boxfont-round/Boxfont Round.ttf", 10);
Button helpButton;
var topRow = new MarginContainer
var topRow = new HBoxContainer
{
MarginLeftOverride = 4,
MarginTopOverride = 2,
MarginRightOverride = 12,
MarginBottomOverride = 2,
Margin = new Thickness(4, 2, 12, 2),
Children =
{
new HBoxContainer
(_nameLabel = new Label
{
Children =
{
(_nameLabel = new Label
{
Text = Loc.GetString("Wires"),
FontOverride = font,
FontColorOverride = StyleNano.NanoGold,
SizeFlagsVertical = SizeFlags.ShrinkCenter
}),
new Control
{
CustomMinimumSize = (8, 0),
},
(_serialLabel = new Label
{
Text = Loc.GetString("DEAD-BEEF"),
FontOverride = fontSmall,
FontColorOverride = Color.Gray,
SizeFlagsVertical = SizeFlags.ShrinkCenter
}),
new Control
{
CustomMinimumSize = (20, 0),
SizeFlagsHorizontal = SizeFlags.Expand
},
(helpButton = new Button {Text = "?"}),
new Control
{
CustomMinimumSize = (2, 0),
},
(CloseButton = new TextureButton
{
StyleClasses = {SS14Window.StyleClassWindowCloseButton},
SizeFlagsVertical = SizeFlags.ShrinkCenter
})
}
}
Text = Loc.GetString("Wires"),
FontOverride = font,
FontColorOverride = StyleNano.NanoGold,
VerticalAlignment = VAlignment.Center,
}),
(_serialLabel = new Label
{
Text = Loc.GetString("DEAD-BEEF"),
FontOverride = fontSmall,
FontColorOverride = Color.Gray,
VerticalAlignment = VAlignment.Center,
Margin = new Thickness(8, 0, 20, 0),
HorizontalAlignment = HAlignment.Left,
HorizontalExpand = true,
}),
(helpButton = new Button
{
Text = "?",
Margin = new Thickness(0, 0, 2, 0),
}),
(CloseButton = new TextureButton
{
StyleClasses = {SS14Window.StyleClassWindowCloseButton},
VerticalAlignment = VAlignment.Center
})
}
};
@@ -207,21 +192,12 @@ namespace Content.Client.GameObjects.Components.Wires
{
Children =
{
new MarginContainer
(_statusContainer = new GridContainer
{
MarginLeftOverride = 8,
MarginRightOverride = 8,
MarginTopOverride = 4,
MarginBottomOverride = 4,
Children =
{
(_statusContainer = new GridContainer
{
// TODO: automatically change columns count.
Columns = 3
})
}
}
Margin = new Thickness(8, 4),
// TODO: automatically change columns count.
Columns = 3
})
}
}
}
@@ -230,17 +206,17 @@ namespace Content.Client.GameObjects.Components.Wires
_topContainer.AddChild(topRow);
_topContainer.AddChild(new PanelContainer
{
CustomMinimumSize = (0, 2),
MinSize = (0, 2),
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#525252ff")}
});
_topContainer.AddChild(middle);
_topContainer.AddChild(new PanelContainer
{
CustomMinimumSize = (0, 2),
MinSize = (0, 2),
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#525252ff")}
});
CloseButton.OnPressed += _ => Close();
LayoutContainer.SetSize(this, (300, 200));
SetSize = (320, 200);
}
@@ -258,7 +234,7 @@ namespace Content.Client.GameObjects.Components.Wires
var type = random.Next(2);
var control = new WireControl(wire.Color, wire.Letter, wire.IsCut, flip, mirror, type, _resourceCache)
{
SizeFlagsVertical = SizeFlags.ShrinkEnd
VerticalAlignment = VAlignment.Bottom
};
_wiresHBox.AddChild(control);
@@ -313,11 +289,12 @@ namespace Content.Client.GameObjects.Components.Wires
public event Action WireClicked;
public event Action ContactsClicked;
public WireControl(WireColor color, WireLetter letter, bool isCut, bool flip, bool mirror, int type, IResourceCache resourceCache)
public WireControl(WireColor color, WireLetter letter, bool isCut, bool flip, bool mirror, int type,
IResourceCache resourceCache)
{
_resourceCache = resourceCache;
SizeFlagsHorizontal = SizeFlags.ShrinkCenter;
HorizontalAlignment = HAlignment.Center;
MouseFilter = MouseFilterMode.Stop;
var layout = new LayoutContainer();
@@ -326,8 +303,8 @@ namespace Content.Client.GameObjects.Components.Wires
var greek = new Label
{
Text = letter.Letter().ToString(),
SizeFlagsVertical = SizeFlags.ShrinkEnd,
SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
VerticalAlignment = VAlignment.Bottom,
HorizontalAlignment = HAlignment.Center,
Align = Label.AlignMode.Center,
FontOverride = _resourceCache.GetFont("/Fonts/NotoSansDisplay/NotoSansDisplay-Bold.ttf", 12),
FontColorOverride = Color.Gray,
@@ -365,14 +342,9 @@ namespace Content.Client.GameObjects.Components.Wires
LayoutContainer.SetPosition(wire, (2, 16));
ToolTip = color.Name();
MinSize = (20, 102);
}
protected override Vector2 CalculateMinimumSize()
{
return (20, 102);
}
protected override void KeyBindDown(GUIBoundKeyEventArgs args)
{
base.KeyBindDown(args);
@@ -425,7 +397,8 @@ namespace Content.Client.GameObjects.Components.Wires
private readonly IResourceCache _resourceCache;
public WireRender(WireColor color, bool isCut, bool flip, bool mirror, int type, IResourceCache resourceCache)
public WireRender(WireColor color, bool isCut, bool flip, bool mirror, int type,
IResourceCache resourceCache)
{
_resourceCache = resourceCache;
_color = color;
@@ -433,11 +406,8 @@ namespace Content.Client.GameObjects.Components.Wires
_flip = flip;
_mirror = mirror;
_type = type;
}
protected override Vector2 CalculateMinimumSize()
{
return (16, 50);
SetSize = (16, 50);
}
protected override void Draw(DrawingHandleScreen handle)
@@ -529,6 +499,7 @@ namespace Content.Client.GameObjects.Components.Wires
var lightContainer = new Control
{
SetSize = (20, 20),
Children =
{
new TextureRect
@@ -588,10 +559,10 @@ namespace Content.Client.GameObjects.Components.Wires
Text = data.Text,
FontOverride = font,
FontColorOverride = Color.FromHex("#A1A6AE"),
SizeFlagsVertical = SizeFlags.ShrinkCenter,
VerticalAlignment = VAlignment.Center,
});
hBox.AddChild(lightContainer);
hBox.AddChild(new Control {CustomMinimumSize = (6, 0)});
hBox.AddChild(new Control {MinSize = (6, 0)});
AddChild(hBox);
}
}

View File

@@ -69,7 +69,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
var doAfterBar = new DoAfterBar
{
SizeFlagsVertical = SizeFlags.ShrinkCenter
VerticalAlignment = VAlignment.Center
};
_doAfterBars[message.ID] = doAfterBar;
@@ -82,7 +82,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
{
Texture = StaticIoC.ResC.GetTexture("/Textures/Interface/Misc/progress_bar.rsi/icon.png"),
TextureScale = Vector2.One * DoAfterBar.DoAfterBarScale,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
VerticalAlignment = VAlignment.Center,
},
doAfterBar

View File

@@ -90,10 +90,11 @@ namespace Content.Client.GameObjects.EntitySystems
hBox.AddChild(new Label
{
Text = entity.Name,
SizeFlagsHorizontal = Control.SizeFlags.FillExpand,
HorizontalExpand = true,
});
var size = Vector2.ComponentMax((minWidth, 0), panel.CombinedMinimumSize);
panel.Measure(Vector2.Infinity);
var size = Vector2.ComponentMax((minWidth, 0), panel.DesiredSize);
_examineTooltipOpen.Open(UIBox2.FromDimensions(popupPos, size));

View File

@@ -26,14 +26,14 @@ namespace Content.Client.GameObjects.EntitySystems.HealthOverlay
CritBar = new HealthOverlayBar
{
Visible = false,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
VerticalAlignment = VAlignment.Center,
Color = Color.Red
};
HealthBar = new HealthOverlayBar
{
Visible = false,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
VerticalAlignment = VAlignment.Center,
Color = Color.Green
};
@@ -45,7 +45,7 @@ namespace Content.Client.GameObjects.EntitySystems.HealthOverlay
{
Texture = StaticIoC.ResC.GetTexture("/Textures/Interface/Misc/health_bar.rsi/icon.png"),
TextureScale = Vector2.One * HealthOverlayBar.HealthBarScale,
SizeFlagsVertical = SizeFlags.ShrinkCenter
VerticalAlignment = VAlignment.Center,
},
CritBar,
HealthBar

View File

@@ -164,7 +164,7 @@ namespace Content.Client.GameObjects.EntitySystems
{
_currentEntityList.List.AddChild(new PanelContainer
{
CustomMinimumSize = (0, 2),
MinSize = (0, 2),
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#333")}
});
}
@@ -176,7 +176,8 @@ namespace Content.Client.GameObjects.EntitySystems
_userInterfaceManager.ModalRoot.AddChild(_currentEntityList);
var size = _currentEntityList.List.CombinedMinimumSize;
_currentEntityList.List.Measure(Vector2.Infinity);
var size = _currentEntityList.List.DesiredSize;
var box = UIBox2.FromDimensions(_userInterfaceManager.MousePositionScaled, size);
_currentEntityList.Open(box);
@@ -284,7 +285,7 @@ namespace Content.Client.GameObjects.EntitySystems
{
vBox.AddChild(new PanelContainer
{
CustomMinimumSize = (0, 2),
MinSize = (0, 2),
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#333")}
});
}
@@ -306,7 +307,7 @@ namespace Content.Client.GameObjects.EntitySystems
{
vBox.AddChild(new PanelContainer
{
CustomMinimumSize = (0, 2),
MinSize = (0, 2),
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#333")}
});
}
@@ -449,11 +450,11 @@ namespace Content.Client.GameObjects.EntitySystems
{
text = $"{text} ({entity.Uid})";
}
control.AddChild(new MarginContainer
control.AddChild(new Label
{
MarginLeftOverride = 4,
MarginRightOverride = 4,
Children = {new Label {Text = text}}
Margin = new Thickness(4, 0),
Text = text
});
AddChild(control);
@@ -486,7 +487,8 @@ namespace Content.Client.GameObjects.EntitySystems
var func = args.Function;
var funcId = _master._inputManager.NetworkBindMap.KeyFunctionID(args.Function);
var message = new FullInputCmdMessage(_master._gameTiming.CurTick, _master._gameTiming.TickFraction, funcId, BoundKeyState.Down,
var message = new FullInputCmdMessage(_master._gameTiming.CurTick, _master._gameTiming.TickFraction,
funcId, BoundKeyState.Down,
_entity.Transform.Coordinates,
args.PointerLocation, _entity.Uid);
@@ -546,12 +548,12 @@ namespace Content.Client.GameObjects.EntitySystems
{
(_icon = new TextureRect
{
CustomMinimumSize = (32, 32),
MinSize = (32, 32),
Stretch = TextureRect.StretchMode.KeepCentered
}),
(_label = new Label()),
// Padding
new Control {CustomMinimumSize = (8, 0)}
new Control {MinSize = (8, 0)}
}
});
}
@@ -603,17 +605,17 @@ namespace Content.Client.GameObjects.EntitySystems
{
(_icon = new TextureRect
{
CustomMinimumSize = (32, 32),
MinSize = (32, 32),
Stretch = TextureRect.StretchMode.KeepCentered
}),
(_label = new Label
{
SizeFlagsHorizontal = SizeFlags.FillExpand
HorizontalExpand = true
}),
// Padding
new Control {CustomMinimumSize = (8, 0)},
new Control {MinSize = (8, 0)},
new TextureRect
{
@@ -662,7 +664,7 @@ namespace Content.Client.GameObjects.EntitySystems
{
popup.List.AddChild(new PanelContainer
{
CustomMinimumSize = (0, 2),
MinSize = (0, 2),
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#333")}
});
}

View File

@@ -1,21 +1,32 @@
<SS14Window xmlns="https://spacestation14.io">
<MarginContainer Name="Margin" SizeFlagsVertical="FillExpand" SizeFlagsHorizontal="Fill">
<VBoxContainer SizeFlagsVertical="FillExpand" SizeFlagsHorizontal="FillExpand" SeparationOverride="5">
<HBoxContainer SizeFlagsVertical="FillExpand" SizeFlagsHorizontal="FillExpand">
<Button Name="InputButton" ToggleMode="True" Text="MIDI Input" TextAlign="Center" SizeFlagsHorizontal="FillExpand" SizeFlagsStretchRatio="1"/>
<Control SizeFlagsHorizontal="FillExpand" SizeFlagsStretchRatio="2" />
<Button Name="FileButton" Text="Play MIDI File" TextAlign="Center" SizeFlagsHorizontal="FillExpand" SizeFlagsStretchRatio="1"/>
</HBoxContainer>
<HBoxContainer SizeFlagsVertical="FillExpand" SizeFlagsHorizontal="Fill">
<Button Name="LoopButton" ToggleMode="True" Text="Loop" TextAlign="Center" SizeFlagsHorizontal="FillExpand" SizeFlagsStretchRatio="1"/>
<Control SizeFlagsHorizontal="FillExpand" SizeFlagsStretchRatio="2" />
<Button Name="StopButton" Text="Stop" TextAlign="Center" SizeFlagsHorizontal="FillExpand" SizeFlagsStretchRatio="1"/>
</HBoxContainer>
<HBoxContainer SizeFlagsVertical="ShrinkEnd" SizeFlagsHorizontal="FillExpand">
<Control SizeFlagsHorizontal="FillExpand" SizeFlagsStretchRatio="0.125"/>
<Slider Name="PlaybackSlider" SizeFlagsHorizontal="FillExpand" />
<Control SizeFlagsHorizontal="FillExpand" SizeFlagsStretchRatio="0.125"/>
</HBoxContainer>
</VBoxContainer>
</MarginContainer>
<SS14Window xmlns="https://spacestation14.io"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client">
<VBoxContainer SeparationOverride="5">
<HBoxContainer VerticalExpand="True">
<Button Name="InputButton" ToggleMode="True" Text="MIDI Input" TextAlign="Center"
HorizontalExpand="True" SizeFlagsStretchRatio="1" />
<Control HorizontalExpand="True" SizeFlagsStretchRatio="2" />
<Button Name="FileButton" Text="Play MIDI File" TextAlign="Center" HorizontalExpand="True"
SizeFlagsStretchRatio="1" />
</HBoxContainer>
<HBoxContainer VerticalExpand="True">
<Button Name="LoopButton" ToggleMode="True" Text="Loop" TextAlign="Center" HorizontalExpand="True"
SizeFlagsStretchRatio="1" />
<Control HorizontalExpand="True" SizeFlagsStretchRatio="2" />
<Button Name="StopButton" Text="Stop" TextAlign="Center" HorizontalExpand="True"
SizeFlagsStretchRatio="1" />
</HBoxContainer>
<HBoxContainer VerticalExpand="True">
<Control HorizontalExpand="True" SizeFlagsStretchRatio="0.125" />
<Slider Name="PlaybackSlider" HorizontalExpand="True" />
<Control HorizontalExpand="True" SizeFlagsStretchRatio="0.125" />
</HBoxContainer>
</VBoxContainer>
<PanelContainer Name="UnavailableOverlay" Visible="False" MouseFilter="Stop">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#000000E5" />
</PanelContainer.PanelOverride>
<Label VerticalAlignment="Center" HorizontalAlignment="Center" Align="Center"
StyleClasses="LabelBig"
Text="{Loc 'MIDI support is currently&#x0a;not available on your platform.'}" />
</PanelContainer>
</SS14Window>

View File

@@ -30,8 +30,6 @@ namespace Content.Client.Instruments
private readonly InstrumentBoundUserInterface _owner;
protected override Vector2? CustomSize => (400, 150);
public InstrumentMenu(InstrumentBoundUserInterface owner)
{
RobustXamlLoader.Load(this);
@@ -50,23 +48,7 @@ namespace Content.Client.Instruments
if (!_midiManager.IsAvailable)
{
Margin.AddChild(new PanelContainer
{
MouseFilter = MouseFilterMode.Stop,
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.Black.WithAlpha(0.90f)},
Children =
{
new Label
{
Align = Label.AlignMode.Center,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
StyleClasses = {StyleNano.StyleClassLabelBig},
Text = Loc.GetString("MIDI support is currently\nnot available on your platform.")
}
}
});
UnavailableOverlay.Visible = true;
// We return early as to not give the buttons behavior.
return;
}
@@ -77,6 +59,8 @@ namespace Content.Client.Instruments
StopButton.OnPressed += MidiStopButtonOnPressed;
PlaybackSlider.OnValueChanged += PlaybackSliderSeek;
PlaybackSlider.OnKeyBindUp += PlaybackSliderKeyUp;
MinSize = SetSize = (400, 150);
}
private void InstrumentOnMidiPlaybackEnded()

View File

@@ -23,7 +23,6 @@ namespace Content.Client.Research
public Button QueueButton;
public Button ServerConnectButton;
public Button ServerSyncButton;
protected override Vector2? CustomSize => (300, 450);
public LatheBoundUserInterface Owner { get; set; }
@@ -31,28 +30,23 @@ namespace Content.Client.Research
public LatheMenu(LatheBoundUserInterface owner = null)
{
SetSize = MinSize = (300, 450);
IoCManager.InjectDependencies(this);
Owner = owner;
Title = "Lathe Menu";
var margin = new MarginContainer()
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand,
};
var vBox = new VBoxContainer()
{
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
SeparationOverride = 5,
};
var hBoxButtons = new HBoxContainer()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
HorizontalExpand = true,
VerticalExpand = true,
SizeFlagsStretchRatio = 1,
};
@@ -60,7 +54,6 @@ namespace Content.Client.Research
{
Text = "Queue",
TextAlign = Label.AlignMode.Center,
SizeFlagsHorizontal = SizeFlags.Fill,
SizeFlagsStretchRatio = 1,
};
@@ -68,7 +61,6 @@ namespace Content.Client.Research
{
Text = "Server list",
TextAlign = Label.AlignMode.Center,
SizeFlagsHorizontal = SizeFlags.Fill,
SizeFlagsStretchRatio = 1,
};
@@ -76,27 +68,26 @@ namespace Content.Client.Research
{
Text = "Sync",
TextAlign = Label.AlignMode.Center,
SizeFlagsHorizontal = SizeFlags.Fill,
SizeFlagsStretchRatio = 1,
};
var spacer = new Control()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
SizeFlagsStretchRatio = 3,
};
var hBoxFilter = new HBoxContainer()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
HorizontalExpand = true,
VerticalExpand = true,
SizeFlagsStretchRatio = 1
};
_searchBar = new LineEdit()
{
PlaceHolder = "Search Designs",
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
SizeFlagsStretchRatio = 3
};
@@ -106,7 +97,6 @@ namespace Content.Client.Research
{
Text = "Filter",
TextAlign = Label.AlignMode.Center,
SizeFlagsHorizontal = SizeFlags.Fill,
SizeFlagsStretchRatio = 1,
Disabled = true,
};
@@ -114,7 +104,7 @@ namespace Content.Client.Research
_items = new ItemList()
{
SizeFlagsStretchRatio = 8,
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
SelectMode = ItemList.ItemListSelectMode.Button,
};
@@ -124,14 +114,14 @@ namespace Content.Client.Research
{
PlaceHolder = "Amount",
Text = "1",
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
};
_amountLineEdit.OnTextChanged += PopulateDisabled;
_materials = new ItemList()
{
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
SizeFlagsStretchRatio = 3
};
@@ -153,9 +143,7 @@ namespace Content.Client.Research
vBox.AddChild(_amountLineEdit);
vBox.AddChild(_materials);
margin.AddChild(vBox);
Contents.AddChild(margin);
Contents.AddChild(vBox);
}
public void ItemSelected(ItemList.ItemListSelectedEventArgs args)

View File

@@ -4,15 +4,13 @@ using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.Utility;
using Robust.Shared.Maths;
using Robust.Shared.Localization;
using Robust.Shared.ViewVariables;
namespace Content.Client.Research
{
public class LatheQueueMenu : SS14Window
{
protected override Vector2? CustomSize => (300, 450);
public LatheBoundUserInterface Owner { get; set; }
[ViewVariables]
@@ -23,67 +21,45 @@ namespace Content.Client.Research
public LatheQueueMenu()
{
Title = "Lathe Queue";
var margin = new MarginContainer()
{
/*MarginTop = 5f,
MarginLeft = 5f,
MarginRight = -5f,
MarginBottom = -5f,*/
};
// margin.SetAnchorAndMarginPreset(LayoutPreset.Wide);
SetSize = MinSize = (300, 450);
Title = Loc.GetString("Lathe Queue");
var vBox = new VBoxContainer();
// vBox.SetAnchorAndMarginPreset(LayoutPreset.Wide);
var descMargin = new MarginContainer()
{
/*MarginTop = 5f,
MarginLeft = 5f,
MarginRight = -5f,
MarginBottom = -5f,*/
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsStretchRatio = 2,
};
var hBox = new HBoxContainer()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
SizeFlagsStretchRatio = 2,
};
_icon = new TextureRect()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
SizeFlagsStretchRatio = 2,
};
var vBoxInfo = new VBoxContainer()
{
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
SizeFlagsStretchRatio = 3,
};
_nameLabel = new Label()
{
RectClipContent = true,
SizeFlagsHorizontal = SizeFlags.Fill,
};
_description = new Label()
{
RectClipContent = true,
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.Fill,
VerticalAlignment = VAlignment.Stretch,
VerticalExpand = true
};
_queueList = new ItemList()
{
SizeFlagsHorizontal = SizeFlags.Fill,
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
SizeFlagsStretchRatio = 3,
SelectMode = ItemList.ItemListSelectMode.None
};
@@ -94,14 +70,10 @@ namespace Content.Client.Research
hBox.AddChild(_icon);
hBox.AddChild(vBoxInfo);
descMargin.AddChild(hBox);
vBox.AddChild(descMargin);
vBox.AddChild(hBox);
vBox.AddChild(_queueList);
margin.AddChild(vBox);
Contents.AddChild(margin);
Contents.AddChild(vBox);
ClearInfo();
}

View File

@@ -16,8 +16,6 @@ namespace Content.Client.Research
{
public ResearchConsoleBoundUserInterface Owner { get; set; }
protected override Vector2? CustomSize => (800, 400);
private readonly List<TechnologyPrototype> _unlockedTechnologyPrototypes = new();
private readonly List<TechnologyPrototype> _unlockableTechnologyPrototypes = new();
private readonly List<TechnologyPrototype> _futureTechnologyPrototypes = new();
@@ -40,6 +38,8 @@ namespace Content.Client.Research
public ResearchConsoleMenu(ResearchConsoleBoundUserInterface owner = null)
{
SetSize = MinSize = (800, 400);
IoCManager.InjectDependencies(this);
Title = Loc.GetString("R&D Console");
@@ -49,8 +49,8 @@ namespace Content.Client.Research
_unlockedTechnologies = new ItemList()
{
SelectMode = ItemList.ItemListSelectMode.Button,
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
HorizontalExpand = true,
VerticalExpand = true,
};
_unlockedTechnologies.OnItemSelected += UnlockedTechnologySelected;
@@ -58,8 +58,8 @@ namespace Content.Client.Research
_unlockableTechnologies = new ItemList()
{
SelectMode = ItemList.ItemListSelectMode.Button,
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
HorizontalExpand = true,
VerticalExpand = true,
};
_unlockableTechnologies.OnItemSelected += UnlockableTechnologySelected;
@@ -67,44 +67,44 @@ namespace Content.Client.Research
_futureTechnologies = new ItemList()
{
SelectMode = ItemList.ItemListSelectMode.Button,
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
HorizontalExpand = true,
VerticalExpand = true,
};
_futureTechnologies.OnItemSelected += FutureTechnologySelected;
var vbox = new VBoxContainer()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
HorizontalExpand = true,
VerticalExpand = true,
};
var hboxTechnologies = new HBoxContainer()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
HorizontalExpand = true,
VerticalExpand = true,
SizeFlagsStretchRatio = 2,
SeparationOverride = 10,
};
var hboxSelected = new HBoxContainer()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
HorizontalExpand = true,
VerticalExpand = true,
SizeFlagsStretchRatio = 1
};
var vboxPoints = new VBoxContainer()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
HorizontalExpand = true,
VerticalExpand = true,
SizeFlagsStretchRatio = 1,
};
var vboxTechInfo = new VBoxContainer()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
HorizontalExpand = true,
VerticalExpand = true,
SizeFlagsStretchRatio = 3,
};
@@ -114,8 +114,8 @@ namespace Content.Client.Research
var vboxPointsButtons = new VBoxContainer()
{
Align = BoxContainer.AlignMode.End,
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
HorizontalExpand = true,
VerticalExpand = true,
};
ServerSelectionButton = new Button() { Text = Loc.GetString("Server list") };
@@ -133,8 +133,8 @@ namespace Content.Client.Research
_technologyIcon = new TextureRect()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
HorizontalExpand = true,
VerticalExpand = true,
SizeFlagsStretchRatio = 1,
Stretch = TextureRect.StretchMode.KeepAspectCentered,
};

View File

@@ -46,31 +46,26 @@ namespace Content.Client.State
new VBoxContainer
{
SeparationOverride = 0,
CustomMinimumSize = (300, 200),
MinSize = (300, 200),
Children =
{
new HBoxContainer
{
Children =
{
new MarginContainer
new Label
{
MarginLeftOverride = 8,
Children =
{
new Label
{
Text = Loc.GetString("Space Station 14"),
StyleClasses = {StyleBase.StyleClassLabelHeading},
VAlign = Label.VAlignMode.Center
},
}
Margin = new Thickness(8, 0, 0, 0),
Text = Loc.GetString("Space Station 14"),
StyleClasses = {StyleBase.StyleClassLabelHeading},
VAlign = Label.VAlignMode.Center
},
(exitButton = new Button
{
Text = Loc.GetString("Exit"),
SizeFlagsHorizontal = Control.SizeFlags.ShrinkEnd | Control.SizeFlags.Expand
HorizontalAlignment = Control.HAlignment.Right,
HorizontalExpand = true,
}),
}
},
@@ -78,103 +73,93 @@ namespace Content.Client.State
// Line
new HighDivider(),
new MarginContainer
new VBoxContainer
{
SizeFlagsVertical = Control.SizeFlags.FillExpand,
MarginLeftOverride = 4,
MarginRightOverride = 4,
MarginTopOverride = 4,
VerticalExpand = true,
Margin = new Thickness(4, 4, 4, 0),
SeparationOverride = 0,
Children =
{
new VBoxContainer
new Control
{
SeparationOverride = 0,
VerticalExpand = true,
Children =
{
new Control
(_connectingStatus = new VBoxContainer
{
SizeFlagsVertical = Control.SizeFlags.FillExpand,
SeparationOverride = 0,
Children =
{
(_connectingStatus = new VBoxContainer
new Label
{
SeparationOverride = 0,
Children =
{
new Label
{
Text = Loc.GetString("Connecting to server..."),
Align = Label.AlignMode.Center,
},
Text = Loc.GetString("Connecting to server..."),
Align = Label.AlignMode.Center,
},
(_connectStatus = new Label
{
StyleClasses = {StyleBase.StyleClassLabelSubText},
Align = Label.AlignMode.Center,
}),
}
(_connectStatus = new Label
{
StyleClasses = {StyleBase.StyleClassLabelSubText},
Align = Label.AlignMode.Center,
}),
(_connectFail = new VBoxContainer
}
}),
(_connectFail = new VBoxContainer
{
Visible = false,
SeparationOverride = 0,
Children =
{
(_connectFailReason = new Label
{
Visible = false,
SeparationOverride = 0,
Children =
{
(_connectFailReason = new Label
{
Align = Label.AlignMode.Center
}),
(retryButton = new Button
{
Text = "Retry",
SizeFlagsHorizontal = Control.SizeFlags.ShrinkCenter,
SizeFlagsVertical =
Control.SizeFlags.Expand |
Control.SizeFlags.ShrinkEnd
})
}
Align = Label.AlignMode.Center
}),
(_disconnected = new VBoxContainer
(retryButton = new Button
{
SeparationOverride = 0,
Children =
{
new Label
{
Text = "Disconnected from server:",
Align = Label.AlignMode.Center
},
new Label
{
Text = _baseClient.LastDisconnectReason,
Align = Label.AlignMode.Center
},
(reconnectButton = new Button
{
Text = "Reconnect",
SizeFlagsHorizontal = Control.SizeFlags.ShrinkCenter,
SizeFlagsVertical =
Control.SizeFlags.Expand |
Control.SizeFlags.ShrinkEnd
})
}
Text = "Retry",
HorizontalAlignment = Control.HAlignment.Center,
VerticalExpand = true,
VerticalAlignment = Control.VAlignment.Bottom,
})
}
},
}),
// Padding.
new Control {CustomMinimumSize = (0, 8)},
new Label
(_disconnected = new VBoxContainer
{
Text = address,
StyleClasses = {StyleBase.StyleClassLabelSubText},
SizeFlagsHorizontal = Control.SizeFlags.ShrinkCenter,
}
SeparationOverride = 0,
Children =
{
new Label
{
Text = "Disconnected from server:",
Align = Label.AlignMode.Center
},
new Label
{
Text = _baseClient.LastDisconnectReason,
Align = Label.AlignMode.Center
},
(reconnectButton = new Button
{
Text = "Reconnect",
HorizontalAlignment = Control.HAlignment.Center,
VerticalExpand = true,
VerticalAlignment = Control.VAlignment.Bottom,
})
}
})
}
},
// Padding.
new Control {MinSize = (0, 8)},
new Label
{
Text = address,
StyleClasses = {StyleBase.StyleClassLabelSubText},
HorizontalAlignment = Control.HAlignment.Center
}
}
},
@@ -187,31 +172,23 @@ namespace Content.Client.State
ContentMarginTopOverride = 2
},
},
new MarginContainer
new HBoxContainer
{
MarginLeftOverride = 12,
MarginRightOverride = 4,
Margin = new Thickness(12, 0, 4, 0),
VerticalAlignment = Control.VAlignment.Bottom,
Children =
{
new HBoxContainer
new Label
{
SizeFlagsVertical = Control.SizeFlags.ShrinkEnd,
Children =
{
new Label
{
Text = Loc.GetString("Don't die!"),
StyleClasses = {StyleBase.StyleClassLabelSubText}
},
new Label
{
Text = "ver 0.1",
SizeFlagsHorizontal =
Control.SizeFlags.Expand | Control.SizeFlags.ShrinkEnd,
StyleClasses = {StyleBase.StyleClassLabelSubText}
}
}
Text = Loc.GetString("Don't die!"),
StyleClasses = {StyleBase.StyleClassLabelSubText}
},
new Label
{
Text = "ver 0.1",
HorizontalExpand = true,
HorizontalAlignment = Control.HAlignment.Right,
StyleClasses = {StyleBase.StyleClassLabelSubText}
}
}
},

View File

@@ -249,7 +249,7 @@ namespace Content.Client.State
UserNameBox = new LineEdit
{
Text = currentUserName, PlaceHolder = "Username",
SizeFlagsHorizontal = SizeFlags.FillExpand
HorizontalExpand = true
};
userNameHBox.AddChild(UserNameBox);
@@ -268,13 +268,13 @@ namespace Content.Client.State
vBox.AddChild(JoinPublicServerButton);
// Separator.
vBox.AddChild(new Control {CustomMinimumSize = (0, 2)});
vBox.AddChild(new Control {MinSize = (0, 2)});
AddressBox = new LineEdit
{
Text = "localhost",
PlaceHolder = "server address:port",
SizeFlagsHorizontal = SizeFlags.FillExpand
HorizontalExpand = true
};
vBox.AddChild(AddressBox);
@@ -289,7 +289,7 @@ namespace Content.Client.State
vBox.AddChild(DirectConnectButton);
// Separator.
vBox.AddChild(new Control {CustomMinimumSize = (0, 2)});
vBox.AddChild(new Control {MinSize = (0, 2)});
OptionsButton = new Button
{

View File

@@ -68,7 +68,7 @@ namespace Content.Client.UserInterface
_gameHud = IoCManager.Resolve<IGameHud>();
Title = Loc.GetString("Actions");
CustomMinimumSize = (300, 300);
MinSize = (300, 300);
Contents.AddChild(new VBoxContainer
{
@@ -81,7 +81,7 @@ namespace Content.Client.UserInterface
(_searchBar = new LineEdit
{
StyleClasses = { StyleNano.StyleClassActionSearchBox },
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
PlaceHolder = Loc.GetString("Search")
}),
(_filterButton = new MultiselectOptionButton<string>()
@@ -97,14 +97,14 @@ namespace Content.Client.UserInterface
(_filterLabel = new Label()),
new ScrollContainer
{
//TODO: needed? CustomMinimumSize = new Vector2(200.0f, 0.0f),
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand,
//TODO: needed? MinSize = new Vector2(200.0f, 0.0f),
VerticalExpand = true,
HorizontalExpand = true,
Children =
{
(_resultsGrid = new GridContainer
{
MaxWidth = 300
MaxGridWidth = 300
})
}
}
@@ -136,12 +136,12 @@ namespace Content.Client.UserInterface
_dragShadow = new TextureRect
{
CustomMinimumSize = (64, 64),
MinSize = (64, 64),
Stretch = TextureRect.StretchMode.Scale,
Visible = false
Visible = false,
SetSize = (64, 64)
};
UserInterfaceManager.PopupRoot.AddChild(_dragShadow);
LayoutContainer.SetSize(_dragShadow, (64, 64));
_dragDropHelper = new DragDropHelper<ActionMenuItem>(OnBeginActionDrag, OnContinueActionDrag, OnEndActionDrag);
}
@@ -190,7 +190,7 @@ namespace Content.Client.UserInterface
base.Resized();
// TODO: Can rework this once https://github.com/space-wizards/RobustToolbox/issues/1392 is done,
// currently no good way to let the grid know what size it has to "work with", so must manually resize
_resultsGrid.MaxWidth = Width;
_resultsGrid.MaxGridWidth = Width;
}
private bool OnBeginActionDrag()

View File

@@ -27,13 +27,13 @@ namespace Content.Client.UserInterface
_onControlFocusExited = onControlFocusExited;
Action = action;
CustomMinimumSize = (64, 64);
SizeFlagsVertical = SizeFlags.None;
MinSize = (64, 64);
VerticalAlignment = VAlignment.Top;
AddChild(new TextureRect
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
HorizontalExpand = true,
VerticalExpand = true,
Stretch = TextureRect.StretchMode.Scale,
Texture = action.Icon.Frame0()
});

View File

@@ -16,7 +16,6 @@ using Robust.Shared.Input;
using Robust.Shared.Input.Binding;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Maths;
using Robust.Shared.Timing;
namespace Content.Client.UserInterface
@@ -75,6 +74,7 @@ namespace Content.Client.UserInterface
public ActionsUI(ClientActionsComponent actionsComponent)
{
SetValue(LayoutContainer.DebugProperty, true);
_actionsComponent = actionsComponent;
_actionManager = IoCManager.Resolve<ActionManager>();
_entityManager = IoCManager.Resolve<IEntityManager>();
@@ -83,14 +83,14 @@ namespace Content.Client.UserInterface
_menu = new ActionMenu(_actionsComponent, this);
LayoutContainer.SetGrowHorizontal(this, LayoutContainer.GrowDirection.End);
LayoutContainer.SetGrowVertical(this, LayoutContainer.GrowDirection.End);
LayoutContainer.SetGrowVertical(this, LayoutContainer.GrowDirection.Constrain);
LayoutContainer.SetAnchorTop(this, 0f);
LayoutContainer.SetAnchorBottom(this, 0.8f);
LayoutContainer.SetMarginLeft(this, 13);
LayoutContainer.SetMarginTop(this, 110);
SizeFlagsHorizontal = SizeFlags.None;
SizeFlagsVertical = SizeFlags.FillExpand;
HorizontalAlignment = HAlignment.Left;
VerticalExpand = true;
var resourceCache = IoCManager.Resolve<IResourceCache>();
@@ -101,101 +101,101 @@ namespace Content.Client.UserInterface
var panelContainer = new PanelContainer()
{
StyleClasses = {StyleNano.StyleClassHotbarPanel},
SizeFlagsHorizontal = SizeFlags.None,
SizeFlagsVertical = SizeFlags.None
HorizontalAlignment = HAlignment.Left,
VerticalAlignment = VAlignment.Top
};
AddChild(panelContainer);
var hotbarContainer = new VBoxContainer
{
SeparationOverride = 3,
SizeFlagsHorizontal = SizeFlags.None
HorizontalAlignment = HAlignment.Left
};
panelContainer.AddChild(hotbarContainer);
var settingsContainer = new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand
HorizontalExpand = true
};
hotbarContainer.AddChild(settingsContainer);
settingsContainer.AddChild(new Control { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 1 });
settingsContainer.AddChild(new Control { HorizontalExpand = true, SizeFlagsStretchRatio = 1 });
_lockTexture = resourceCache.GetTexture("/Textures/Interface/Nano/lock.svg.192dpi.png");
_unlockTexture = resourceCache.GetTexture("/Textures/Interface/Nano/lock_open.svg.192dpi.png");
_lockButton = new TextureButton
{
TextureNormal = _unlockTexture,
SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
HorizontalAlignment = HAlignment.Center,
VerticalAlignment = VAlignment.Center,
SizeFlagsStretchRatio = 1,
Scale = (0.5f, 0.5f)
};
settingsContainer.AddChild(_lockButton);
settingsContainer.AddChild(new Control { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 2 });
settingsContainer.AddChild(new Control { HorizontalExpand = true, SizeFlagsStretchRatio = 2 });
_settingsButton = new TextureButton
{
TextureNormal = resourceCache.GetTexture("/Textures/Interface/Nano/gear.svg.192dpi.png"),
SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
HorizontalAlignment = HAlignment.Center,
VerticalAlignment = VAlignment.Center,
SizeFlagsStretchRatio = 1,
Scale = (0.5f, 0.5f)
};
settingsContainer.AddChild(_settingsButton);
settingsContainer.AddChild(new Control { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 1 });
settingsContainer.AddChild(new Control { HorizontalExpand = true, SizeFlagsStretchRatio = 1 });
// this allows a 2 column layout if window gets too small
_slotContainer = new GridContainer
{
MaxHeight = CalcMaxHeight()
MaxGridHeight = CalcMaxHeight()
};
hotbarContainer.AddChild(_slotContainer);
_loadoutContainer = new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
MouseFilter = MouseFilterMode.Stop
};
hotbarContainer.AddChild(_loadoutContainer);
_loadoutContainer.AddChild(new Control { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 1 });
_loadoutContainer.AddChild(new Control { HorizontalExpand = true, SizeFlagsStretchRatio = 1 });
var previousHotbarIcon = new TextureRect()
{
Texture = resourceCache.GetTexture("/Textures/Interface/Nano/left_arrow.svg.192dpi.png"),
SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
HorizontalAlignment = HAlignment.Center,
VerticalAlignment = VAlignment.Center,
SizeFlagsStretchRatio = 1,
TextureScale = (0.5f, 0.5f)
};
_loadoutContainer.AddChild(previousHotbarIcon);
_loadoutContainer.AddChild(new Control { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 2 });
_loadoutContainer.AddChild(new Control { HorizontalExpand = true, SizeFlagsStretchRatio = 2 });
_loadoutNumber = new Label
{
Text = "1",
SizeFlagsStretchRatio = 1
};
_loadoutContainer.AddChild(_loadoutNumber);
_loadoutContainer.AddChild(new Control { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 2 });
_loadoutContainer.AddChild(new Control { HorizontalExpand = true, SizeFlagsStretchRatio = 2 });
var nextHotbarIcon = new TextureRect
{
Texture = resourceCache.GetTexture("/Textures/Interface/Nano/right_arrow.svg.192dpi.png"),
SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
HorizontalAlignment = HAlignment.Center,
VerticalAlignment = VAlignment.Center,
SizeFlagsStretchRatio = 1,
TextureScale = (0.5f, 0.5f)
};
_loadoutContainer.AddChild(nextHotbarIcon);
_loadoutContainer.AddChild(new Control { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 1 });
_loadoutContainer.AddChild(new Control { HorizontalExpand = true, SizeFlagsStretchRatio = 1 });
_slots = new ActionSlot[ClientActionsComponent.Slots];
_dragShadow = new TextureRect
{
CustomMinimumSize = (64, 64),
MinSize = (64, 64),
Stretch = TextureRect.StretchMode.Scale,
Visible = false
Visible = false,
SetSize = (64, 64)
};
UserInterfaceManager.PopupRoot.AddChild(_dragShadow);
LayoutContainer.SetSize(_dragShadow, (64, 64));
for (byte i = 0; i < ClientActionsComponent.Slots; i++)
{
@@ -205,6 +205,8 @@ namespace Content.Client.UserInterface
}
DragDropHelper = new DragDropHelper<ActionSlot>(OnBeginActionDrag, OnContinueActionDrag, OnEndActionDrag);
MinSize = (10, 400);
}
protected override void EnteredTree()
@@ -231,16 +233,10 @@ namespace Content.Client.UserInterface
_gameHud.ActionsButtonVisible = false;
}
protected override Vector2 CalculateMinimumSize()
{
// allows us to shrink down to a 2-column layout minimum
return (10, 400);
}
protected override void Resized()
{
base.Resized();
_slotContainer.MaxHeight = CalcMaxHeight();
_slotContainer.MaxGridHeight = CalcMaxHeight();
}
private float CalcMaxHeight()
@@ -265,7 +261,7 @@ namespace Content.Client.UserInterface
protected override void UIScaleChanged()
{
_slotContainer.MaxHeight = CalcMaxHeight();
_slotContainer.MaxGridHeight = CalcMaxHeight();
base.UIScaleChanged();
}

View File

@@ -82,11 +82,11 @@ namespace Content.Client.UserInterface
(_amountEdit = new LineEdit
{
PlaceHolder = Loc.GetString("A number..."),
SizeFlagsHorizontal = SizeFlags.FillExpand
HorizontalExpand = true
}),
},
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand
HorizontalExpand = true,
VerticalExpand = true
},
new HBoxContainer
{
@@ -94,7 +94,7 @@ namespace Content.Client.UserInterface
{
(_errorLabel = new Label
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
ClipText = true
}),

View File

@@ -21,10 +21,9 @@ namespace Content.Client.UserInterface.AdminMenu
remove => PlayerTabControl.OnPlayerListRefresh -= value;
}
protected override Vector2? CustomSize => (500, 250);
public AdminMenuWindow()
{
MinSize = SetSize = (500, 250);
Title = Loc.GetString("Admin Menu");
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);

View File

@@ -1,15 +1,15 @@
<SS14Window
xmlns="https://spacestation14.io">
<HBoxContainer SizeFlagsHorizontal="FillExpand">
<VBoxContainer SizeFlagsHorizontal="FillExpand" SizeFlagsStretchRatio="0.45">
<HBoxContainer SizeFlagsHorizontal="FillExpand" SizeFlagsVertical="FillExpand"
<HBoxContainer HorizontalExpand="True">
<VBoxContainer HorizontalExpand="True" SizeFlagsStretchRatio="0.45">
<HBoxContainer HorizontalExpand="True" VerticalExpand="True"
SizeFlagsStretchRatio="0.1">
<LineEdit Name="SearchBar" PlaceHolder="Search" SizeFlagsHorizontal="FillExpand"
<LineEdit Name="SearchBar" PlaceHolder="Search" HorizontalExpand="True"
SizeFlagsStretchRatio="0.6" />
</HBoxContainer>
<ItemList Name="OutfitList" SelectMode="Single" SizeFlagsVertical="FillExpand"
<ItemList Name="OutfitList" SelectMode="Single" VerticalExpand="True"
SizeFlagsStretchRatio="0.9" />
<Button Name="ConfirmButton" SizeFlagsHorizontal="FillExpand" />
<Button Name="ConfirmButton" HorizontalExpand="True" />
</VBoxContainer>
</HBoxContainer>
</SS14Window>

View File

@@ -20,12 +20,11 @@ namespace Content.Client.UserInterface.AdminMenu.SetOutfit
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;
public EntityUid? TargetEntityId { get; set; }
protected override Vector2? CustomSize => (250, 320);
private StartingGearPrototype? _selectedOutfit;
public SetOutfitMenu()
{
MinSize = SetSize = (250, 320);
IoCManager.InjectDependencies(this);
RobustXamlLoader.Load(this);

View File

@@ -1,12 +1,10 @@
<MarginContainer
<Control
xmlns="https://spacestation14.io"
xmlns:amc="clr-namespace:Content.Client.UserInterface.AdminMenu.CustomControls"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:at="clr-namespace:Content.Client.UserInterface.AdminMenu.Tabs.AdminTab"
MarginLeftOverride="4"
MarginTopOverride="4" MarginRightOverride="4"
MarginBottomOverride="4"
CustomMinimumSize="50 50">
Margin="4"
MinSize="50 50">
<VBoxContainer>
<GridContainer Columns="4">
<amc:UICommandButton Command="kick" Text="{Loc Kick}" WindowType="{x:Type at:KickWindow}" />
@@ -16,4 +14,4 @@
<amc:CommandButton Command="permissions" Text="{Loc Permissions Panel}" />
</GridContainer>
</VBoxContainer>
</MarginContainer>
</Control>

View File

@@ -1,11 +1,11 @@
#nullable enable
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface;
namespace Content.Client.UserInterface.AdminMenu.Tabs.AdminTab
{
[GenerateTypedNameReferences]
public partial class AdminTab : MarginContainer
public partial class AdminTab : Control
{
}
}

View File

@@ -1,24 +1,24 @@
<SS14Window
xmlns="https://spacestation14.io"
xmlns:cc="clr-namespace:Content.Client.UserInterface.AdminMenu.CustomControls"
Title="{Loc Ban}" CustomMinimumSize="425 162">
Title="{Loc Ban}" MinSize="425 162">
<VBoxContainer>
<HBoxContainer>
<Label Text="{Loc Player}" CustomMinimumSize="100 0" />
<Control CustomMinimumSize="50 0" />
<LineEdit Name="PlayerNameLine" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" />
<Label Text="{Loc Player}" MinWidth="100" />
<Control MinWidth="50" />
<LineEdit Name="PlayerNameLine" MinWidth="100" HorizontalExpand="True" />
</HBoxContainer>
<HBoxContainer>
<Label Text="{Loc Reason}" CustomMinimumSize="100 0" />
<Control CustomMinimumSize="50 0" />
<LineEdit Name="ReasonLine" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" />
<Label Text="{Loc Reason}" MinSize="100 0" />
<Control MinSize="50 0" />
<LineEdit Name="ReasonLine" MinSize="100 0" HorizontalExpand="True" />
</HBoxContainer>
<HBoxContainer>
<Label Text="{Loc Minutes}" CustomMinimumSize="100 0" />
<Control CustomMinimumSize="50 0" />
<LineEdit Name="MinutesLine" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" PlaceHolder="{Loc 0 minutes for a permanent ban}" />
<Label Text="{Loc Minutes}" MinWidth="100" />
<Control MinWidth="50" />
<LineEdit Name="MinutesLine" MinWidth="100" HorizontalExpand="True" PlaceHolder="{Loc 0 minutes for a permanent ban}" />
</HBoxContainer>
<Control CustomMinimumSize="50 0" />
<Control MinWidth="50" />
<Button Name="SubmitButton" Text="{Loc Ban}" />
</VBoxContainer>
</SS14Window>

View File

@@ -1,12 +1,12 @@
<SS14Window
xmlns="https://spacestation14.io"
xmlns:cc="clr-namespace:Content.Client.UserInterface.AdminMenu.CustomControls"
Title="{Loc Kick}" CustomMinimumSize="425 272">
Title="{Loc Kick}" MinSize="425 272">
<VBoxContainer>
<HBoxContainer>
<Label Text="{Loc Reason}" CustomMinimumSize="100 0" />
<Control CustomMinimumSize="50 0" />
<LineEdit Name="ReasonLine" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" />
<Label Text="{Loc Reason}" MinWidth="100" />
<Control MinWidth="50" />
<LineEdit Name="ReasonLine" MinWidth="100" HorizontalExpand="True" />
</HBoxContainer>
<cc:PlayerListControl Name="PlayerList" />
<Button Name="SubmitButton" Text="{Loc Kick}" />

View File

@@ -1,8 +1,8 @@
<SS14Window
xmlns="https://spacestation14.io"
xmlns:cc="clr-namespace:Content.Client.UserInterface.AdminMenu.CustomControls"
Title="{Loc Teleport}" CustomMinimumSize="425 230">
<VBoxContainer SizeFlagsVertical="FillExpand">
Title="{Loc Teleport}" MinSize="425 230">
<VBoxContainer>
<cc:PlayerListControl Name="PlayerList" />
<Button Name="SubmitButton" Text="{Loc Teleport}" />
</VBoxContainer>

View File

@@ -1,16 +1,14 @@
<MarginContainer
<Control
xmlns="https://spacestation14.io"
xmlns:amc="clr-namespace:Content.Client.UserInterface.AdminMenu.CustomControls"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:abt="clr-namespace:Content.Client.UserInterface.AdminMenu.Tabs.AdminbusTab"
MarginLeftOverride="4"
MarginTopOverride="4" MarginRightOverride="4"
MarginBottomOverride="4"
CustomMinimumSize="50 50">
Margin="4"
MinSize="50 50">
<GridContainer
Columns="4">
<amc:CommandButton Name="SpawnEntitiesButton" Text="{Loc Spawn Entities}" />
<amc:CommandButton Name="SpawnTilesButton" Text="{Loc Spawn Tiles} " />
<amc:UICommandButton Command="events" Text="{Loc Station Events}" WindowType="{x:Type abt:StationEventsWindow}" />
</GridContainer>
</MarginContainer>
</Control>

View File

@@ -2,6 +2,7 @@
using Robust.Client.AutoGenerated;
using Robust.Client.Placement;
using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.IoC;
@@ -11,7 +12,7 @@ using Robust.Shared.Prototypes;
namespace Content.Client.UserInterface.AdminMenu.Tabs.AdminbusTab
{
[GenerateTypedNameReferences]
public partial class AdminbusTab : MarginContainer
public partial class AdminbusTab : Control
{
protected override void EnteredTree()
{

View File

@@ -2,9 +2,9 @@
xmlns="https://spacestation14.io" Title="Kick">
<VBoxContainer>
<HBoxContainer>
<Label Text="{Loc Event}" CustomMinimumSize="100 0" />
<Control CustomMinimumSize="50 0" />
<OptionButton Name="EventsOptions" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" />
<Label Text="{Loc Event}" MinSize="100 0" />
<Control MinSize="50 0" />
<OptionButton Name="EventsOptions" MinSize="100 0" HorizontalExpand="True" />
</HBoxContainer>
<Button Name="PauseButton" Text="{Loc Pause}" />
<Button Name="ResumeButton" Text="{Loc Resume}" />

View File

@@ -2,9 +2,9 @@
xmlns="https://spacestation14.io" Title="{Loc Add Atmos}">
<VBoxContainer>
<HBoxContainer>
<Label Text="{Loc Grid}" CustomMinimumSize="100 0" />
<Control CustomMinimumSize="50 0" />
<OptionButton Name="GridOptions" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" />
<Label Text="{Loc Grid}" MinSize="100 0" />
<Control MinSize="50 0" />
<OptionButton Name="GridOptions" MinSize="100 0" HorizontalExpand="True" />
</HBoxContainer>
<Button Name="SubmitButton" Text="{Loc Add Atmos}" />
</VBoxContainer>

View File

@@ -2,29 +2,29 @@
xmlns="https://spacestation14.io" Title="{Loc Add Gas}">
<VBoxContainer>
<HBoxContainer>
<Label Text="{Loc Grid}" CustomMinimumSize="100 0" />
<Control CustomMinimumSize="50 0" />
<OptionButton Name="GridOptions" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" />
<Label Text="{Loc Grid}" MinSize="100 0" />
<Control MinSize="50 0" />
<OptionButton Name="GridOptions" MinSize="100 0" HorizontalExpand="True" />
</HBoxContainer>
<HBoxContainer>
<Label Text="{Loc TileX}" CustomMinimumSize="100 0" />
<Control CustomMinimumSize="50 0" />
<SpinBox Name="TileXSpin" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" />
<Label Text="{Loc TileX}" MinSize="100 0" />
<Control MinSize="50 0" />
<SpinBox Name="TileXSpin" MinSize="100 0" HorizontalExpand="True" />
</HBoxContainer>
<HBoxContainer>
<Label Text="{Loc TileY}" CustomMinimumSize="100 0" />
<Control CustomMinimumSize="50 0" />
<SpinBox Name="TileYSpin" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" />
<Label Text="{Loc TileY}" MinSize="100 0" />
<Control MinSize="50 0" />
<SpinBox Name="TileYSpin" MinSize="100 0" HorizontalExpand="True" />
</HBoxContainer>
<HBoxContainer>
<Label Text="{Loc Gas}" CustomMinimumSize="100 0" />
<Control CustomMinimumSize="50 0" />
<OptionButton Name="GasOptions" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" />
<Label Text="{Loc Gas}" MinSize="100 0" />
<Control MinSize="50 0" />
<OptionButton Name="GasOptions" MinSize="100 0" HorizontalExpand="True" />
</HBoxContainer>
<HBoxContainer>
<Label Text="{Loc Amount}" CustomMinimumSize="100 0" />
<Control CustomMinimumSize="50 0" />
<SpinBox Name="AmountSpin" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" />
<Label Text="{Loc Amount}" MinSize="100 0" />
<Control MinSize="50 0" />
<SpinBox Name="AmountSpin" MinSize="100 0" HorizontalExpand="True" />
</HBoxContainer>
<Button Name="SubmitButton" Text="{Loc Add Gas}" />
</VBoxContainer>

View File

@@ -1,12 +1,10 @@
<MarginContainer
<Control
xmlns="https://spacestation14.io"
xmlns:amc="clr-namespace:Content.Client.UserInterface.AdminMenu.CustomControls"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:at="clr-namespace:Content.Client.UserInterface.AdminMenu.Tabs.AtmosTab"
MarginLeftOverride="4"
MarginTopOverride="4" MarginRightOverride="4"
MarginBottomOverride="4"
CustomMinimumSize="50 50">
Margin="4"
MinSize="50 50">
<GridContainer Columns="4">
<amc:UICommandButton Text="{Loc Add Atmos}" Command="addatmos" WindowType="{x:Type at:AddAtmosWindow}" />
<amc:UICommandButton Text="{Loc Add Gas}" Command="addgas" WindowType="{x:Type at:AddGasWindow}" />
@@ -14,4 +12,4 @@
<amc:UICommandButton Text="{Loc Set Temperature}" Command="settemp"
WindowType="{x:Type at:SetTemperatureWindow}" />
</GridContainer>
</MarginContainer>
</Control>

View File

@@ -1,11 +1,12 @@
#nullable enable
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
namespace Content.Client.UserInterface.AdminMenu.Tabs.AtmosTab
{
[GenerateTypedNameReferences]
public partial class AtmosTab : MarginContainer
public partial class AtmosTab : Control
{
}
}

View File

@@ -2,19 +2,19 @@
xmlns="https://spacestation14.io" Title="{Loc Fill Gas}">
<VBoxContainer>
<HBoxContainer>
<Label Text="{Loc Grid}" CustomMinimumSize="100 0" />
<Control CustomMinimumSize="50 0" />
<OptionButton Name="GridOptions" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" />
<Label Text="{Loc Grid}" MinSize="100 0" />
<Control MinSize="50 0" />
<OptionButton Name="GridOptions" MinSize="100 0" HorizontalExpand="True" />
</HBoxContainer>
<HBoxContainer>
<Label Text="{Loc Gas}" CustomMinimumSize="100 0" />
<Control CustomMinimumSize="50 0" />
<OptionButton Name="GasOptions" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" />
<Label Text="{Loc Gas}" MinSize="100 0" />
<Control MinSize="50 0" />
<OptionButton Name="GasOptions" MinSize="100 0" HorizontalExpand="True" />
</HBoxContainer>
<HBoxContainer>
<Label Text="{Loc Amount}" CustomMinimumSize="100 0" />
<Control CustomMinimumSize="50 0" />
<SpinBox Name="AmountSpin" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" />
<Label Text="{Loc Amount}" MinSize="100 0" />
<Control MinSize="50 0" />
<SpinBox Name="AmountSpin" MinSize="100 0" HorizontalExpand="True" />
</HBoxContainer>
<Button Name="SubmitButton" Text="{Loc Fill Gas}" />
</VBoxContainer>

View File

@@ -2,24 +2,24 @@
xmlns="https://spacestation14.io" Title="{Loc Set Temperature}">
<VBoxContainer>
<HBoxContainer>
<Label Text="{Loc Grid}" CustomMinimumSize="100 0" />
<Control CustomMinimumSize="50 0" />
<OptionButton Name="GridOptions" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" />
<Label Text="{Loc Grid}" MinSize="100 0" />
<Control MinSize="50 0" />
<OptionButton Name="GridOptions" MinSize="100 0" HorizontalExpand="True" />
</HBoxContainer>
<HBoxContainer>
<Label Text="{Loc TileX}" CustomMinimumSize="100 0" />
<Control CustomMinimumSize="50 0" />
<SpinBox Name="TileXSpin" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" />
<Label Text="{Loc TileX}" MinSize="100 0" />
<Control MinSize="50 0" />
<SpinBox Name="TileXSpin" MinSize="100 0" HorizontalExpand="True" />
</HBoxContainer>
<HBoxContainer>
<Label Text="{Loc TileY}" CustomMinimumSize="100 0" />
<Control CustomMinimumSize="50 0" />
<SpinBox Name="TileYSpin" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" />
<Label Text="{Loc TileY}" MinSize="100 0" />
<Control MinSize="50 0" />
<SpinBox Name="TileYSpin" MinSize="100 0" HorizontalExpand="True" />
</HBoxContainer>
<HBoxContainer>
<Label Text="{Loc Temperature}" CustomMinimumSize="100 0" />
<Control CustomMinimumSize="50 0" />
<SpinBox Name="TemperatureSpin" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" />
<Label Text="{Loc Temperature}" MinSize="100 0" />
<Control MinSize="50 0" />
<SpinBox Name="TemperatureSpin" MinSize="100 0" HorizontalExpand="True" />
</HBoxContainer>
<Button Name="SubmitButton" Text="{Loc Set Temperature}" />
</VBoxContainer>

View File

@@ -1,15 +1,14 @@
<MarginContainer
xmlns="https://spacestation14.io">
<VBoxContainer SizeFlagsVertical="Fill">
<HBoxContainer SizeFlagsVertical="Fill">
<Label Name="PlayerCount" SizeFlagsHorizontal="FillExpand" SizeFlagsStretchRatio="0.7"
<Control xmlns="https://spacestation14.io">
<VBoxContainer>
<HBoxContainer>
<Label Name="PlayerCount" HorizontalExpand="True" SizeFlagsStretchRatio="0.7"
Text="{Loc Player Count}" />
<Button Name="RefreshButton" SizeFlagsHorizontal="FillExpand" SizeFlagsStretchRatio="0.3"
<Button Name="RefreshButton" HorizontalExpand="True" SizeFlagsStretchRatio="0.3"
Text="{Loc Refresh}" />
</HBoxContainer>
<Control CustomMinimumSize="0 5" />
<ScrollContainer SizeFlagsHorizontal="FillExpand" SizeFlagsVertical="FillExpand">
<Control MinSize="0 5" />
<ScrollContainer HorizontalExpand="True" VerticalExpand="True">
<VBoxContainer Name="PlayerList" />
</ScrollContainer>
</VBoxContainer>
</MarginContainer>
</Control>

View File

@@ -13,7 +13,7 @@ using Robust.Shared.Maths;
namespace Content.Client.UserInterface.AdminMenu.Tabs
{
[GenerateTypedNameReferences]
public partial class PlayerTab : MarginContainer
public partial class PlayerTab : Control
{
public delegate void PlayerListRefresh();
@@ -42,7 +42,7 @@ namespace Content.Client.UserInterface.AdminMenu.Tabs
var header = new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
SeparationOverride = 4,
Children =
{
@@ -50,14 +50,14 @@ namespace Content.Client.UserInterface.AdminMenu.Tabs
{
Text = "Name",
SizeFlagsStretchRatio = 2f,
SizeFlagsHorizontal = SizeFlags.FillExpand
HorizontalExpand = true
},
new VSeparator(),
new Label
{
Text = "Player",
SizeFlagsStretchRatio = 2f,
SizeFlagsHorizontal = SizeFlags.FillExpand
HorizontalExpand = true
}
}
};
@@ -79,7 +79,7 @@ namespace Content.Client.UserInterface.AdminMenu.Tabs
{
var hBox = new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
SeparationOverride = 4,
Children =
{
@@ -87,7 +87,7 @@ namespace Content.Client.UserInterface.AdminMenu.Tabs
{
Text = name,
SizeFlagsStretchRatio = 2f,
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
ClipText = true
},
new VSeparator(),
@@ -95,7 +95,7 @@ namespace Content.Client.UserInterface.AdminMenu.Tabs
{
Text = player,
SizeFlagsStretchRatio = 2f,
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
ClipText = true
}
}
@@ -121,7 +121,7 @@ namespace Content.Client.UserInterface.AdminMenu.Tabs
{
public VSeparator()
{
CustomMinimumSize = (2, 5);
MinSize = (2, 5);
AddChild(new PanelContainer
{
PanelOverride = new StyleBoxFlat

View File

@@ -1,14 +1,12 @@
<MarginContainer
<Control
xmlns="https://spacestation14.io"
xmlns:amc="clr-namespace:Content.Client.UserInterface.AdminMenu.CustomControls"
MarginLeftOverride="4"
MarginTopOverride="4" MarginRightOverride="4"
MarginBottomOverride="4"
CustomMinimumSize="50 50">
Margin="4"
MinSize="50 50">
<GridContainer
Columns="4">
<amc:CommandButton Command="startround" Text="{Loc Start Round}" />
<amc:CommandButton Command="endround" Text="{Loc End Round}" />
<amc:CommandButton Command="restartround" Text="{Loc Restart Round}" />
</GridContainer>
</MarginContainer>
</Control>

View File

@@ -1,11 +1,12 @@
#nullable enable
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
namespace Content.Client.UserInterface.AdminMenu.Tabs
{
[GenerateTypedNameReferences]
public partial class RoundTab : MarginContainer
public partial class RoundTab : Control
{
}
}

View File

@@ -1,13 +1,11 @@
<MarginContainer
<Control
xmlns="https://spacestation14.io"
xmlns:amc="clr-namespace:Content.Client.UserInterface.AdminMenu.CustomControls"
MarginLeftOverride="4"
MarginTopOverride="4" MarginRightOverride="4"
MarginBottomOverride="4"
CustomMinimumSize="50 50">
Margin="4"
MinSize="50 50">
<GridContainer
Columns="4" >
<amc:CommandButton Command="restart" Text="{Loc Reboot}"></amc:CommandButton>
<amc:CommandButton Command="shutdown" Text="{Loc Shutdown}"></amc:CommandButton>
</GridContainer>
</MarginContainer>
</Control>

View File

@@ -1,14 +1,12 @@
#nullable enable
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
namespace Content.Client.UserInterface.AdminMenu.Tabs
{
[GenerateTypedNameReferences]
public partial class ServerTab : MarginContainer
public partial class ServerTab : Control
{
public ServerTab()
{
}
}
}

View File

@@ -1,7 +1,6 @@
using Content.Client.UserInterface.Stylesheets;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Maths;
namespace Content.Client.UserInterface
{
@@ -25,37 +24,35 @@ namespace Content.Client.UserInterface
var panelContainer = new PanelContainer
{
StyleClasses = {StyleNano.StyleClassTransparentBorderedWindowPanel},
SizeFlagsHorizontal = SizeFlags.ShrinkEnd,
SizeFlagsVertical = SizeFlags.None
HorizontalAlignment = HAlignment.Right,
VerticalAlignment = VAlignment.Top
};
AddChild(panelContainer);
Grid = new GridContainer
{
MaxHeight = 64,
MaxGridHeight = 64,
ExpandBackwards = true
};
panelContainer.AddChild(Grid);
MinSize = (64, 64);
}
// This makes no sense but I'm leaving it in place in case I break anything by removing it.
protected override void Resized()
{
// TODO: Can rework this once https://github.com/space-wizards/RobustToolbox/issues/1392 is done,
// this is here because there isn't currently a good way to allow the grid to adjust its height based
// on constraints, otherwise we would use anchors to lay it out
base.Resized();
Grid.MaxHeight = Height;
}
protected override Vector2 CalculateMinimumSize()
{
// allows us to shrink down to a single row
return (64, 64);
Grid.MaxGridHeight = Height;
}
protected override void UIScaleChanged()
{
Grid.MaxHeight = Height;
Grid.MaxGridHeight = Height;
base.UIScaleChanged();
}
}

View File

@@ -72,7 +72,7 @@ namespace Content.Client.UserInterface.Atmos.GasTank
Children =
{
(_topContainer = new VBoxContainer()),
new Control {CustomMinimumSize = (0, 110)}
new Control {MinSize = (0, 110)}
}
};
@@ -82,37 +82,26 @@ namespace Content.Client.UserInterface.Atmos.GasTank
var font = _resourceCache.GetFont("/Fonts/Boxfont-round/Boxfont Round.ttf", 13);
var topRow = new MarginContainer
var topRow = new HBoxContainer
{
MarginLeftOverride = 4,
MarginTopOverride = 2,
MarginRightOverride = 12,
MarginBottomOverride = 2,
Margin = new Thickness(4, 2, 12, 2),
Children =
{
new HBoxContainer
(_lblName = new Label
{
Children =
{
(_lblName = new Label
{
Text = Loc.GetString("Gas Tank"),
FontOverride = font,
FontColorOverride = StyleNano.NanoGold,
SizeFlagsVertical = SizeFlags.ShrinkCenter
}),
new Control
{
CustomMinimumSize = (20, 0),
SizeFlagsHorizontal = SizeFlags.Expand
},
(btnClose = new TextureButton
{
StyleClasses = {SS14Window.StyleClassWindowCloseButton},
SizeFlagsVertical = SizeFlags.ShrinkCenter
})
}
}
Text = Loc.GetString("Gas Tank"),
FontOverride = font,
FontColorOverride = StyleNano.NanoGold,
VerticalAlignment = VAlignment.Center,
HorizontalExpand = true,
HorizontalAlignment = HAlignment.Left,
Margin = new Thickness(0, 0, 20, 0),
}),
(btnClose = new TextureButton
{
StyleClasses = {SS14Window.StyleClassWindowCloseButton},
VerticalAlignment = VAlignment.Center
})
}
};
@@ -121,30 +110,23 @@ namespace Content.Client.UserInterface.Atmos.GasTank
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#202025")},
Children =
{
new MarginContainer
(_contentContainer = new VBoxContainer
{
MarginLeftOverride = 8,
MarginRightOverride = 8,
MarginTopOverride = 4,
MarginBottomOverride = 4,
Children =
{
(_contentContainer = new VBoxContainer())
}
}
Margin = new Thickness(8, 4),
})
}
};
_topContainer.AddChild(topRow);
_topContainer.AddChild(new PanelContainer
{
CustomMinimumSize = (0, 2),
MinSize = (0, 2),
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#525252ff")}
});
_topContainer.AddChild(middle);
_topContainer.AddChild(new PanelContainer
{
CustomMinimumSize = (0, 2),
MinSize = (0, 2),
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#525252ff")}
});
@@ -154,26 +136,20 @@ namespace Content.Client.UserInterface.Atmos.GasTank
//internals
_lblInternals = new RichTextLabel
{CustomMinimumSize = (200, 0), SizeFlagsVertical = SizeFlags.ShrinkCenter};
{MinSize = (200, 0), VerticalAlignment = VAlignment.Center};
_btnInternals = new Button {Text = Loc.GetString("Toggle")};
_contentContainer.AddChild(
new MarginContainer
new HBoxContainer
{
MarginTopOverride = 7,
Children =
{
new HBoxContainer
{
Children = {_lblInternals, _btnInternals}
}
}
Margin = new Thickness(0, 7, 0, 0),
Children = {_lblInternals, _btnInternals}
});
// Separator
_contentContainer.AddChild(new Control
{
CustomMinimumSize = new Vector2(0, 10)
MinSize = new Vector2(0, 10)
});
_contentContainer.AddChild(new Label
@@ -181,19 +157,12 @@ namespace Content.Client.UserInterface.Atmos.GasTank
Text = Loc.GetString("Output Pressure"),
Align = Label.AlignMode.Center
});
_spbPressure = new FloatSpinBox {IsValid = f => f >= 0 || f <= 3000};
_contentContainer.AddChild(
new MarginContainer
{
MarginRightOverride = 25,
MarginLeftOverride = 25,
MarginBottomOverride = 7,
Children =
{
_spbPressure
}
}
);
_spbPressure = new FloatSpinBox
{
IsValid = f => f >= 0 || f <= 3000,
Margin = new Thickness(25, 0, 25, 7)
};
_contentContainer.AddChild(_spbPressure);
// Handlers
_spbPressure.OnValueChanged += args =>

View File

@@ -15,8 +15,6 @@ namespace Content.Client.UserInterface.Cargo
{
public class CargoConsoleMenu : SS14Window
{
protected override Vector2? CustomSize => (400, 600);
public CargoConsoleBoundUserInterface Owner { get; private set; }
public event Action<BaseButton.ButtonEventArgs> OnItemSelected;
@@ -42,6 +40,7 @@ namespace Content.Client.UserInterface.Cargo
public CargoConsoleMenu(CargoConsoleBoundUserInterface owner)
{
SetSize = MinSize = (400, 600);
IoCManager.InjectDependencies(this);
Owner = owner;
@@ -112,7 +111,7 @@ namespace Content.Client.UserInterface.Cargo
//Text = Loc.GetString("Call Shuttle"),
Text = Loc.GetString("Activate Telepad"), //Shuttle code pending
TextAlign = Label.AlignMode.Center,
SizeFlagsHorizontal = SizeFlags.FillExpand
HorizontalExpand = true
};
PermissionsButton = new Button()
{
@@ -127,13 +126,13 @@ namespace Content.Client.UserInterface.Cargo
_categories = new OptionButton
{
Prefix = Loc.GetString("Categories: "),
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
SizeFlagsStretchRatio = 1
};
_searchBar = new LineEdit
{
PlaceHolder = Loc.GetString("Search"),
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
SizeFlagsStretchRatio = 1
};
category.AddChild(_categories);
@@ -142,41 +141,41 @@ namespace Content.Client.UserInterface.Cargo
var products = new ScrollContainer()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
HorizontalExpand = true,
VerticalExpand = true,
SizeFlagsStretchRatio = 6
};
Products = new VBoxContainer()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand
HorizontalExpand = true,
VerticalExpand = true
};
products.AddChild(Products);
rows.AddChild(products);
var requestsAndOrders = new PanelContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
SizeFlagsStretchRatio = 6,
PanelOverride = new StyleBoxFlat { BackgroundColor = Color.Black }
};
var orderScrollBox = new ScrollContainer
{
SizeFlagsVertical = SizeFlags.FillExpand
VerticalExpand = true
};
var rAndOVBox = new VBoxContainer();
var requestsLabel = new Label { Text = Loc.GetString("Requests") };
_requests = new VBoxContainer // replace with scroll box so that approval buttons can be added
{
StyleClasses = { "transparentItemList" },
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
SizeFlagsStretchRatio = 1,
};
var ordersLabel = new Label { Text = Loc.GetString("Orders") };
_orders = new VBoxContainer
{
StyleClasses = { "transparentItemList" },
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
SizeFlagsStretchRatio = 1,
};
rAndOVBox.AddChild(requestsLabel);
@@ -189,7 +188,7 @@ namespace Content.Client.UserInterface.Cargo
rows.AddChild(new TextureButton
{
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
});
Contents.AddChild(rows);
@@ -351,30 +350,30 @@ namespace Content.Client.UserInterface.Cargo
public CargoProductRow()
{
SizeFlagsHorizontal = SizeFlags.FillExpand;
HorizontalExpand = true;
MainButton = new Button
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand
HorizontalExpand = true,
VerticalExpand = true
};
AddChild(MainButton);
var hBox = new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand
HorizontalExpand = true
};
Icon = new TextureRect
{
CustomMinimumSize = new Vector2(32.0f, 32.0f),
MinSize = new Vector2(32.0f, 32.0f),
RectClipContent = true
};
hBox.AddChild(Icon);
ProductName = new Label
{
SizeFlagsHorizontal = SizeFlags.FillExpand
HorizontalExpand = true
};
hBox.AddChild(ProductName);
@@ -384,7 +383,7 @@ namespace Content.Client.UserInterface.Cargo
};
PointCost = new Label
{
CustomMinimumSize = new Vector2(40.0f, 32.0f),
MinSize = new Vector2(40.0f, 32.0f),
Align = Label.AlignMode.Right
};
panel.AddChild(PointCost);
@@ -405,34 +404,34 @@ namespace Content.Client.UserInterface.Cargo
public CargoOrderRow()
{
SizeFlagsHorizontal = SizeFlags.FillExpand;
HorizontalExpand = true;
var hBox = new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
};
Icon = new TextureRect
{
CustomMinimumSize = new Vector2(32.0f, 32.0f),
MinSize = new Vector2(32.0f, 32.0f),
RectClipContent = true
};
hBox.AddChild(Icon);
var vBox = new VBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand
HorizontalExpand = true,
VerticalExpand = true
};
ProductName = new Label
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
StyleClasses = { StyleNano.StyleClassLabelSubText },
ClipText = true
};
Description = new Label
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
StyleClasses = { StyleNano.StyleClassLabelSubText },
ClipText = true
};

View File

@@ -35,7 +35,7 @@ namespace Content.Client.UserInterface.Cargo
var amountLabel = new Label { Text = Loc.GetString("Amount:") };
Amount = new SpinBox
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
Value = 1
};
Amount.SetButtons(new List<int>() { -100, -10, -1 }, new List<int>() { 1, 10, 100 });

View File

@@ -16,27 +16,18 @@ namespace Content.Client.UserInterface.Cargo
private int[] _accountIds = new int[] { };
private int _selectedAccountId = -1;
protected override Vector2? CustomSize => (300, 300);
public CargoConsoleBoundUserInterface Owner;
public GalacticBankSelectionMenu()
{
MinSize = SetSize = (300, 300);
IoCManager.InjectDependencies(this);
Title = Loc.GetString("Galactic Bank Selection");
_accounts = new ItemList() { SelectMode = ItemList.ItemListSelectMode.Single };
var margin = new MarginContainer()
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand,
};
margin.AddChild(_accounts);
Contents.AddChild(margin);
Contents.AddChild(_accounts);
}
public void Populate(int accountCount, string[] accountNames, int[] accountIds, int selectedAccountId)

View File

@@ -36,12 +36,9 @@ namespace Content.Client.UserInterface
{
_entityManager = entityManager;
_preferencesManager = preferencesManager;
var margin = new MarginContainer
var margin = new Control
{
MarginBottomOverride = 20,
MarginLeftOverride = 20,
MarginRightOverride = 20,
MarginTopOverride = 20
Margin = new Thickness(20),
};
AddChild(margin);
@@ -67,32 +64,25 @@ namespace Content.Client.UserInterface
var topHBox = new HBoxContainer
{
CustomMinimumSize = (0, 40),
MinSize = (0, 40),
Children =
{
new MarginContainer
new Label
{
MarginLeftOverride = 8,
Children =
{
new Label
{
Text = Loc.GetString("Character Setup"),
StyleClasses = {StyleNano.StyleClassLabelHeadingBigger},
VAlign = Label.VAlignMode.Center,
SizeFlagsHorizontal = SizeFlags.Expand | SizeFlags.ShrinkCenter
}
}
Margin = new Thickness(8, 0, 0, 0),
Text = Loc.GetString("Character Setup"),
StyleClasses = {StyleNano.StyleClassLabelHeadingBigger},
VAlign = Label.VAlignMode.Center,
},
(SaveButton = new Button
{
SizeFlagsHorizontal = SizeFlags.Expand | SizeFlags.ShrinkEnd,
HorizontalExpand = true,
HorizontalAlignment = HAlignment.Right,
Text = Loc.GetString("Save"),
StyleClasses = {StyleNano.StyleClassButtonBig},
}),
(CloseButton = new Button
{
SizeFlagsHorizontal = SizeFlags.ShrinkEnd,
Text = Loc.GetString("Close"),
StyleClasses = {StyleNano.StyleClassButtonBig},
})
@@ -112,29 +102,20 @@ namespace Content.Client.UserInterface
var hBox = new HBoxContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
SeparationOverride = 0
};
vBox.AddChild(hBox);
_charactersVBox = new VBoxContainer();
hBox.AddChild(new MarginContainer
hBox.AddChild(new ScrollContainer
{
CustomMinimumSize = (330, 0),
SizeFlagsHorizontal = SizeFlags.Fill,
MarginTopOverride = 5,
MarginLeftOverride = 5,
MinSize = (325, 0),
Margin = new Thickness(5, 5, 0, 0),
Children =
{
new ScrollContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
Children =
{
_charactersVBox
}
}
_charactersVBox
}
});
@@ -152,7 +133,7 @@ namespace Content.Client.UserInterface
hBox.AddChild(new PanelContainer
{
PanelOverride = new StyleBoxFlat {BackgroundColor = StyleNano.NanoGold},
CustomMinimumSize = (2, 0)
MinSize = (2, 0)
});
_humanoidProfileEditor = new HumanoidProfileEditor(preferencesManager, prototypeManager, entityManager);
_humanoidProfileEditor.OnProfileChanged += newProfile => { UpdateUI(); };
@@ -266,7 +247,7 @@ namespace Content.Client.UserInterface
{
Text = description,
ClipText = true,
SizeFlagsHorizontal = SizeFlags.FillExpand
HorizontalExpand = true
};
var deleteButton = new Button
{
@@ -281,7 +262,7 @@ namespace Content.Client.UserInterface
var internalHBox = new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
SeparationOverride = 0,
Children =
{

View File

@@ -131,8 +131,8 @@ namespace Content.Client.UserInterface.Controls
SlotIndex = slotIndex;
MouseFilter = MouseFilterMode.Stop;
CustomMinimumSize = (64, 64);
SizeFlagsVertical = SizeFlags.None;
MinSize = (64, 64);
VerticalAlignment = VAlignment.Top;
TooltipDelay = CustomTooltipDelay;
TooltipSupplier = SupplyTooltip;
@@ -144,29 +144,29 @@ namespace Content.Client.UserInterface.Controls
_bigActionIcon = new TextureRect
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
HorizontalExpand = true,
VerticalExpand = true,
Stretch = TextureRect.StretchMode.Scale,
Visible = false
};
_bigItemSpriteView = new SpriteView
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
HorizontalExpand = true,
VerticalExpand = true,
Scale = (2,2),
Visible = false
};
_smallActionIcon = new TextureRect
{
SizeFlagsHorizontal = SizeFlags.ShrinkEnd,
SizeFlagsVertical = SizeFlags.ShrinkEnd,
HorizontalAlignment = HAlignment.Right,
VerticalAlignment = VAlignment.Bottom,
Stretch = TextureRect.StretchMode.Scale,
Visible = false
};
_smallItemSpriteView = new SpriteView
{
SizeFlagsHorizontal = SizeFlags.ShrinkEnd,
SizeFlagsVertical = SizeFlags.ShrinkEnd,
HorizontalAlignment = HAlignment.Right,
VerticalAlignment = VAlignment.Bottom,
Visible = false
};
@@ -175,28 +175,26 @@ namespace Content.Client.UserInterface.Controls
// padding to the left of the number to shift it right
var paddingBox = new HBoxContainer()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
CustomMinimumSize = (64, 64)
HorizontalExpand = true,
VerticalExpand = true,
MinSize = (64, 64)
};
paddingBox.AddChild(new Control()
{
CustomMinimumSize = (4, 4),
SizeFlagsVertical = SizeFlags.Fill
MinSize = (4, 4),
});
paddingBox.AddChild(_number);
// padding to the left of the small icon
var paddingBoxItemIcon = new HBoxContainer()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
CustomMinimumSize = (64, 64)
HorizontalExpand = true,
VerticalExpand = true,
MinSize = (64, 64)
};
paddingBoxItemIcon.AddChild(new Control()
{
CustomMinimumSize = (32, 32),
SizeFlagsVertical = SizeFlags.Fill
MinSize = (32, 32),
});
paddingBoxItemIcon.AddChild(new Control
{

View File

@@ -38,9 +38,18 @@ namespace Content.Client.UserInterface
var rootContainer = new TabContainer();
var patronsList = new ScrollContainer();
var ss14ContributorsList = new ScrollContainer();
var licensesList = new ScrollContainer();
var patronsList = new ScrollContainer
{
HScrollEnabled = false
};
var ss14ContributorsList = new ScrollContainer
{
HScrollEnabled = false
};
var licensesList = new ScrollContainer
{
HScrollEnabled = false
};
rootContainer.AddChild(ss14ContributorsList);
rootContainer.AddChild(patronsList);
@@ -56,14 +65,15 @@ namespace Content.Client.UserInterface
Contents.AddChild(rootContainer);
CustomMinimumSize = (650, 450);
SetSize = (650, 650);
}
private void PopulateLicenses(ScrollContainer licensesList)
{
var margin = new MarginContainer {MarginLeftOverride = 2, MarginTopOverride = 2};
var vBox = new VBoxContainer();
margin.AddChild(vBox);
var vBox = new VBoxContainer
{
Margin = new Thickness(2, 2, 0, 0)
};
foreach (var entry in CreditsManager.GetLicenses().OrderBy(p => p.Name))
{
@@ -77,14 +87,15 @@ namespace Content.Client.UserInterface
}
}
licensesList.AddChild(margin);
licensesList.AddChild(vBox);
}
private void PopulatePatronsList(Control patronsList)
{
var margin = new MarginContainer {MarginLeftOverride = 2, MarginTopOverride = 2};
var vBox = new VBoxContainer();
margin.AddChild(vBox);
var vBox = new VBoxContainer
{
Margin = new Thickness(2, 2, 0, 0)
};
var patrons = LoadPatrons();
// Do not show "become a patron" button on Steam builds
@@ -95,7 +106,7 @@ namespace Content.Client.UserInterface
vBox.AddChild(patronButton = new Button
{
Text = "Become a Patron",
SizeFlagsHorizontal = SizeFlags.ShrinkCenter
HorizontalAlignment = HAlignment.Center
});
patronButton.OnPressed +=
@@ -107,7 +118,7 @@ namespace Content.Client.UserInterface
{
if (!first)
{
vBox.AddChild(new Control {CustomMinimumSize = (0, 10)});
vBox.AddChild(new Control {MinSize = (0, 10)});
}
first = false;
@@ -123,7 +134,7 @@ namespace Content.Client.UserInterface
patronsList.AddChild(margin);
patronsList.AddChild(vBox);
}
private IEnumerable<PatronEntry> LoadPatrons()
@@ -140,17 +151,14 @@ namespace Content.Client.UserInterface
{
Button contributeButton;
var margin = new MarginContainer
var vBox = new VBoxContainer
{
MarginLeftOverride = 2,
MarginTopOverride = 2
Margin = new Thickness(2, 2, 0, 0)
};
var vBox = new VBoxContainer();
margin.AddChild(vBox);
vBox.AddChild(new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
HorizontalAlignment = HAlignment.Center,
SeparationOverride = 20,
Children =
{
@@ -165,7 +173,7 @@ namespace Content.Client.UserInterface
{
if (!first)
{
vBox.AddChild(new Control {CustomMinimumSize = (0, 10)});
vBox.AddChild(new Control {MinSize = (0, 10)});
}
first = false;
@@ -190,7 +198,7 @@ namespace Content.Client.UserInterface
AddSection("Original Space Station 13 Remake Team", "OriginalRemake.txt");
AddSection("Special Thanks", "SpecialThanks.txt", true);
contributorsList.AddChild(margin);
contributorsList.AddChild(vBox);
contributeButton.OnPressed += _ =>
IoCManager.Resolve<IUriOpener>().OpenUri(UILinks.GitHub);

View File

@@ -132,7 +132,7 @@ namespace Content.Client.UserInterface
public void Initialize()
{
RootControl = new LC();
RootControl = new LC { Name = "AAAAAAAAAAAAAAAAAAAAAA"};
LC.SetAnchorPreset(RootControl, LC.LayoutPreset.Wide);
var escapeTexture = _resourceCache.GetTexture("/Textures/Interface/hamburger.svg.192dpi.png");
@@ -162,7 +162,7 @@ namespace Content.Client.UserInterface
_buttonEscapeMenu = new TopButton(escapeTexture, EngineKeyFunctions.EscapeMenu, _inputManager)
{
ToolTip = Loc.GetString("Open escape menu."),
CustomMinimumSize = (70, 64),
MinSize = (70, 64),
StyleClasses = {StyleBase.ButtonOpenRight}
};
@@ -174,7 +174,7 @@ namespace Content.Client.UserInterface
_buttonCharacterMenu = new TopButton(characterTexture, ContentKeyFunctions.OpenCharacterMenu, _inputManager)
{
ToolTip = Loc.GetString("Open character menu."),
CustomMinimumSize = topMinSize,
MinSize = topMinSize,
Visible = false,
StyleClasses = {StyleBase.ButtonSquare}
};
@@ -187,7 +187,7 @@ namespace Content.Client.UserInterface
_buttonInventoryMenu = new TopButton(inventoryTexture, ContentKeyFunctions.OpenInventoryMenu, _inputManager)
{
ToolTip = Loc.GetString("Open inventory menu."),
CustomMinimumSize = topMinSize,
MinSize = topMinSize,
Visible = false,
StyleClasses = {StyleBase.ButtonSquare}
};
@@ -200,7 +200,7 @@ namespace Content.Client.UserInterface
_buttonCraftingMenu = new TopButton(craftingTexture, ContentKeyFunctions.OpenCraftingMenu, _inputManager)
{
ToolTip = Loc.GetString("Open crafting menu."),
CustomMinimumSize = topMinSize,
MinSize = topMinSize,
Visible = false,
StyleClasses = {StyleBase.ButtonSquare}
};
@@ -213,7 +213,7 @@ namespace Content.Client.UserInterface
_buttonActionsMenu = new TopButton(actionsTexture, ContentKeyFunctions.OpenActionsMenu, _inputManager)
{
ToolTip = Loc.GetString("Open actions menu."),
CustomMinimumSize = topMinSize,
MinSize = topMinSize,
Visible = false,
StyleClasses = {StyleBase.ButtonSquare}
};
@@ -226,7 +226,7 @@ namespace Content.Client.UserInterface
_buttonAdminMenu = new TopButton(adminTexture, ContentKeyFunctions.OpenAdminMenu, _inputManager)
{
ToolTip = Loc.GetString("Open admin menu."),
CustomMinimumSize = topMinSize,
MinSize = topMinSize,
Visible = false,
StyleClasses = {StyleBase.ButtonSquare}
};
@@ -239,7 +239,7 @@ namespace Content.Client.UserInterface
_buttonSandboxMenu = new TopButton(sandboxTexture, ContentKeyFunctions.OpenSandboxWindow, _inputManager)
{
ToolTip = Loc.GetString("Open sandbox menu."),
CustomMinimumSize = topMinSize,
MinSize = topMinSize,
Visible = false,
StyleClasses = {StyleBase.ButtonSquare}
};
@@ -252,7 +252,7 @@ namespace Content.Client.UserInterface
_buttonTutorial = new TopButton(tutorialTexture, ContentKeyFunctions.OpenTutorial, _inputManager)
{
ToolTip = Loc.GetString("Open tutorial."),
CustomMinimumSize = topMinSize,
MinSize = topMinSize,
StyleClasses = {StyleBase.ButtonOpenLeft, TopButton.StyleClassRedTopButton},
};
@@ -300,25 +300,25 @@ namespace Content.Client.UserInterface
LC.SetMarginBottom(centerBottomContainer, -10f);
RootControl.AddChild(centerBottomContainer);
HandsContainer = new MarginContainer
HandsContainer = new Control
{
SizeFlagsVertical = Control.SizeFlags.ShrinkEnd
VerticalAlignment = Control.VAlignment.Bottom,
};
RightInventoryQuickButtonContainer = new MarginContainer
RightInventoryQuickButtonContainer = new Control
{
SizeFlagsVertical = Control.SizeFlags.ShrinkEnd
VerticalAlignment = Control.VAlignment.Bottom,
};
LeftInventoryQuickButtonContainer = new MarginContainer
LeftInventoryQuickButtonContainer = new Control
{
SizeFlagsVertical = Control.SizeFlags.ShrinkEnd
VerticalAlignment = Control.VAlignment.Bottom,
};
centerBottomContainer.AddChild(LeftInventoryQuickButtonContainer);
centerBottomContainer.AddChild(HandsContainer);
centerBottomContainer.AddChild(RightInventoryQuickButtonContainer);
SuspicionContainer = new MarginContainer
SuspicionContainer = new Control
{
SizeFlagsHorizontal = Control.SizeFlags.ShrinkCenter
HorizontalAlignment = Control.HAlignment.Center
};
RootControl.AddChild(SuspicionContainer);
@@ -330,7 +330,7 @@ namespace Content.Client.UserInterface
_topNotificationContainer = new VBoxContainer
{
CustomMinimumSize = (600, 0)
MinSize = (600, 0)
};
RootControl.AddChild(_topNotificationContainer);
LC.SetAnchorPreset(_topNotificationContainer, LC.LayoutPreset.CenterTop);
@@ -498,21 +498,21 @@ namespace Content.Client.UserInterface
{
Children =
{
new Control {CustomMinimumSize = (0, VertPad)},
(_textureRect = new TextureRect
{
TextureScale = (0.5f, 0.5f),
Texture = texture,
SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
SizeFlagsVertical = SizeFlags.Expand | SizeFlags.ShrinkCenter,
HorizontalAlignment = HAlignment.Center,
VerticalAlignment = VAlignment.Center,
VerticalExpand = true,
Margin = new Thickness(0, VertPad),
ModulateSelfOverride = NormalColor,
Stretch = TextureRect.StretchMode.KeepCentered
}),
new Control {CustomMinimumSize = (0, VertPad)},
(_label = new Label
{
Text = ShortKeyName(_function),
SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
HorizontalAlignment = HAlignment.Center,
ModulateSelfOverride = NormalColor,
StyleClasses = {StyleClassLabelTopButton}
})

View File

@@ -54,41 +54,33 @@ namespace Content.Client.UserInterface
public class GhostTargetWindow : SS14Window
{
protected override Vector2? CustomSize => (300, 450);
private readonly GhostComponent _owner;
private readonly VBoxContainer _buttonContainer;
public GhostTargetWindow(GhostComponent owner)
{
MinSize = SetSize = (300, 450);
Title = "Ghost Warp";
_owner = owner;
_owner.GhostRequestWarpPoint();
_owner.GhostRequestPlayerNames();
var margin = new MarginContainer()
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand,
};
_buttonContainer = new VBoxContainer()
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.Fill,
VerticalExpand = true,
SeparationOverride = 5,
};
var scrollBarContainer = new ScrollContainer()
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand
VerticalExpand = true,
HorizontalExpand = true
};
margin.AddChild(scrollBarContainer);
scrollBarContainer.AddChild(_buttonContainer);
Contents.AddChild(margin);
Contents.AddChild(scrollBarContainer);
}
public void Populate()
@@ -107,10 +99,10 @@ namespace Content.Client.UserInterface
{
Text = value,
TextAlign = Label.AlignMode.Right,
SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
HorizontalAlignment = HAlignment.Center,
VerticalAlignment = VAlignment.Center,
SizeFlagsStretchRatio = 1,
CustomMinimumSize = (230, 20),
MinSize = (230, 20),
ClipText = true,
};
@@ -131,10 +123,10 @@ namespace Content.Client.UserInterface
{
Text = $"Warp: {name}",
TextAlign = Label.AlignMode.Right,
SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
HorizontalAlignment = HAlignment.Center,
VerticalAlignment = VAlignment.Center,
SizeFlagsStretchRatio = 1,
CustomMinimumSize = (230,20),
MinSize = (230,20),
ClipText = true,
};

View File

@@ -63,7 +63,8 @@ namespace Content.Client.UserInterface
public HumanoidCharacterProfile Profile;
public event Action<HumanoidCharacterProfile> OnProfileChanged;
public HumanoidProfileEditor(IClientPreferencesManager preferencesManager, IPrototypeManager prototypeManager, IEntityManager entityManager)
public HumanoidProfileEditor(IClientPreferencesManager preferencesManager, IPrototypeManager prototypeManager,
IEntityManager entityManager)
{
_random = IoCManager.Resolve<IRobustRandom>();
_prototypeManager = prototypeManager;
@@ -74,17 +75,9 @@ namespace Content.Client.UserInterface
AddChild(hbox);
#region Left
var margin = new MarginContainer
{
MarginTopOverride = 10,
MarginBottomOverride = 10,
MarginLeftOverride = 10,
MarginRightOverride = 10
};
hbox.AddChild(margin);
var vBox = new VBoxContainer();
margin.AddChild(vBox);
var vBox = new VBoxContainer {Margin = new Thickness(10)};
hbox.AddChild(vBox);
var middleContainer = new HBoxContainer
{
@@ -116,13 +109,13 @@ namespace Content.Client.UserInterface
var panel = HighlightedContainer();
var hBox = new HBoxContainer
{
SizeFlagsVertical = SizeFlags.FillExpand
VerticalExpand = true
};
var nameLabel = new Label { Text = Loc.GetString("Name:") };
var nameLabel = new Label {Text = Loc.GetString("Name:")};
_nameEdit = new LineEdit
{
CustomMinimumSize = (270, 0),
SizeFlagsVertical = SizeFlags.ShrinkCenter
MinSize = (270, 0),
VerticalAlignment = VAlignment.Center
};
_nameEdit.OnTextChanged += args => { SetName(args.Text); };
var nameRandomButton = new Button
@@ -139,7 +132,7 @@ namespace Content.Client.UserInterface
#endregion Name
var tabContainer = new TabContainer { SizeFlagsVertical = SizeFlags.FillExpand };
var tabContainer = new TabContainer {VerticalExpand = true};
vBox.AddChild(tabContainer);
#region Appearance
@@ -161,7 +154,7 @@ namespace Content.Client.UserInterface
{
var panel = HighlightedContainer();
var hBox = new HBoxContainer();
var sexLabel = new Label { Text = Loc.GetString("Sex:") };
var sexLabel = new Label {Text = Loc.GetString("Sex:")};
var sexButtonGroup = new ButtonGroup();
@@ -209,8 +202,8 @@ namespace Content.Client.UserInterface
{
var panel = HighlightedContainer();
var hBox = new HBoxContainer();
var ageLabel = new Label { Text = Loc.GetString("Age:") };
_ageEdit = new LineEdit { CustomMinimumSize = (40, 0) };
var ageLabel = new Label {Text = Loc.GetString("Age:")};
_ageEdit = new LineEdit {MinSize = (40, 0)};
_ageEdit.OnTextChanged += args =>
{
if (!int.TryParse(args.Text, out var newAge))
@@ -230,7 +223,7 @@ namespace Content.Client.UserInterface
{
var panel = HighlightedContainer();
var hBox = new HBoxContainer();
var genderLabel = new Label { Text = Loc.GetString("Pronouns:") };
var genderLabel = new Label {Text = Loc.GetString("Pronouns:")};
_genderButton = new OptionButton();
@@ -257,7 +250,7 @@ namespace Content.Client.UserInterface
{
var panel = HighlightedContainer();
panel.SizeFlagsHorizontal = SizeFlags.None;
panel.HorizontalAlignment = HAlignment.Left;
var hairHBox = new HBoxContainer();
_hairPicker = new HairStylePicker();
@@ -316,7 +309,7 @@ namespace Content.Client.UserInterface
{
var panel = HighlightedContainer();
var hBox = new HBoxContainer();
var clothingLabel = new Label { Text = Loc.GetString("Clothing:") };
var clothingLabel = new Label {Text = Loc.GetString("Clothing:")};
_clothingButton = new OptionButton();
@@ -342,7 +335,7 @@ namespace Content.Client.UserInterface
{
var panel = HighlightedContainer();
var hBox = new HBoxContainer();
var backpackLabel = new Label { Text = Loc.GetString("Backpack:") };
var backpackLabel = new Label {Text = Loc.GetString("Backpack:")};
_backpackButton = new OptionButton();
@@ -379,7 +372,7 @@ namespace Content.Client.UserInterface
(_preferenceUnavailableButton = new OptionButton()),
new ScrollContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
Children =
{
jobList
@@ -433,7 +426,7 @@ namespace Content.Client.UserInterface
{
category.AddChild(new Control
{
CustomMinimumSize = new Vector2(0, 23),
MinSize = new Vector2(0, 23),
});
}
@@ -498,7 +491,7 @@ namespace Content.Client.UserInterface
{
new ScrollContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
Children =
{
antagList
@@ -519,6 +512,7 @@ namespace Content.Client.UserInterface
{
continue;
}
var selector = new AntagPreferenceSelector(antag);
antagList.AddChild(selector);
_antagPreferences.Add(selector);
@@ -568,7 +562,7 @@ namespace Content.Client.UserInterface
_saveButton = new Button
{
Text = Loc.GetString("Save"),
SizeFlagsHorizontal = SizeFlags.ShrinkCenter
HorizontalAlignment = HAlignment.Center
};
_saveButton.OnPressed += args => { Save(); };
panel.AddChild(_saveButton);
@@ -581,19 +575,10 @@ namespace Content.Client.UserInterface
#region Right
margin = new MarginContainer
{
MarginTopOverride = 10,
MarginBottomOverride = 10,
MarginLeftOverride = 10,
MarginRightOverride = 10
};
hbox.AddChild(margin);
vBox = new VBoxContainer()
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand,
VerticalExpand = true,
HorizontalExpand = true,
};
hbox.AddChild(vBox);
@@ -605,8 +590,7 @@ namespace Content.Client.UserInterface
// Front
var box = new Control()
{
SizeFlagsHorizontal = SizeFlags.Fill,
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
SizeFlagsStretchRatio = 1f,
};
vBox.AddChild(box);
@@ -615,7 +599,7 @@ namespace Content.Client.UserInterface
Sprite = sprite,
Scale = (6, 6),
OverrideDirection = Direction.South,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
VerticalAlignment = VAlignment.Center,
SizeFlagsStretchRatio = 1
};
box.AddChild(_previewSprite);
@@ -623,8 +607,7 @@ namespace Content.Client.UserInterface
// Side
box = new Control()
{
SizeFlagsHorizontal = SizeFlags.Fill,
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
SizeFlagsStretchRatio = 1f,
};
vBox.AddChild(box);
@@ -633,7 +616,7 @@ namespace Content.Client.UserInterface
Sprite = sprite,
Scale = (6, 6),
OverrideDirection = Direction.East,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
VerticalAlignment = VAlignment.Center,
SizeFlagsStretchRatio = 1
};
box.AddChild(_previewSpriteSide);
@@ -862,7 +845,8 @@ namespace Content.Client.UserInterface
if (job.Icon != null)
{
var specifier = new SpriteSpecifier.Rsi(new ResourcePath("/Textures/Interface/Misc/job_icons.rsi"), job.Icon);
var specifier = new SpriteSpecifier.Rsi(new ResourcePath("/Textures/Interface/Misc/job_icons.rsi"),
job.Icon);
icon.Texture = specifier.Frame0();
}
@@ -871,7 +855,7 @@ namespace Content.Client.UserInterface
Children =
{
icon,
new Label {Text = job.Name, CustomMinimumSize = (175, 0)},
new Label {Text = job.Name, MinSize = (175, 0)},
_optionButton
}
});
@@ -918,6 +902,7 @@ namespace Content.Client.UserInterface
}
});
}
private void OnCheckBoxToggled(BaseButton.ButtonToggledEventArgs args)
{
PreferenceChanged?.Invoke(Preference);

View File

@@ -8,7 +8,7 @@ using Robust.Shared.Maths;
namespace Content.Client.UserInterface
{
public class ItemSlotButton : MarginContainer
public class ItemSlotButton : Control
{
private const string HighlightShader = "SelectionOutlineInrange";
@@ -29,7 +29,7 @@ namespace Content.Client.UserInterface
public ItemSlotButton(Texture texture, Texture storageTexture)
{
CustomMinimumSize = (64, 64);
MinSize = (64, 64);
AddChild(Button = new TextureRect
{
@@ -41,7 +41,7 @@ namespace Content.Client.UserInterface
AddChild(_highlightRect = new PanelContainer
{
StyleClasses = { StyleNano.StyleClassHandSlotHighlight },
CustomMinimumSize = (32, 32),
MinSize = (32, 32),
Visible = false
});
@@ -63,8 +63,8 @@ namespace Content.Client.UserInterface
{
TextureNormal = storageTexture,
Scale = (0.75f, 0.75f),
SizeFlagsHorizontal = SizeFlags.ShrinkEnd,
SizeFlagsVertical = SizeFlags.ShrinkEnd,
HorizontalAlignment = HAlignment.Right,
VerticalAlignment = VAlignment.Bottom,
Visible = false,
});
@@ -92,8 +92,6 @@ namespace Content.Client.UserInterface
AddChild(CooldownDisplay = new CooldownGraphic
{
SizeFlagsHorizontal = SizeFlags.Fill,
SizeFlagsVertical = SizeFlags.Fill,
Visible = false,
});
}

View File

@@ -64,7 +64,10 @@ namespace Content.Client.UserInterface
}
}
});
SizeFlagsVertical = SizeFlags.ShrinkEnd;
VerticalAlignment = VAlignment.Bottom;
// TODO: Depending on if its a two-hand panel or not
MinSize = (150, 0);
}
/// <summary>
@@ -156,11 +159,5 @@ namespace Content.Client.UserInterface
_activeStatusComponents.Add((statusComponent, control));
}
}
// TODO: Depending on if its a two-hand panel or not
protected override Vector2 CalculateMinimumSize()
{
return Vector2.ComponentMax(base.CalculateMinimumSize(), (150, 0));
}
}
}

View File

@@ -24,8 +24,6 @@ namespace Content.Client.UserInterface
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;
[Dependency] private readonly IClientGameTicker _gameTicker = default!;
protected override Vector2? CustomSize => (360, 560);
public event Action<string> SelectedId;
private readonly Dictionary<string, JobButton> _jobButtons = new();
@@ -33,6 +31,7 @@ namespace Content.Client.UserInterface
public LateJoinGui()
{
MinSize = SetSize = (360, 560);
IoCManager.InjectDependencies(this);
Title = Loc.GetString("Late Join");
@@ -44,7 +43,7 @@ namespace Content.Client.UserInterface
{
new ScrollContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
Children =
{
jobList
@@ -77,7 +76,7 @@ namespace Content.Client.UserInterface
{
category.AddChild(new Control
{
CustomMinimumSize = new Vector2(0, 23),
MinSize = new Vector2(0, 23),
});
}
@@ -104,7 +103,7 @@ namespace Content.Client.UserInterface
var jobSelector = new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand
HorizontalExpand = true
};
var icon = new TextureRect

Some files were not shown because too many files have changed in this diff Show More