Updating sonar/steering tickboxes to match received network state, graying out disabled tickboxes

This commit is contained in:
Regalis
2016-02-02 19:32:38 +02:00
parent 89406896ca
commit ebbcf8b835
5 changed files with 39 additions and 9 deletions
@@ -20,6 +20,8 @@ namespace Barotrauma.Items.Components
private Sprite pingCircle, screenOverlay;
private GUITickBox isActiveTickBox;
[HasDefaultValue(0.0f, false)]
public float Range
{
@@ -45,8 +47,8 @@ namespace Barotrauma.Items.Components
}
}
var tickBox = new GUITickBox(new Rectangle(0,0,20,20), "Sonar", Alignment.TopLeft, GuiFrame);
tickBox.OnSelected = (GUITickBox box) =>
isActiveTickBox = new GUITickBox(new Rectangle(0, 0, 20, 20), "Sonar", Alignment.TopLeft, GuiFrame);
isActiveTickBox.OnSelected = (GUITickBox box) =>
{
IsActive = box.Selected;
item.NewComponentEvent(this, true, false);
@@ -330,6 +332,7 @@ namespace Barotrauma.Items.Components
try
{
IsActive = message.ReadBoolean();
isActiveTickBox.Selected = IsActive;
}
catch
{
@@ -17,7 +17,7 @@ namespace Barotrauma.Items.Components
private Vector2 currVelocity;
private Vector2 targetVelocity;
private GUITickBox maintainPosTickBox;
private GUITickBox autopilotTickBox, maintainPosTickBox;
private bool autoPilot;
@@ -43,8 +43,9 @@ namespace Barotrauma.Items.Components
autoPilot = value;
maintainPosTickBox.Enabled = autoPilot;
autopilotTickBox.Selected = value;
maintainPosTickBox.Enabled = autoPilot;
if (autoPilot)
{