Cleanup with resharper (mostly removing redundancies & using collection.Length/Count properties instead of the Count method)

This commit is contained in:
Regalis
2016-10-31 20:35:04 +02:00
parent 5cc605bc01
commit eb2c51c2f1
46 changed files with 93 additions and 200 deletions
+1 -1
View File
@@ -124,7 +124,7 @@ namespace Barotrauma
public int CountChildren
{
get { return children.Count(); }
get { return children.Count; }
}
public virtual Color Color
+3 -29
View File
@@ -382,38 +382,14 @@ namespace Barotrauma
//base.Draw(spriteBatch);
frame.Draw(spriteBatch);
//GUI.DrawRectangle(spriteBatch, rect, color*alpha, true);
int x = rect.X, y = rect.Y;
if (!scrollBarHidden)
{
scrollBar.Draw(spriteBatch);
if (scrollBar.IsHorizontal)
{
x -= (int)((totalSize - rect.Width) * scrollBar.BarScroll);
}
else
{
y -= (int)((totalSize - rect.Height) * scrollBar.BarScroll);
}
}
if (!scrollBarHidden) scrollBar.Draw(spriteBatch);
for (int i = 0; i < children.Count; i++)
{
GUIComponent child = children[i];
if (child == frame || !child.Visible) continue;
if (scrollBar.IsHorizontal)
{
x += child.Rect.Width + spacing;
}
else
{
y += child.Rect.Height + spacing;
}
if (scrollBar.IsHorizontal)
{
if (child.Rect.Right < rect.X) continue;
@@ -421,7 +397,6 @@ namespace Barotrauma
if (child.Rect.X < rect.X && child.Rect.Right >= rect.X)
{
x = rect.X;
continue;
}
}
@@ -432,7 +407,6 @@ namespace Barotrauma
if (child.Rect.Y < rect.Y && child.Rect.Y + child.Rect.Height >= rect.Y)
{
y = rect.Y;
continue;
}
}
-10
View File
@@ -169,26 +169,16 @@ namespace Barotrauma
private void MoveButton()
{
//if (!enabled) return false;
//if (barSize == 1.0f) return false;
int newX = bar.Rect.X - frame.Rect.X, newY = bar.Rect.Y - frame.Rect.Y;
float moveAmount;
if (isHorizontal)
{
moveAmount = PlayerInput.MouseSpeed.X;
barScroll += moveAmount / (frame.Rect.Width - bar.Rect.Width);
//newX = Math.Min(Math.Max(newX + moveAmount, 0), frame.Rect.Width - bar.Rect.Width);
//barScroll = (float)newX / ((float)frame.Rect.Width - (float)bar.Rect.Width);
}
else
{
moveAmount = PlayerInput.MouseSpeed.Y;
barScroll += moveAmount / (frame.Rect.Height - bar.Rect.Height);
//newY = Math.Min(Math.Max(newY+moveAmount, 0), frame.Rect.Height - bar.Rect.Height);
//barScroll = (float)newY / ((float)frame.Rect.Height - (float)bar.Rect.Height);
}
BarScroll = barScroll;