Fixed GUITickBoxes appearing unchecked if they're set to the checked state when interaction with the box has been disabled (or vice versa)
This commit is contained in:
@@ -1,13 +1,12 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using Microsoft.Xna.Framework.Input;
|
|
||||||
|
|
||||||
namespace Barotrauma
|
namespace Barotrauma
|
||||||
{
|
{
|
||||||
public class GUITickBox : GUIComponent
|
public class GUITickBox : GUIComponent
|
||||||
{
|
{
|
||||||
GUIFrame box;
|
private GUIFrame box;
|
||||||
GUITextBlock text;
|
private GUITextBlock text;
|
||||||
|
|
||||||
public delegate bool OnSelectedHandler(GUITickBox obj);
|
public delegate bool OnSelectedHandler(GUITickBox obj);
|
||||||
public OnSelectedHandler OnSelected;
|
public OnSelectedHandler OnSelected;
|
||||||
@@ -22,6 +21,8 @@ namespace Barotrauma
|
|||||||
if (value == selected) return;
|
if (value == selected) return;
|
||||||
selected = value;
|
selected = value;
|
||||||
state = (selected) ? ComponentState.Selected : ComponentState.None;
|
state = (selected) ? ComponentState.Selected : ComponentState.None;
|
||||||
|
|
||||||
|
box.State = state;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,9 +108,9 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public override void Update(float deltaTime)
|
public override void Update(float deltaTime)
|
||||||
{
|
{
|
||||||
if (!Visible || !Enabled) return;
|
if (!Visible) return;
|
||||||
|
|
||||||
if (MouseOn == this)
|
if (MouseOn == this && Enabled)
|
||||||
{
|
{
|
||||||
box.State = ComponentState.Hover;
|
box.State = ComponentState.Hover;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user