(2c264b075) Improve readability (no functional changes).
This commit is contained in:
@@ -136,8 +136,6 @@ namespace Barotrauma
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
hudProgressBars = new Dictionary<object, HUDProgressBar>();
|
||||
}
|
||||
|
||||
partial void UpdateLimbLightSource(Limb limb)
|
||||
@@ -148,14 +146,12 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
private bool wasFiring;
|
||||
|
||||
/// <summary>
|
||||
/// Control the Character according to player input
|
||||
/// </summary>
|
||||
public void ControlLocalPlayer(float deltaTime, Camera cam, bool moveCam = true)
|
||||
{
|
||||
if (DisableControls || GUI.PauseMenuOpen || GUI.SettingsMenuOpen)
|
||||
if (DisableControls)
|
||||
{
|
||||
foreach (Key key in keys)
|
||||
{
|
||||
@@ -165,25 +161,10 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
wasFiring |= keys[(int)InputType.Aim].Held && keys[(int)InputType.Shoot].Held;
|
||||
for (int i = 0; i < keys.Length; i++)
|
||||
{
|
||||
keys[i].SetState();
|
||||
}
|
||||
//if we were firing (= pressing the aim and shoot keys at the same time)
|
||||
//and the fire key is the same as Select or Use, reset the key to prevent accidentally selecting/using items
|
||||
if (wasFiring && !keys[(int)InputType.Shoot].Held)
|
||||
{
|
||||
if (GameMain.Config.KeyBind(InputType.Shoot).Equals(GameMain.Config.KeyBind(InputType.Select)))
|
||||
{
|
||||
keys[(int)InputType.Select].Reset();
|
||||
}
|
||||
if (GameMain.Config.KeyBind(InputType.Shoot).Equals(GameMain.Config.KeyBind(InputType.Use)))
|
||||
{
|
||||
keys[(int)InputType.Use].Reset();
|
||||
}
|
||||
wasFiring = false;
|
||||
}
|
||||
|
||||
float targetOffsetAmount = 0.0f;
|
||||
if (moveCam)
|
||||
|
||||
@@ -276,6 +276,9 @@ namespace Barotrauma
|
||||
characterInfos.Add(characterInfo);
|
||||
}
|
||||
|
||||
characterInfos.Add(characterInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove the character from the crew (and crew menus).
|
||||
/// </summary>
|
||||
|
||||
@@ -8,7 +8,7 @@ using System.Xml.Linq;
|
||||
|
||||
namespace Barotrauma.Items.Components
|
||||
{
|
||||
partial class Repairable : ItemComponent, IDrawableComponent
|
||||
partial class Repairable : ItemComponent
|
||||
{
|
||||
private GUIButton repairButton;
|
||||
private GUIProgressBar progressBar;
|
||||
@@ -25,13 +25,7 @@ namespace Barotrauma.Items.Components
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public Vector2 DrawSize
|
||||
{
|
||||
//use the extents of the item as the draw size
|
||||
get { return Vector2.Zero; }
|
||||
}
|
||||
|
||||
|
||||
public override bool ShouldDrawHUD(Character character)
|
||||
{
|
||||
if (!HasRequiredItems(character, false) || character.SelectedConstruction != item) return false;
|
||||
@@ -104,7 +98,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override void DrawHUD(SpriteBatch spriteBatch, Character character)
|
||||
{
|
||||
IsActive = true;
|
||||
@@ -143,28 +137,5 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
//no need to write anything, just letting the server know we started repairing
|
||||
}
|
||||
|
||||
public void Draw(SpriteBatch spriteBatch, bool editing)
|
||||
{
|
||||
if (GameMain.DebugDraw && Character.Controlled?.FocusedItem == item)
|
||||
{
|
||||
bool paused = !ShouldDeteriorate();
|
||||
if (deteriorationTimer > 0.0f)
|
||||
{
|
||||
GUI.DrawString(spriteBatch,
|
||||
new Vector2(item.WorldPosition.X, -item.WorldPosition.Y), "Deterioration delay " + ((int)deteriorationTimer) + (paused ? " [PAUSED]" : ""),
|
||||
paused ? Color.Cyan : Color.Lime, Color.Black * 0.5f);
|
||||
}
|
||||
else
|
||||
{
|
||||
GUI.DrawString(spriteBatch,
|
||||
new Vector2(item.WorldPosition.X, -item.WorldPosition.Y), "Deteriorating at " + (int)(DeteriorationSpeed * 60.0f) + " units/min" + (paused ? " [PAUSED]" : ""),
|
||||
paused ? Color.Cyan : Color.Red, Color.Black * 0.5f);
|
||||
}
|
||||
GUI.DrawString(spriteBatch,
|
||||
new Vector2(item.WorldPosition.X, -item.WorldPosition.Y + 20), "Condition: " + (int)item.Condition + "/" + (int)item.MaxCondition,
|
||||
Color.Orange);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1272,17 +1272,17 @@ namespace Barotrauma
|
||||
};
|
||||
|
||||
var innerFrame = new GUIFrame(new RectTransform(new Vector2(0.2f, 0.36f), loadFrame.RectTransform, Anchor.Center) { MinSize = new Point(350, 500) });
|
||||
GUIFrame paddedLoadFrame = new GUIFrame(new RectTransform(new Vector2(0.9f, 0.9f), innerFrame.RectTransform, Anchor.Center), style: null);
|
||||
|
||||
var paddedLoadFrame = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.9f), innerFrame.RectTransform, Anchor.Center)) { Stretch = true, RelativeSpacing = 0.05f };
|
||||
|
||||
var deleteButtonHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.1f), paddedLoadFrame.RectTransform, Anchor.Center));
|
||||
|
||||
var subList = new GUIListBox(new RectTransform(new Vector2(1.0f, 1.0f), paddedLoadFrame.RectTransform))
|
||||
var subList = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.9f), paddedLoadFrame.RectTransform))
|
||||
{
|
||||
ScrollBarVisible = true,
|
||||
OnSelected = (GUIComponent selected, object userData) =>
|
||||
{
|
||||
if (deleteButtonHolder.FindChild("delete") is GUIButton deleteBtn) deleteBtn.Enabled = true;
|
||||
Submarine sub = userData as Submarine;
|
||||
if (paddedLoadFrame.FindChild("delete") is GUIButton deleteBtn)
|
||||
{
|
||||
deleteBtn.Enabled = !sub.IsVanillaSubmarine();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -1307,7 +1307,17 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
var deleteButton = new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), deleteButtonHolder.RectTransform, Anchor.TopCenter),
|
||||
new GUIButton(new RectTransform(new Vector2(0.3f, 0.05f), paddedLoadFrame.RectTransform, Anchor.BottomLeft),
|
||||
TextManager.Get("Cancel"), style: "GUIButtonLarge")
|
||||
{
|
||||
OnClicked = (GUIButton btn, object userdata) =>
|
||||
{
|
||||
loadFrame = null;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
var deleteButton = new GUIButton(new RectTransform(new Vector2(0.3f, 0.05f), paddedLoadFrame.RectTransform, Anchor.BottomRight) { RelativeOffset = new Vector2(0.31f, 0.0f) },
|
||||
TextManager.Get("Delete"), style: "GUIButtonLarge")
|
||||
{
|
||||
Enabled = false,
|
||||
@@ -1325,19 +1335,7 @@ namespace Barotrauma
|
||||
return true;
|
||||
};
|
||||
|
||||
var controlBtnHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.1f), paddedLoadFrame.RectTransform), isHorizontal: true) { RelativeSpacing = 0.2f, Stretch = true };
|
||||
|
||||
new GUIButton(new RectTransform(new Vector2(0.5f, 1.0f), controlBtnHolder.RectTransform, Anchor.BottomLeft),
|
||||
TextManager.Get("Cancel"), style: "GUIButtonLarge")
|
||||
{
|
||||
OnClicked = (GUIButton btn, object userdata) =>
|
||||
{
|
||||
loadFrame = null;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
new GUIButton(new RectTransform(new Vector2(0.5f, 1.0f), controlBtnHolder.RectTransform, Anchor.BottomRight),
|
||||
new GUIButton(new RectTransform(new Vector2(0.3f, 0.05f), paddedLoadFrame.RectTransform, Anchor.BottomRight),
|
||||
TextManager.Get("Load"), style: "GUIButtonLarge")
|
||||
{
|
||||
OnClicked = LoadSub
|
||||
|
||||
Reference in New Issue
Block a user