Re-organize all projects (#4166)

This commit is contained in:
DrSmugleaf
2021-06-09 22:19:39 +02:00
committed by GitHub
parent 9f50e4061b
commit ff1a2d97ea
1773 changed files with 5258 additions and 5508 deletions

View File

@@ -0,0 +1,169 @@
using Content.Client.Eui;
using Content.Shared.Administration;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.Eui;
using JetBrains.Annotations;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Prototypes;
namespace Content.Client.Administration.UI
{
[UsedImplicitly]
public sealed class AdminAddReagentEui : BaseEui
{
[Dependency] private readonly IPrototypeManager _prototypes = default!;
private readonly Menu _window;
public AdminAddReagentEui()
{
_window = new Menu(this);
_window.OnClose += () => SendMessage(new AdminAddReagentEuiMsg.Close());
}
public override void Opened()
{
_window.OpenCentered();
}
public override void Closed()
{
_window.Close();
}
public override void HandleState(EuiStateBase state)
{
_window.HandleState((AdminAddReagentEuiState) state);
}
private void DoAdd(bool close, string reagentId, ReagentUnit amount)
{
SendMessage(new AdminAddReagentEuiMsg.DoAdd
{
Amount = amount,
ReagentId = reagentId,
CloseAfter = close
});
}
private sealed class Menu : SS14Window
{
private readonly AdminAddReagentEui _eui;
private readonly Label _volumeLabel;
private readonly LineEdit _reagentIdEdit;
private readonly LineEdit _amountEdit;
private readonly Label _errorLabel;
private readonly Button _addButton;
private readonly Button _addCloseButton;
public Menu(AdminAddReagentEui eui)
{
_eui = eui;
Title = Loc.GetString("Add reagent...");
Contents.AddChild(new VBoxContainer
{
Children =
{
new GridContainer
{
Columns = 2,
Children =
{
new Label {Text = Loc.GetString("Cur volume: ")},
(_volumeLabel = new Label()),
new Label {Text = Loc.GetString("Reagent: ")},
(_reagentIdEdit = new LineEdit {PlaceHolder = Loc.GetString("Reagent ID...")}),
new Label {Text = Loc.GetString("Amount: ")},
(_amountEdit = new LineEdit
{
PlaceHolder = Loc.GetString("A number..."),
HorizontalExpand = true
}),
},
HorizontalExpand = true,
VerticalExpand = true
},
new HBoxContainer
{
Children =
{
(_errorLabel = new Label
{
HorizontalExpand = true,
ClipText = true
}),
(_addButton = new Button {Text = Loc.GetString("Add")}),
(_addCloseButton = new Button {Text = Loc.GetString("Add & Close")})
}
}
}
});
_reagentIdEdit.OnTextChanged += _ => CheckErrors();
_amountEdit.OnTextChanged += _ => CheckErrors();
_addButton.OnPressed += _ => DoAdd(false);
_addCloseButton.OnPressed += _ => DoAdd(true);
CheckErrors();
}
private void DoAdd(bool close)
{
_eui.DoAdd(
close,
_reagentIdEdit.Text,
ReagentUnit.New(float.Parse(_amountEdit.Text)));
}
private void CheckErrors()
{
if (string.IsNullOrWhiteSpace(_reagentIdEdit.Text))
{
DoError(Loc.GetString("Must specify reagent ID"));
return;
}
if (!_eui._prototypes.HasIndex<ReagentPrototype>(_reagentIdEdit.Text))
{
DoError(Loc.GetString("'{0}' does not exist.", _reagentIdEdit.Text));
return;
}
if (string.IsNullOrWhiteSpace(_amountEdit.Text))
{
DoError(Loc.GetString("Must specify reagent amount"));
return;
}
if (!float.TryParse(_amountEdit.Text, out _))
{
DoError(Loc.GetString("Invalid amount"));
return;
}
_addButton.Disabled = false;
_addCloseButton.Disabled = false;
_errorLabel.Text = "";
void DoError(string text)
{
_errorLabel.Text = text;
_addButton.Disabled = true;
_addCloseButton.Disabled = true;
}
}
public void HandleState(AdminAddReagentEuiState state)
{
_volumeLabel.Text = Loc.GetString("{0}/{1}u", state.CurVolume, state.MaxVolume);
}
}
}
}

View File

@@ -0,0 +1,19 @@
<SS14Window
xmlns="https://spacestation14.io"
xmlns:adminMenu="clr-namespace:Content.Client.UserInterface.AdminMenu.Tabs;assembly=Content.Client"
xmlns:adminTab="clr-namespace:Content.Client.UserInterface.AdminMenu.Tabs.AdminTab"
xmlns:adminbusTab="clr-namespace:Content.Client.UserInterface.AdminMenu.Tabs.AdminbusTab"
xmlns:atmosTab="clr-namespace:Content.Client.UserInterface.AdminMenu.Tabs.AtmosTab"
xmlns:adminTab1="clr-namespace:Content.Client.Administration.UI.Tabs.AdminTab"
xmlns:adminbusTab1="clr-namespace:Content.Client.Administration.UI.Tabs.AdminbusTab"
xmlns:atmosTab1="clr-namespace:Content.Client.Administration.UI.Tabs.AtmosTab"
xmlns:tabs="clr-namespace:Content.Client.Administration.UI.Tabs">
<TabContainer Name="MasterTabContainer">
<adminTab1:AdminTab />
<adminbusTab1:AdminbusTab />
<atmosTab1:AtmosTab />
<tabs:RoundTab />
<tabs:ServerTab />
<tabs:PlayerTab Name="PlayerTabControl" />
</TabContainer>
</SS14Window>

View File

@@ -0,0 +1,58 @@
#nullable enable
using System.Collections.Generic;
using Content.Client.Administration.UI.Tabs;
using Content.Client.HUD;
using Content.Shared.Administration.Menu;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
namespace Content.Client.Administration.UI
{
[GenerateTypedNameReferences]
public partial class AdminMenuWindow : SS14Window
{
[Dependency] private readonly IGameHud? _gameHud = default!;
public event PlayerTab.PlayerListRefresh? OnPlayerListRefresh
{
add => PlayerTabControl.OnPlayerListRefresh += value;
remove => PlayerTabControl.OnPlayerListRefresh -= value;
}
public AdminMenuWindow()
{
MinSize = SetSize = (500, 250);
Title = Loc.GetString("Admin Menu");
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
MasterTabContainer.SetTabTitle(0, Loc.GetString("Admin"));
MasterTabContainer.SetTabTitle(1, Loc.GetString("Adminbus"));
MasterTabContainer.SetTabTitle(2, Loc.GetString("Atmos"));
MasterTabContainer.SetTabTitle(3, Loc.GetString("Round"));
MasterTabContainer.SetTabTitle(4, Loc.GetString("Server"));
MasterTabContainer.SetTabTitle(5, Loc.GetString("Players"));
}
protected override void EnteredTree()
{
base.EnteredTree();
if (_gameHud != null)
_gameHud.AdminButtonDown = true;
}
protected override void ExitedTree()
{
base.ExitedTree();
if (_gameHud != null)
_gameHud.AdminButtonDown = false;
}
public void RefreshPlayerList(IEnumerable<AdminMenuPlayerListMessage.PlayerInfo> players)
{
PlayerTabControl.RefreshPlayerList(players);
}
}
}

View File

@@ -0,0 +1,38 @@
#nullable enable
using Robust.Client.Console;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.IoC;
namespace Content.Client.Administration.UI.CustomControls
{
public class CommandButton : Button
{
public string? Command { get; set; }
public CommandButton() : base()
{
OnPressed += Execute;
}
protected virtual bool CanPress()
{
return string.IsNullOrEmpty(Command) ||
IoCManager.Resolve<IClientConGroupController>().CanCommand(Command);
}
protected override void EnteredTree()
{
if (!CanPress())
{
Visible = false;
}
}
protected virtual void Execute(ButtonEventArgs obj)
{
// Default is to execute command
if (!string.IsNullOrEmpty(Command))
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(Command);
}
}
}

View File

@@ -0,0 +1,13 @@
<VBoxContainer
xmlns="https://spacestation14.io">
<Control CustomMinimumSize="0 5" />
<HBoxContainer>
<!-- <Label Text="{Loc Search}" CustomMinimumSize="100 0" /> -->
<!-- <Control CustomMinimumSize="50 0" /> -->
<LineEdit Name="FilterLineEdit" CustomMinimumSize="100 0" SizeFlagsHorizontal="FillExpand" PlaceHolder="{Loc Filter}"/>
</HBoxContainer>
<!-- <Control CustomMinimumSize="0 5" /> -->
<ItemList
Name="PlayerItemList" SelectMode="Single" SizeFlagsVertical="FillExpand" SizeFlagsHorizontal="FillExpand"
CustomMinimumSize="100 100" />
</VBoxContainer>

View File

@@ -0,0 +1,79 @@
#nullable enable
using System;
using System.Collections.Generic;
using System.Linq;
using Robust.Client.AutoGenerated;
using Robust.Client.Player;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.IoC;
using Robust.Shared.Players;
namespace Content.Client.Administration.UI.CustomControls
{
[GenerateTypedNameReferences]
public partial class PlayerListControl : VBoxContainer
{
private List<ICommonSession>? _data;
public event Action<ICommonSession?>? OnSelectionChanged;
protected override void EnteredTree()
{
// Fill the Option data
_data = IoCManager.Resolve<IPlayerManager>().Sessions.OfType<ICommonSession>().ToList();
PopulateList();
PlayerItemList.OnItemSelected += PlayerItemListOnOnItemSelected;
PlayerItemList.OnItemDeselected += PlayerItemListOnOnItemDeselected;
FilterLineEdit.OnTextChanged += FilterLineEditOnOnTextEntered;
}
private void FilterLineEditOnOnTextEntered(LineEdit.LineEditEventArgs obj)
{
PopulateList(FilterLineEdit.Text);
}
private static string GetDisplayName(ICommonSession session)
{
return $"{session.Name} ({session.AttachedEntity?.Name})";
}
private void PlayerItemListOnOnItemSelected(ItemList.ItemListSelectedEventArgs obj)
{
var selectedPlayer = (ICommonSession) obj.ItemList[obj.ItemIndex].Metadata!;
OnSelectionChanged?.Invoke(selectedPlayer);
}
private void PlayerItemListOnOnItemDeselected(ItemList.ItemListDeselectedEventArgs obj)
{
OnSelectionChanged?.Invoke(null);
}
private void PopulateList(string? filter = null)
{
// _data should never be null here
if (_data == null)
return;
PlayerItemList.Clear();
foreach (var session in _data)
{
var displayName = GetDisplayName(session);
if (!string.IsNullOrEmpty(filter) &&
!displayName.ToLowerInvariant().Contains(filter.Trim().ToLowerInvariant()))
{
continue;
}
PlayerItemList.Add(new ItemList.Item(PlayerItemList)
{
Metadata = session,
Text = displayName
});
}
}
public void ClearSelection()
{
PlayerItemList.ClearSelected();
}
}
}

View File

@@ -0,0 +1,21 @@
#nullable enable
using System;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.IoC;
namespace Content.Client.Administration.UI.CustomControls
{
public class UICommandButton : CommandButton
{
public Type? WindowType { get; set; }
private SS14Window? _window;
protected override void Execute(ButtonEventArgs obj)
{
if (WindowType == null)
return;
_window = (SS14Window) IoCManager.Resolve<IDynamicTypeFactory>().CreateInstance(WindowType);
_window?.OpenCentered();
}
}
}

View File

@@ -0,0 +1,603 @@
using System.Collections.Generic;
using System.Linq;
using Content.Client.Administration.Managers;
using Content.Client.Eui;
using Content.Client.Stylesheets;
using Content.Shared.Administration;
using Content.Shared.Eui;
using JetBrains.Annotations;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Maths;
using Robust.Shared.Utility;
using static Content.Shared.Administration.PermissionsEuiMsg;
namespace Content.Client.Administration.UI
{
[UsedImplicitly]
public sealed class PermissionsEui : BaseEui
{
private const int NoRank = -1;
[Dependency] private readonly IClientAdminManager _adminManager = default!;
private readonly Menu _menu;
private readonly List<SS14Window> _subWindows = new();
private Dictionary<int, PermissionsEuiState.AdminRankData> _ranks =
new();
public PermissionsEui()
{
IoCManager.InjectDependencies(this);
_menu = new Menu(this);
_menu.AddAdminButton.OnPressed += AddAdminPressed;
_menu.AddAdminRankButton.OnPressed += AddAdminRankPressed;
_menu.OnClose += CloseEverything;
}
public override void Closed()
{
base.Closed();
CloseEverything();
}
private void CloseEverything()
{
foreach (var subWindow in _subWindows.ToArray())
{
subWindow.Close();
}
_menu.Close();
}
private void AddAdminPressed(BaseButton.ButtonEventArgs obj)
{
OpenEditWindow(null);
}
private void AddAdminRankPressed(BaseButton.ButtonEventArgs obj)
{
OpenRankEditWindow(null);
}
private void OnEditPressed(PermissionsEuiState.AdminData admin)
{
OpenEditWindow(admin);
}
private void OpenEditWindow(PermissionsEuiState.AdminData? data)
{
var window = new EditAdminWindow(this, data);
window.SaveButton.OnPressed += _ => SaveAdminPressed(window);
window.OpenCentered();
window.OnClose += () => _subWindows.Remove(window);
if (data != null)
{
window.RemoveButton!.OnPressed += _ => RemoveButtonPressed(window);
}
_subWindows.Add(window);
}
private void OpenRankEditWindow(KeyValuePair<int, PermissionsEuiState.AdminRankData>? rank)
{
var window = new EditAdminRankWindow(this, rank);
window.SaveButton.OnPressed += _ => SaveAdminRankPressed(window);
window.OpenCentered();
window.OnClose += () => _subWindows.Remove(window);
if (rank != null)
{
window.RemoveButton!.OnPressed += _ => RemoveRankButtonPressed(window);
}
_subWindows.Add(window);
}
private void RemoveButtonPressed(EditAdminWindow window)
{
SendMessage(new RemoveAdmin {UserId = window.SourceData!.Value.UserId});
window.Close();
}
private void RemoveRankButtonPressed(EditAdminRankWindow window)
{
SendMessage(new RemoveAdminRank {Id = window.SourceId!.Value});
window.Close();
}
private void SaveAdminPressed(EditAdminWindow popup)
{
popup.CollectSetFlags(out var pos, out var neg);
int? rank = popup.RankButton.SelectedId;
if (rank == NoRank)
{
rank = null;
}
var title = string.IsNullOrWhiteSpace(popup.TitleEdit.Text) ? null : popup.TitleEdit.Text;
if (popup.SourceData is { } src)
{
SendMessage(new UpdateAdmin
{
UserId = src.UserId,
Title = title,
PosFlags = pos,
NegFlags = neg,
RankId = rank
});
}
else
{
DebugTools.AssertNotNull(popup.NameEdit);
SendMessage(new AddAdmin
{
UserNameOrId = popup.NameEdit!.Text,
Title = title,
PosFlags = pos,
NegFlags = neg,
RankId = rank
});
}
popup.Close();
}
private void SaveAdminRankPressed(EditAdminRankWindow popup)
{
var flags = popup.CollectSetFlags();
var name = popup.NameEdit.Text;
if (popup.SourceId is { } src)
{
SendMessage(new UpdateAdminRank
{
Id = src,
Flags = flags,
Name = name
});
}
else
{
SendMessage(new AddAdminRank
{
Flags = flags,
Name = name
});
}
popup.Close();
}
public override void Opened()
{
_menu.OpenCentered();
}
public override void HandleState(EuiStateBase state)
{
var s = (PermissionsEuiState) state;
if (s.IsLoading)
{
return;
}
_ranks = s.AdminRanks;
_menu.AdminsList.RemoveAllChildren();
foreach (var admin in s.Admins)
{
var al = _menu.AdminsList;
var name = admin.UserName ?? admin.UserId.ToString();
al.AddChild(new Label {Text = name});
var titleControl = new Label {Text = admin.Title ?? Loc.GetString("none")};
if (admin.Title == null) // none
{
titleControl.StyleClasses.Add(StyleBase.StyleClassItalic);
}
al.AddChild(titleControl);
bool italic;
string rank;
var combinedFlags = admin.PosFlags;
if (admin.RankId is { } rankId)
{
italic = false;
var rankData = s.AdminRanks[rankId];
rank = rankData.Name;
combinedFlags |= rankData.Flags;
}
else
{
italic = true;
rank = Loc.GetString("none");
}
var rankControl = new Label {Text = rank};
if (italic)
{
rankControl.StyleClasses.Add(StyleBase.StyleClassItalic);
}
al.AddChild(rankControl);
var flagsText = AdminFlagsHelper.PosNegFlagsText(admin.PosFlags, admin.NegFlags);
al.AddChild(new Label
{
Text = flagsText,
HorizontalExpand = true,
HorizontalAlignment = Control.HAlignment.Center,
});
var editButton = new Button {Text = Loc.GetString("Edit")};
editButton.OnPressed += _ => OnEditPressed(admin);
al.AddChild(editButton);
if (!_adminManager.HasFlag(combinedFlags))
{
editButton.Disabled = true;
editButton.ToolTip = Loc.GetString("You do not have the required flags to edit this admin.");
}
}
_menu.AdminRanksList.RemoveAllChildren();
foreach (var kv in s.AdminRanks)
{
var rank = kv.Value;
var flagsText = string.Join(' ', AdminFlagsHelper.FlagsToNames(rank.Flags).Select(f => $"+{f}"));
_menu.AdminRanksList.AddChild(new Label {Text = rank.Name});
_menu.AdminRanksList.AddChild(new Label
{
Text = flagsText,
HorizontalExpand = true,
HorizontalAlignment = Control.HAlignment.Center,
});
var editButton = new Button {Text = Loc.GetString("Edit")};
editButton.OnPressed += _ => OnEditRankPressed(kv);
_menu.AdminRanksList.AddChild(editButton);
if (!_adminManager.HasFlag(rank.Flags))
{
editButton.Disabled = true;
editButton.ToolTip = Loc.GetString("You do not have the required flags to edit this rank.");
}
}
}
private void OnEditRankPressed(KeyValuePair<int, PermissionsEuiState.AdminRankData> rank)
{
OpenRankEditWindow(rank);
}
private sealed class Menu : SS14Window
{
private readonly PermissionsEui _ui;
public readonly GridContainer AdminsList;
public readonly GridContainer AdminRanksList;
public readonly Button AddAdminButton;
public readonly Button AddAdminRankButton;
public Menu(PermissionsEui ui)
{
_ui = ui;
Title = Loc.GetString("Permissions Panel");
var tab = new TabContainer();
AddAdminButton = new Button
{
Text = Loc.GetString("Add Admin"),
HorizontalAlignment = HAlignment.Right
};
AddAdminRankButton = new Button
{
Text = Loc.GetString("Add Admin Rank"),
HorizontalAlignment = HAlignment.Right
};
AdminsList = new GridContainer {Columns = 5, VerticalExpand = true};
var adminVBox = new VBoxContainer
{
Children = {AdminsList, AddAdminButton},
};
TabContainer.SetTabTitle(adminVBox, Loc.GetString("Admins"));
AdminRanksList = new GridContainer {Columns = 3};
var rankVBox = new VBoxContainer
{
Children = { AdminRanksList, AddAdminRankButton}
};
TabContainer.SetTabTitle(rankVBox, Loc.GetString("Admin Ranks"));
tab.AddChild(adminVBox);
tab.AddChild(rankVBox);
Contents.AddChild(tab);
}
protected override Vector2 ContentsMinimumSize => (600, 400);
}
private sealed class EditAdminWindow : SS14Window
{
public readonly PermissionsEuiState.AdminData? SourceData;
public readonly LineEdit? NameEdit;
public readonly LineEdit TitleEdit;
public readonly OptionButton RankButton;
public readonly Button SaveButton;
public readonly Button? RemoveButton;
public readonly Dictionary<AdminFlags, (Button inherit, Button sub, Button plus)> FlagButtons
= new();
public EditAdminWindow(PermissionsEui ui, PermissionsEuiState.AdminData? data)
{
SetSize = MinSize = (600, 400);
SourceData = data;
Control nameControl;
if (data is { } dat)
{
var name = dat.UserName ?? dat.UserId.ToString();
Title = Loc.GetString("Edit admin {0}", name);
nameControl = new Label {Text = name};
}
else
{
Title = Loc.GetString("Add admin");
nameControl = NameEdit = new LineEdit {PlaceHolder = Loc.GetString("Username/User ID")};
}
TitleEdit = new LineEdit {PlaceHolder = Loc.GetString("Custom title, leave blank to inherit rank title.")};
RankButton = new OptionButton();
SaveButton = new Button {Text = Loc.GetString("Save"), HorizontalAlignment = HAlignment.Right};
RankButton.AddItem(Loc.GetString("No rank"), NoRank);
foreach (var (rId, rank) in ui._ranks)
{
RankButton.AddItem(rank.Name, rId);
}
RankButton.SelectId(data?.RankId ?? NoRank);
RankButton.OnItemSelected += RankSelected;
var permGrid = new GridContainer
{
Columns = 4,
HSeparationOverride = 0,
VSeparationOverride = 0
};
foreach (var flag in AdminFlagsHelper.AllFlags)
{
// Can only grant out perms you also have yourself.
// Primarily intended to prevent people giving themselves +HOST with +PERMISSIONS but generalized.
var disable = !ui._adminManager.HasFlag(flag);
var flagName = flag.ToString().ToUpper();
var group = new ButtonGroup();
var inherit = new Button
{
Text = "I",
StyleClasses = {StyleBase.ButtonOpenRight},
Disabled = disable,
Group = group,
};
var sub = new Button
{
Text = "-",
StyleClasses = {StyleBase.ButtonOpenBoth},
Disabled = disable,
Group = group
};
var plus = new Button
{
Text = "+",
StyleClasses = {StyleBase.ButtonOpenLeft},
Disabled = disable,
Group = group
};
if (data is { } d)
{
if ((d.NegFlags & flag) != 0)
{
sub.Pressed = true;
}
else if ((d.PosFlags & flag) != 0)
{
plus.Pressed = true;
}
else
{
inherit.Pressed = true;
}
}
else
{
inherit.Pressed = true;
}
permGrid.AddChild(new Label {Text = flagName});
permGrid.AddChild(inherit);
permGrid.AddChild(sub);
permGrid.AddChild(plus);
FlagButtons.Add(flag, (inherit, sub, plus));
}
var bottomButtons = new HBoxContainer();
if (data != null)
{
// show remove button.
RemoveButton = new Button {Text = Loc.GetString("Remove")};
bottomButtons.AddChild(RemoveButton);
}
bottomButtons.AddChild(SaveButton);
Contents.AddChild(new VBoxContainer
{
Children =
{
new HBoxContainer
{
SeparationOverride = 2,
Children =
{
new VBoxContainer
{
HorizontalExpand = true,
Children =
{
nameControl,
TitleEdit,
RankButton
}
},
permGrid
},
VerticalExpand = true
},
bottomButtons
}
});
}
private void RankSelected(OptionButton.ItemSelectedEventArgs obj)
{
RankButton.SelectId(obj.Id);
}
public void CollectSetFlags(out AdminFlags pos, out AdminFlags neg)
{
pos = default;
neg = default;
foreach (var (flag, (_, s, p)) in FlagButtons)
{
if (s.Pressed)
{
neg |= flag;
}
else if (p.Pressed)
{
pos |= flag;
}
}
}
}
private sealed class EditAdminRankWindow : SS14Window
{
public readonly int? SourceId;
public readonly LineEdit NameEdit;
public readonly Button SaveButton;
public readonly Button? RemoveButton;
public readonly Dictionary<AdminFlags, CheckBox> FlagCheckBoxes = new();
public EditAdminRankWindow(PermissionsEui ui, KeyValuePair<int, PermissionsEuiState.AdminRankData>? data)
{
MinSize = SetSize = (600, 400);
SourceId = data?.Key;
NameEdit = new LineEdit
{
PlaceHolder = Loc.GetString("Rank name"),
};
if (data != null)
{
NameEdit.Text = data.Value.Value.Name;
}
SaveButton = new Button {
Text = Loc.GetString("Save"),
HorizontalAlignment = HAlignment.Right,
HorizontalExpand = true
};
var flagsBox = new VBoxContainer();
foreach (var flag in AdminFlagsHelper.AllFlags)
{
// Can only grant out perms you also have yourself.
// Primarily intended to prevent people giving themselves +HOST with +PERMISSIONS but generalized.
var disable = !ui._adminManager.HasFlag(flag);
var flagName = flag.ToString().ToUpper();
var checkBox = new CheckBox
{
Disabled = disable,
Text = flagName
};
if (data != null && (data.Value.Value.Flags & flag) != 0)
{
checkBox.Pressed = true;
}
FlagCheckBoxes.Add(flag, checkBox);
flagsBox.AddChild(checkBox);
}
var bottomButtons = new HBoxContainer();
if (data != null)
{
// show remove button.
RemoveButton = new Button {Text = Loc.GetString("Remove")};
bottomButtons.AddChild(RemoveButton);
}
bottomButtons.AddChild(SaveButton);
Contents.AddChild(new VBoxContainer
{
Children =
{
NameEdit,
flagsBox,
bottomButtons
}
});
}
public AdminFlags CollectSetFlags()
{
AdminFlags flags = default;
foreach (var (flag, chk) in FlagCheckBoxes)
{
if (chk.Pressed)
{
flags |= flag;
}
}
return flags;
}
}
}
}

View File

@@ -0,0 +1,35 @@
using Content.Client.Eui;
using Content.Shared.Administration;
using Content.Shared.Eui;
using JetBrains.Annotations;
namespace Content.Client.Administration.UI.SetOutfit
{
[UsedImplicitly]
public sealed class SetOutfitEui : BaseEui
{
private readonly SetOutfitMenu _window;
public SetOutfitEui()
{
_window = new SetOutfitMenu();
}
public override void Opened()
{
_window.OpenCentered();
}
public override void Closed()
{
base.Closed();
_window.Close();
}
public override void HandleState(EuiStateBase state)
{
var outfitState = (SetOutfitEuiState) state;
_window.TargetEntityId = outfitState.TargetEntityId;
}
}
}

View File

@@ -0,0 +1,15 @@
<SS14Window
xmlns="https://spacestation14.io">
<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" />
</HBoxContainer>
<ItemList Name="OutfitList" SelectMode="Single" VerticalExpand="True"
SizeFlagsStretchRatio="0.9" />
<Button Name="ConfirmButton" HorizontalExpand="True" />
</VBoxContainer>
</HBoxContainer>
</SS14Window>

View File

@@ -0,0 +1,97 @@
using Content.Shared.Roles;
using Robust.Client.AutoGenerated;
using Robust.Client.Console;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Prototypes;
namespace Content.Client.Administration.UI.SetOutfit
{
[GenerateTypedNameReferences]
public partial class SetOutfitMenu : SS14Window
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;
public EntityUid? TargetEntityId { get; set; }
private StartingGearPrototype? _selectedOutfit;
public SetOutfitMenu()
{
MinSize = SetSize = (250, 320);
IoCManager.InjectDependencies(this);
RobustXamlLoader.Load(this);
Title = Loc.GetString("Set Outfit");
ConfirmButton.Text = Loc.GetString("Confirm");
ConfirmButton.OnPressed += ConfirmButtonOnOnPressed;
SearchBar.OnTextChanged += SearchBarOnOnTextChanged;
OutfitList.OnItemSelected += OutfitListOnOnItemSelected;
OutfitList.OnItemDeselected += OutfitListOnOnItemDeselected;
PopulateList();
}
private void ConfirmButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
{
if (TargetEntityId == null || _selectedOutfit == null)
return;
var command = $"setoutfit {TargetEntityId} {_selectedOutfit.ID}";
_consoleHost.ExecuteCommand(command);
Close();
}
private void OutfitListOnOnItemSelected(ItemList.ItemListSelectedEventArgs obj)
{
_selectedOutfit = (StartingGearPrototype) obj.ItemList[obj.ItemIndex].Metadata!;
ConfirmButton.Disabled = false;
}
private void OutfitListOnOnItemDeselected(ItemList.ItemListDeselectedEventArgs obj)
{
_selectedOutfit = null;
ConfirmButton.Disabled = true;
}
private void SearchBarOnOnTextChanged(LineEdit.LineEditEventArgs obj)
{
PopulateByFilter(SearchBar.Text);
}
private void PopulateList()
{
foreach (var gear in _prototypeManager.EnumeratePrototypes<StartingGearPrototype>())
{
OutfitList.Add(GetItem(gear, OutfitList));
}
}
private void PopulateByFilter(string filter)
{
OutfitList.Clear();
foreach (var gear in _prototypeManager.EnumeratePrototypes<StartingGearPrototype>())
{
if (!string.IsNullOrEmpty(filter) &&
gear.ID.ToLowerInvariant().Contains(filter.Trim().ToLowerInvariant()))
{
OutfitList.Add(GetItem(gear, OutfitList));
}
}
}
private static ItemList.Item GetItem(StartingGearPrototype gear, ItemList itemList)
{
return new(itemList)
{
Metadata = gear,
Text = gear.ID
};
}
}
}

