WIP CrashReporter, misc refactoring

This commit is contained in:
Regalis
2015-09-19 15:14:47 +03:00
parent 16bf562837
commit f6966f06c3
86 changed files with 1616 additions and 631 deletions
+16 -18
View File
@@ -61,7 +61,7 @@ namespace Subsurface
public static void TogglePauseMenu()
{
if (Screen.Selected == Game1.MainMenuScreen) return;
if (Screen.Selected == GameMain.MainMenuScreen) return;
TogglePauseMenu(null, null);
@@ -75,22 +75,22 @@ namespace Subsurface
y += 60;
if (Screen.Selected == Game1.GameScreen && Game1.GameSession !=null)
if (Screen.Selected == GameMain.GameScreen && GameMain.GameSession !=null)
{
SinglePlayerMode spMode = Game1.GameSession.gameMode as SinglePlayerMode;
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.OnClicked += TogglePauseMenu;
button.OnClicked += Game1.GameSession.LoadPrevious;
button.OnClicked += GameMain.GameSession.LoadPrevious;
y += 60;
}
}
if (Screen.Selected == Game1.LobbyScreen)
if (Screen.Selected == GameMain.LobbyScreen)
{
SinglePlayerMode spMode = Game1.GameSession.gameMode as SinglePlayerMode;
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);
@@ -121,11 +121,11 @@ namespace Subsurface
{
if (button.UserData as string == "save")
{
SaveUtil.SaveGame(Game1.GameSession.SaveFile);
SaveUtil.SaveGame(GameMain.GameSession.SaveFile);
}
Game1.MainMenuScreen.Select();
GameMain.MainMenuScreen.Select();
//Game1.MainMenuScreen.SelectTab(null, (int)MainMenuScreen.Tabs.Main);
return true;
@@ -301,15 +301,15 @@ namespace Subsurface
public static void Draw(float deltaTime, SpriteBatch spriteBatch, Camera cam)
{
spriteBatch.DrawString(Font,
"FPS: " + (int)Game1.FrameCounter.AverageFramesPerSecond,
"FPS: " + (int)GameMain.FrameCounter.AverageFramesPerSecond,
new Vector2(10, 10), Color.White);
if (Game1.DebugDraw)
if (GameMain.DebugDraw)
{
spriteBatch.DrawString(Font,
"Physics: " + Game1.World.UpdateTime
+ " - bodies: " + Game1.World.BodyList.Count
+ " Camera pos: " + Game1.GameScreen.Cam.Position,
"Physics: " + GameMain.World.UpdateTime
+ " - bodies: " + GameMain.World.BodyList.Count
+ " Camera pos: " + GameMain.GameScreen.Cam.Position,
new Vector2(10, 30), Color.White);
if (Submarine.Loaded!=null)
@@ -318,12 +318,10 @@ namespace Subsurface
"Sub pos: " + Submarine.Loaded.Position,
new Vector2(10, 50), Color.White);
}
}
if (Character.Controlled != null && cam!=null) Character.Controlled.DrawHud(spriteBatch, cam);
if (Game1.NetworkMember != null) Game1.NetworkMember.Draw(spriteBatch);
if (GameMain.NetworkMember != null) GameMain.NetworkMember.Draw(spriteBatch);
DrawMessages(spriteBatch, (float)deltaTime);
@@ -366,7 +364,7 @@ namespace Subsurface
return;
}
Vector2 currPos = new Vector2(Game1.GraphicsWidth / 2.0f, Game1.GraphicsHeight * 0.7f);
Vector2 currPos = new Vector2(GameMain.GraphicsWidth / 2.0f, GameMain.GraphicsHeight * 0.7f);
currPos.Y += messages.Count * 30;
messages.Add(new GUIMessage(message, color, currPos, lifeTime));
@@ -382,7 +380,7 @@ namespace Subsurface
{
if (messages.Count == 0) return;
Vector2 currPos = new Vector2(Game1.GraphicsWidth / 2.0f, Game1.GraphicsHeight * 0.7f);
Vector2 currPos = new Vector2(GameMain.GraphicsWidth / 2.0f, GameMain.GraphicsHeight * 0.7f);
int i = 1;
foreach (GUIMessage msg in messages)
+1 -1
View File
@@ -290,7 +290,7 @@ namespace Subsurface
protected virtual void UpdateDimensions(GUIComponent parent = null)
{
Rectangle parentRect = (parent==null) ? new Rectangle(0,0,Game1.GraphicsWidth, Game1.GraphicsHeight) : parent.rect;
Rectangle parentRect = (parent==null) ? new Rectangle(0,0,GameMain.GraphicsWidth, GameMain.GraphicsHeight) : parent.rect;
Vector4 padding = (parent == null) ? Vector4.Zero : parent.padding;
+5 -5
View File
@@ -38,7 +38,7 @@ namespace Subsurface
monsterTexture = TextureLoader.FromFile("Content/UI/titleMonster.png");
titleTexture = TextureLoader.FromFile("Content/UI/titleText.png");
renderTarget = new RenderTarget2D(graphics, Game1.GraphicsWidth, Game1.GraphicsHeight);
renderTarget = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight);
}
@@ -53,15 +53,15 @@ namespace Subsurface
graphics.SetRenderTarget(renderTarget);
//Debug.WriteLine(stopwatch.Elapsed.TotalMilliseconds);
Scale = Game1.GraphicsHeight/1500.0f;
Scale = GameMain.GraphicsHeight/1500.0f;
state += deltaTime;
if (loadState>-1)
{
CenterPosition = new Vector2(Game1.GraphicsWidth*0.3f, Game1.GraphicsHeight/2.0f);
CenterPosition = new Vector2(GameMain.GraphicsWidth*0.3f, GameMain.GraphicsHeight/2.0f);
TitlePosition = CenterPosition + new Vector2(-0.0f + (float)Math.Sqrt(state) * 220.0f, 0.0f) * Scale;
TitlePosition.X = Math.Min(TitlePosition.X, (float)Game1.GraphicsWidth / 2.0f);
TitlePosition.X = Math.Min(TitlePosition.X, (float)GameMain.GraphicsWidth / 2.0f);
}
@@ -103,7 +103,7 @@ namespace Subsurface
loadText = "Loading... " + (int)loadState + " %";
}
spriteBatch.DrawString(GUI.Font, loadText, new Vector2(Game1.GraphicsWidth/2.0f - 50.0f, Game1.GraphicsHeight*0.8f), Color.White);
spriteBatch.DrawString(GUI.Font, loadText, new Vector2(GameMain.GraphicsWidth/2.0f - 50.0f, GameMain.GraphicsHeight*0.8f), Color.White);
spriteBatch.End();