mirror of
https://github.com/space-wizards/space-station-14.git
synced 2026-02-14 19:29:53 +01:00
* Added random gate * minor edit * cleaning up my shit after trying to do something faster * new lines * some changes * joke * UI * Long Division * Dont use ctrl + x in 3 am * I hope these are the final touches * One thing, I don't know why * noname commit * no way, 1kk of code lines edit * sudo rm -rf ... and something there... * update * sometimes its sad
38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
using Content.Shared.DeviceLinking;
|
|
using JetBrains.Annotations;
|
|
using Robust.Client.UserInterface;
|
|
|
|
namespace Content.Client.DeviceLinking.UI;
|
|
|
|
[UsedImplicitly]
|
|
public sealed class RandomGateBoundUserInterface : BoundUserInterface
|
|
{
|
|
private RandomGateSetupWindow? _window;
|
|
|
|
public RandomGateBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) { }
|
|
|
|
protected override void Open()
|
|
{
|
|
base.Open();
|
|
_window = this.CreateWindow<RandomGateSetupWindow>();
|
|
_window.OnApplyPressed += OnProbabilityChanged;
|
|
}
|
|
|
|
private void OnProbabilityChanged(string value)
|
|
{
|
|
if (!float.TryParse(value, out var probability))
|
|
return;
|
|
|
|
SendPredictedMessage(new RandomGateProbabilityChangedMessage(probability));
|
|
}
|
|
|
|
protected override void UpdateState(BoundUserInterfaceState state)
|
|
{
|
|
base.UpdateState(state);
|
|
if (state is not RandomGateBoundUserInterfaceState castState || _window == null)
|
|
return;
|
|
|
|
_window.SetProbability(castState.SuccessProbability * 100);
|
|
}
|
|
}
|