View File

@@ -0,0 +1,19 @@
<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"
xmlns:customControls="clr-namespace:Content.Client.Administration.UI.CustomControls"
xmlns:adminTab="clr-namespace:Content.Client.Administration.UI.Tabs.AdminTab"
Margin="4"
MinSize="50 50">
<VBoxContainer>
<GridContainer Columns="4">
<customControls:UICommandButton Command="kick" Text="{Loc Kick}" WindowType="{x:Type adminTab:KickWindow}" />
<customControls:UICommandButton Command="ban" Text="{Loc Ban}" WindowType="{x:Type adminTab:BanWindow}" />
<customControls:CommandButton Command="aghost" Text="{Loc Admin Ghost}" />
<customControls:UICommandButton Command="tpto" Text="{Loc Teleport}" WindowType="{x:Type adminTab:TeleportWindow}" />
<customControls:CommandButton Command="permissions" Text="{Loc Permissions Panel}" />
</GridContainer>
</VBoxContainer>
</Control>

View File

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

View File

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

View File

@@ -0,0 +1,35 @@
#nullable enable
using JetBrains.Annotations;
using Robust.Client.AutoGenerated;
using Robust.Client.Console;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.IoC;
using Robust.Shared.Utility;
namespace Content.Client.Administration.UI.Tabs.AdminTab
{
[GenerateTypedNameReferences]
[UsedImplicitly]
public partial class BanWindow : SS14Window
{
protected override void EnteredTree()
{
PlayerNameLine.OnTextChanged += PlayerNameLineOnOnTextChanged;
SubmitButton.OnPressed += SubmitButtonOnOnPressed;
}
private void PlayerNameLineOnOnTextChanged(LineEdit.LineEditEventArgs obj)
{
SubmitButton.Disabled = string.IsNullOrEmpty(PlayerNameLine.Text);
}
private void SubmitButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
{
// Small verification if Player Name exists
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(
$"ban \"{PlayerNameLine.Text}\" \"{CommandParsing.Escape(ReasonLine.Text)}\" {MinutesLine.Text}");
}
}
}

