diff --git a/Content.Client/Preferences/UI/CharacterSetupGui.xaml b/Content.Client/Preferences/UI/CharacterSetupGui.xaml
new file mode 100644
index 0000000000..cc1ed26641
--- /dev/null
+++ b/Content.Client/Preferences/UI/CharacterSetupGui.xaml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Content.Client/Preferences/UI/CharacterSetupGui.cs b/Content.Client/Preferences/UI/CharacterSetupGui.xaml.cs
similarity index 68%
rename from Content.Client/Preferences/UI/CharacterSetupGui.cs
rename to Content.Client/Preferences/UI/CharacterSetupGui.xaml.cs
index c544a774e9..c0c8ad6c42 100644
--- a/Content.Client/Preferences/UI/CharacterSetupGui.cs
+++ b/Content.Client/Preferences/UI/CharacterSetupGui.xaml.cs
@@ -7,11 +7,13 @@ using Content.Client.Resources;
using Content.Client.Stylesheets;
using Content.Shared.Preferences;
using Content.Shared.Roles;
+using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
+using Robust.Client.UserInterface.XAML;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
@@ -22,16 +24,19 @@ using static Robust.Client.UserInterface.Controls.BoxContainer;
namespace Content.Client.Preferences.UI
{
- public class CharacterSetupGui : Control
+ [GenerateTypedNameReferences]
+ public partial class CharacterSetupGui : Control
{
- private readonly BoxContainer _charactersVBox;
- private readonly Button _createNewCharacterButton;
- private readonly IEntityManager _entityManager;
- private readonly HumanoidProfileEditor _humanoidProfileEditor;
private readonly IClientPreferencesManager _preferencesManager;
- public readonly Button CloseButton;
- public readonly Button SaveButton;
- public readonly Button RulesButton;
+ 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;
public CharacterSetupGui(
IEntityManager entityManager,
@@ -39,16 +44,9 @@ namespace Content.Client.Preferences.UI
IClientPreferencesManager preferencesManager,
IPrototypeManager prototypeManager)
{
- AddChild(new ParallaxControl());
-
+ RobustXamlLoader.Load(this);
_entityManager = entityManager;
_preferencesManager = preferencesManager;
- var margin = new Control
- {
- Margin = new Thickness(20),
- };
-
- AddChild(margin);
var panelTex = resourceCache.GetTexture("/Textures/Interface/Nano/button.svg.96dpi.png");
var back = new StyleBoxTexture
@@ -58,89 +56,7 @@ namespace Content.Client.Preferences.UI
};
back.SetPatchMargin(StyleBox.Margin.All, 10);
- var panel = new PanelContainer
- {
- PanelOverride = back
- };
-
- margin.AddChild(panel);
-
- var vBox = new BoxContainer
- {
- Orientation = LayoutOrientation.Vertical,
- SeparationOverride = 0
- };
-
- margin.AddChild(vBox);
-
- var topHBox = new BoxContainer
- {
- Orientation = LayoutOrientation.Horizontal,
- MinSize = (0, 40),
- Children =
- {
- new Label
- {
- Margin = new Thickness(8, 0, 0, 0),
- Text = Loc.GetString("character-setup-gui-character-setup-label"),
- StyleClasses = {StyleNano.StyleClassLabelHeadingBigger},
- VAlign = Label.VAlignMode.Center,
- },
- (RulesButton = new Button
- {
- HorizontalExpand = true,
- HorizontalAlignment = HAlignment.Right,
- Text = Loc.GetString("character-setup-gui-character-setup-rules-button"),
- StyleClasses = {StyleNano.StyleClassButtonBig},
-
- }),
- (SaveButton = new Button
- {
- Text = Loc.GetString("character-setup-gui-character-setup-save-button"),
- StyleClasses = {StyleNano.StyleClassButtonBig},
-
- }),
- (CloseButton = new Button
- {
- Text = Loc.GetString("character-setup-gui-character-setup-close-button"),
- StyleClasses = {StyleNano.StyleClassButtonBig},
- })
- }
- };
-
- vBox.AddChild(topHBox);
-
- vBox.AddChild(new PanelContainer
- {
- PanelOverride = new StyleBoxFlat
- {
- BackgroundColor = StyleNano.NanoGold,
- ContentMarginTopOverride = 2
- }
- });
-
- var hBox = new BoxContainer
- {
- Orientation = LayoutOrientation.Horizontal,
- VerticalExpand = true,
- SeparationOverride = 0
- };
- vBox.AddChild(hBox);
-
- _charactersVBox = new BoxContainer
- {
- Orientation = LayoutOrientation.Vertical
- };
-
- hBox.AddChild(new ScrollContainer
- {
- MinSize = (325, 0),
- Margin = new Thickness(5, 5, 0, 0),
- Children =
- {
- _charactersVBox
- }
- });
+ _backgroundPanel.PanelOverride = back;
_createNewCharacterButton = new Button
{
@@ -153,14 +69,9 @@ namespace Content.Client.Preferences.UI
args.Event.Handle();
};
- hBox.AddChild(new PanelContainer
- {
- PanelOverride = new StyleBoxFlat {BackgroundColor = StyleNano.NanoGold},
- MinSize = (2, 0)
- });
_humanoidProfileEditor = new HumanoidProfileEditor(preferencesManager, prototypeManager, entityManager);
_humanoidProfileEditor.OnProfileChanged += ProfileChanged;
- hBox.AddChild(_humanoidProfileEditor);
+ _humanoidProfileEditorContainer.AddChild(_humanoidProfileEditor);
UpdateUI();
diff --git a/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml b/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml
new file mode 100644
index 0000000000..60d045b1b2
--- /dev/null
+++ b/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml
@@ -0,0 +1,131 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Content.Client/Preferences/UI/HumanoidProfileEditor.cs b/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs
similarity index 62%
rename from Content.Client/Preferences/UI/HumanoidProfileEditor.cs
rename to Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs
index 611f594ec7..b370dcc0dd 100644
--- a/Content.Client/Preferences/UI/HumanoidProfileEditor.cs
+++ b/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs
@@ -9,10 +9,12 @@ using Content.Shared.CharacterAppearance;
using Content.Shared.GameTicking;
using Content.Shared.Preferences;
using Content.Shared.Roles;
+using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
+using Robust.Client.UserInterface.XAML;
using Robust.Client.Utility;
using Robust.Shared.Enums;
using Robust.Shared.GameObjects;
@@ -28,37 +30,52 @@ using static Robust.Client.UserInterface.Controls.BoxContainer;
namespace Content.Client.Preferences.UI
{
+ public class HighlightedContainer : PanelContainer
+ {
+ public HighlightedContainer()
+ {
+ PanelOverride = new StyleBoxFlat()
+ {
+ BackgroundColor = new Color(47, 47, 53),
+ ContentMarginTopOverride = 10,
+ ContentMarginBottomOverride = 10,
+ ContentMarginLeftOverride = 10,
+ ContentMarginRightOverride = 10
+ };
+ }
+ }
+
+ [GenerateTypedNameReferences]
public partial class HumanoidProfileEditor : Control
{
- private static readonly StyleBoxFlat HighlightedStyle = new()
- {
- BackgroundColor = new Color(47, 47, 53),
- ContentMarginTopOverride = 10,
- ContentMarginBottomOverride = 10,
- ContentMarginLeftOverride = 10,
- ContentMarginRightOverride = 10
- };
-
- private readonly LineEdit _ageEdit;
- private readonly LineEdit _nameEdit;
+ private LineEdit _ageEdit => CAgeEdit;
+ private LineEdit _nameEdit => CNameEdit;
+ private Button _nameRandomButton => CNameRandomize;
+ private Button _randomizeEverythingButton => CRandomizeEverything;
+ private RichTextLabel _warningLabel => CWarningLabel;
private readonly IClientPreferencesManager _preferencesManager;
- private readonly Button _saveButton;
- private readonly Button _sexFemaleButton;
- private readonly Button _sexMaleButton;
- private readonly OptionButton _genderButton;
- private readonly OptionButton _clothingButton;
- private readonly OptionButton _backpackButton;
- private readonly HairStylePicker _hairPicker;
- private readonly HairStylePicker _facialHairPicker;
- private readonly EyeColorPicker _eyesPicker;
+ private Button _saveButton => CSaveButton;
+ private Button _sexFemaleButton => CSexFemale;
+ private Button _sexMaleButton => CSexMale;
+ private OptionButton _genderButton => CPronounsButton;
+ private OptionButton _clothingButton => CClothingButton;
+ private OptionButton _backpackButton => CBackpackButton;
+ private HairStylePicker _hairPicker => CHairStylePicker;
+ private HairStylePicker _facialHairPicker => CFacialHairPicker;
+ private EyeColorPicker _eyesPicker => CEyeColorPicker;
+ private TabContainer _tabContainer => CTabContainer;
+ private BoxContainer _jobList => CJobList;
+ private BoxContainer _antagList => CAntagList;
private readonly List _jobPriorities;
- private readonly OptionButton _preferenceUnavailableButton;
+ private OptionButton _preferenceUnavailableButton => CPreferenceUnavailableButton;
private readonly Dictionary _jobCategories;
private readonly List _antagPreferences;
private readonly IEntity _previewDummy;
+ private Control _previewSpriteControl => CSpriteViewFront;
+ private Control _previewSpriteSideControl => CSpriteViewSide;
private readonly SpriteView _previewSprite;
private readonly SpriteView _previewSpriteSide;
@@ -72,147 +89,36 @@ namespace Content.Client.Preferences.UI
public HumanoidProfileEditor(IClientPreferencesManager preferencesManager, IPrototypeManager prototypeManager,
IEntityManager entityManager)
{
+ RobustXamlLoader.Load(this);
_random = IoCManager.Resolve();
_prototypeManager = prototypeManager;
_preferencesManager = preferencesManager;
- var hbox = new BoxContainer
- {
- Orientation = LayoutOrientation.Horizontal
- };
- AddChild(hbox);
-
#region Left
- var vBox = new BoxContainer
- {
- Orientation = LayoutOrientation.Vertical,
- Margin = new Thickness(10)
- };
- hbox.AddChild(vBox);
-
- var middleContainer = new BoxContainer
- {
- Orientation = LayoutOrientation.Horizontal,
- SeparationOverride = 10
- };
- vBox.AddChild(middleContainer);
-
- var leftColumn = new BoxContainer
- {
- Orientation = LayoutOrientation.Vertical
- };
- middleContainer.AddChild(leftColumn);
-
#region Randomize
- var randomizePanel = HighlightedContainer();
- var randomizeVbox = new BoxContainer() { Orientation = LayoutOrientation.Vertical };
- randomizePanel.AddChild(randomizeVbox);
- leftColumn.AddChild(randomizePanel);
-
#endregion Randomize
#region Name
- var namePanel = HighlightedContainer();
- var nameHBox = new BoxContainer
- {
- Orientation = LayoutOrientation.Horizontal,
- VerticalExpand = true
- };
- var nameLabel = new Label { Text = Loc.GetString("humanoid-profile-editor-name-label") };
- _nameEdit = new LineEdit
- {
- MinSize = (270, 0),
- VerticalAlignment = VAlignment.Center
- };
_nameEdit.OnTextChanged += args => { SetName(args.Text); };
- var nameRandomButton = new Button
- {
- Text = Loc.GetString("humanoid-profile-editor-name-random-button"),
- };
- nameRandomButton.OnPressed += args => RandomizeName();
- nameHBox.AddChild(nameLabel);
- nameHBox.AddChild(_nameEdit);
- nameHBox.AddChild(nameRandomButton);
- randomizeVbox.AddChild(nameHBox);
-
- var randomizeEverythingButton = new Button
- {
- HorizontalAlignment = HAlignment.Center,
- HorizontalExpand = false,
- MaxWidth = 256,
- Text = Loc.GetString("humanoid-profile-editor-randomize-everything-button"),
- };
- randomizeEverythingButton.OnPressed += args => { RandomizeEverything(); };
- randomizeVbox.AddChild(randomizeEverythingButton);
-
- var warningLabel = new RichTextLabel()
- {
- HorizontalExpand = false,
- VerticalExpand = true,
- MaxWidth = 425,
- HorizontalAlignment = HAlignment.Left,
- };
- warningLabel.SetMarkup($"[color=red]{Loc.GetString("humanoid-profile-editor-naming-rules-warning")}[/color]");
- randomizeVbox.AddChild(warningLabel);
+ _nameRandomButton.OnPressed += args => RandomizeName();
+ _randomizeEverythingButton.OnPressed += args => { RandomizeEverything(); };
+ _warningLabel.SetMarkup($"[color=red]{Loc.GetString("humanoid-profile-editor-naming-rules-warning")}[/color]");
#endregion Name
- var tabContainer = new TabContainer {VerticalExpand = true};
- vBox.AddChild(tabContainer);
-
#region Appearance
- var appearanceList = new BoxContainer
- {
- Orientation = LayoutOrientation.Vertical
- };
-
- var appearanceVBox = new BoxContainer
- {
- Orientation = LayoutOrientation.Vertical,
- Children =
- {
- new ScrollContainer
- {
- VerticalExpand = true,
- Children =
- {
- appearanceList
- }
- }
- }
- };
- tabContainer.AddChild(appearanceVBox);
- tabContainer.SetTabTitle(0, Loc.GetString("humanoid-profile-editor-appearance-tab"));
-
- var sexAndAgeRow = new BoxContainer
- {
- Orientation = LayoutOrientation.Horizontal,
- SeparationOverride = 10
- };
-
- appearanceList.AddChild(sexAndAgeRow);
+ _tabContainer.SetTabTitle(0, Loc.GetString("humanoid-profile-editor-appearance-tab"));
#region Sex
- var sexPanel = HighlightedContainer();
- var sexHBox = new BoxContainer
- {
- Orientation = LayoutOrientation.Horizontal
- };
- var sexLabel = new Label { Text = Loc.GetString("humanoid-profile-editor-sex-label") };
-
var sexButtonGroup = new ButtonGroup();
- _sexMaleButton = new Button
- {
- Text = Loc.GetString("humanoid-profile-editor-sex-male-button"),
- Group = sexButtonGroup
- };
+ _sexMaleButton.Group = sexButtonGroup;
_sexMaleButton.OnPressed += args =>
{
SetSex(Sex.Male);
@@ -223,11 +129,7 @@ namespace Content.Client.Preferences.UI
}
};
- _sexFemaleButton = new Button
- {
- Text = Loc.GetString("humanoid-profile-editor-sex-female-button"),
- Group = sexButtonGroup
- };
+ _sexFemaleButton.Group = sexButtonGroup;
_sexFemaleButton.OnPressed += _ =>
{
SetSex(Sex.Female);
@@ -239,47 +141,21 @@ namespace Content.Client.Preferences.UI
}
};
- sexHBox.AddChild(sexLabel);
- sexHBox.AddChild(_sexMaleButton);
- sexHBox.AddChild(_sexFemaleButton);
- sexPanel.AddChild(sexHBox);
- sexAndAgeRow.AddChild(sexPanel);
-
#endregion Sex
#region Age
- var agePanel = HighlightedContainer();
- var ageHBox = new BoxContainer
- {
- Orientation = LayoutOrientation.Horizontal
- };
- var ageLabel = new Label { Text = Loc.GetString("humanoid-profile-editor-age-label") };
- _ageEdit = new LineEdit { MinSize = (40, 0) };
_ageEdit.OnTextChanged += args =>
{
if (!int.TryParse(args.Text, out var newAge))
return;
SetAge(newAge);
};
- ageHBox.AddChild(ageLabel);
- ageHBox.AddChild(_ageEdit);
- agePanel.AddChild(ageHBox);
- sexAndAgeRow.AddChild(agePanel);
#endregion Age
#region Gender
- var genderPanel = HighlightedContainer();
- var genderHBox = new BoxContainer
- {
- Orientation = LayoutOrientation.Horizontal
- };
- var genderLabel = new Label { Text = Loc.GetString("humanoid-profile-editor-pronouns-label") };
-
- _genderButton = new OptionButton();
-
_genderButton.AddItem(Loc.GetString("humanoid-profile-editor-pronouns-male-text"), (int) Gender.Male);
_genderButton.AddItem(Loc.GetString("humanoid-profile-editor-pronouns-female-text"), (int) Gender.Female);
_genderButton.AddItem(Loc.GetString("humanoid-profile-editor-pronouns-epicene-text"), (int) Gender.Epicene);
@@ -291,25 +167,10 @@ namespace Content.Client.Preferences.UI
SetGender((Gender) args.Id);
};
- genderHBox.AddChild(genderLabel);
- genderHBox.AddChild(_genderButton);
- genderPanel.AddChild(genderHBox);
- sexAndAgeRow.AddChild(genderPanel);
-
#endregion Gender
#region Hair
- var hairPanel = HighlightedContainer();
- var hairHBox = new BoxContainer
- {
- Orientation = LayoutOrientation.Horizontal
- };
-
- _hairPicker = new HairStylePicker
- {
- HorizontalAlignment = HAlignment.Center
- };
_hairPicker.Populate();
_hairPicker.OnHairStylePicked += newStyle =>
@@ -330,7 +191,6 @@ namespace Content.Client.Preferences.UI
IsDirty = true;
};
- _facialHairPicker = new HairStylePicker();
_facialHairPicker.Populate();
_facialHairPicker.OnHairStylePicked += newStyle =>
@@ -351,25 +211,10 @@ namespace Content.Client.Preferences.UI
IsDirty = true;
};
- hairHBox.AddChild(_hairPicker);
- hairHBox.AddChild(_facialHairPicker);
-
- hairPanel.AddChild(hairHBox);
- appearanceList.AddChild(hairPanel);
-
#endregion Hair
#region Clothing
- var clothingPanel = HighlightedContainer();
- var clothingHBox = new BoxContainer
- {
- Orientation = LayoutOrientation.Horizontal
- };
- var clothingLabel = new Label { Text = Loc.GetString("humanoid-profile-editor-clothing-label") };
-
- _clothingButton = new OptionButton();
-
_clothingButton.AddItem(Loc.GetString("humanoid-profile-editor-preference-jumpsuit"), (int) ClothingPreference.Jumpsuit);
_clothingButton.AddItem(Loc.GetString("humanoid-profile-editor-preference-jumpskirt"), (int) ClothingPreference.Jumpskirt);
@@ -379,24 +224,10 @@ namespace Content.Client.Preferences.UI
SetClothing((ClothingPreference) args.Id);
};
- clothingHBox.AddChild(clothingLabel);
- clothingHBox.AddChild(_clothingButton);
- clothingPanel.AddChild(clothingHBox);
- appearanceList.AddChild(clothingPanel);
-
#endregion Clothing
#region Backpack
- var backpackPanel = HighlightedContainer();
- var backpackHBox = new BoxContainer
- {
- Orientation = LayoutOrientation.Horizontal
- };
- var backpackLabel = new Label { Text = Loc.GetString("humanoid-profile-editor-backpack-label") };
-
- _backpackButton = new OptionButton();
-
_backpackButton.AddItem(Loc.GetString("humanoid-profile-editor-preference-backpack"), (int) BackpackPreference.Backpack);
_backpackButton.AddItem(Loc.GetString("humanoid-profile-editor-preference-satchel"), (int) BackpackPreference.Satchel);
_backpackButton.AddItem(Loc.GetString("humanoid-profile-editor-preference-duffelbag"), (int) BackpackPreference.Duffelbag);
@@ -407,24 +238,10 @@ namespace Content.Client.Preferences.UI
SetBackpack((BackpackPreference) args.Id);
};
- backpackHBox.AddChild(backpackLabel);
- backpackHBox.AddChild(_backpackButton);
- backpackPanel.AddChild(backpackHBox);
- appearanceList.AddChild(backpackPanel);
-
#endregion Backpack
#region Eyes
- var eyesPanel = HighlightedContainer();
- var eyesVBox = new BoxContainer
- {
- Orientation = LayoutOrientation.Vertical
- };
- var eyesLabel = new Label { Text = Loc.GetString("humanoid-profile-editor-eyes-label") };
-
- _eyesPicker = new EyeColorPicker();
-
_eyesPicker.OnEyeColorPicked += newColor =>
{
if (Profile is null)
@@ -434,42 +251,13 @@ namespace Content.Client.Preferences.UI
IsDirty = true;
};
- eyesVBox.AddChild(eyesLabel);
- eyesVBox.AddChild(_eyesPicker);
- eyesPanel.AddChild(eyesVBox);
- appearanceList.AddChild(eyesPanel);
-
#endregion Eyes
#endregion Appearance
#region Jobs
- var jobList = new BoxContainer
- {
- Orientation = LayoutOrientation.Vertical
- };
-
- var jobVBox = new BoxContainer
- {
- Orientation = LayoutOrientation.Vertical,
- Children =
- {
- (_preferenceUnavailableButton = new OptionButton()),
- new ScrollContainer
- {
- VerticalExpand = true,
- Children =
- {
- jobList
- }
- }
- }
- };
-
- tabContainer.AddChild(jobVBox);
-
- tabContainer.SetTabTitle(1, Loc.GetString("humanoid-profile-editor-jobs-tab"));
+ _tabContainer.SetTabTitle(1, Loc.GetString("humanoid-profile-editor-jobs-tab"));
_preferenceUnavailableButton.AddItem(
Loc.GetString("humanoid-profile-editor-preference-unavailable-stay-in-lobby-button"),
@@ -532,7 +320,7 @@ namespace Content.Client.Preferences.UI
});
_jobCategories[department] = category;
- jobList.AddChild(category);
+ _jobList.AddChild(category);
}
var selector = new JobPrioritySelector(job);
@@ -570,43 +358,20 @@ namespace Content.Client.Preferences.UI
#region Antags
- var antagList = new BoxContainer
- {
- Orientation = LayoutOrientation.Vertical
- };
-
- var antagVBox = new BoxContainer
- {
- Orientation = LayoutOrientation.Vertical,
- Children =
- {
- new ScrollContainer
- {
- VerticalExpand = true,
- Children =
- {
- antagList
- }
- }
- }
- };
-
- tabContainer.AddChild(antagVBox);
-
- tabContainer.SetTabTitle(2, Loc.GetString("humanoid-profile-editor-antags-tab"));
+ _tabContainer.SetTabTitle(2, Loc.GetString("humanoid-profile-editor-antags-tab"));
_antagPreferences = new List();
- foreach (var antag in prototypeManager.EnumeratePrototypes().OrderBy(a => a.Name))
+ foreach (var antag in prototypeManager.EnumeratePrototypes().OrderBy(a => a.Name))
+ {
+ if (!antag.SetPreference)
{
- if (!antag.SetPreference)
- {
- continue;
- }
+ continue;
+ }
- var selector = new AntagPreferenceSelector(antag);
- antagList.AddChild(selector);
- _antagPreferences.Add(selector);
+ var selector = new AntagPreferenceSelector(antag);
+ _antagList.AddChild(selector);
+ _antagPreferences.Add(selector);
selector.PreferenceChanged += preference =>
{
@@ -617,51 +382,9 @@ namespace Content.Client.Preferences.UI
#endregion Antags
- var rightColumn = new BoxContainer
- {
- Orientation = LayoutOrientation.Vertical
- };
- middleContainer.AddChild(rightColumn);
-
- #region Import/Export
-
- var importExportPanelContainer = HighlightedContainer();
- var importExportHBox = new BoxContainer
- {
- Orientation = LayoutOrientation.Horizontal
- };
- var importButton = new Button
- {
- Text = Loc.GetString("humanoid-profile-editor-import-button"),
- Disabled = true,
- ToolTip = Loc.GetString("generic-not-yet-implemented")
- };
- var exportButton = new Button
- {
- Text = Loc.GetString("humanoid-profile-editor-export-button"),
- Disabled = true,
- ToolTip = Loc.GetString("generic-not-yet-implemented")
- };
- importExportHBox.AddChild(importButton);
- importExportHBox.AddChild(exportButton);
- importExportPanelContainer.AddChild(importExportHBox);
- rightColumn.AddChild(importExportPanelContainer);
-
- #endregion Import/Export
-
#region Save
- {
- var panel = HighlightedContainer();
- _saveButton = new Button
- {
- Text = Loc.GetString("humanoid-profile-editor-save-button"),
- HorizontalAlignment = HAlignment.Center
- };
- _saveButton.OnPressed += args => { Save(); };
- panel.AddChild(_saveButton);
- rightColumn.AddChild(panel);
- }
+ _saveButton.OnPressed += args => { Save(); };
#endregion Save
@@ -669,26 +392,12 @@ namespace Content.Client.Preferences.UI
#region Right
- vBox = new BoxContainer
- {
- Orientation = LayoutOrientation.Vertical,
- VerticalExpand = true,
- HorizontalExpand = true,
- };
- hbox.AddChild(vBox);
-
#region Preview
_previewDummy = entityManager.SpawnEntity("MobHumanDummy", MapCoordinates.Nullspace);
var sprite = _previewDummy.GetComponent();
// Front
- var box = new Control()
- {
- VerticalExpand = true,
- SizeFlagsStretchRatio = 1f,
- };
- vBox.AddChild(box);
_previewSprite = new SpriteView
{
Sprite = sprite,
@@ -697,15 +406,9 @@ namespace Content.Client.Preferences.UI
VerticalAlignment = VAlignment.Center,
SizeFlagsStretchRatio = 1
};
- box.AddChild(_previewSprite);
+ _previewSpriteControl.AddChild(_previewSprite);
// Side
- box = new Control()
- {
- VerticalExpand = true,
- SizeFlagsStretchRatio = 1f,
- };
- vBox.AddChild(box);
_previewSpriteSide = new SpriteView
{
Sprite = sprite,
@@ -714,7 +417,7 @@ namespace Content.Client.Preferences.UI
VerticalAlignment = VAlignment.Center,
SizeFlagsStretchRatio = 1
};
- box.AddChild(_previewSpriteSide);
+ _previewSpriteSideControl.AddChild(_previewSpriteSide);
#endregion Right
@@ -805,13 +508,6 @@ namespace Content.Client.Preferences.UI
}
}
- private static Control HighlightedContainer()
- {
- return new PanelContainer
- {
- PanelOverride = HighlightedStyle
- };
- }
private void UpdateNameEdit()
{