WIP CrashReporter, misc refactoring
This commit is contained in:
@@ -39,11 +39,11 @@ namespace Subsurface
|
||||
{
|
||||
base.Select();
|
||||
|
||||
Game1.DebugDraw = true;
|
||||
GameMain.DebugDraw = true;
|
||||
|
||||
cam = new Camera();
|
||||
|
||||
GUIpanel = new GUIFrame(new Rectangle(0, 0, 300, Game1.GraphicsHeight), GUI.Style);
|
||||
GUIpanel = new GUIFrame(new Rectangle(0, 0, 300, GameMain.GraphicsHeight), GUI.Style);
|
||||
GUIpanel.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
|
||||
|
||||
physicsButton = new GUIButton(new Rectangle(0, 50, 200, 25), "Physics", Alignment.Left, GUI.Style, GUIpanel);
|
||||
@@ -66,7 +66,7 @@ namespace Subsurface
|
||||
if (editingCharacter != Character.CharacterList[0]) UpdateLimbLists(Character.CharacterList[0]);
|
||||
editingCharacter = Character.CharacterList[0];
|
||||
|
||||
Vector2 camPos = editingCharacter.AnimController.limbs[0].body.SimPosition;
|
||||
Vector2 camPos = editingCharacter.AnimController.Limbs[0].body.SimPosition;
|
||||
camPos = ConvertUnits.ToDisplayUnits(camPos);
|
||||
camPos.Y = -camPos.Y;
|
||||
cam.TargetPos = camPos;
|
||||
@@ -83,7 +83,7 @@ namespace Subsurface
|
||||
|
||||
textures = new List<Texture2D>();
|
||||
texturePaths = new List<string>();
|
||||
foreach (Limb limb in editingCharacter.AnimController.limbs)
|
||||
foreach (Limb limb in editingCharacter.AnimController.Limbs)
|
||||
{
|
||||
if (texturePaths.Contains(limb.sprite.FilePath)) continue;
|
||||
textures.Add(limb.sprite.Texture);
|
||||
@@ -112,7 +112,7 @@ namespace Subsurface
|
||||
|
||||
Ragdoll.UpdateAll((float)Physics.step);
|
||||
|
||||
Game1.World.Step((float)Physics.step);
|
||||
GameMain.World.Step((float)Physics.step);
|
||||
|
||||
Physics.accumulator -= Physics.step;
|
||||
}
|
||||
@@ -169,10 +169,10 @@ namespace Subsurface
|
||||
int x = 0, y = 0;
|
||||
for (int i = 0; i < textures.Count; i++ )
|
||||
{
|
||||
x = Game1.GraphicsWidth - textures[i].Width;
|
||||
x = GameMain.GraphicsWidth - textures[i].Width;
|
||||
spriteBatch.Draw(textures[i], new Vector2(x, y), Color.White);
|
||||
|
||||
foreach (Limb limb in editingCharacter.AnimController.limbs)
|
||||
foreach (Limb limb in editingCharacter.AnimController.Limbs)
|
||||
{
|
||||
if (limb.sprite.FilePath != texturePaths[i]) continue;
|
||||
Rectangle rect = limb.sprite.SourceRect;
|
||||
@@ -219,7 +219,7 @@ namespace Subsurface
|
||||
private void UpdateLimbLists(Character character)
|
||||
{
|
||||
limbList.ClearChildren();
|
||||
foreach (Limb limb in character.AnimController.limbs)
|
||||
foreach (Limb limb in character.AnimController.Limbs)
|
||||
{
|
||||
GUITextBlock textBlock = new GUITextBlock(
|
||||
new Rectangle(0,0,0,25),
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Subsurface
|
||||
|
||||
private string GetPhysicsBodyCount()
|
||||
{
|
||||
return "Physics bodies: " + Game1.World.BodyList.Count;
|
||||
return "Physics bodies: " + GameMain.World.BodyList.Count;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace Subsurface
|
||||
|
||||
selectedTab = -1;
|
||||
|
||||
GUIpanel = new GUIFrame(new Rectangle(0, 0, 150, Game1.GraphicsHeight), GUI.Style);
|
||||
GUIpanel = new GUIFrame(new Rectangle(0, 0, 150, GameMain.GraphicsHeight), GUI.Style);
|
||||
GUIpanel.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
|
||||
//GUIListBox constructionList = new GUIListBox(new Rectangle(0, 0, 0, 300), Color.White * 0.7f, GUIpanel);
|
||||
//constructionList.OnSelected = MapEntityPrefab.SelectPrefab;
|
||||
@@ -84,13 +84,13 @@ namespace Subsurface
|
||||
|
||||
GUItabs = new GUIComponent[2];
|
||||
int width = 400, height = 400;
|
||||
GUItabs[0] = new GUIFrame(new Rectangle(Game1.GraphicsWidth/2-width/2, Game1.GraphicsHeight/2-height/2, width, height), GUI.Style);
|
||||
GUItabs[0] = new GUIFrame(new Rectangle(GameMain.GraphicsWidth/2-width/2, GameMain.GraphicsHeight/2-height/2, width, height), GUI.Style);
|
||||
GUItabs[0].Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
|
||||
GUIListBox itemList = new GUIListBox(new Rectangle(0, 0, 0, 0), Color.White * 0.7f, GUI.Style, GUItabs[0]);
|
||||
itemList.OnSelected = SelectPrefab;
|
||||
itemList.CheckSelected = MapEntityPrefab.GetSelected;
|
||||
|
||||
GUItabs[1] = new GUIFrame(new Rectangle(Game1.GraphicsWidth / 2 - width / 2, Game1.GraphicsHeight / 2 - height / 2, width, height), GUI.Style);
|
||||
GUItabs[1] = new GUIFrame(new Rectangle(GameMain.GraphicsWidth / 2 - width / 2, GameMain.GraphicsHeight / 2 - height / 2, width, height), GUI.Style);
|
||||
GUItabs[1].Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
|
||||
GUIListBox structureList = new GUIListBox(new Rectangle(0, 0, 0, 300), Color.White * 0.7f, GUI.Style, GUItabs[1]);
|
||||
structureList.OnSelected = SelectPrefab;
|
||||
@@ -143,7 +143,7 @@ namespace Subsurface
|
||||
{
|
||||
dummyCharacter.Remove();
|
||||
dummyCharacter = null;
|
||||
Game1.World.ProcessChanges();
|
||||
GameMain.World.ProcessChanges();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ namespace Subsurface
|
||||
|
||||
dummyCharacter = new Character(Character.HumanConfigFile, Vector2.Zero);
|
||||
Character.Controlled = dummyCharacter;
|
||||
Game1.World.ProcessChanges();
|
||||
GameMain.World.ProcessChanges();
|
||||
}
|
||||
|
||||
private bool SelectTab(GUIButton button, object obj)
|
||||
@@ -218,7 +218,7 @@ namespace Subsurface
|
||||
if (dummyCharacter.SelectedConstruction==null)
|
||||
{
|
||||
Vector2 mouseSimPos = FarseerPhysics.ConvertUnits.ToSimUnits(cam.ScreenToWorld(PlayerInput.MousePosition));
|
||||
foreach (Limb limb in dummyCharacter.AnimController.limbs)
|
||||
foreach (Limb limb in dummyCharacter.AnimController.Limbs)
|
||||
{
|
||||
limb.body.SetTransform(mouseSimPos, 0.0f);
|
||||
}
|
||||
|
||||
@@ -28,9 +28,9 @@ namespace Subsurface
|
||||
cam = new Camera();
|
||||
cam.Translate(new Vector2(-10.0f, 50.0f));
|
||||
|
||||
renderTarget = new RenderTarget2D(graphics, Game1.GraphicsWidth, Game1.GraphicsHeight);
|
||||
renderTargetWater = new RenderTarget2D(graphics, Game1.GraphicsWidth, Game1.GraphicsHeight);
|
||||
renderTargetAir = new RenderTarget2D(graphics, Game1.GraphicsWidth, Game1.GraphicsHeight);
|
||||
renderTarget = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
||||
renderTargetWater = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
||||
renderTargetAir = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
||||
|
||||
background = new Sprite("Content/Map/background.png", Vector2.Zero);
|
||||
backgroundTop = new Sprite("Content/Map/background2.png", Vector2.Zero);
|
||||
@@ -70,14 +70,14 @@ namespace Subsurface
|
||||
// Game1.GameSession.Submarine.ApplyForce(targetMovement * 100000.0f);
|
||||
//}
|
||||
|
||||
if (Game1.GameSession!=null) Game1.GameSession.Update((float)deltaTime);
|
||||
if (GameMain.GameSession!=null) GameMain.GameSession.Update((float)deltaTime);
|
||||
//EventManager.Update(gameTime);
|
||||
|
||||
Character.UpdateAll(cam, (float)deltaTime);
|
||||
|
||||
BackgroundSpriteManager.Update((float)deltaTime);
|
||||
|
||||
Game1.ParticleManager.Update((float)deltaTime);
|
||||
GameMain.ParticleManager.Update((float)deltaTime);
|
||||
|
||||
StatusEffect.UpdateAll((float)deltaTime);
|
||||
|
||||
@@ -98,9 +98,9 @@ namespace Subsurface
|
||||
|
||||
Ragdoll.UpdateAll((float)Physics.step);
|
||||
|
||||
if (Game1.GameSession != null && Game1.GameSession.Level != null) Game1.GameSession.Submarine.Update((float)Physics.step);
|
||||
if (GameMain.GameSession != null && GameMain.GameSession.Level != null) GameMain.GameSession.Submarine.Update((float)Physics.step);
|
||||
|
||||
Game1.World.Step((float)Physics.step);
|
||||
GameMain.World.Step((float)Physics.step);
|
||||
|
||||
Level.AfterWorldStep();
|
||||
|
||||
@@ -132,7 +132,7 @@ namespace Subsurface
|
||||
}
|
||||
}
|
||||
|
||||
if (Game1.GameSession != null) Game1.GameSession.Draw(spriteBatch);
|
||||
if (GameMain.GameSession != null) GameMain.GameSession.Draw(spriteBatch);
|
||||
|
||||
GUI.Draw((float)deltaTime, spriteBatch, cam);
|
||||
|
||||
@@ -143,7 +143,7 @@ namespace Subsurface
|
||||
|
||||
public void DrawMap(GraphicsDevice graphics, SpriteBatch spriteBatch)
|
||||
{
|
||||
Game1.LightManager.DrawLightmap(graphics, spriteBatch, cam);
|
||||
GameMain.LightManager.DrawLightmap(graphics, spriteBatch, cam);
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
//1. draw the background, characters and the parts of the submarine that are behind them
|
||||
@@ -167,14 +167,14 @@ namespace Subsurface
|
||||
background.SourceRect = new Rectangle((int)backgroundPos.X, (int)Math.Max(backgroundPos.Y, 0), 1024, 1024);
|
||||
background.DrawTiled(spriteBatch,
|
||||
(backgroundPos.Y < 0) ? new Vector2(0.0f, -backgroundPos.Y) : Vector2.Zero,
|
||||
new Vector2(Game1.GraphicsWidth, 1024 - backgroundPos.Y),
|
||||
new Vector2(GameMain.GraphicsWidth, 1024 - backgroundPos.Y),
|
||||
Vector2.Zero, Color.White);
|
||||
}
|
||||
|
||||
if (backgroundPos.Y < 0)
|
||||
{
|
||||
backgroundTop.SourceRect = new Rectangle((int)backgroundPos.X, (int)backgroundPos.Y, 1024, (int)Math.Min(-backgroundPos.Y, 1024));
|
||||
backgroundTop.DrawTiled(spriteBatch, Vector2.Zero, new Vector2(Game1.GraphicsWidth, Math.Min(-backgroundPos.Y, Game1.GraphicsHeight)),
|
||||
backgroundTop.DrawTiled(spriteBatch, Vector2.Zero, new Vector2(GameMain.GraphicsWidth, Math.Min(-backgroundPos.Y, GameMain.GraphicsHeight)),
|
||||
Vector2.Zero, Color.White);
|
||||
}
|
||||
}
|
||||
@@ -208,7 +208,7 @@ namespace Subsurface
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.Immediate,
|
||||
BlendState.AlphaBlend);
|
||||
spriteBatch.Draw(renderTarget, new Rectangle(0, 0, Game1.GraphicsWidth, Game1.GraphicsHeight), new Color(0.75f, 0.8f, 0.9f, 1.0f));
|
||||
spriteBatch.Draw(renderTarget, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), new Color(0.75f, 0.8f, 0.9f, 1.0f));
|
||||
spriteBatch.End();
|
||||
|
||||
BlendState blend = new BlendState();
|
||||
@@ -219,7 +219,7 @@ namespace Subsurface
|
||||
BlendState.AlphaBlend,
|
||||
null, DepthStencilState.DepthRead, null, null,
|
||||
cam.Transform);
|
||||
Game1.ParticleManager.Draw(spriteBatch, true);
|
||||
GameMain.ParticleManager.Draw(spriteBatch, true);
|
||||
|
||||
spriteBatch.End();
|
||||
|
||||
@@ -229,7 +229,7 @@ namespace Subsurface
|
||||
graphics.SetRenderTarget(renderTargetAir);
|
||||
spriteBatch.Begin(SpriteSortMode.Immediate,
|
||||
BlendState.AlphaBlend);
|
||||
spriteBatch.Draw(renderTarget, new Rectangle(0, 0, Game1.GraphicsWidth, Game1.GraphicsHeight), Color.White);
|
||||
spriteBatch.Draw(renderTarget, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.White);
|
||||
spriteBatch.End();
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.Immediate,
|
||||
@@ -237,7 +237,7 @@ namespace Subsurface
|
||||
null, DepthStencilState.DepthRead, null, null,
|
||||
cam.Transform);
|
||||
|
||||
Game1.ParticleManager.Draw(spriteBatch, false);
|
||||
GameMain.ParticleManager.Draw(spriteBatch, false);
|
||||
spriteBatch.End();
|
||||
|
||||
graphics.SetRenderTarget(null);
|
||||
@@ -257,17 +257,17 @@ namespace Subsurface
|
||||
|
||||
Hull.renderer.Render(graphics, cam, renderTargetAir, Cam.ShaderTransform);
|
||||
|
||||
if (Game1.GameSession != null && Game1.GameSession.Level != null)
|
||||
if (GameMain.GameSession != null && GameMain.GameSession.Level != null)
|
||||
{
|
||||
Game1.GameSession.Level.Render(graphics, cam);
|
||||
Game1.GameSession.Level.SetObserverPosition(cam.WorldViewCenter);
|
||||
GameMain.GameSession.Level.Render(graphics, cam);
|
||||
GameMain.GameSession.Level.SetObserverPosition(cam.WorldViewCenter);
|
||||
}
|
||||
|
||||
if (Game1.LightManager.LightingEnabled)
|
||||
if (GameMain.LightManager.LightingEnabled)
|
||||
{
|
||||
//multiply scene with lightmap
|
||||
spriteBatch.Begin(SpriteSortMode.Immediate, CustomBlendStates.Multiplicative);
|
||||
spriteBatch.Draw(Game1.LightManager.LightMap, Vector2.Zero, Color.White);
|
||||
spriteBatch.Draw(GameMain.LightManager.LightMap, Vector2.Zero, Color.White);
|
||||
spriteBatch.End();
|
||||
}
|
||||
|
||||
@@ -284,15 +284,15 @@ namespace Subsurface
|
||||
|
||||
foreach (Character c in Character.CharacterList) c.DrawFront(spriteBatch);
|
||||
|
||||
if (Game1.GameSession != null && Game1.GameSession.Level != null)
|
||||
if (GameMain.GameSession != null && GameMain.GameSession.Level != null)
|
||||
{
|
||||
Game1.GameSession.Level.Draw(spriteBatch);
|
||||
GameMain.GameSession.Level.Draw(spriteBatch);
|
||||
//Game1.GameSession.Level.SetObserverPosition(cam.WorldViewCenter);
|
||||
}
|
||||
|
||||
spriteBatch.End();
|
||||
|
||||
Game1.LightManager.DrawLOS(graphics, cam, LightManager.ViewPos);
|
||||
GameMain.LightManager.DrawLOS(graphics, cam, LightManager.ViewPos);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Subsurface
|
||||
Rectangle panelRect = new Rectangle(
|
||||
40, 40,
|
||||
180,
|
||||
Game1.GraphicsHeight - 80);
|
||||
GameMain.GraphicsHeight - 80);
|
||||
|
||||
leftPanel = new GUIFrame(panelRect, GUI.Style);
|
||||
//leftPanel.Padding = GUI.style.smallPadding;
|
||||
@@ -92,8 +92,8 @@ namespace Subsurface
|
||||
panelRect = new Rectangle(
|
||||
panelRect.X + panelRect.Width + 40,
|
||||
40,
|
||||
Game1.GraphicsWidth - panelRect.Width - 120,
|
||||
Game1.GraphicsHeight - 80);
|
||||
GameMain.GraphicsWidth - panelRect.Width - 120,
|
||||
GameMain.GraphicsHeight - 80);
|
||||
|
||||
rightPanel = new GUIFrame[4];
|
||||
|
||||
@@ -147,7 +147,7 @@ namespace Subsurface
|
||||
{
|
||||
base.Select();
|
||||
|
||||
gameMode = Game1.GameSession.gameMode as SinglePlayerMode;
|
||||
gameMode = GameMain.GameSession.gameMode as SinglePlayerMode;
|
||||
|
||||
selectedRightPanel = (int)PanelTab.Crew;
|
||||
|
||||
@@ -210,9 +210,9 @@ namespace Subsurface
|
||||
|
||||
new GUITextBlock(new Rectangle(0,0,0,0), location.Name, Color.Transparent, Color.White, Alignment.TopLeft, null, locationPanel);
|
||||
|
||||
if (Game1.GameSession.Map.SelectedConnection != null && Game1.GameSession.Map.SelectedConnection.Quest != null)
|
||||
if (GameMain.GameSession.Map.SelectedConnection != null && GameMain.GameSession.Map.SelectedConnection.Quest != null)
|
||||
{
|
||||
var quest = Game1.GameSession.Map.SelectedConnection.Quest;
|
||||
var quest = GameMain.GameSession.Map.SelectedConnection.Quest;
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 40, 0, 20), "Quest: "+quest.Name, Color.Transparent, Color.White, Alignment.TopLeft, null, locationPanel);
|
||||
|
||||
@@ -343,7 +343,7 @@ namespace Subsurface
|
||||
|
||||
graphics.Clear(Color.CornflowerBlue);
|
||||
|
||||
Game1.GameScreen.DrawMap(graphics, spriteBatch);
|
||||
GameMain.GameScreen.DrawMap(graphics, spriteBatch);
|
||||
|
||||
spriteBatch.Begin();
|
||||
|
||||
@@ -353,16 +353,16 @@ namespace Subsurface
|
||||
|
||||
if (selectedRightPanel == (int)PanelTab.Map)
|
||||
{
|
||||
Game1.GameSession.Map.Draw(spriteBatch, new Rectangle(
|
||||
GameMain.GameSession.Map.Draw(spriteBatch, new Rectangle(
|
||||
rightPanel[selectedRightPanel].Rect.X + 20,
|
||||
rightPanel[selectedRightPanel].Rect.Y + 20,
|
||||
rightPanel[selectedRightPanel].Rect.Width - 280,
|
||||
rightPanel[selectedRightPanel].Rect.Height - 40), mapZoom);
|
||||
}
|
||||
|
||||
if (rightPanel[(int)selectedRightPanel].UserData as Location != Game1.GameSession.Map.CurrentLocation)
|
||||
if (rightPanel[(int)selectedRightPanel].UserData as Location != GameMain.GameSession.Map.CurrentLocation)
|
||||
{
|
||||
UpdateLocationTab(Game1.GameSession.Map.CurrentLocation);
|
||||
UpdateLocationTab(GameMain.GameSession.Map.CurrentLocation);
|
||||
}
|
||||
|
||||
GUI.Draw((float)deltaTime, spriteBatch, null);
|
||||
@@ -380,7 +380,7 @@ namespace Subsurface
|
||||
|
||||
private string GetMoney()
|
||||
{
|
||||
return "Money: " + ((Game1.GameSession == null) ? "" : gameMode.CrewManager.Money.ToString());
|
||||
return "Money: " + ((GameMain.GameSession == null) ? "" : gameMode.CrewManager.Money.ToString());
|
||||
}
|
||||
|
||||
private bool SelectCharacter(GUIComponent component, object selection)
|
||||
@@ -416,9 +416,9 @@ namespace Subsurface
|
||||
CharacterInfo characterInfo = selection as CharacterInfo;
|
||||
if (characterInfo == null) return false;
|
||||
|
||||
if (gameMode.TryHireCharacter(Game1.GameSession.Map.CurrentLocation.HireManager, characterInfo))
|
||||
if (gameMode.TryHireCharacter(GameMain.GameSession.Map.CurrentLocation.HireManager, characterInfo))
|
||||
{
|
||||
UpdateLocationTab(Game1.GameSession.Map.CurrentLocation);
|
||||
UpdateLocationTab(GameMain.GameSession.Map.CurrentLocation);
|
||||
}
|
||||
|
||||
|
||||
@@ -428,15 +428,15 @@ namespace Subsurface
|
||||
|
||||
private bool StartShift(GUIButton button, object selection)
|
||||
{
|
||||
Game1.GameSession.StartShift(TimeSpan.Zero, selectedLevel, false);
|
||||
Game1.GameScreen.Select();
|
||||
GameMain.GameSession.StartShift(TimeSpan.Zero, selectedLevel, false);
|
||||
GameMain.GameScreen.Select();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool QuitToMainMenu(GUIButton button, object selection)
|
||||
{
|
||||
Game1.MainMenuScreen.Select();
|
||||
GameMain.MainMenuScreen.Select();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,11 +23,11 @@ namespace Subsurface
|
||||
private GUITextBox serverNameBox, portBox, passwordBox, maxPlayersBox;
|
||||
private GUITickBox isPublicBox, useUpnpBox;
|
||||
|
||||
private Game1 game;
|
||||
private GameMain game;
|
||||
|
||||
int selectedTab;
|
||||
|
||||
public MainMenuScreen(Game1 game)
|
||||
public MainMenuScreen(GameMain game)
|
||||
{
|
||||
menuTabs = new GUIFrame[Enum.GetValues(typeof(Tabs)).Length+1];
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Subsurface
|
||||
//menuTabs[(int)Tabs.Main].Padding = GUI.style.smallPadding;
|
||||
|
||||
Rectangle panelRect = new Rectangle(
|
||||
Game1.GraphicsWidth / 2 - 250,
|
||||
GameMain.GraphicsWidth / 2 - 250,
|
||||
buttonsTab.Rect.Y,
|
||||
500, 360);
|
||||
|
||||
@@ -136,7 +136,7 @@ namespace Subsurface
|
||||
minusPlayersBox.OnClicked = ChangeMaxPlayers;
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 150, 0, 30), "Password (optional):", GUI.Style, Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tabs.HostServer]);
|
||||
passwordBox = new GUITextBox(new Rectangle(160, 170, 200, 30), null, null, Alignment.TopLeft, Alignment.Left, GUI.Style, menuTabs[(int)Tabs.HostServer]);
|
||||
passwordBox = new GUITextBox(new Rectangle(160, 150, 200, 30), null, null, Alignment.TopLeft, Alignment.Left, GUI.Style, menuTabs[(int)Tabs.HostServer]);
|
||||
|
||||
isPublicBox = new GUITickBox(new Rectangle(10, 200, 20, 20), "Public server", Alignment.TopLeft, menuTabs[(int)Tabs.HostServer]);
|
||||
isPublicBox.ToolTip = "Public servers are shown in the list of available servers in the ''Join Server'' -tab";
|
||||
@@ -189,7 +189,7 @@ namespace Subsurface
|
||||
|
||||
private bool JoinServerClicked(GUIButton button, object obj)
|
||||
{
|
||||
Game1.ServerListScreen.Select();
|
||||
GameMain.ServerListScreen.Select();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -223,9 +223,9 @@ namespace Subsurface
|
||||
return false;
|
||||
}
|
||||
|
||||
Game1.NetworkMember = new GameServer(name, port, isPublicBox.Selected, passwordBox.Text, useUpnpBox.Selected, int.Parse(maxPlayersBox.Text));
|
||||
GameMain.NetworkMember = new GameServer(name, port, isPublicBox.Selected, passwordBox.Text, useUpnpBox.Selected, int.Parse(maxPlayersBox.Text));
|
||||
|
||||
Game1.NetLobbyScreen.IsServer = true;
|
||||
GameMain.NetLobbyScreen.IsServer = true;
|
||||
//Game1.NetLobbyScreen.Select();
|
||||
return true;
|
||||
}
|
||||
@@ -340,10 +340,10 @@ namespace Subsurface
|
||||
buttonsTab.Update((float)deltaTime);
|
||||
if (selectedTab>0) menuTabs[selectedTab].Update((float)deltaTime);
|
||||
|
||||
Game1.TitleScreen.TitlePosition =
|
||||
Vector2.Lerp(Game1.TitleScreen.TitlePosition, new Vector2(
|
||||
Game1.TitleScreen.TitleSize.X / 2.0f * Game1.TitleScreen.Scale + 30.0f,
|
||||
Game1.TitleScreen.TitleSize.Y / 2.0f * Game1.TitleScreen.Scale + 30.0f),
|
||||
GameMain.TitleScreen.TitlePosition =
|
||||
Vector2.Lerp(GameMain.TitleScreen.TitlePosition, new Vector2(
|
||||
GameMain.TitleScreen.TitleSize.X / 2.0f * GameMain.TitleScreen.Scale + 30.0f,
|
||||
GameMain.TitleScreen.TitleSize.Y / 2.0f * GameMain.TitleScreen.Scale + 30.0f),
|
||||
0.1f);
|
||||
|
||||
}
|
||||
@@ -352,7 +352,7 @@ namespace Subsurface
|
||||
{
|
||||
graphics.Clear(Color.CornflowerBlue);
|
||||
|
||||
Game1.TitleScreen.Draw(spriteBatch, graphics, -1.0f, (float)deltaTime);
|
||||
GameMain.TitleScreen.Draw(spriteBatch, graphics, -1.0f, (float)deltaTime);
|
||||
|
||||
//Game1.GameScreen.DrawMap(graphics, spriteBatch);
|
||||
|
||||
@@ -363,7 +363,7 @@ namespace Subsurface
|
||||
|
||||
GUI.Draw((float)deltaTime, spriteBatch, null);
|
||||
|
||||
spriteBatch.DrawString(GUI.Font, "Subsurface v"+Game1.Version, new Vector2(10, Game1.GraphicsHeight-20), Color.White);
|
||||
spriteBatch.DrawString(GUI.Font, "Subsurface v"+GameMain.Version, new Vector2(10, GameMain.GraphicsHeight-20), Color.White);
|
||||
|
||||
spriteBatch.End();
|
||||
}
|
||||
@@ -383,10 +383,10 @@ namespace Subsurface
|
||||
Submarine selectedSub = mapList.SelectedData as Submarine;
|
||||
if (selectedSub == null) return false;
|
||||
|
||||
Game1.GameSession = new GameSession(selectedSub, saveNameBox.Text, GameModePreset.list.Find(gm => gm.Name == "Single Player"));
|
||||
(Game1.GameSession.gameMode as SinglePlayerMode).GenerateMap(seedBox.Text);
|
||||
GameMain.GameSession = new GameSession(selectedSub, saveNameBox.Text, GameModePreset.list.Find(gm => gm.Name == "Single Player"));
|
||||
(GameMain.GameSession.gameMode as SinglePlayerMode).GenerateMap(seedBox.Text);
|
||||
|
||||
Game1.LobbyScreen.Select();
|
||||
GameMain.LobbyScreen.Select();
|
||||
|
||||
new GUIMessageBox("Welcome to Subsurface!", "Please note that the single player mode is very unfinished at the moment; "+
|
||||
"for example, the NPCs don't have an AI yet and there are only a couple of different quests to complete. The multiplayer "+
|
||||
@@ -420,7 +420,7 @@ namespace Subsurface
|
||||
}
|
||||
|
||||
|
||||
Game1.LobbyScreen.Select();
|
||||
GameMain.LobbyScreen.Select();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -105,8 +105,8 @@ namespace Subsurface
|
||||
|
||||
public NetLobbyScreen()
|
||||
{
|
||||
int width = Math.Min(Game1.GraphicsWidth - 80, 1500);
|
||||
int height = Math.Min(Game1.GraphicsHeight - 80, 800);
|
||||
int width = Math.Min(GameMain.GraphicsWidth - 80, 1500);
|
||||
int height = Math.Min(GameMain.GraphicsHeight - 80, 800);
|
||||
|
||||
Rectangle panelRect = new Rectangle(0,0,width,height);
|
||||
|
||||
@@ -232,7 +232,7 @@ namespace Subsurface
|
||||
|
||||
var serverName = new GUITextBox(new Rectangle(0, 0, 200, 20), null, null, Alignment.TopLeft, Alignment.TopLeft, GUI.Style, infoFrame);
|
||||
serverName.TextGetter = GetServerName;
|
||||
serverName.Enabled = Game1.Server != null;
|
||||
serverName.Enabled = GameMain.Server != null;
|
||||
serverName.OnTextChanged = ChangeServerName;
|
||||
|
||||
serverMessage = new GUITextBox(new Rectangle(0, 30, 360, 70), null, null, Alignment.TopLeft, Alignment.TopLeft, GUI.Style, infoFrame);
|
||||
@@ -248,50 +248,50 @@ namespace Subsurface
|
||||
|
||||
public override void Select()
|
||||
{
|
||||
Game1.LightManager.LosEnabled = false;
|
||||
GameMain.LightManager.LosEnabled = false;
|
||||
|
||||
//infoFrame.ClearChildren();
|
||||
|
||||
textBox.Select();
|
||||
|
||||
Character.Controlled = null;
|
||||
Game1.GameScreen.Cam.TargetPos = Vector2.Zero;
|
||||
GameMain.GameScreen.Cam.TargetPos = Vector2.Zero;
|
||||
|
||||
subList.Enabled = Game1.Server != null;
|
||||
modeList.Enabled = Game1.Server != null;
|
||||
durationBar.Enabled = Game1.Server != null;
|
||||
seedBox.Enabled = Game1.Server != null;
|
||||
serverMessage.Enabled = Game1.Server != null;
|
||||
ServerName = (Game1.Server==null) ? "Server" : Game1.Server.Name;
|
||||
subList.Enabled = GameMain.Server != null;
|
||||
modeList.Enabled = GameMain.Server != null;
|
||||
durationBar.Enabled = GameMain.Server != null;
|
||||
seedBox.Enabled = GameMain.Server != null;
|
||||
serverMessage.Enabled = GameMain.Server != null;
|
||||
ServerName = (GameMain.Server==null) ? "Server" : GameMain.Server.Name;
|
||||
|
||||
modeList.OnSelected += SelectMode;
|
||||
|
||||
infoFrame.RemoveChild(infoFrame.children.Find(c => c.UserData as string == "startButton"));
|
||||
|
||||
if (IsServer && Game1.Server != null)
|
||||
if (IsServer && GameMain.Server != null)
|
||||
{
|
||||
GUIButton startButton = new GUIButton(new Rectangle(0, 0, 200, 30), "Start", Alignment.BottomRight, GUI.Style, infoFrame);
|
||||
startButton.OnClicked = Game1.Server.StartGame;
|
||||
startButton.OnClicked = GameMain.Server.StartGame;
|
||||
startButton.UserData = "startButton";
|
||||
|
||||
//mapList.OnSelected = new GUIListBox.OnSelectedHandler(Game1.server.UpdateNetLobby);
|
||||
modeList.OnSelected += Game1.Server.UpdateNetLobby;
|
||||
durationBar.OnMoved = Game1.Server.UpdateNetLobby;
|
||||
modeList.OnSelected += GameMain.Server.UpdateNetLobby;
|
||||
durationBar.OnMoved = GameMain.Server.UpdateNetLobby;
|
||||
|
||||
if (subList.CountChildren > 0 && subList.Selected == null) subList.Select(-1);
|
||||
if (GameModePreset.list.Count > 0 && modeList.Selected == null) modeList.Select(-1);
|
||||
|
||||
if (infoFrame.children.Find(c => c.UserData as string == "playyourself") == null)
|
||||
{
|
||||
var playYourself = new GUITickBox(new Rectangle(0, -20, 20, 20), "Play yourself", Alignment.TopLeft, playerFrame);
|
||||
playYourself.Selected = Game1.Server.CharacterInfo != null;
|
||||
var playYourself = new GUITickBox(new Rectangle(-30, -30, 20, 20), "Play yourself", Alignment.TopLeft, playerFrame);
|
||||
playYourself.Selected = GameMain.Server.CharacterInfo != null;
|
||||
playYourself.OnSelected = TogglePlayYourself;
|
||||
playYourself.UserData = "playyourself";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdatePlayerFrame(Game1.Client.CharacterInfo);
|
||||
UpdatePlayerFrame(GameMain.Client.CharacterInfo);
|
||||
}
|
||||
|
||||
base.Select();
|
||||
@@ -303,10 +303,10 @@ namespace Subsurface
|
||||
{
|
||||
playerFrame.ClearChildren();
|
||||
|
||||
if (IsServer && Game1.Server != null)
|
||||
if (IsServer && GameMain.Server != null)
|
||||
{
|
||||
var playYourself = new GUITickBox(new Rectangle(0, -20, 20, 20), "Play yourself", Alignment.TopLeft, playerFrame);
|
||||
playYourself.Selected = Game1.Server.CharacterInfo != null;
|
||||
playYourself.Selected = GameMain.Server.CharacterInfo != null;
|
||||
playYourself.OnSelected = TogglePlayYourself;
|
||||
playYourself.UserData = "playyourself";
|
||||
}
|
||||
@@ -364,17 +364,17 @@ namespace Subsurface
|
||||
GUITickBox tickBox = obj as GUITickBox;
|
||||
if (tickBox.Selected)
|
||||
{
|
||||
Game1.Server.CharacterInfo = new CharacterInfo(Character.HumanConfigFile, Game1.Server.Name);
|
||||
UpdatePlayerFrame(Game1.Server.CharacterInfo);
|
||||
GameMain.Server.CharacterInfo = new CharacterInfo(Character.HumanConfigFile, GameMain.Server.Name);
|
||||
UpdatePlayerFrame(GameMain.Server.CharacterInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
playerFrame.ClearChildren();
|
||||
|
||||
if (IsServer && Game1.Server != null)
|
||||
if (IsServer && GameMain.Server != null)
|
||||
{
|
||||
Game1.Server.CharacterInfo = null;
|
||||
Game1.Server.Character = null;
|
||||
GameMain.Server.CharacterInfo = null;
|
||||
GameMain.Server.Character = null;
|
||||
|
||||
var playYourself = new GUITickBox(new Rectangle(0, -20, 20, 20), "Play yourself", Alignment.TopLeft, playerFrame);
|
||||
playYourself.OnSelected = TogglePlayYourself;
|
||||
@@ -385,7 +385,7 @@ namespace Subsurface
|
||||
|
||||
private bool SelectMap(GUIComponent component, object obj)
|
||||
{
|
||||
if (Game1.Server != null) Game1.Server.UpdateNetLobby(obj);
|
||||
if (GameMain.Server != null) GameMain.Server.UpdateNetLobby(obj);
|
||||
|
||||
Submarine sub = (Submarine)obj;
|
||||
|
||||
@@ -399,18 +399,18 @@ namespace Subsurface
|
||||
|
||||
public bool ChangeServerName(GUITextBox textBox, string text)
|
||||
{
|
||||
if (Game1.Server == null) return false;
|
||||
if (GameMain.Server == null) return false;
|
||||
ServerName = text;
|
||||
Game1.Server.UpdateNetLobby(null, null);
|
||||
GameMain.Server.UpdateNetLobby(null, null);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool UpdateServerMessage(GUITextBox textBox, string text)
|
||||
{
|
||||
if (Game1.Server == null) return false;
|
||||
if (GameMain.Server == null) return false;
|
||||
ServerMessage = text;
|
||||
Game1.Server.UpdateNetLobby(null, null);
|
||||
GameMain.Server.UpdateNetLobby(null, null);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -456,8 +456,8 @@ namespace Subsurface
|
||||
|
||||
pos += offset * 0.8f;
|
||||
|
||||
Game1.GameScreen.Cam.TargetPos = pos;
|
||||
Game1.GameScreen.Cam.MoveCamera((float)deltaTime);
|
||||
GameMain.GameScreen.Cam.TargetPos = pos;
|
||||
GameMain.GameScreen.Cam.MoveCamera((float)deltaTime);
|
||||
|
||||
menu.Update((float)deltaTime);
|
||||
|
||||
@@ -468,7 +468,7 @@ namespace Subsurface
|
||||
{
|
||||
graphics.Clear(Color.CornflowerBlue);
|
||||
|
||||
Game1.GameScreen.DrawMap(graphics, spriteBatch);
|
||||
GameMain.GameScreen.DrawMap(graphics, spriteBatch);
|
||||
|
||||
spriteBatch.Begin();
|
||||
|
||||
@@ -507,7 +507,7 @@ namespace Subsurface
|
||||
|
||||
public bool StartGame(object obj)
|
||||
{
|
||||
Game1.Server.StartGame(null, obj);
|
||||
GameMain.Server.StartGame(null, obj);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -515,7 +515,7 @@ namespace Subsurface
|
||||
{
|
||||
if (String.IsNullOrEmpty(message)) return false;
|
||||
|
||||
Game1.NetworkMember.SendChatMessage(Game1.NetworkMember.Name + ": " + message);
|
||||
GameMain.NetworkMember.SendChatMessage(GameMain.NetworkMember.Name + ": " + message);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -534,14 +534,14 @@ namespace Subsurface
|
||||
try
|
||||
{
|
||||
Gender gender = (Gender)obj;
|
||||
Game1.Client.CharacterInfo.Gender = gender;
|
||||
Game1.Client.SendCharacterData();
|
||||
GameMain.Client.CharacterInfo.Gender = gender;
|
||||
GameMain.Client.SendCharacterData();
|
||||
|
||||
//CreatePreviewCharacter();
|
||||
}
|
||||
catch {}
|
||||
|
||||
UpdatePreviewPlayer(Game1.Client.CharacterInfo);
|
||||
UpdatePreviewPlayer(GameMain.Client.CharacterInfo);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -570,7 +570,7 @@ namespace Subsurface
|
||||
//textBox.Text = LevelSeed;
|
||||
//textBox.Selected = false;
|
||||
|
||||
if (Game1.Server != null) Game1.Server.UpdateNetLobby(null);
|
||||
if (GameMain.Server != null) GameMain.Server.UpdateNetLobby(null);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -579,13 +579,13 @@ namespace Subsurface
|
||||
{
|
||||
if (string.IsNullOrEmpty(newName)) return false;
|
||||
|
||||
if (Game1.NetworkMember == null || Game1.NetworkMember.CharacterInfo == null) return true;
|
||||
if (GameMain.NetworkMember == null || GameMain.NetworkMember.CharacterInfo == null) return true;
|
||||
|
||||
Game1.NetworkMember.CharacterInfo.Name = newName;
|
||||
if (Game1.Client != null)
|
||||
GameMain.NetworkMember.CharacterInfo.Name = newName;
|
||||
if (GameMain.Client != null)
|
||||
{
|
||||
Game1.Client.Name = newName;
|
||||
Game1.Client.SendCharacterData();
|
||||
GameMain.Client.Name = newName;
|
||||
GameMain.Client.SendCharacterData();
|
||||
}
|
||||
|
||||
textBox.Text = newName;
|
||||
@@ -628,7 +628,7 @@ namespace Subsurface
|
||||
(listBox.children[i] as GUITextBlock).Text = (i+1) + ". " + (listBox.children[i].UserData as JobPrefab).Name;
|
||||
}
|
||||
|
||||
if (Game1.Client!=null) Game1.Client.SendCharacterData();
|
||||
if (GameMain.Client!=null) GameMain.Client.SendCharacterData();
|
||||
}
|
||||
|
||||
public bool TrySelectMap(string mapName, string md5Hash)
|
||||
|
||||
@@ -36,8 +36,8 @@ namespace Subsurface
|
||||
|
||||
public ServerListScreen()
|
||||
{
|
||||
int width = Math.Min(Game1.GraphicsWidth - 160, 1000);
|
||||
int height = Math.Min(Game1.GraphicsHeight - 160, 700);
|
||||
int width = Math.Min(GameMain.GraphicsWidth - 160, 1000);
|
||||
int height = Math.Min(GameMain.GraphicsHeight - 160, 700);
|
||||
|
||||
Rectangle panelRect = new Rectangle(0, 0, width, height);
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace Subsurface
|
||||
|
||||
GUIButton button = new GUIButton(new Rectangle(-20, -20, 100, 30), "Back", Alignment.TopLeft, GUI.Style, menu);
|
||||
button.UserData = 0;
|
||||
button.OnClicked = Game1.MainMenuScreen.SelectTab;
|
||||
button.OnClicked = GameMain.MainMenuScreen.SelectTab;
|
||||
|
||||
|
||||
refreshDisableTimer = DateTime.Now;
|
||||
@@ -302,8 +302,8 @@ namespace Subsurface
|
||||
selectedPassword = passwordBox.Text;
|
||||
}
|
||||
|
||||
Game1.NetworkMember = new GameClient(clientNameBox.Text);
|
||||
Game1.Client.ConnectToServer(ip, selectedPassword);
|
||||
GameMain.NetworkMember = new GameClient(clientNameBox.Text);
|
||||
GameMain.Client.ConnectToServer(ip, selectedPassword);
|
||||
|
||||
yield return CoroutineStatus.Success;
|
||||
}
|
||||
@@ -312,7 +312,7 @@ namespace Subsurface
|
||||
{
|
||||
graphics.Clear(Color.CornflowerBlue);
|
||||
|
||||
Game1.GameScreen.DrawMap(graphics, spriteBatch);
|
||||
GameMain.GameScreen.DrawMap(graphics, spriteBatch);
|
||||
|
||||
spriteBatch.Begin();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user