View File

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

View File

@@ -0,0 +1,39 @@
#nullable enable
using JetBrains.Annotations;
using Robust.Client.AutoGenerated;
using Robust.Client.Console;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.IoC;
using Robust.Shared.Players;
using Robust.Shared.Utility;
namespace Content.Client.Administration.UI.Tabs.AdminTab
{
[GenerateTypedNameReferences]
[UsedImplicitly]
public partial class KickWindow : SS14Window
{
private ICommonSession? _selectedSession;
protected override void EnteredTree()
{
SubmitButton.OnPressed += SubmitButtonOnOnPressed;
PlayerList.OnSelectionChanged += OnListOnOnSelectionChanged;
}
private void OnListOnOnSelectionChanged(ICommonSession? obj)
{
_selectedSession = obj;
SubmitButton.Disabled = _selectedSession == null;
}
private void SubmitButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
{
if (_selectedSession == null)
return;
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(
$"kick \"{_selectedSession.Name}\" \"{CommandParsing.Escape(ReasonLine.Text)}\"");
}
}
}

View File

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

View File

@@ -0,0 +1,39 @@
#nullable enable
using JetBrains.Annotations;
using Robust.Client.AutoGenerated;
using Robust.Client.Console;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.IoC;
using Robust.Shared.Players;
namespace Content.Client.Administration.UI.Tabs.AdminTab
{
[GenerateTypedNameReferences]
[UsedImplicitly]
public partial class TeleportWindow : SS14Window
{
private ICommonSession? _selectedSession;
protected override void EnteredTree()
{
SubmitButton.OnPressed += SubmitButtonOnOnPressed;
PlayerList.OnSelectionChanged += OnListOnOnSelectionChanged;
}
private void OnListOnOnSelectionChanged(ICommonSession? obj)
{
_selectedSession = obj;
SubmitButton.Disabled = _selectedSession == null;
}
private void SubmitButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
{
if (_selectedSession == null)
return;
// Execute command
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(
$"tpto \"{_selectedSession.Name}\"");
}
}
}

