From ebbcf8b8359439503e5735a16b7ab18dce378618 Mon Sep 17 00:00:00 2001 From: Regalis Date: Tue, 2 Feb 2016 19:32:38 +0200 Subject: [PATCH] Updating sonar/steering tickboxes to match received network state, graying out disabled tickboxes --- Subsurface/Source/GUI/GUITickBox.cs | 21 +++++++++++++----- .../Source/Items/Components/Machines/Radar.cs | 7 ++++-- .../Items/Components/Machines/Steering.cs | 5 +++-- Subsurface/changelog.txt | 15 +++++++++++++ Subsurface_Solution.v12.suo | Bin 908800 -> 908800 bytes 5 files changed, 39 insertions(+), 9 deletions(-) diff --git a/Subsurface/Source/GUI/GUITickBox.cs b/Subsurface/Source/GUI/GUITickBox.cs index f6097edfa..a4b0456b5 100644 --- a/Subsurface/Source/GUI/GUITickBox.cs +++ b/Subsurface/Source/GUI/GUITickBox.cs @@ -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); } } diff --git a/Subsurface/Source/Items/Components/Machines/Radar.cs b/Subsurface/Source/Items/Components/Machines/Radar.cs index dabfa610e..e730bdc80 100644 --- a/Subsurface/Source/Items/Components/Machines/Radar.cs +++ b/Subsurface/Source/Items/Components/Machines/Radar.cs @@ -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 { diff --git a/Subsurface/Source/Items/Components/Machines/Steering.cs b/Subsurface/Source/Items/Components/Machines/Steering.cs index c9e4353e6..72c0ccb24 100644 --- a/Subsurface/Source/Items/Components/Machines/Steering.cs +++ b/Subsurface/Source/Items/Components/Machines/Steering.cs @@ -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) { diff --git a/Subsurface/changelog.txt b/Subsurface/changelog.txt index 5e0f11bae..fed5f56a1 100644 --- a/Subsurface/changelog.txt +++ b/Subsurface/changelog.txt @@ -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 --------------------------------------------------------------------------------------------------------- diff --git a/Subsurface_Solution.v12.suo b/Subsurface_Solution.v12.suo index 64899467dfc7d3ef21606bd49a574508f37b8b35..bb7149411a1945d66856e031cab2e7a01c9b533a 100644 GIT binary patch delta 856 zcmY*WTSydP6rOYbe|6W^-7L50!IH@ce2CQ)E6X+vL@<@mQWCN3ZV8f9Am&Y(Vq8#8{6%RVWe$?Dl|MqlGu}bPT z+)vGeSSDZ_QrT9yN%N!2S{Ot(5T11vm<6N5mzL)qV=B+}OIwv*D>AH%awvDkUAowh zHA~ib6@=rKb*CCmb{c08wIHdF)ETIFrs4z`1-M18f@Zv+(D{C>jbDtI7JwM7dyXx5 z1xT-k1`8T7R;;6_fO)E%fgtP?NrZi?|+A_a>up@>N+M zKP$%np^kzBqKwLB#O;;m-n{6I46Pg=9ojb#&7W_h$(P_G=O?j9LDRnf6A{VMYec%0 z9u^5?QvVg_^3`W6zaz_=!*U1D@frydetaqn`1 g9yf`S>m|BmI2Z|xM23^$Vk9wEFx*y&p8T}v53%S(!~g&Q delta 1309 zcmY+?ZA@EL7zgnCoO}8LZH0A~@xd{6+wfu*QVI+uH^W&X%*`a=iSaWF|*4PU*_Ny)Gw>ksP)p7opux!A2N z^Fg&*c4@9owoDWWpBg(Vyldo%&G_S#+N7g9M0XeXCH8yI1IOk%twh_ywyq1QIhVW2 z1?$hKi`6YAM$-v>lQ0s~Ws0VF>5!QpLGfa^jT$y874bI8gW8xTv1{77B}=2##TqvsH3vC4Odb|{fV-2%(o zC{g&G@-CVbXPk09n=*>T0`p8q(D*f4e?n6Z%2DD~dM#f!GDq0IeXC)_gio#Au4Sf@ z=nApu0Bcs;XlS#Gj?LQ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