38 lines
1.0 KiB
C#
38 lines
1.0 KiB
C#
using Content.Client.UserInterface.Fragments;
|
|
using Content.Shared.Mech;
|
|
using Robust.Client.GameObjects;
|
|
using Robust.Client.UserInterface;
|
|
|
|
namespace Content.Client.Mech.Ui.Equipment;
|
|
|
|
public sealed partial class MechSoundboardUi : UIFragment
|
|
{
|
|
private MechSoundboardUiFragment? _fragment;
|
|
|
|
public override Control GetUIFragmentRoot()
|
|
{
|
|
return _fragment!;
|
|
}
|
|
|
|
public override void Setup(BoundUserInterface userInterface, EntityUid? fragmentOwner)
|
|
{
|
|
if (fragmentOwner == null)
|
|
return;
|
|
|
|
_fragment = new MechSoundboardUiFragment();
|
|
_fragment.OnPlayAction += sound =>
|
|
{
|
|
// TODO: IDK dog
|
|
userInterface.SendMessage(new MechSoundboardPlayMessage(IoCManager.Resolve<IEntityManager>().GetNetEntity(fragmentOwner.Value), sound));
|
|
};
|
|
}
|
|
|
|
public override void UpdateState(BoundUserInterfaceState state)
|
|
{
|
|
if (state is not MechSoundboardUiState soundboardState)
|
|
return;
|
|
|
|
_fragment?.UpdateContents(soundboardState);
|
|
}
|
|
}
|