View File

@@ -0,0 +1,16 @@
<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"
xmlns:customControls="clr-namespace:Content.Client.Administration.UI.CustomControls"
xmlns:adminbusTab="clr-namespace:Content.Client.Administration.UI.Tabs.AdminbusTab"
Margin="4"
MinSize="50 50">
<GridContainer
Columns="4">
<customControls:CommandButton Name="SpawnEntitiesButton" Text="{Loc Spawn Entities}" />
<customControls:CommandButton Name="SpawnTilesButton" Text="{Loc Spawn Tiles} " />
<customControls:UICommandButton Command="events" Text="{Loc Station Events}" WindowType="{x:Type adminbusTab:StationEventsWindow}" />
</GridContainer>
</Control>

View File

@@ -0,0 +1,44 @@
#nullable enable
using Content.Client.Administration.Managers;
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;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
namespace Content.Client.Administration.UI.Tabs.AdminbusTab
{
[GenerateTypedNameReferences]
public partial class AdminbusTab : Control
{
protected override void EnteredTree()
{
// For the SpawnEntitiesButton and SpawnTilesButton we need to do the press manually
// TODO: This will probably need some command check at some point
SpawnEntitiesButton.OnPressed += SpawnEntitiesButtonOnOnPressed;
SpawnTilesButton.OnPressed += SpawnTilesButtonOnOnPressed;
}
private static void SpawnEntitiesButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
{
var manager = IoCManager.Resolve<IAdminMenuManager>();
var window = new EntitySpawnWindow(IoCManager.Resolve<IPlacementManager>(),
IoCManager.Resolve<IPrototypeManager>(),
IoCManager.Resolve<IResourceCache>());
manager.OpenCommand(window);
}
private static void SpawnTilesButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
{
var manager = IoCManager.Resolve<IAdminMenuManager>();
var window = new TileSpawnWindow(IoCManager.Resolve<ITileDefinitionManager>(),
IoCManager.Resolve<IPlacementManager>(),
IoCManager.Resolve<IResourceCache>());
manager.OpenCommand(window);
}
}
}

