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

View File

@@ -668,12 +668,10 @@ namespace Barotrauma.Networking
}
if (!gameStarted) return;
List<Character> crew = new List<Character>();
foreach (Character c in Character.CharacterList)
{
if (!c.IsRemotePlayer || !c.IsHumanoid || c.Info==null) continue;
crew.Add(c);
}
//GameMain.GameSession.CrewManager.CreateCrewFrame(crew);
@@ -772,13 +770,7 @@ namespace Barotrauma.Networking
GameMain.GameSession.StartShift(levelSeed,loadSecondSub);
if (respawnAllowed) respawnManager = new RespawnManager(this, GameMain.NetLobbyScreen.SelectedShuttle);
//myCharacter = ReadCharacterData(inc);
//Character.Controlled = myCharacter;
List<Character> crew = new List<Character>();
byte characterCount = inc.ReadByte();
for (int i = 0; i < characterCount; i++)
{
@@ -819,7 +811,7 @@ namespace Barotrauma.Networking
if (Screen.Selected == GameMain.GameScreen)
{
var cinematic = new TransitionCinematic(Submarine.MainSub, GameMain.GameScreen.Cam, endPreviewLength);
new TransitionCinematic(Submarine.MainSub, GameMain.GameScreen.Cam, endPreviewLength);
float secondsLeft = endPreviewLength;
@@ -1053,9 +1045,7 @@ namespace Barotrauma.Networking
if (votedClient == null) return false;
votedClient.AddKickVote(new Client(name, ID));
if (votedClient == null) return false;
Vote(VoteType.Kick, votedClient);
button.Enabled = false;

View File

@@ -1130,7 +1130,7 @@ namespace Barotrauma.Networking
{
float endPreviewLength = 10.0f;
var cinematic = new TransitionCinematic(Submarine.MainSub, GameMain.GameScreen.Cam, endPreviewLength);
new TransitionCinematic(Submarine.MainSub, GameMain.GameScreen.Cam, endPreviewLength);
float secondsLeft = endPreviewLength;
@@ -1217,18 +1217,10 @@ namespace Barotrauma.Networking
private void UpdateCrewFrame()
{
List<Character> crew = new List<Character>();
foreach (Client c in connectedClients)
{
if (c.Character == null || !c.inGame) continue;
crew.Add(c.Character);
}
if (myCharacter != null) crew.Add(myCharacter);
//if (GameMain.GameSession!=null) GameMain.GameSession.CrewManager.CreateCrewFrame(crew);
}
public override void KickPlayer(string playerName, bool ban, bool range = false)
@@ -1376,7 +1368,7 @@ namespace Barotrauma.Networking
int resentMessages = 0;
int clientListHeight = connectedClients.Count() * 40;
int clientListHeight = connectedClients.Count * 40;
float scrollBarHeight = (height - 110) / (float)Math.Max(clientListHeight, 110);
if (clientListScrollBar.BarSize != scrollBarHeight)

View File

@@ -119,8 +119,9 @@ namespace Barotrauma.Networking
text = text.ToLower();
foreach (GUITextBlock textBlock in listBox.children)
foreach (GUIComponent child in listBox.children)
{
var textBlock = child as GUITextBlock;
if (textBlock == null) continue;
textBlock.Visible = textBlock.Text.ToLower().Contains(text);