Remove encapsulation for previously protected XAML UI fields (#4975)

This commit is contained in:
Visne
2021-10-28 14:23:17 +02:00
committed by GitHub
parent aed66cfc48
commit ac78145b94
49 changed files with 158 additions and 202 deletions

View File

@@ -4,12 +4,12 @@
MinWidth="500">
<GridContainer Columns="1">
<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
<LineEdit Name="_announcer" PlaceHolder="{Loc 'announcer-placeholder'}" Text="{Loc 'Central Command'}" HorizontalExpand="True" SizeFlagsStretchRatio="2"/>
<LineEdit Name="Announcer" Access="Public" PlaceHolder="{Loc 'announcer-placeholder'}" Text="{Loc 'Central Command'}" HorizontalExpand="True" SizeFlagsStretchRatio="2"/>
<Control HorizontalExpand="True" SizeFlagsStretchRatio="1" />
<OptionButton Name="_announceMethod" HorizontalExpand="True" SizeFlagsStretchRatio="2"/>
<OptionButton Name="AnnounceMethod" Access="Public" HorizontalExpand="True" SizeFlagsStretchRatio="2"/>
</BoxContainer>
<LineEdit Name="_announcement" PlaceHolder="{Loc 'announcement-placeholder'}"/>
<LineEdit Name="Announcement" Access="Public" PlaceHolder="{Loc 'announcement-placeholder'}"/>
<Button Name="_announceButton" Disabled="True" Text="{Loc 'Announce'}" HorizontalAlignment="Center"/>
<Button Name="AnnounceButton" Access="Public" Disabled="True" Text="{Loc 'Announce'}" HorizontalAlignment="Center"/>
</GridContainer>
</SS14Window>

View File

@@ -13,10 +13,6 @@ namespace Content.Client.Administration.UI
public partial class AdminAnnounceWindow : SS14Window
{
[Dependency] private readonly ILocalizationManager _localization = default!;
public Button AnnounceButton => _announceButton;
public OptionButton AnnounceMethod => _announceMethod;
public LineEdit Announcer => _announcer;
public LineEdit Announcement => _announcement;
public AdminAnnounceWindow()
{

View File

@@ -112,7 +112,7 @@ namespace Content.Client.Alerts
{
_alertControls.Remove(alertKeyToRemove, out var control);
if (control == null) return;
_ui.Grid.Children.Remove(control);
_ui.AlertContainer.Children.Remove(control);
}
// now we know that alertControls contains alerts that should still exist but
@@ -145,7 +145,7 @@ namespace Content.Client.Alerts
{
if (existingAlertControl != null)
{
_ui.Grid.Children.Remove(existingAlertControl);
_ui.AlertContainer.Children.Remove(existingAlertControl);
}
// this is a new alert + alert key or just a different alert with the same
@@ -154,12 +154,12 @@ namespace Content.Client.Alerts
if (_alertOrder != null)
{
var added = false;
foreach (var alertControl in _ui.Grid.Children)
foreach (var alertControl in _ui.AlertContainer.Children)
{
if (_alertOrder.Compare(newAlert, ((AlertControl) alertControl).Alert) < 0)
{
var idx = alertControl.GetPositionInParent();
_ui.Grid.Children.Add(newAlertControl);
_ui.AlertContainer.Children.Add(newAlertControl);
newAlertControl.SetPositionInParent(idx);
added = true;
break;
@@ -168,12 +168,12 @@ namespace Content.Client.Alerts
if (!added)
{
_ui.Grid.Children.Add(newAlertControl);
_ui.AlertContainer.Children.Add(newAlertControl);
}
}
else
{
_ui.Grid.Children.Add(newAlertControl);
_ui.AlertContainer.Children.Add(newAlertControl);
}
_alertControls[newAlert.AlertKey] = newAlertControl;

View File

@@ -3,7 +3,7 @@
<PanelContainer StyleClasses="TransparentBorderedWindowPanel"
HorizontalAlignment="Right"
VerticalAlignment="Top">
<GridContainer Name="AlertContainer" MaxGridHeight="64" ExpandBackwards="True">
<GridContainer Name="AlertContainer" Access="Public" MaxGridHeight="64" ExpandBackwards="True">
</GridContainer>
</PanelContainer>

View File

@@ -18,8 +18,6 @@ namespace Content.Client.Alerts.UI
public const float ChatSeparation = 38f;
public GridContainer Grid => AlertContainer;
public AlertsUI()
{
IoCManager.InjectDependencies(this);

View File

@@ -2,7 +2,7 @@
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
SetSize="400 600"
MinSize="400 600">
<BoxContainer Orientation="Vertical" Name="rows"> <!-- TODO: remove name -->
<BoxContainer Orientation="Vertical">
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'cargo-console-menu-account-name-label'}"
StyleClasses="LabelKeyText" />
@@ -28,7 +28,8 @@
Text="0/20" />
</BoxContainer>
<BoxContainer Orientation="Horizontal">
<Button Name="CallShuttleButtonProtected"
<Button Name="CallShuttleButton"
Access="Public"
Text="{Loc 'cargo-console-menu-call-shuttle-button'}"
TextAlign="Center"
HorizontalExpand="True"/>

View File

@@ -25,8 +25,6 @@ namespace Content.Client.Cargo.UI
public event Action<ButtonEventArgs>? OnOrderApproved;
public event Action<ButtonEventArgs>? OnOrderCanceled;
public Button CallShuttleButton => CallShuttleButtonProtected;
private readonly List<string> _categoryStrings = new();
private string? _category;

View File

@@ -3,15 +3,19 @@
<BoxContainer Orientation="Vertical">
<GridContainer Columns="2">
<Label Text="{Loc 'cargo-console-order-menu-requester-label'}" />
<LineEdit Name="RequesterProtected" />
<LineEdit Name="Requester"
Access="Public" />
<Label Text="{Loc 'cargo-console-order-menu-reason-label'}" />
<LineEdit Name="ReasonProtected" />
<LineEdit Name="Reason"
Access="Public" />
<Label Text="{Loc 'cargo-console-order-menu-amount-label'}" />
<SpinBox Name="AmountProtected"
<SpinBox Name="Amount"
Access="Public"
HorizontalExpand="True"
Value="1" />
</GridContainer>
<Button Name="SubmitButtonProtected"
<Button Name="SubmitButton"
Access="Public"
Text="{Loc 'cargo-console-order-menu-submit-button'}"
TextAlign="Center" />
</BoxContainer>

View File

@@ -10,11 +10,6 @@ namespace Content.Client.Cargo.UI
[GenerateTypedNameReferences]
partial class CargoConsoleOrderMenu : SS14Window
{
public LineEdit Requester => RequesterProtected;
public LineEdit Reason => ReasonProtected;
public SpinBox Amount => AmountProtected;
public Button SubmitButton => SubmitButtonProtected;
public CargoConsoleOrderMenu()
{
RobustXamlLoader.Load(this);

View File

@@ -2,25 +2,30 @@
HorizontalExpand="True">
<BoxContainer Orientation="Horizontal"
HorizontalExpand="True">
<TextureRect Name="IconProtected"
<TextureRect Name="Icon"
Access="Public"
MinSize="32 32"
RectClipContent="True" />
<BoxContainer Orientation="Vertical"
HorizontalExpand="True"
VerticalExpand="True">
<Label Name="ProductNameProtected"
<Label Name="ProductName"
Access="Public"
HorizontalExpand="True"
StyleClasses="LabelSubText"
ClipText="True" />
<Label Name="DescriptionProtected"
<Label Name="Description"
Access="Public"
HorizontalExpand="True"
StyleClasses="LabelSubText"
ClipText="True" />
</BoxContainer>
<Button Name="ApproveProtected"
<Button Name="Approve"
Access="Public"
Text="{Loc 'cargo-console-menu-cargo-order-row-approve-button'}"
StyleClasses="LabelSubText" />
<Button Name="CancelProtected"
<Button Name="Cancel"
Access="Public"
Text="{Loc 'cargo-console-menu-cargo-order-row-cancel-button'}"
StyleClasses="LabelSubText" />
</BoxContainer>

View File

@@ -9,11 +9,6 @@ namespace Content.Client.Cargo.UI
public partial class CargoOrderRow : PanelContainer
{
public CargoOrderData? Order { get; set; }
public TextureRect Icon => IconProtected;
public Label ProductName => ProductNameProtected;
public Label Description => DescriptionProtected;
public Button Approve => ApproveProtected;
public Button Cancel => CancelProtected;
public CargoOrderRow()
{

View File

@@ -1,21 +1,25 @@
<PanelContainer xmlns="https://spacestation14.io"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
HorizontalExpand="True">
<Button Name="MainButtonProtected"
<Button Name="MainButton"
Access="Public"
HorizontalExpand="True"
VerticalExpand="True" />
<BoxContainer Orientation="Horizontal"
HorizontalExpand="True">
<TextureRect Name="IconProtected"
<TextureRect Name="Icon"
Access="Public"
MinSize="32 32"
RectClipContent="True" />
<Label Name="ProductNameProtected"
<Label Name="ProductName"
Access="Public"
HorizontalExpand="True" />
<PanelContainer>
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#25252A" />
</PanelContainer.PanelOverride>
<Label Name="PointCostProtected"
<Label Name="PointCost"
Access="Public"
MinSize="40 32"
Align="Right" />
</PanelContainer>

View File

@@ -9,10 +9,6 @@ namespace Content.Client.Cargo.UI
public partial class CargoProductRow : PanelContainer
{
public CargoProductPrototype? Product { get; set; }
public TextureRect Icon => IconProtected;
public Button MainButton => MainButtonProtected;
public Label ProductName => ProductNameProtected;
public Label PointCost => PointCostProtected;
public CargoProductRow()
{

View File

@@ -16,9 +16,9 @@ namespace Content.Client.Chemistry.UI
base.Open();
_window = new TransferAmountWindow();
_window.applyButton.OnPressed += _ =>
_window.ApplyButton.OnPressed += _ =>
{
if (int.TryParse(_window.amountLineEdit.Text, out var i))
if (int.TryParse(_window.AmountLineEdit.Text, out var i))
{
SendMessage(new TransferAmountSetValueMessage(ReagentUnit.New(i)));
_window.Close();

View File

@@ -4,8 +4,8 @@
<BoxContainer Orientation="Vertical" SeparationOverride="4" MinSize="240 80">
<BoxContainer Orientation="Horizontal">
<LineEdit Name="AmountLineEdit" HorizontalExpand="True" PlaceHolder="{Loc 'ui-transfer-amount-line-edit-placeholder'}"/>
<LineEdit Name="AmountLineEdit" Access="Public" HorizontalExpand="True" PlaceHolder="{Loc 'ui-transfer-amount-line-edit-placeholder'}"/>
</BoxContainer>
<Button Name="ApplyButton" Text="{Loc 'ui-transfer-amount-apply'}"/>
<Button Name="ApplyButton" Access="Public" Text="{Loc 'ui-transfer-amount-apply'}"/>
</BoxContainer>
</SS14Window>

View File

@@ -8,9 +8,6 @@ namespace Content.Client.Chemistry.UI
[GenerateTypedNameReferences]
public partial class TransferAmountWindow : SS14Window
{
public Button applyButton => ApplyButton;
public LineEdit amountLineEdit => AmountLineEdit;
public TransferAmountWindow()
{
RobustXamlLoader.Load(this);

View File

@@ -3,9 +3,9 @@
<BoxContainer Orientation="Vertical" HorizontalExpand="True" SizeFlagsStretchRatio="0.4">
<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
<LineEdit Name="SearchBar" PlaceHolder="Search" HorizontalExpand="True"/>
<OptionButton Name="Category" MinSize="130 0"/>
<OptionButton Name="Category" Access="Public" MinSize="130 0"/>
</BoxContainer>
<ItemList Name="RecipesList" SelectMode="Single" VerticalExpand="True"/>
<ItemList Name="Recipes" Access="Public" SelectMode="Single" VerticalExpand="True"/>
</BoxContainer>
<Control MinSize="10 0"/>
<BoxContainer Orientation="Vertical" HorizontalExpand="True" SizeFlagsStretchRatio="0.6">
@@ -19,7 +19,7 @@
</BoxContainer>
</BoxContainer>
</Control>
<ItemList Name="StepList" VerticalExpand="True"/>
<ItemList Name="RecipeStepList" Access="Public" VerticalExpand="True"/>
<BoxContainer Orientation="Vertical">
<Button Name="BuildButton" Disabled="True" ToggleMode="True" VerticalExpand="True" SizeFlagsStretchRatio="0.5"/>
<BoxContainer Orientation="Horizontal" VerticalExpand="True" SizeFlagsStretchRatio="0.5">

View File

@@ -20,7 +20,7 @@ namespace Content.Client.Construction.UI
// It isn't optimal to expose UI controls like this, but the UI control design is
// questionable so it can't be helped.
string[] Categories { get; set; }
OptionButton CategoryButton { get; }
OptionButton Category { get; }
bool EraseButtonPressed { get; set; }
bool BuildButtonPressed { get; set; }
@@ -63,19 +63,12 @@ namespace Content.Client.Construction.UI
public string[] Categories { get; set; } = Array.Empty<string>();
public OptionButton CategoryButton => Category;
public bool EraseButtonPressed
{
get => EraseButton.Pressed;
set => EraseButton.Pressed = value;
}
/// <inheritdoc />
public ItemList Recipes => RecipesList;
public ItemList RecipeStepList => StepList;
public ConstructionMenu()
{
SetSize = MinSize = (720, 320);
@@ -86,8 +79,8 @@ namespace Content.Client.Construction.UI
Title = Loc.GetString("construction-menu-title");
BuildButton.Text = Loc.GetString("construction-menu-place-ghost");
RecipesList.OnItemSelected += obj => RecipeSelected?.Invoke(this, obj.ItemList[obj.ItemIndex]);
RecipesList.OnItemDeselected += _ => RecipeSelected?.Invoke(this, null);
Recipes.OnItemSelected += obj => RecipeSelected?.Invoke(this, obj.ItemList[obj.ItemIndex]);
Recipes.OnItemDeselected += _ => RecipeSelected?.Invoke(this, null);
SearchBar.OnTextChanged += _ => PopulateRecipes?.Invoke(this, (SearchBar.Text, Categories[Category.SelectedId]));
Category.OnItemSelected += obj =>
@@ -132,7 +125,7 @@ namespace Content.Client.Construction.UI
TargetName.SetMessage(string.Empty);
TargetDesc.SetMessage(string.Empty);
TargetTexture.Texture = null;
StepList.Clear();
RecipeStepList.Clear();
}
}
}

View File

@@ -199,7 +199,7 @@ namespace Content.Client.Construction.UI
uniqueCategories.Add(category);
}
_constructionView.CategoryButton.Clear();
_constructionView.Category.Clear();
var array = uniqueCategories.ToArray();
Array.Sort(array);
@@ -207,7 +207,7 @@ namespace Content.Client.Construction.UI
for (var i = 0; i < array.Length; i++)
{
var category = array[i];
_constructionView.CategoryButton.AddItem(category, i);
_constructionView.Category.AddItem(category, i);
}
_constructionView.Categories = array;

View File

@@ -6,12 +6,14 @@
<Label Text="{Loc 'disposal-router-window-tags-label'}" />
<Control MinSize="0 10" />
<BoxContainer Orientation="Horizontal">
<LineEdit Name="TagInputProtected"
<LineEdit Name="TagInput"
Access="Public"
HorizontalExpand="True"
MinSize="320 0"
ToolTip="{Loc 'disposal-router-window-tag-input-tooltip'}" />
<Control MinSize="10 0" />
<Button Name="ConfirmProtected"
<Button Name="Confirm"
Access="Public"
Text="{Loc 'disposal-router-window-tag-input-confirm-button'}" />
</BoxContainer>
</BoxContainer>

View File

@@ -13,9 +13,6 @@ namespace Content.Client.Disposal.UI
[GenerateTypedNameReferences]
public partial class DisposalRouterWindow : SS14Window
{
public LineEdit TagInput => TagInputProtected;
public Button Confirm => ConfirmProtected;
public DisposalRouterWindow()
{
RobustXamlLoader.Load(this);

View File

@@ -6,11 +6,13 @@
<Label Text="{Loc 'disposal-tagger-window-tag-input-label'}" />
<Control MinSize="0 10" />
<BoxContainer Orientation="Horizontal">
<LineEdit Name="TagInputProtected"
<LineEdit Name="TagInput"
Access="Public"
HorizontalExpand="True"
MinSize="320 0" />
<Control MinSize="10 0" />
<Button Name="ConfirmProtected"
<Button Name="Confirm"
Access="Public"
Text="{Loc 'disposal-tagger-window-tag-confirm-button'}" />
</BoxContainer>
</BoxContainer>

View File

@@ -13,9 +13,6 @@ namespace Content.Client.Disposal.UI
[GenerateTypedNameReferences]
public partial class DisposalTaggerWindow : SS14Window
{
public LineEdit TagInput => TagInputProtected;
public Button Confirm => ConfirmProtected;
public DisposalTaggerWindow()
{
RobustXamlLoader.Load(this);

View File

@@ -23,14 +23,17 @@
</BoxContainer>
<Control MinSize="0 10" />
<BoxContainer Orientation="Horizontal">
<Button Name="EngageProtected"
<Button Name="Engage"
Access="Public"
Text="{Loc 'ui-disposal-unit-button-flush'}"
StyleClasses="OpenRight"
ToggleMode="True" />
<Button Name="EjectProtected"
<Button Name="Eject"
Access="Public"
Text="{Loc 'ui-disposal-unit-button-eject'}"
StyleClasses="OpenBoth" />
<CheckButton Name="PowerProtected"
<CheckButton Name="Power"
Access="Public"
Text="{Loc 'ui-disposal-unit-button-power'}"
StyleClasses="OpenLeft" />
</BoxContainer>

View File

@@ -19,10 +19,6 @@ namespace Content.Client.Disposal.UI
[GenerateTypedNameReferences]
public partial class DisposalUnitWindow : SS14Window
{
public Button Engage => EngageProtected;
public Button Eject => EjectProtected;
public Button Power => PowerProtected;
public DisposalUnitWindow()
{
IoCManager.InjectDependencies(this);

View File

@@ -6,7 +6,8 @@
<BoxContainer Orientation="Horizontal">
<RichTextLabel Name="Status" />
</BoxContainer>
<Button Name="SwitchProtected"
<Button Name="Switch"
Access="Public"
TextAlign="Center"
MinHeight="60" />
</BoxContainer>

View File

@@ -13,8 +13,6 @@ namespace Content.Client.Gravity.UI
{
private readonly GravityGeneratorBoundUserInterface _owner;
public Button Switch => SwitchProtected;
public GravityGeneratorWindow(GravityGeneratorBoundUserInterface ui)
{
RobustXamlLoader.Load(this);

View File

@@ -1,7 +1,7 @@
<customControls:BoxContainer Orientation="Vertical" xmlns:customControls="https://spacestation14.io">
<customControls:SplitContainer Orientation="Horizontal">
<customControls:Label Name="Label" Align="Center"/>
<customControls:Button Name="Button" TextAlign="Center"/>
</customControls:SplitContainer>
<customControls:ItemList Name="ItemList" VerticalExpand="True" HorizontalExpand="True" SelectMode="Button" SizeFlagsStretchRatio="2" MinSize="100 128"/>
</customControls:BoxContainer>
<BoxContainer Orientation="Vertical" xmlns="https://spacestation14.io">
<SplitContainer Orientation="Horizontal">
<Label Name="Label" Align="Center"/>
<Button Name="EjectButton" Access="Public" TextAlign="Center"/>
</SplitContainer>
<ItemList Name="BoxContents" Access="Public" VerticalExpand="True" HorizontalExpand="True" SelectMode="Button" SizeFlagsStretchRatio="2" MinSize="100 128"/>
</BoxContainer>

View File

@@ -7,9 +7,6 @@ namespace Content.Client.Kitchen.UI
public partial class LabelledContentBox : BoxContainer
{
public string? LabelText { get => Label.Text; set => Label.Text = value; }
public string? ButtonText { get => Button.Text; set => Button.Text = value; }
public ItemList BoxContents => ItemList;
public Button EjectButton => Button;
public string? ButtonText { get => EjectButton.Text; set => EjectButton.Text = value; }
}
}

View File

@@ -20,10 +20,10 @@
<!-- Top row -->
<BoxContainer Orientation="Horizontal" MinSize="0 40">
<Label Margin="8 0 0 0" StyleClasses="LabelHeadingBigger" VAlign="Center" Text="{Loc 'Lobby'}" />
<Label Name="CServerName" StyleClasses="LabelHeadingBigger" VAlign="Center" />
<ui:VoteCallMenuButton Name="CCallVoteButton" StyleClasses="ButtonBig" />
<Button Name="COptionsButton" StyleClasses="ButtonBig" Text="{Loc 'Options'}" />
<Button Name="CLeaveButton" StyleClasses="ButtonBig" Text="{Loc 'Leave'}" />
<Label Name="ServerName" Access="Public" StyleClasses="LabelHeadingBigger" VAlign="Center" />
<ui:VoteCallMenuButton Name="CallVoteButton" StyleClasses="ButtonBig" />
<Button Name="OptionsButton" Access="Public" StyleClasses="ButtonBig" Text="{Loc 'Options'}" />
<Button Name="LeaveButton" Access="Public" StyleClasses="ButtonBig" Text="{Loc 'Leave'}" />
</BoxContainer>
<!-- Gold line -->
<PanelContainer>
@@ -35,18 +35,20 @@
<!-- Middle section with the two vertical panels -->
<BoxContainer Orientation="Horizontal" VerticalExpand="True">
<!-- Left panel -->
<BoxContainer Orientation="Vertical" Name="CLeftPanelContainer" HorizontalExpand="True">
<BoxContainer Orientation="Vertical" Name="LeftPanelContainer" HorizontalExpand="True">
<hudUi:StripeBack>
<BoxContainer Orientation="Horizontal" SeparationOverride="6" Margin="3 3 3 3">
<cc:UICommandButton Command="observe" Name="CObserveButton" Text="{Loc 'Observe'}" StyleClasses="ButtonBig" WindowType="{x:Type lobbyUi:ObserveWarningWindow}"/>
<Label Name="CStartTime" Align="Right"
<cc:UICommandButton Command="observe" Name="ObserveButton" Text="{Loc 'Observe'}" StyleClasses="ButtonBig" WindowType="{x:Type lobbyUi:ObserveWarningWindow}"/>
<Label Name="StartTime"
Access="Public"
Align="Right"
FontColorOverride="{x:Static maths:Color.DarkGray}"
StyleClasses="LabelBig" HorizontalExpand="True" />
<Button Name="CReadyButton" ToggleMode="True" Text="{Loc 'Ready Up'}"
<Button Name="ReadyButton" Access="Public" ToggleMode="True" Text="{Loc 'Ready Up'}"
StyleClasses="ButtonBig" />
</BoxContainer>
</hudUi:StripeBack>
<chatUi:ChatBox Name="CChat" VerticalExpand="True" Margin="3 3 3 3"/>
<chatUi:ChatBox Name="Chat" Access="Public" VerticalExpand="True" Margin="3 3 3 3"/>
</BoxContainer>
<!-- Gold line -->
<PanelContainer MinSize="2 0">
@@ -59,16 +61,21 @@
<BoxContainer Orientation="Vertical">
<!-- Player list -->
<hudUi:NanoHeading Text="{Loc 'Online Players'}" />
<lobbyUi:LobbyPlayerList Name="COnlinePlayerList"
<lobbyUi:LobbyPlayerList Name="OnlinePlayerList"
Access="Public"
HorizontalExpand="True"
VerticalExpand="True"
Margin="3 3 3 3" />
<!-- Server info -->
<hudUi:NanoHeading Text="{Loc 'Server Info'}" />
<info:ServerInfo Name="CServerInfo" VerticalExpand="True" Margin="3 3 3 3"/>
<info:ServerInfo Name="ServerInfo"
Access="Public"
VerticalExpand="True"
Margin="3 3 3 3"/>
</BoxContainer>
<BoxContainer Orientation="Vertical"
Name="CVoteContainer"
Name="VoteContainer"
Access="Public"
HorizontalAlignment="Right"
Margin="0 8 8 0" />
</Control>

View File

@@ -15,16 +15,6 @@ namespace Content.Client.Lobby.UI
[GenerateTypedNameReferences]
internal sealed partial class LobbyGui : Control
{
public Label ServerName => CServerName;
public Label StartTime => CStartTime;
public Button ReadyButton => CReadyButton;
public Button ObserveButton => CObserveButton;
public Button OptionsButton => COptionsButton;
public Button LeaveButton => CLeaveButton;
public ChatBox Chat => CChat;
public BoxContainer VoteContainer => CVoteContainer;
public LobbyPlayerList OnlinePlayerList => COnlinePlayerList;
public ServerInfo ServerInfo => CServerInfo;
public LobbyCharacterPreviewPanel CharacterPreview { get; }
public LobbyGui(IEntityManager entityManager,
@@ -42,7 +32,7 @@ namespace Content.Client.Lobby.UI
HorizontalAlignment = HAlignment.Left
};
CLeftPanelContainer.AddChild(CharacterPreview);
LeftPanelContainer.AddChild(CharacterPreview);
CharacterPreview.SetPositionFirst();
}
}

View File

@@ -99,7 +99,7 @@ namespace Content.Client.MainMenu
private void TryConnect(string address)
{
var inputName = _mainMenuControl.UserNameBox.Text.Trim();
var inputName = _mainMenuControl.UsernameBox.Text.Trim();
if (!UsernameHelpers.IsNameValid(inputName, out var reason))
{
var invalidReason = Loc.GetString(reason.ToText());
@@ -110,7 +110,7 @@ namespace Content.Client.MainMenu
}
var configName = _configurationManager.GetCVar(CVars.PlayerName);
if (_mainMenuControl.UserNameBox.Text != configName)
if (_mainMenuControl.UsernameBox.Text != configName)
{
_configurationManager.SetCVar(CVars.PlayerName, inputName);
_configurationManager.SaveToFile();

View File

@@ -11,29 +11,35 @@
<BoxContainer Orientation="Horizontal"
SeparationOverride="4">
<Label Text="{Loc 'main-menu-username-label'}" />
<LineEdit Name="UsernameBoxProtected"
<LineEdit Name="UsernameBox"
Access="Public"
PlaceHolder="{Loc 'main-menu-username-text'}"
HorizontalExpand="True" />
</BoxContainer>
<Button Name="JoinPublicServerButtonProtected"
<Button Name="JoinPublicServerButton"
Access="Public"
Text="{Loc 'main-menu-join-public-server-button'}"
StyleIdentifier="mainMenu"
TextAlign="Center" />
<Control MinSize="0 2" />
<LineEdit Name="AddressBoxProtected"
<LineEdit Name="AddressBox"
Access="Public"
Text="localhost"
PlaceHolder="server address:port"
HorizontalExpand="True" />
<Button Name="DirectConnectButtonProtected"
<Button Name="DirectConnectButton"
Access="Public"
Text="{Loc 'main-menu-direct-connect-button'}"
TextAlign="Center"
StyleIdentifier="mainMenu" />
<Control MinSize="0 2" />
<Button Name="OptionsButtonProtected"
<Button Name="OptionsButton"
Access="Public"
Text="{Loc 'main-menu-options-button'}"
TextAlign="Center"
StyleIdentifier="mainMenu" />
<Button Name="QuitButtonProtected"
<Button Name="QuitButton"
Access="Public"
Text="{Loc 'main-menu-quit-button'}"
TextAlign="Center"
StyleIdentifier="mainMenu" />

View File

@@ -14,13 +14,6 @@ namespace Content.Client.MainMenu.UI
[GenerateTypedNameReferences]
public partial class MainMenuControl : Control
{
public LineEdit UserNameBox => UsernameBoxProtected;
public Button JoinPublicServerButton => JoinPublicServerButtonProtected;
public LineEdit AddressBox => AddressBoxProtected;
public Button DirectConnectButton => DirectConnectButtonProtected;
public Button OptionsButton => OptionsButtonProtected;
public Button QuitButton => QuitButtonProtected;
public MainMenuControl(IResourceCache resCache, IConfigurationManager configMan)
{
RobustXamlLoader.Load(this);
@@ -36,7 +29,7 @@ namespace Content.Client.MainMenu.UI
Logo.Texture = logoTexture;
var currentUserName = configMan.GetCVar(CVars.PlayerName);
UserNameBox.Text = currentUserName;
UsernameBox.Text = currentUserName;
#if !FULL_RELEASE
JoinPublicServerButton.Disabled = true;

View File

@@ -2,7 +2,8 @@
MinSize="250 100"
SetSize="250 100">
<BoxContainer Orientation="Vertical">
<Button Name="ScanButtonProtected"
<Button Name="ScanButton"
Access="Public"
Text="{Loc 'medical-scanner-window-save-button-text'}" />
<Label Name="Diagnostics" />
</BoxContainer>

View File

@@ -17,8 +17,6 @@ namespace Content.Client.MedicalScanner.UI
[GenerateTypedNameReferences]
public partial class MedicalScannerWindow : SS14Window
{
public Button ScanButton => ScanButtonProtected;
public MedicalScannerWindow()
{
RobustXamlLoader.Load(this);

View File

@@ -7,25 +7,30 @@
VerticalExpand="True"
HorizontalExpand="True"
MinSize="50 50">
<RichTextLabel Name="PdaOwnerLabelProtected" />
<RichTextLabel Name="PdaOwnerLabel" Access="Public" />
<PanelContainer>
<BoxContainer Orientation="Horizontal">
<RichTextLabel Name="IdInfoLabelProtected"
<RichTextLabel Name="IdInfoLabel"
Access="Public"
HorizontalExpand="True" />
<Button Name="EjectIdButtonProtected"
<Button Name="EjectIdButton"
Access="Public"
Text="{Loc 'comp-pda-ui-eject-id-button'}"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
<Button Name="EjectPenButtonProtected"
<Button Name="EjectPenButton"
Access="Public"
Text="{Loc 'comp-pda-ui-eject-pen-button'}"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
</BoxContainer>
</PanelContainer>
<Button Name="FlashLightToggleButtonProtected"
<Button Name="FlashLightToggleButton"
Access="Public"
Text="{Loc 'comp-pda-ui-toggle-flashlight-button'}"
ToggleMode="True" />
<Button Name="ActivateUplinkButtonProtected"
<Button Name="ActivateUplinkButton"
Access="Public"
Text="{Loc 'pda-bound-user-interface-uplink-tab-title'}" />
</BoxContainer>
</TabContainer>

View File

@@ -1,5 +1,4 @@
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Localization;
@@ -9,15 +8,6 @@ namespace Content.Client.PDA
[GenerateTypedNameReferences]
public partial class PDAMenu : SS14Window
{
public Button FlashLightToggleButton => FlashLightToggleButtonProtected;
public Button EjectIdButton => EjectIdButtonProtected;
public Button EjectPenButton => EjectPenButtonProtected;
public Button ActivateUplinkButton => ActivateUplinkButtonProtected;
public RichTextLabel PdaOwnerLabel => PdaOwnerLabelProtected;
public RichTextLabel IdInfoLabel => IdInfoLabelProtected;
public PDAMenu()
{
RobustXamlLoader.Load(this);

View File

@@ -3,7 +3,8 @@
SetSize="300 300">
<BoxContainer Orientation="Vertical">
<RichTextLabel Name="Label" />
<LineEdit Name="InputProtected"
<LineEdit Name="Input"
Access="Public"
Visible="False" />
</BoxContainer>
</SS14Window>

View File

@@ -10,8 +10,6 @@ namespace Content.Client.Paper.UI
[GenerateTypedNameReferences]
public partial class PaperWindow : SS14Window
{
public LineEdit Input => InputProtected;
public PaperWindow()
{
RobustXamlLoader.Load(this);

View File

@@ -1,26 +1,26 @@
<Control xmlns="https://spacestation14.io"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
xmlns:magicmirror="clr-namespace:Content.Client.CharacterAppearance"
xmlns:parallax="clr-namespace:Content.Client.Parallax"
xmlns:prefUi="clr-namespace:Content.Client.Preferences.UI"
xmlns:style="clr-namespace:Content.Client.Stylesheets">
<parallax:ParallaxControl />
<Control Margin="20 20 20 20">
<PanelContainer Name="CBackgroundPanel" />
<PanelContainer Name="BackgroundPanel" />
<BoxContainer Orientation="Vertical" SeparationOverride="0">
<BoxContainer Orientation="Horizontal" MinSize="0 40">
<Label Text="{Loc 'character-setup-gui-character-setup-label'}"
Margin="8 0 0 0" VAlign="Center"
StyleClasses="{x:Static style:StyleNano.StyleClassLabelHeadingBigger}" />
<Button Name="CRulesButton" HorizontalExpand="True"
<Button Name="RulesButton" HorizontalExpand="True"
Text="{Loc 'character-setup-gui-character-setup-rules-button'}"
StyleClasses="{x:Static style:StyleNano.StyleClassButtonBig}"
HorizontalAlignment="Right" />
<Button Name="CSaveButton"
<Button Name="SaveButton"
Access="Public"
Text="{Loc 'character-setup-gui-character-setup-save-button'}"
StyleClasses="{x:Static style:StyleNano.StyleClassButtonBig}"/>
<Button Name="CCloseButton"
<Button Name="CloseButton"
Access="Public"
Text="{Loc 'character-setup-gui-character-setup-close-button'}"
StyleClasses="{x:Static style:StyleNano.StyleClassButtonBig}"/>
</BoxContainer>
@@ -31,14 +31,14 @@
</PanelContainer>
<BoxContainer Orientation="Horizontal" VerticalExpand="True" SeparationOverride="0">
<ScrollContainer MinSize="325 0" Margin="5 5 0 0">
<BoxContainer Name="CCharacters" Orientation="Vertical" />
<BoxContainer Name="Characters" Orientation="Vertical" />
</ScrollContainer>
<PanelContainer MinSize="2 0">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="{x:Static style:StyleNano.NanoGold}" ContentMarginTopOverride="2" />
</PanelContainer.PanelOverride>
</PanelContainer>
<BoxContainer Name="CCharEditor" />
<BoxContainer Name="CharEditor" />
</BoxContainer>
</BoxContainer>
</Control>

View File

@@ -29,14 +29,8 @@ namespace Content.Client.Preferences.UI
{
private readonly IClientPreferencesManager _preferencesManager;
private readonly IEntityManager _entityManager;
private PanelContainer _backgroundPanel => CBackgroundPanel;
private BoxContainer _charactersVBox => CCharacters;
private Button _createNewCharacterButton;
private HumanoidProfileEditor _humanoidProfileEditor;
private BoxContainer _humanoidProfileEditorContainer => CCharEditor;
public Button CloseButton => CCloseButton;
public Button SaveButton => CSaveButton;
public Button RulesButton => CRulesButton;
private readonly Button _createNewCharacterButton;
private readonly HumanoidProfileEditor _humanoidProfileEditor;
public CharacterSetupGui(
IEntityManager entityManager,
@@ -56,7 +50,7 @@ namespace Content.Client.Preferences.UI
};
back.SetPatchMargin(StyleBox.Margin.All, 10);
_backgroundPanel.PanelOverride = back;
BackgroundPanel.PanelOverride = back;
_createNewCharacterButton = new Button
{
@@ -71,7 +65,7 @@ namespace Content.Client.Preferences.UI
_humanoidProfileEditor = new HumanoidProfileEditor(preferencesManager, prototypeManager, entityManager);
_humanoidProfileEditor.OnProfileChanged += ProfileChanged;
_humanoidProfileEditorContainer.AddChild(_humanoidProfileEditor);
CharEditor.AddChild(_humanoidProfileEditor);
UpdateUI();
@@ -100,7 +94,7 @@ namespace Content.Client.Preferences.UI
{
var numberOfFullSlots = 0;
var characterButtonsGroup = new ButtonGroup();
_charactersVBox.RemoveAllChildren();
Characters.RemoveAllChildren();
if (!_preferencesManager.ServerDataLoaded)
{
@@ -123,7 +117,7 @@ namespace Content.Client.Preferences.UI
_preferencesManager,
characterButtonsGroup,
character);
_charactersVBox.AddChild(characterPickerButton);
Characters.AddChild(characterPickerButton);
var characterIndexCopy = slot;
characterPickerButton.OnPressed += args =>
@@ -139,7 +133,7 @@ namespace Content.Client.Preferences.UI
_createNewCharacterButton.Disabled =
numberOfFullSlots >= _preferencesManager.Settings.MaxCharacterSlots;
_charactersVBox.AddChild(_createNewCharacterButton);
Characters.AddChild(_createNewCharacterButton);
}
private class CharacterPickerButton : ContainerButton

View File

@@ -71,11 +71,14 @@
Align="End"
HorizontalExpand="True"
VerticalExpand="True">
<Button Name="ServerSelectionButtonProtected"
<Button Name="ServerSelectionButton"
Access="Public"
Text="{Loc 'research-console-menu-server-selection-button'}" />
<Button Name="ServerSyncButtonProtected"
<Button Name="ServerSyncButton"
Access="Public"
Text="{Loc 'research-console-menu-server-sync-button'}" />
<Button Name="UnlockButtonProtected"
<Button Name="UnlockButton"
Access="Public"
Disabled="True" />
</BoxContainer>
</BoxContainer>

View File

@@ -21,10 +21,6 @@ namespace Content.Client.Research.UI
private readonly List<TechnologyPrototype> _unlockableTechnologyPrototypes = new();
private readonly List<TechnologyPrototype> _futureTechnologyPrototypes = new();
public Button UnlockButton => UnlockButtonProtected;
public Button ServerSelectionButton => ServerSelectionButtonProtected;
public Button ServerSyncButton => ServerSyncButtonProtected;
public TechnologyPrototype? TechnologySelected;
public ResearchConsoleMenu(ResearchConsoleBoundUserInterface owner)

View File

@@ -4,7 +4,8 @@
<BoxContainer Orientation="Horizontal">
<Label Name="UplinkItemName"
HorizontalExpand="True"/>
<Button Name="UplinkItemBuyButtonProtected"
<Button Name="UplinkItemBuyButton"
Access="Public"
HorizontalAlignment="Right"
MinWidth="64"/>
</BoxContainer>

View File

@@ -9,8 +9,6 @@ namespace Content.Client.Traitor.Uplink
[GenerateTypedNameReferences]
public partial class UplinkListingControl : Control
{
public Button UplinkItemBuyButton => UplinkItemBuyButtonProtected;
public UplinkListingControl(string itemName, string itemDescription, int itemPrice, bool canBuy)
{
RobustXamlLoader.Load(this);
@@ -18,8 +16,8 @@ namespace Content.Client.Traitor.Uplink
UplinkItemName.Text = itemName;
UplinkItemDescription.SetMessage(itemDescription);
UplinkItemBuyButtonProtected.Text = $"{itemPrice} TC";
UplinkItemBuyButtonProtected.Disabled = !canBuy;
UplinkItemBuyButton.Text = $"{itemPrice} TC";
UplinkItemBuyButton.Disabled = !canBuy;
}
}
}

View File

@@ -8,7 +8,8 @@
VerticalExpand="True">
<BoxContainer Orientation="Horizontal"
Margin="4 4 4 4">
<RichTextLabel Name="BalanceInfoProtected"
<RichTextLabel Name="BalanceInfo"
Access="Public"
HorizontalExpand="True"
HorizontalAlignment="Left" />
</BoxContainer>

View File

@@ -16,7 +16,6 @@ namespace Content.Client.Traitor.Uplink
{
private readonly IPrototypeManager _prototypeManager;
public RichTextLabel BalanceInfo => BalanceInfoProtected;
public event Action<BaseButton.ButtonEventArgs, UplinkListingData>? OnListingButtonPressed;
public event Action<BaseButton.ButtonEventArgs, UplinkCategory>? OnCategoryButtonPressed;

View File

@@ -60,8 +60,8 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
Assert.NotNull(alertsUI);
// we should be seeing 3 alerts - our health, and the 2 debug alerts, in a specific order.
Assert.That(alertsUI.Grid.ChildCount, Is.GreaterThanOrEqualTo(3));
var alertControls = alertsUI.Grid.Children.Select(c => (AlertControl) c);
Assert.That(alertsUI.AlertContainer.ChildCount, Is.GreaterThanOrEqualTo(3));
var alertControls = alertsUI.AlertContainer.Children.Select(c => (AlertControl) c);
var alertIDs = alertControls.Select(ac => ac.Alert.AlertType).ToArray();
var expectedIDs = new [] {AlertType.HumanHealth, AlertType.Debug1, AlertType.Debug2};
Assert.That(alertIDs, Is.SupersetOf(expectedIDs));
@@ -96,8 +96,8 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
Assert.NotNull(alertsUI);
// we should be seeing 2 alerts now because one was cleared
Assert.That(alertsUI.Grid.ChildCount, Is.GreaterThanOrEqualTo(2));
var alertControls = alertsUI.Grid.Children.Select(c => (AlertControl) c);
Assert.That(alertsUI.AlertContainer.ChildCount, Is.GreaterThanOrEqualTo(2));
var alertControls = alertsUI.AlertContainer.Children.Select(c => (AlertControl) c);
var alertIDs = alertControls.Select(ac => ac.Alert.AlertType).ToArray();
var expectedIDs = new [] {AlertType.HumanHealth, AlertType.Debug2};
Assert.That(alertIDs, Is.SupersetOf(expectedIDs));