View File

@@ -0,0 +1,13 @@
<SS14Window
xmlns="https://spacestation14.io" Title="Kick">
<VBoxContainer>
<HBoxContainer>
<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}" />
<Button Name="SubmitButton" Text="{Loc Run}" />
</VBoxContainer>
</SS14Window>

View File

@@ -0,0 +1,54 @@
#nullable enable
using System.Collections.Generic;
using System.Linq;
using Content.Client.StationEvents.Managers;
using JetBrains.Annotations;
using Robust.Client.AutoGenerated;
using Robust.Client.Console;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
namespace Content.Client.Administration.UI.Tabs.AdminbusTab
{
[GenerateTypedNameReferences]
[UsedImplicitly]
public partial class StationEventsWindow : SS14Window
{
private List<string>? _data;
protected override void EnteredTree()
{
_data = IoCManager.Resolve<IStationEventManager>().StationEvents.ToList();
_data.Add(_data.Any() ? Loc.GetString("Not loaded") : Loc.GetString("Random"));
foreach (var stationEvent in _data)
{
EventsOptions.AddItem(stationEvent);
}
EventsOptions.OnItemSelected += eventArgs => EventsOptions.SelectId(eventArgs.Id);
PauseButton.OnPressed += PauseButtonOnOnPressed;
ResumeButton.OnPressed += ResumeButtonOnOnPressed;
SubmitButton.OnPressed += SubmitButtonOnOnPressed;
}
private static void PauseButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
{
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand("events pause");
}
private static void ResumeButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
{
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand("events resume");
}
private void SubmitButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
{
if (_data == null)
return;
var selectedEvent = _data[EventsOptions.SelectedId];
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand($"events run \"{selectedEvent}\"");
}
}
}

