Merge remote-tracking branch 'refs/remotes/barotrauma/master'
Conflicts: Subsurface/Properties/AssemblyInfo.cs Subsurface/Source/Characters/Character.cs Subsurface/Source/GUI/GUI.cs Subsurface/Source/GameMain.cs Subsurface/Source/GameSettings.cs Subsurface/Source/Items/CharacterInventory.cs Subsurface/Source/Items/Components/ItemComponent.cs Subsurface/Source/Items/Components/Machines/Pump.cs Subsurface/Source/Items/Components/Machines/Radar.cs Subsurface/Source/Items/Components/Machines/Steering.cs Subsurface/Source/Items/Components/Power/PowerContainer.cs Subsurface/Source/Items/Inventory.cs Subsurface/Source/Items/Item.cs Subsurface/Source/Items/ItemSpawner.cs Subsurface/Source/Map/Levels/WaterRenderer.cs Subsurface/Source/Map/LinkedSubmarine.cs Subsurface/Source/Map/Map/Map.cs Subsurface/Source/Map/Structure.cs Subsurface/Source/Map/Submarine.cs Subsurface/Source/Map/WayPoint.cs Subsurface/Source/Networking/GameClient.cs Subsurface/Source/Networking/GameServer.cs Subsurface/Source/Physics/PhysicsBody.cs Subsurface/Source/Screens/GameScreen.cs
This commit is contained in:
@@ -116,6 +116,21 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public override Rectangle Rect
|
||||
{
|
||||
get
|
||||
{
|
||||
return rect;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Rect = value;
|
||||
|
||||
frame.Rect = new Rectangle(value.X, value.Y, frame.Rect.Width, frame.Rect.Height);
|
||||
textBlock.Rect = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Selected { get; set; }
|
||||
|
||||
public GUIButton(Rectangle rect, string text, GUIStyle style, GUIComponent parent = null)
|
||||
@@ -183,6 +198,25 @@ namespace Barotrauma
|
||||
|
||||
base.Update(deltaTime);
|
||||
|
||||
//Color currColor = color;
|
||||
//if (state == ComponentState.Hover) currColor = hoverColor;
|
||||
//if (state == ComponentState.Selected) currColor = selectedColor;
|
||||
|
||||
//GUI.DrawRectangle(spriteBatch, rect, currColor * alpha, true);
|
||||
|
||||
////spriteBatch.DrawString(HUD.font, text, new Vector2(rect.X+rect.Width/2, rect.Y+rect.Height/2), Color.Black, 0.0f, new Vector2(0.5f,0.5f), 1.0f, SpriteEffects.None, 0.0f);
|
||||
|
||||
//GUI.DrawRectangle(spriteBatch, rect, Color.Black * alpha, false);
|
||||
|
||||
DrawChildren(spriteBatch);
|
||||
|
||||
//if (!Enabled) GUI.DrawRectangle(spriteBatch, rect, Color.Gray*0.5f, true);
|
||||
}
|
||||
|
||||
public override void Update(float deltaTime)
|
||||
{
|
||||
if (!Visible) return;
|
||||
base.Update(deltaTime);
|
||||
if (rect.Contains(PlayerInput.MousePosition) && CanBeSelected && Enabled && (MouseOn == null || MouseOn == this || IsParentOf(MouseOn)))
|
||||
{
|
||||
state = ComponentState.Hover;
|
||||
@@ -196,7 +230,6 @@ namespace Barotrauma
|
||||
else if (PlayerInput.LeftButtonClicked())
|
||||
{
|
||||
GUI.PlayUISound(GUISoundType.Click);
|
||||
|
||||
if (OnClicked != null)
|
||||
{
|
||||
if (OnClicked(this, UserData) && CanBeSelected) state = ComponentState.Selected;
|
||||
@@ -212,7 +245,6 @@ namespace Barotrauma
|
||||
{
|
||||
state = Selected ? ComponentState.Selected : ComponentState.None;
|
||||
}
|
||||
|
||||
frame.State = state;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user