-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
64 changed files
with
9,164 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<DefaultWindow xmlns="https://spacestation14.io" | ||
xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls" | ||
Title="{Loc cd-actions-admin-modify-records}" | ||
MinSize="300 300"> | ||
<BoxContainer Orientation="Vertical"> | ||
<LineEdit Name="EntityEdit" PlaceHolder="Entity" HorizontalExpand="True" /> | ||
<OptionButton Name="EntityEntryType" HorizontalExpand="True" /> | ||
<LineEdit Name="EntityEntryIndex" PlaceHolder="Index"/> | ||
<BoxContainer Orientation="Horizontal" > | ||
<cc:CommandButton Name="PurgeCommand" Text="{Loc cd-actions-admin-modify-reset}"/> | ||
<cc:CommandButton Name="DelCommand" Text="{Loc cd-actions-admin-modify-del-entry}"/> | ||
</BoxContainer> | ||
</BoxContainer> | ||
</DefaultWindow> |
48 changes: 48 additions & 0 deletions
48
Content.Client/_CD/Admin/UI/ModifyCharacterRecords.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using Content.Shared._CD.Records; | ||
using Robust.Client.AutoGenerated; | ||
using Robust.Client.UserInterface.CustomControls; | ||
using Robust.Client.UserInterface.XAML; | ||
|
||
namespace Content.Client._CD.Admin.UI; | ||
|
||
[GenerateTypedNameReferences] | ||
public sealed partial class ModifyCharacterRecords : DefaultWindow | ||
{ | ||
public ModifyCharacterRecords() | ||
{ | ||
RobustXamlLoader.Load(this); | ||
IoCManager.InjectDependencies(this); | ||
|
||
foreach (var v in Enum.GetValues<CharacterRecordType>()) | ||
{ | ||
EntityEntryType.AddItem(v.ToString()); | ||
} | ||
|
||
EntityEntryType.OnItemSelected += args => | ||
{ | ||
EntityEntryType.SelectId(args.Id); | ||
UpdateCommands(); | ||
}; | ||
|
||
EntityEdit.OnTextChanged += _ => UpdateCommands(); | ||
EntityEntryIndex.OnTextChanged += _ => UpdateCommands(); | ||
} | ||
|
||
private void UpdateCommands() | ||
{ | ||
if (!int.TryParse(EntityEdit.Text, out var uid)) | ||
{ | ||
return; | ||
} | ||
|
||
if (!int.TryParse(EntityEntryIndex.Text, out var idx)) | ||
{ | ||
return; | ||
} | ||
|
||
var ty = (CharacterRecordType)EntityEntryType.SelectedId; | ||
|
||
PurgeCommand.Command = $"purgecharacterrecords {uid}"; | ||
DelCommand.Command = $"delrecordentry {uid} {ty.ToString()} {idx}"; | ||
} | ||
} |
82 changes: 82 additions & 0 deletions
82
Content.Client/_CD/Records/UI/CharacterRecordConsoleBoundUserInterface.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
using Content.Shared._CD.Records; | ||
using Content.Shared.CriminalRecords; | ||
using Content.Shared.CriminalRecords.Components; | ||
using Content.Shared.Security; | ||
using Content.Shared.StationRecords; | ||
using JetBrains.Annotations; | ||
|
||
namespace Content.Client._CD.Records.UI; | ||
|
||
[UsedImplicitly] | ||
public sealed class CharacterRecordConsoleBoundUserInterface : BoundUserInterface | ||
{ | ||
[ViewVariables] private CharacterRecordViewer? _window; | ||
|
||
public CharacterRecordConsoleBoundUserInterface(EntityUid owner, Enum key) | ||
: base(owner, key) | ||
{ | ||
} | ||
|
||
protected override void UpdateState(BoundUserInterfaceState baseState) | ||
{ | ||
base.UpdateState(baseState); | ||
if (baseState is not CharacterRecordConsoleState state) | ||
return; | ||
|
||
if (_window?.IsSecurity() ?? false) | ||
{ | ||
var comp = EntMan.GetComponent<CriminalRecordsConsoleComponent>(Owner); | ||
_window!.SecurityWantedStatusMaxLength = comp.MaxStringLength; | ||
} | ||
|
||
_window?.UpdateState(state); | ||
} | ||
|
||
protected override void Open() | ||
{ | ||
base.Open(); | ||
|
||
_window = new(); | ||
_window.OnClose += Close; | ||
_window.OnListingItemSelected += (ent, stationRecordKey) => | ||
{ | ||
SendMessage(new CharacterRecordConsoleSelectMsg(ent)); | ||
|
||
// If we are a security records console, we also need to inform the criminal records | ||
// system of our state. | ||
if (_window.IsSecurity() && stationRecordKey != null) | ||
{ | ||
SendMessage(new SelectStationRecord(stationRecordKey)); | ||
_window.SetSecurityStatusEnabled(true); | ||
} | ||
else | ||
{ | ||
// If the user does not have criminal records for some reason, we should not be able | ||
// to set their wanted status | ||
_window.SetSecurityStatusEnabled(false); | ||
} | ||
}; | ||
|
||
_window.OnFiltersChanged += (ty, txt) => | ||
{ | ||
if (txt == null) | ||
SendMessage(new CharacterRecordsConsoleFilterMsg(null)); | ||
else | ||
SendMessage(new CharacterRecordsConsoleFilterMsg(new StationRecordsFilter(ty, txt))); | ||
}; | ||
|
||
_window.OnSetSecurityStatus += (status, reason) => | ||
{ | ||
SendMessage(new CriminalRecordChangeStatus(status, reason)); | ||
}; | ||
|
||
_window.OpenCentered(); | ||
} | ||
|
||
protected override void Dispose(bool disposing) | ||
{ | ||
base.Dispose(disposing); | ||
|
||
_window?.Close(); | ||
} | ||
} |
Oops, something went wrong.