View File

@@ -0,0 +1,11 @@
<SS14Window
xmlns="https://spacestation14.io" Title="{Loc Add Atmos}">
<VBoxContainer>
<HBoxContainer>
<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>
</SS14Window>

View File

@@ -0,0 +1,43 @@
#nullable enable
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
using Robust.Client.AutoGenerated;
using Robust.Client.Console;
using Robust.Client.Player;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.IoC;
using Robust.Shared.Map;
namespace Content.Client.Administration.UI.Tabs.AtmosTab
{
[GenerateTypedNameReferences]
[UsedImplicitly]
public partial class AddAtmosWindow : SS14Window
{
private IEnumerable<IMapGrid>? _data;
protected override void EnteredTree()
{
_data = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0);
foreach (var grid in _data)
{
var playerGrid = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity?.Transform.GridID;
GridOptions.AddItem($"{grid.Index} {(playerGrid == grid.Index ? " (Current)" : "")}");
}
GridOptions.OnItemSelected += eventArgs => GridOptions.SelectId(eventArgs.Id);
SubmitButton.OnPressed += SubmitButtonOnOnPressed;
}
private void SubmitButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
{
if (_data == null)
return;
var dataList = _data.ToList();
var selectedGrid = dataList[GridOptions.SelectedId].Index;
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand($"addatmos {selectedGrid}");
}
}
}

