Правки и добавления
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls"
|
||||
xmlns:at="clr-namespace:Content.Client.Administration.UI.Tabs.AdminTab"
|
||||
xmlns:wd="clr-namespace:Content.Client._White.Administration"
|
||||
Margin="4"
|
||||
MinSize="50 50">
|
||||
<BoxContainer Orientation="Vertical">
|
||||
@@ -18,7 +19,7 @@
|
||||
<cc:CommandButton Command="adminlogs" Text="{Loc admin-player-actions-window-admin-logs}"/>
|
||||
<cc:CommandButton Command="faxui" Text="{Loc admin-player-actions-window-admin-fax}"/>
|
||||
<cc:UICommandButton Command="enableShuttleCall" Text="{Loc admin-player-actions-window-shuttle-call}" WindowType="{x:Type at:AdminShuttleCallEnableWindow}"/>
|
||||
<cc:UICommandButton Command="" Text="Накрутка времени" WindowType="{x:Type at:HoursPanel }"/>
|
||||
<cc:UICommandButton Text="Накрутка времени" WindowType="{x:Type wd:HoursPanel }"/>
|
||||
</GridContainer>
|
||||
</BoxContainer>
|
||||
</Control>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<DefaultWindow
|
||||
xmlns="https://spacestation14.io"
|
||||
xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls"
|
||||
Title="Накрутка времени" MinSize="300 300">
|
||||
Title="Накрутка времени" MinSize="300 500">
|
||||
<BoxContainer Orientation="Vertical">
|
||||
<BoxContainer Orientation="Horizontal">
|
||||
<Label Text="Игрок" MinWidth="100" />
|
||||
@@ -17,5 +17,13 @@
|
||||
<OptionButton Name="RoleOption" />
|
||||
<cc:PlayerListControl Name="PlayerList" VerticalExpand="True" MinWidth="200"/>
|
||||
<Button Name="SubmitButton" Text="Добавить время" />
|
||||
<Button Name="SaveButton" Text="Сохранить изменения в БД" Disabled="true" Margin="0 6 0 3"/>
|
||||
<BoxContainer Orientation="Vertical">
|
||||
<PanelContainer StyleClasses="LowDivider" Margin="0 4 0 2" />
|
||||
<BoxContainer Orientation="Horizontal" Margin="10 2 4 0" VerticalAlignment="Bottom">
|
||||
<Label Text="Проверяйте консоль на результат работы" StyleClasses="WindowFooterText"
|
||||
HorizontalAlignment="Left" HorizontalExpand="True" Margin="0 0 5 0" />
|
||||
</BoxContainer>
|
||||
</BoxContainer>
|
||||
</BoxContainer>
|
||||
</DefaultWindow>
|
||||
</DefaultWindow>
|
||||
@@ -8,7 +8,7 @@ using Robust.Client.UserInterface.XAML;
|
||||
using Robust.Shared.Prototypes;
|
||||
using static Robust.Client.UserInterface.Controls.LineEdit;
|
||||
|
||||
namespace Content.Client.Administration.UI.Tabs.AdminTab;
|
||||
namespace Content.Client._White.Administration;
|
||||
|
||||
[GenerateTypedNameReferences]
|
||||
[UsedImplicitly]
|
||||
@@ -24,21 +24,23 @@ public sealed partial class HoursPanel : DefaultWindow
|
||||
MinutesLine.OnTextChanged += UpdateButtonsText;
|
||||
RoleOption.OnItemSelected += args => RoleOption.SelectId(args.Id);
|
||||
SubmitButton.OnPressed += _ => OnSubmitButtonOnPressed(roles);
|
||||
SaveButton.OnPressed += _ => OnSaveButtonOnPressed();
|
||||
OnNamesChanged();
|
||||
InitRoleList(roles);
|
||||
|
||||
}
|
||||
private void InitRoleList(Dictionary<int, string> Roles)
|
||||
private void InitRoleList(Dictionary<int, string> roles)
|
||||
{
|
||||
var roleInd = 0;
|
||||
RoleOption.AddItem("общее", roleInd);
|
||||
Roles.Add(roleInd, "Overall");
|
||||
roles.Add(roleInd, "Overall");
|
||||
roleInd++;
|
||||
foreach (var dep in IoCManager.Resolve<IPrototypeManager>().EnumeratePrototypes<DepartmentPrototype>())
|
||||
{
|
||||
foreach (var role in dep.Roles)
|
||||
{
|
||||
RoleOption.AddItem(Loc.GetString($"Job{role.Id}"), roleInd);
|
||||
Roles.Add(roleInd, $"Job{role.Id}");
|
||||
roles.Add(roleInd, $"Job{role.Id}");
|
||||
roleInd++;
|
||||
}
|
||||
}
|
||||
@@ -53,21 +55,21 @@ public sealed partial class HoursPanel : DefaultWindow
|
||||
|
||||
private void AddMinutes(uint add)
|
||||
{
|
||||
OnNamesChanged();
|
||||
if (!TryGetMinutes(MinutesLine.Text, out var minutes))
|
||||
minutes = 0;
|
||||
|
||||
MinutesLine.Text = $"{minutes + add}";
|
||||
UpdateButtons(minutes + add);
|
||||
OnNamesChanged();
|
||||
}
|
||||
|
||||
private void UpdateButtonsText(LineEditEventArgs obj)
|
||||
{
|
||||
OnNamesChanged();
|
||||
if (!TryGetMinutes(obj.Text, out var minutes))
|
||||
return;
|
||||
|
||||
UpdateButtons(minutes);
|
||||
OnNamesChanged();
|
||||
}
|
||||
|
||||
private void UpdateButtons(uint minutes)
|
||||
@@ -90,5 +92,13 @@ public sealed partial class HoursPanel : DefaultWindow
|
||||
{
|
||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(
|
||||
$"playtime_addrole {PlayerNameLine.Text} {roles[RoleOption.SelectedId]} {MinutesLine.Text}");
|
||||
SaveButton.Disabled = false;
|
||||
}
|
||||
|
||||
private void OnSaveButtonOnPressed()
|
||||
{
|
||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(
|
||||
$"playtime_save {PlayerNameLine.Text}");
|
||||
SaveButton.Disabled = true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user