* Moved pen slot to separate component * Moved it all to more generic item slot class * Add sounds * Item slots now supports many slots * Some clean-up * Refactored slots a bit * Moving ID card out * Moving pda to system * Moving PDA owner to ECS * Moved PDA flashlight to separate component * Toggle lights work through events * Fixing UI * Moving uplink to separate component * Continue moving uplink to separate component * More cleaning * Removing pda shared * Nuked shared pda component * Fixed flashlight * Pen slot now showed in UI * Light toggle now shows correctly in UI * Small refactoring of item slots * Added contained entity * Fixed tests * Finished with PDA * Moving PDA uplink to separate window * Adding-removing uplink should show new button * Working on a better debug * Debug command to add uplink * Uplink send state to UI * Almost working UI * Uplink correcty updates when you buy-sell items * Ups * Moved localization to separate file * Minor fixes * Removed item slots methods events * Removed PDA owner name * Removed one uplink event * Deleted all uplink events * Removed flashlight events * Update Content.Shared/Traitor/Uplink/UplinkVisuals.cs Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Update Content.Server/Containers/ItemSlot/ItemSlotsSystem.cs Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Update Content.Server/Containers/ItemSlot/ItemSlotsSystem.cs Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Update Content.Server/GameTicking/Presets/PresetTraitorDeathMatch.cs Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Item slots system review * Flashlight review * PDA to XAML * Move UplinkMenu to seperate class, fix WeightedColors methods * Move UI to XAML * Moved events to entity id * Address review * Removed uplink extensions * Minor fix * Moved item slots to shared * My bad Robust... * Fixed pda sound * Fixed pda tests * Fixed pda test again Co-authored-by: Alexander Evgrashin <evgrashin.adl@gmail.com> Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: Visne <vincefvanwijk@gmail.com>
106 lines
3.2 KiB
C#
106 lines
3.2 KiB
C#
using Content.Client.Message;
|
|
using Content.Shared.PDA;
|
|
using JetBrains.Annotations;
|
|
using Robust.Client.GameObjects;
|
|
using Robust.Client.UserInterface.Controls;
|
|
using Robust.Client.UserInterface.CustomControls;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.IoC;
|
|
using Robust.Shared.Localization;
|
|
using Robust.Shared.Prototypes;
|
|
using static Robust.Client.UserInterface.Controls.BoxContainer;
|
|
|
|
namespace Content.Client.PDA
|
|
{
|
|
[UsedImplicitly]
|
|
public class PDABoundUserInterface : BoundUserInterface
|
|
{
|
|
private PDAMenu? _menu;
|
|
|
|
public PDABoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
|
|
{
|
|
}
|
|
|
|
protected override void Open()
|
|
{
|
|
base.Open();
|
|
SendMessage(new PDARequestUpdateInterfaceMessage());
|
|
_menu = new PDAMenu();
|
|
_menu.OpenToLeft();
|
|
_menu.OnClose += Close;
|
|
_menu.FlashLightToggleButton.OnToggled += _ =>
|
|
{
|
|
SendMessage(new PDAToggleFlashlightMessage());
|
|
};
|
|
|
|
_menu.EjectIdButton.OnPressed += _ =>
|
|
{
|
|
SendMessage(new PDAEjectIDMessage());
|
|
};
|
|
|
|
_menu.EjectPenButton.OnPressed += _ =>
|
|
{
|
|
SendMessage(new PDAEjectPenMessage());
|
|
};
|
|
|
|
_menu.ActivateUplinkButton.OnPressed += _ =>
|
|
{
|
|
SendMessage(new PDAShowUplinkMessage());
|
|
};
|
|
|
|
}
|
|
|
|
protected override void UpdateState(BoundUserInterfaceState state)
|
|
{
|
|
base.UpdateState(state);
|
|
|
|
if (_menu == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
switch (state)
|
|
{
|
|
case PDAUpdateState msg:
|
|
{
|
|
_menu.FlashLightToggleButton.Pressed = msg.FlashlightEnabled;
|
|
|
|
if (msg.PDAOwnerInfo.ActualOwnerName != null)
|
|
{
|
|
_menu.PdaOwnerLabel.SetMarkup(Loc.GetString("comp-pda-ui-owner",
|
|
("ActualOwnerName", msg.PDAOwnerInfo.ActualOwnerName)));
|
|
}
|
|
|
|
|
|
if (msg.PDAOwnerInfo.IdOwner != null || msg.PDAOwnerInfo.JobTitle != null)
|
|
{
|
|
_menu.IdInfoLabel.SetMarkup(Loc.GetString("comp-pda-ui",
|
|
("Owner",msg.PDAOwnerInfo.IdOwner ?? "Unknown"),
|
|
("JobTitle",msg.PDAOwnerInfo.JobTitle ?? "Unassigned")));
|
|
}
|
|
else
|
|
{
|
|
_menu.IdInfoLabel.SetMarkup(Loc.GetString("comp-pda-ui-blank"));
|
|
}
|
|
|
|
_menu.EjectIdButton.Visible = msg.PDAOwnerInfo.IdOwner != null || msg.PDAOwnerInfo.JobTitle != null;
|
|
_menu.EjectPenButton.Visible = msg.HasPen;
|
|
_menu.ActivateUplinkButton.Visible = msg.HasUplink;
|
|
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
base.Dispose(disposing);
|
|
if (!disposing)
|
|
return;
|
|
|
|
_menu?.Dispose();
|
|
}
|
|
}
|
|
}
|