Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

admin event preference panel #480

Merged
2 changes: 1 addition & 1 deletion .run/Content Server+Client.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
<toRun name="Content.Server" type="DotNetProject" />
<method v="2" />
</configuration>
</component>
dffdff2423 marked this conversation as resolved.
Show resolved Hide resolved
</component>
3 changes: 1 addition & 2 deletions Content.Client/_CD/Admin/UI/EventPreferencePanelEui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ public override void HandleState(EuiStateBase state)
if (state is not EventPreferencePanelEuiState s)
return;

EventPreferencesPanel.SetDetails(s.Username, s.Preferences);
EventPreferencesPanel.SetPreferenceList(s.Preferences, s.VisibleAntagPrototypes);
EventPreferencesPanel.SetDetails(s.Username, s.Preferences, s.VisibleAntagPrototypes);
}

}
9 changes: 2 additions & 7 deletions Content.Client/_CD/Admin/UI/EventPreferencesPanel.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;

namespace Content.Client._CD.Admin.UI;

[GenerateTypedNameReferences]
Expand All @@ -19,18 +18,14 @@ public EventPreferencesPanel()
/// </summary>
/// <param name="username">Player's username</param>
/// <param name="currentPreferences">Profile preference to fetch the character name from</param>
public void SetDetails(string username, HumanoidCharacterProfile currentPreferences)
public void SetDetails(string username, HumanoidCharacterProfile currentPreferences, IEnumerable<AntagPrototype> listablePreferences)
{
PlayerLabel.Text = Loc.GetString("cd-eventpreferencepanel-player", ("player", username));
CharacterLabel.Text = Loc.GetString(
"cd-eventpreferencepanel-character",
("characterName", currentPreferences.Name)
);
}

/// <inheritdoc cref="EventPreferences.SetPreferenceList"/>
public void SetPreferenceList(HumanoidCharacterProfile userPreferences, IEnumerable<AntagPrototype> listablePreferences)
{
EventPreferenceControl.SetPreferenceList(userPreferences, listablePreferences);
EventPreferenceControl.SetPreferenceList(currentPreferences, listablePreferences);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public sealed class EventPreferencesCommand : LocalizedCommands
{
[Dependency] private readonly IPlayerLocator _locator = default!;
[Dependency] private readonly IServerPreferencesManager _pref = default!;
[Dependency] private readonly EuiManager _euis = default!;
[Dependency] private readonly EuiManager _eui = default!;
[Dependency] private readonly IPlayerManager _players = default!;
public override string Command => "eventpreferences";

Expand Down Expand Up @@ -43,7 +43,7 @@ public override async void Execute(IConsoleShell shell, string argStr, string[]
var pref = (HumanoidCharacterProfile)_pref.GetPreferences(queriedPlayer.UserId).SelectedCharacter;

var ui = new EventPreferencesPanelEui(queriedPlayer, pref);
_euis.OpenEui(ui, admin);
_eui.OpenEui(ui, admin);
ui.SetState();
}

Expand Down