View File

@@ -0,0 +1,31 @@
<SS14Window
xmlns="https://spacestation14.io" Title="{Loc Add Gas}">
<VBoxContainer>
<HBoxContainer>
<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}" MinSize="100 0" />
<Control MinSize="50 0" />
<SpinBox Name="TileXSpin" MinSize="100 0" HorizontalExpand="True" />
</HBoxContainer>
<HBoxContainer>
<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}" MinSize="100 0" />
<Control MinSize="50 0" />
<OptionButton Name="GasOptions" MinSize="100 0" HorizontalExpand="True" />
</HBoxContainer>
<HBoxContainer>
<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>
</SS14Window>

View File

@@ -0,0 +1,64 @@
#nullable enable
using System.Collections.Generic;
using System.Linq;
using Content.Client.GameObjects.EntitySystems;
using Content.Shared.Atmos;
using JetBrains.Annotations;
using Robust.Client.AutoGenerated;
using Robust.Client.Console;
using Robust.Client.Player;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
namespace Content.Client.Administration.UI.Tabs.AtmosTab
{
[GenerateTypedNameReferences]
[UsedImplicitly]
public partial class AddGasWindow : SS14Window
{
private IEnumerable<IMapGrid>? _gridData;
private IEnumerable<GasPrototype>? _gasData;
protected override void EnteredTree()
{
// Fill out grids
_gridData = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0);
foreach (var grid in _gridData)
{
var playerGrid = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity?.Transform.GridID;
GridOptions.AddItem($"{grid.Index} {(playerGrid == grid.Index ? " (Current)" : "")}");
}
GridOptions.OnItemSelected += eventArgs => GridOptions.SelectId(eventArgs.Id);
// Fill out gases
_gasData = EntitySystem.Get<AtmosphereSystem>().Gases;
foreach (var gas in _gasData)
{
GasOptions.AddItem($"{gas.Name} ({gas.ID})");
}
GasOptions.OnItemSelected += eventArgs => GasOptions.SelectId(eventArgs.Id);
SubmitButton.OnPressed += SubmitButtonOnOnPressed;
}
private void SubmitButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
{
if (_gridData == null || _gasData == null)
return;
var gridList = _gridData.ToList();
var gridIndex = gridList[GridOptions.SelectedId].Index;
var gasList = _gasData.ToList();
var gasId = gasList[GasOptions.SelectedId].ID;
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(
$"addgas {TileXSpin.Value} {TileYSpin.Value} {gridIndex} {gasId} {AmountSpin.Value}");
}
}
}

View File

@@ -0,0 +1,17 @@
<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"
xmlns:customControls="clr-namespace:Content.Client.Administration.UI.CustomControls"
xmlns:atmosTab="clr-namespace:Content.Client.Administration.UI.Tabs.AtmosTab"
Margin="4"
MinSize="50 50">
<GridContainer Columns="4">
<customControls:UICommandButton Text="{Loc Add Atmos}" Command="addatmos" WindowType="{x:Type atmosTab:AddAtmosWindow}" />
<customControls:UICommandButton Text="{Loc Add Gas}" Command="addgas" WindowType="{x:Type atmosTab:AddGasWindow}" />
<customControls:UICommandButton Text="{Loc Fill Gas}" Command="fillgas" WindowType="{x:Type atmosTab:FillGasWindow}" />
<customControls:UICommandButton Text="{Loc Set Temperature}" Command="settemp"
WindowType="{x:Type atmosTab:SetTemperatureWindow}" />
</GridContainer>
</Control>

View File

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

View File

@@ -0,0 +1,21 @@
<SS14Window
xmlns="https://spacestation14.io" Title="{Loc Fill Gas}">
<VBoxContainer>
<HBoxContainer>
<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}" MinSize="100 0" />
<Control MinSize="50 0" />
<OptionButton Name="GasOptions" MinSize="100 0" HorizontalExpand="True" />
</HBoxContainer>
<HBoxContainer>
<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>
</SS14Window>

View File

@@ -0,0 +1,64 @@
#nullable enable
using System.Collections.Generic;
using System.Linq;
using Content.Client.GameObjects.EntitySystems;
using Content.Shared.Atmos;
using JetBrains.Annotations;
using Robust.Client.AutoGenerated;
using Robust.Client.Console;
using Robust.Client.Player;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
namespace Content.Client.Administration.UI.Tabs.AtmosTab
{
[GenerateTypedNameReferences]
[UsedImplicitly]
public partial class FillGasWindow : SS14Window
{
private IEnumerable<IMapGrid>? _gridData;
private IEnumerable<GasPrototype>? _gasData;
protected override void EnteredTree()
{
// Fill out grids
_gridData = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0);
foreach (var grid in _gridData)
{
var playerGrid = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity?.Transform.GridID;
GridOptions.AddItem($"{grid.Index} {(playerGrid == grid.Index ? " (Current)" : "")}");
}
GridOptions.OnItemSelected += eventArgs => GridOptions.SelectId(eventArgs.Id);
// Fill out gases
_gasData = EntitySystem.Get<AtmosphereSystem>().Gases;
foreach (var gas in _gasData)
{
GasOptions.AddItem($"{gas.Name} ({gas.ID})");
}
GasOptions.OnItemSelected += eventArgs => GasOptions.SelectId(eventArgs.Id);
SubmitButton.OnPressed += SubmitButtonOnOnPressed;
}
private void SubmitButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
{
if (_gridData == null || _gasData == null)
return;
var gridList = _gridData.ToList();
var gridIndex = gridList[GridOptions.SelectedId].Index;
var gasList = _gasData.ToList();
var gasId = gasList[GasOptions.SelectedId].ID;
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(
$"fillgas {gridIndex} {gasId} {AmountSpin.Value}");
}
}
}

View File

@@ -0,0 +1,26 @@
<SS14Window
xmlns="https://spacestation14.io" Title="{Loc Set Temperature}">
<VBoxContainer>
<HBoxContainer>
<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}" MinSize="100 0" />
<Control MinSize="50 0" />
<SpinBox Name="TileXSpin" MinSize="100 0" HorizontalExpand="True" />
</HBoxContainer>
<HBoxContainer>
<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}" MinSize="100 0" />
<Control MinSize="50 0" />
<SpinBox Name="TemperatureSpin" MinSize="100 0" HorizontalExpand="True" />
</HBoxContainer>
<Button Name="SubmitButton" Text="{Loc Set Temperature}" />
</VBoxContainer>
</SS14Window>

