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
@@ -152,10 +152,10 @@ namespace Barotrauma
EditLimb(spriteBatch);
int x = 0, y = 0;
int y = 0;
for (int i = 0; i < textures.Count; i++ )
{
x = GameMain.GraphicsWidth - textures[i].Width;
int x = GameMain.GraphicsWidth - textures[i].Width;
spriteBatch.Draw(textures[i], new Vector2(x, y), Color.White);
foreach (Limb limb in editingCharacter.AnimController.Limbs)
+3 -5
View File
@@ -304,7 +304,7 @@ namespace Barotrauma
for (int i = 0; i<dummyCharacter.Inventory.SlotPositions.Length; i++)
{
dummyCharacter.Inventory.SlotPositions[i].X += false ? -1000 : leftPanel.Rect.Width+10;
dummyCharacter.Inventory.SlotPositions[i].X += leftPanel.Rect.Width+10;
}
Character.Controlled = dummyCharacter;
@@ -472,16 +472,14 @@ namespace Barotrauma
var deleteButton = new GUIButton(new Rectangle(0, 0, 70, 20), "Delete", Alignment.BottomLeft, GUI.Style, loadFrame);
deleteButton.Enabled = false;
deleteButton.UserData = "delete";
deleteButton.OnClicked = (GUIButton btn, object userdata) =>
deleteButton.OnClicked = (btn, userdata) =>
{
var subListBox = loadFrame.GetChild<GUIListBox>();
if (subList.Selected!=null)
{
Submarine sub = subList.Selected.UserData as Submarine;
try
{
System.IO.File.Delete(sub.FilePath);
File.Delete(sub.FilePath);
}
catch (Exception e)
{
+2 -2
View File
@@ -242,7 +242,7 @@ namespace Barotrauma
null, null, null, null,
cam.Transform);
Submarine.DrawBack(spriteBatch,false,s => s is Structure && ((s as Structure).resizeHorizontal || (s as Structure).resizeVertical));
Submarine.DrawBack(spriteBatch,false,s => s is Structure && (((Structure)s).resizeHorizontal || ((Structure)s).resizeVertical));
spriteBatch.End();
@@ -258,7 +258,7 @@ namespace Barotrauma
null, null, null, null,
cam.Transform);
Submarine.DrawBack(spriteBatch, false, s => (!(s is Structure)) || (!(s as Structure).resizeHorizontal && !(s as Structure).resizeHorizontal));
Submarine.DrawBack(spriteBatch, false, s => !(s is Structure) || (!((Structure)s).resizeHorizontal && !((Structure)s).resizeHorizontal));
foreach (Character c in Character.CharacterList) c.Draw(spriteBatch);
+1 -1
View File
@@ -94,7 +94,7 @@ namespace Barotrauma
var subsToShow = Submarine.SavedSubmarines.Where(s => !s.HasTag(SubmarineTag.HideInMenus));
foreach (Submarine sub in Submarine.SavedSubmarines)
foreach (Submarine sub in subsToShow)
{
var textBlock = new GUITextBlock(
new Rectangle(0, 0, 0, 25),
+3 -5
View File
@@ -9,12 +9,10 @@ using FarseerPhysics.Dynamics;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Reflection;
using System.ComponentModel;
namespace Barotrauma
{
partial class NetLobbyScreen : Screen
class NetLobbyScreen : Screen
{
private GUIFrame menu;
private GUIFrame infoFrame;
@@ -1062,10 +1060,10 @@ namespace Barotrauma
//}
GameModePreset modePreset = obj as GameModePreset;
missionTypeBlock.Visible = modePreset.Name == "Mission";
if (modePreset == null) return false;
missionTypeBlock.Visible = modePreset.Name == "Mission";
valueChanged = true;
return true;
@@ -176,13 +176,13 @@ namespace Barotrauma
passwordBox.Enabled = false;
passwordBox.UserData = "password";
var nameText = new GUITextBlock(new Rectangle(columnX[0], 0, 0, 0), serverName, GUI.Style, serverFrame);
new GUITextBlock(new Rectangle(columnX[0], 0, 0, 0), serverName, GUI.Style, serverFrame);
int playerCount = 0, maxPlayers = 1;
int.TryParse(currPlayersStr, out playerCount);
int.TryParse(maxPlayersStr, out maxPlayers);
var playerCountText = new GUITextBlock(new Rectangle(columnX[1], 0, 0, 0), playerCount + "/" + maxPlayers, GUI.Style, serverFrame);
new GUITextBlock(new Rectangle(columnX[1], 0, 0, 0), playerCount + "/" + maxPlayers, GUI.Style, serverFrame);
var gameStartedBox = new GUITickBox(new Rectangle(columnX[2] + (columnX[3] - columnX[2])/ 2, 0, 20, 20), "", Alignment.TopLeft, serverFrame);
gameStartedBox.Selected = gameStarted == "1";