Some cleanup using ReSharper (mostly removing redundancies)

This commit is contained in:
Regalis
2016-03-12 15:32:34 +02:00
parent ae4e4d8f34
commit d1580328ed
99 changed files with 197 additions and 483 deletions
-3
View File
@@ -1,8 +1,5 @@
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
namespace Barotrauma
+8 -8
View File
@@ -57,9 +57,9 @@ namespace Barotrauma
public static void Init(ContentManager content)
{
GUI.Font = ToolBox.TryLoadFont("SpriteFont1", content);
GUI.SmallFont = ToolBox.TryLoadFont("SmallFont", content);
GUI.LargeFont = ToolBox.TryLoadFont("LargeFont", content);
Font = ToolBox.TryLoadFont("SpriteFont1", content);
SmallFont = ToolBox.TryLoadFont("SmallFont", content);
LargeFont = ToolBox.TryLoadFont("LargeFont", content);
cursor = new Sprite("Content/UI/cursor.png", Vector2.Zero);
}
@@ -104,7 +104,7 @@ namespace Barotrauma
pauseMenu = new GUIFrame(new Rectangle(0, 0, 200, 300), null, Alignment.Center, Style);
int y = 0;
var button = new GUIButton(new Rectangle(0, y, 0, 30), "Resume", Alignment.CenterX, GUI.Style, pauseMenu);
var button = new GUIButton(new Rectangle(0, y, 0, 30), "Resume", Alignment.CenterX, Style, pauseMenu);
button.OnClicked = TogglePauseMenu;
y += 60;
@@ -114,7 +114,7 @@ namespace Barotrauma
SinglePlayerMode spMode = GameMain.GameSession.gameMode as SinglePlayerMode;
if (spMode != null)
{
button = new GUIButton(new Rectangle(0, y, 0, 30), "Load previous", Alignment.CenterX, GUI.Style, pauseMenu);
button = new GUIButton(new Rectangle(0, y, 0, 30), "Load previous", Alignment.CenterX, Style, pauseMenu);
button.OnClicked += TogglePauseMenu;
button.OnClicked += GameMain.GameSession.LoadPrevious;
@@ -127,7 +127,7 @@ namespace Barotrauma
SinglePlayerMode spMode = GameMain.GameSession.gameMode as SinglePlayerMode;
if (spMode != null)
{
button = new GUIButton(new Rectangle(0, y, 0, 30), "Save & quit", Alignment.CenterX, GUI.Style, pauseMenu);
button = new GUIButton(new Rectangle(0, y, 0, 30), "Save & quit", Alignment.CenterX, Style, pauseMenu);
button.OnClicked += QuitClicked;
button.OnClicked += TogglePauseMenu;
button.UserData = "save";
@@ -137,7 +137,7 @@ namespace Barotrauma
}
button = new GUIButton(new Rectangle(0, y, 0, 30), "Quit", Alignment.CenterX, GUI.Style, pauseMenu);
button = new GUIButton(new Rectangle(0, y, 0, 30), "Quit", Alignment.CenterX, Style, pauseMenu);
button.OnClicked += QuitClicked;
button.OnClicked += TogglePauseMenu;
}
@@ -193,7 +193,7 @@ namespace Barotrauma
public static void DrawString(SpriteBatch sb, Vector2 pos, string text, Color color, Color? backgroundColor=null, int backgroundPadding=0, SpriteFont font = null)
{
if (font == null) font = GUI.Font;
if (font == null) font = Font;
if (backgroundColor != null)
{
Vector2 textSize = font.MeasureString(text);
+2 -3
View File
@@ -1,5 +1,4 @@
using Microsoft.Xna.Framework;
using System;
using System.Linq;
namespace Barotrauma
@@ -23,8 +22,8 @@ namespace Barotrauma
this.rect = rect;
this.alignment = alignment;
if (color!=null) this.color = (Color)color;
if (color != null) this.color = (Color)color;
if (parent != null)
{
+4 -9
View File
@@ -1,20 +1,15 @@
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Barotrauma
{
class GUIMessage
{
ColoredText coloredText;
Vector2 pos;
private ColoredText coloredText;
private Vector2 pos;
float lifeTime;
Vector2 size;
private float lifeTime;
private Vector2 size;
public string Text
{
-19
View File
@@ -1,5 +1,4 @@
using System.Xml.Linq;
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
@@ -22,24 +21,6 @@ namespace Barotrauma
return;
}
//smallPadding = ToolBox.GetAttributeVector4(doc.Root, "smallpadding", Vector4.Zero);
//largePadding = ToolBox.GetAttributeVector4(doc.Root, "largepadding", Vector4.Zero);
//Vector4 colorVector = ToolBox.GetAttributeVector4(doc.Root, "backgroundcolor", new Vector4(0.0f,0.0f,0.0f,1.0f));
//backGroundColor = new Color(colorVector.X, colorVector.Y, colorVector.Z, colorVector.W);
//colorVector = ToolBox.GetAttributeVector4(doc.Root, "foregroundcolor", new Vector4(0.0f, 0.0f, 0.0f, 1.0f));
//foreGroundColor = new Color(colorVector.X, colorVector.Y, colorVector.Z, colorVector.W);
//colorVector = ToolBox.GetAttributeVector4(doc.Root, "textcolor", new Vector4(0.0f, 0.0f, 0.0f, 1.0f));
//textColor = new Color(colorVector.X, colorVector.Y, colorVector.Z, colorVector.W);
//colorVector = ToolBox.GetAttributeVector4(doc.Root, "hovercolor", new Vector4(0.0f, 0.0f, 0.0f, 1.0f));
//hoverColor = new Color(colorVector.X, colorVector.Y, colorVector.Z, colorVector.W);
//colorVector = ToolBox.GetAttributeVector4(doc.Root, "selectedcolor", new Vector4(0.0f, 0.0f, 0.0f, 1.0f));
//selectedColor = new Color(colorVector.X, colorVector.Y, colorVector.Z, colorVector.W);
foreach (XElement subElement in doc.Root.Elements())
{
GUIComponentStyle componentStyle = new GUIComponentStyle(subElement);
+1 -1
View File
@@ -93,7 +93,7 @@ namespace Barotrauma
{
}
protected override void UpdateDimensions(GUIComponent parent)
protected override void UpdateDimensions(GUIComponent parent = null)
{
base.UpdateDimensions(parent);