View File

@@ -0,0 +1,44 @@
#nullable enable
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
using Robust.Client.AutoGenerated;
using Robust.Client.Console;
using Robust.Client.Player;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.IoC;
using Robust.Shared.Map;
namespace Content.Client.Administration.UI.Tabs.AtmosTab
{
[GenerateTypedNameReferences]
[UsedImplicitly]
public partial class SetTemperatureWindow : SS14Window
{
private IEnumerable<IMapGrid>? _data;
protected override void EnteredTree()
{
_data = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0);
foreach (var grid in _data)
{
var playerGrid = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity?.Transform.GridID;
GridOptions.AddItem($"{grid.Index} {(playerGrid == grid.Index ? " (Current)" : "")}");
}
GridOptions.OnItemSelected += eventArgs => GridOptions.SelectId(eventArgs.Id);
SubmitButton.OnPressed += SubmitButtonOnOnPressed;
}
private void SubmitButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
{
if (_data == null)
return;
var dataList = _data.ToList();
var selectedGrid = dataList[GridOptions.SelectedId].Index;
IoCManager.Resolve<IClientConsoleHost>()
.ExecuteCommand($"settemp {TileXSpin.Value} {TileYSpin.Value} {selectedGrid} {TemperatureSpin.Value}");
}
}
}

View File

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

View File

@@ -0,0 +1,166 @@
#nullable enable
using System.Collections.Generic;
using Content.Shared.Administration.Menu;
using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.IoC;
using Robust.Shared.Maths;
namespace Content.Client.Administration.UI.Tabs
{
[GenerateTypedNameReferences]
public partial class PlayerTab : Control
{
public delegate void PlayerListRefresh();
public event PlayerListRefresh? OnPlayerListRefresh;
public PlayerTab()
{
IoCManager.InjectDependencies(this);
RobustXamlLoader.Load(this);
RefreshButton.OnPressed += (_) => OnPlayerListRefresh?.Invoke();
}
protected override void EnteredTree()
{
OnPlayerListRefresh?.Invoke();
}
public void RefreshPlayerList(IEnumerable<AdminMenuPlayerListMessage.PlayerInfo> players)
{
PlayerList.RemoveAllChildren();
var playerManager = IoCManager.Resolve<IPlayerManager>();
PlayerCount.Text = $"Players: {playerManager.PlayerCount}";
var altColor = Color.FromHex("#292B38");
var defaultColor = Color.FromHex("#2F2F3B");
var header = new HBoxContainer
{
HorizontalExpand = true,
SeparationOverride = 4,
Children =
{
new Label
{
Text = "Username",
SizeFlagsStretchRatio = 2f,
HorizontalExpand = true
},
new VSeparator(),
new Label
{
Text = "Character",
SizeFlagsStretchRatio = 2f,
HorizontalExpand = true
},
new VSeparator(),
new Label()
{
Text = "Antagonist",
SizeFlagsStretchRatio = 2f,
HorizontalExpand = true,
}
}
};
PlayerList.AddChild(new PanelContainer
{
PanelOverride = new StyleBoxFlat
{
BackgroundColor = altColor,
},
Children =
{
header
}
});
PlayerList.AddChild(new HSeparator());
var useAltColor = false;
foreach (var player in players)
{
var hBox = new HBoxContainer
{
HorizontalExpand = true,
SeparationOverride = 4,
Children =
{
new Label
{
Text = player.Username,
SizeFlagsStretchRatio = 2f,
HorizontalExpand = true,
ClipText = true
},
new VSeparator(),
new Label
{
Text = player.CharacterName,
SizeFlagsStretchRatio = 2f,
HorizontalExpand = true,
ClipText = true
},
new VSeparator(),
new Label()
{
Text = player.Antag ? "YES" : "NO",
SizeFlagsStretchRatio = 2f,
HorizontalExpand = true,
ClipText = true,
}
}
};
PlayerList.AddChild(new PanelContainer
{
PanelOverride = new StyleBoxFlat
{
BackgroundColor = useAltColor ? altColor : defaultColor,
},
Children =
{
hBox
}
});
useAltColor ^= true;
}
}
private static readonly Color SeparatorColor = Color.FromHex("#3D4059");
private class VSeparator : PanelContainer
{
public VSeparator()
{
MinSize = (2, 5);
AddChild(new PanelContainer
{
PanelOverride = new StyleBoxFlat
{
BackgroundColor = SeparatorColor
}
});
}
}
private class HSeparator : Control
{
public HSeparator()
{
AddChild(new PanelContainer
{
PanelOverride = new StyleBoxFlat
{
BackgroundColor = SeparatorColor,
ContentMarginBottomOverride = 2, ContentMarginLeftOverride = 2
}
});
}
}
}
}

View File

@@ -0,0 +1,13 @@
<Control
xmlns="https://spacestation14.io"
xmlns:amc="clr-namespace:Content.Client.UserInterface.AdminMenu.CustomControls"
xmlns:customControls="clr-namespace:Content.Client.Administration.UI.CustomControls"
Margin="4"
MinSize="50 50">
<GridContainer
Columns="4">
<customControls:CommandButton Command="startround" Text="{Loc Start Round}" />
<customControls:CommandButton Command="endround" Text="{Loc End Round}" />
<customControls:CommandButton Command="restartround" Text="{Loc Restart Round}" />
</GridContainer>
</Control>

View File

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

View File

@@ -0,0 +1,12 @@
<Control
xmlns="https://spacestation14.io"
xmlns:amc="clr-namespace:Content.Client.UserInterface.AdminMenu.CustomControls"
xmlns:customControls="clr-namespace:Content.Client.Administration.UI.CustomControls"
Margin="4"
MinSize="50 50">
<GridContainer
Columns="4" >
<customControls:CommandButton Command="restart" Text="{Loc Reboot}"></customControls:CommandButton>
<customControls:CommandButton Command="shutdown" Text="{Loc Shutdown}"></customControls:CommandButton>
</GridContainer>
</Control>

View File

@@ -0,0 +1,11 @@
#nullable enable
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
namespace Content.Client.Administration.UI.Tabs
{
[GenerateTypedNameReferences]
public partial class ServerTab : Control
{
}
}