Files
wwdpublic/Content.Client/_Goobstation/AmmoSelector/AmmoSelectorMenuBoundUserInterface.cs
Aviu00 cef5458f20 Hardlight bow rebalance (#1523)
* Hardlight bow rebalance.

* Clumsy proof.

(cherry picked from commit 8dd06fd71bd100777721bd2cee9b7345c127af41)
2025-03-21 17:38:08 +03:00

40 lines
1.2 KiB
C#

using Content.Shared._Goobstation.Weapons.AmmoSelector;
using JetBrains.Annotations;
using Robust.Client.Graphics;
using Robust.Client.Input;
using Robust.Client.UserInterface;
using Robust.Shared.Prototypes;
namespace Content.Client._Goobstation.AmmoSelector;
[UsedImplicitly]
public sealed class AmmoSelectorMenuBoundUserInterface : BoundUserInterface
{
[Dependency] private readonly IClyde _displayManager = default!;
[Dependency] private readonly IInputManager _inputManager = default!;
private AmmoSelectorMenu? _menu;
public AmmoSelectorMenuBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
IoCManager.InjectDependencies(this);
}
protected override void Open()
{
base.Open();
_menu = this.CreateWindow<AmmoSelectorMenu>();
_menu.SetEntity(Owner);
_menu.SendAmmoSelectorSystemMessageAction += SendAmmoSelectorSystemMessage;
var vpSize = _displayManager.ScreenSize;
_menu.OpenCenteredAt(_inputManager.MouseScreenPosition.Position / vpSize);
}
public void SendAmmoSelectorSystemMessage(ProtoId<SelectableAmmoPrototype> protoId)
{
SendPredictedMessage(new AmmoSelectedMessage(protoId));
}
}