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

@@ -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