Gravity generator rewrite (#4828)
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
committed by
GitHub
parent
0e33b246db
commit
059fa9ae48
@@ -10,28 +10,25 @@ namespace Content.Client.Gravity.UI
|
||||
{
|
||||
private GravityGeneratorWindow? _window;
|
||||
|
||||
public bool IsOn;
|
||||
|
||||
public GravityGeneratorBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base (owner, uiKey)
|
||||
{
|
||||
SendMessage(new SharedGravityGeneratorComponent.GeneratorStatusRequestMessage());
|
||||
}
|
||||
|
||||
protected override void Open()
|
||||
{
|
||||
base.Open();
|
||||
|
||||
IsOn = false;
|
||||
|
||||
_window = new GravityGeneratorWindow(this);
|
||||
_window = new GravityGeneratorWindow(this, Owner);
|
||||
|
||||
/*
|
||||
_window.Switch.OnPressed += _ =>
|
||||
{
|
||||
SendMessage(new SharedGravityGeneratorComponent.SwitchGeneratorMessage(!IsOn));
|
||||
SendMessage(new SharedGravityGeneratorComponent.GeneratorStatusRequestMessage());
|
||||
};
|
||||
*/
|
||||
|
||||
_window.OpenCentered();
|
||||
_window.OnClose += Close;
|
||||
}
|
||||
|
||||
protected override void UpdateState(BoundUserInterfaceState state)
|
||||
@@ -39,8 +36,7 @@ namespace Content.Client.Gravity.UI
|
||||
base.UpdateState(state);
|
||||
|
||||
var castState = (SharedGravityGeneratorComponent.GeneratorState) state;
|
||||
IsOn = castState.On;
|
||||
_window?.UpdateButton();
|
||||
_window?.UpdateState(castState);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
@@ -50,5 +46,10 @@ namespace Content.Client.Gravity.UI
|
||||
|
||||
_window?.Dispose();
|
||||
}
|
||||
|
||||
public void SetPowerSwitch(bool on)
|
||||
{
|
||||
SendMessage(new SharedGravityGeneratorComponent.SwitchGeneratorMessage(on));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user