Selecting stairs based on WorldRect in editor, disable input if window not active, disable traveling if no locations are selected

This commit is contained in:
Regalis
2016-01-27 22:27:51 +02:00
parent 8cc12b6988
commit 7637bc441f
21 changed files with 95 additions and 77 deletions
@@ -326,10 +326,10 @@ namespace Barotrauma
if (draggingItem != null && !draggingItemSlot.Contains(PlayerInput.MousePosition))
{
if (PlayerInput.GetMouseState.LeftButton == ButtonState.Pressed)
if (PlayerInput.LeftButtonDown())
{
slotRect.X = PlayerInput.GetMouseState.X - slotRect.Width / 2;
slotRect.Y = PlayerInput.GetMouseState.Y - slotRect.Height / 2;
slotRect.X = (int)PlayerInput.MousePosition.X - slotRect.Width / 2;
slotRect.Y = (int)PlayerInput.MousePosition.Y - slotRect.Height / 2;
DrawSlot(spriteBatch, slotRect, draggingItem, false, false);
}
@@ -136,7 +136,7 @@ namespace Barotrauma.Items.Components
ignoredBodies.Add(limb.body.FarseerBody);
}
Vector2 rayStart = item.WorldPosition + TransformedBarrelPos;
Vector2 rayStart = item.WorldPosition;
Vector2 rayEnd = targetPosition;
Body targetBody = Submarine.PickBody(
@@ -351,7 +351,7 @@ namespace Barotrauma.Items.Components
if (selectedNodeIndex == null && draggingWire == null)// && !MapEntity.SelectedAny)
{
if (PlayerInput.LeftButtonDown() && PlayerInput.GetOldMouseState.LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Released)
if (PlayerInput.LeftButtonClicked())
{
MapEntity.DisableSelect = true;
MapEntity.SelectEntity(item);
+5 -5
View File
@@ -205,10 +205,10 @@ namespace Barotrauma
if (draggingItem != null && !draggingItemSlot.Contains(PlayerInput.MousePosition) && draggingItem.Container == this.Owner)
{
if (PlayerInput.GetMouseState.LeftButton == ButtonState.Pressed)
if (PlayerInput.LeftButtonDown())
{
slotRect.X = PlayerInput.GetMouseState.X - slotRect.Width / 2;
slotRect.Y = PlayerInput.GetMouseState.Y - slotRect.Height / 2;
slotRect.X = (int)PlayerInput.MousePosition.X - slotRect.Width / 2;
slotRect.Y = (int)PlayerInput.MousePosition.Y - slotRect.Height / 2;
//GUI.DrawRectangle(spriteBatch, rect, Color.White, true);
//draggingItem.sprite.Draw(spriteBatch, new Vector2(rect.X + rect.Width / 2, rect.Y + rect.Height / 2), Color.White);
@@ -261,12 +261,12 @@ namespace Barotrauma
{
if (draggingItem == null)
{
if (PlayerInput.GetMouseState.LeftButton == ButtonState.Pressed)
if (PlayerInput.LeftButtonDown())
{
draggingItem = item;
}
}
else if (PlayerInput.GetMouseState.LeftButton == ButtonState.Released)
else if (PlayerInput.LeftButtonReleased())
{
if (PlayerInput.DoubleClicked())
{
+2 -3
View File
@@ -114,8 +114,7 @@ namespace Barotrauma
if (placePosition == Vector2.Zero)
{
if (PlayerInput.GetMouseState.LeftButton == ButtonState.Pressed)
placePosition = position;
if (PlayerInput.LeftButtonDown()) placePosition = position;
}
else
{
@@ -124,7 +123,7 @@ namespace Barotrauma
if (resizeVertical)
placeSize.Y = Math.Max(placePosition.Y - position.Y, size.Y);
if (PlayerInput.GetMouseState.LeftButton == ButtonState.Released)
if (PlayerInput.LeftButtonReleased())
{
var item = new Item(new Rectangle((int)placePosition.X, (int)placePosition.Y, (int)placeSize.X, (int)placeSize.Y), this, Submarine.Loaded);
placePosition = Vector2.Zero;