Updating sonar/steering tickboxes to match received network state, graying out disabled tickboxes
This commit is contained in:
@@ -25,10 +25,19 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
private bool enabled;
|
||||
|
||||
public bool Enabled
|
||||
{
|
||||
get;
|
||||
set;
|
||||
get
|
||||
{
|
||||
return enabled;
|
||||
}
|
||||
set
|
||||
{
|
||||
enabled = value;
|
||||
text.TextColor = enabled ? Color.White : Color.White * 0.5f;
|
||||
}
|
||||
}
|
||||
|
||||
public GUITickBox(Rectangle rect, string label, Alignment alignment, GUIComponent parent)
|
||||
@@ -86,12 +95,14 @@ namespace Barotrauma
|
||||
|
||||
DrawChildren(spriteBatch);
|
||||
|
||||
float alpha = enabled ? 1.0f : 0.8f;
|
||||
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle(box.Rect.X + 1, box.Rect.Y + 1, box.Rect.Width - 2, box.Rect.Height - 2),
|
||||
box.State == ComponentState.Hover ? new Color(50,50,50,255) : Color.Black, true);
|
||||
(box.State == ComponentState.Hover ? new Color(50, 50, 50, 255) : Color.Black) * alpha, true);
|
||||
|
||||
if (!selected) return;
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle(box.Rect.X + 5, box.Rect.Y + 5, box.Rect.Width - 10, box.Rect.Height - 10),
|
||||
Color.Green * 0.8f, true);
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle(box.Rect.X + 5, box.Rect.Y + 5, box.Rect.Width - 10, box.Rect.Height - 10),
|
||||
Color.Green * 0.8f * alpha, true);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
---------------------------------------------------------------------------------------------------------
|
||||
v0.3.0.4
|
||||
---------------------------------------------------------------------------------------------------------
|
||||
|
||||
- submarine editor can be used without the console now
|
||||
- autopilot can be set to maintain the current position of the sub
|
||||
- monster syncing bugfixes
|
||||
- ladder syncing bugfixes
|
||||
- fixed server randomly stunning the players
|
||||
- fixed "submarine not found" errors which occurred in multiplayer if the filename didn't match the
|
||||
name of the submarine
|
||||
- fixed new structures not lining up with existing ones if switching to editor while a round is running
|
||||
- fixed a bug in shadow rendering which caused memory leaks
|
||||
- molochs and endworms are immune to bleeding!
|
||||
|
||||
---------------------------------------------------------------------------------------------------------
|
||||
v0.3.0.3
|
||||
---------------------------------------------------------------------------------------------------------
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user