Merge remote-tracking branch 'barotrauma/master' into new-netcode

# Conflicts:
#	Subsurface/Source/Characters/Character.cs
#	Subsurface/Source/Items/Components/Machines/Steering.cs
#	Subsurface/Source/Map/Structure.cs
#	Subsurface/Source/Networking/GameClient.cs
#	Subsurface/Source/Networking/GameServer.cs
This commit is contained in:
juanjp600
2016-11-05 18:09:44 -03:00
42 changed files with 431 additions and 177 deletions

View File

@@ -13,6 +13,9 @@ namespace Barotrauma
public readonly GameMode gameMode;
//two locations used as the start and end in the MP mode
private Location[] dummyLocations;
private InfoFrameTab selectedTab;
private GUIButton infoButton;
private GUIFrame infoFrame;
@@ -50,7 +53,37 @@ namespace Barotrauma
return (mode == null) ? null : mode.Map;
}
}
public Location StartLocation
{
get
{
if (Map != null) return Map.CurrentLocation;
if (dummyLocations==null)
{
CreateDummyLocations();
}
return dummyLocations[0];
}
}
public Location EndLocation
{
get
{
if (Map != null) return Map.SelectedLocation;
if (dummyLocations == null)
{
CreateDummyLocations();
}
return dummyLocations[1];
}
}
public Submarine Submarine
{
get { return submarine; }
@@ -81,12 +114,10 @@ namespace Barotrauma
this.saveFile = saveFile;
//guiRoot = new GUIFrame(new Rectangle(0,0,GameMain.GraphicsWidth,GameMain.GraphicsWidth), Color.Transparent);
infoButton = new GUIButton(new Rectangle(10, 10, 100, 20), "Info", GUI.Style, null);
infoButton.OnClicked = ToggleInfoFrame;
if (gameModePreset!=null) gameMode = gameModePreset.Instantiate(missionType);
if (gameModePreset != null) gameMode = gameModePreset.Instantiate(missionType);
this.submarine = submarine;
}
@@ -109,6 +140,17 @@ namespace Barotrauma
}
}
private void CreateDummyLocations()
{
dummyLocations = new Location[2];
MTRandom rand = new MTRandom(ToolBox.StringToInt(GameMain.NetLobbyScreen.LevelSeed));
for (int i = 0; i < 2; i++)
{
dummyLocations[i] = Location.CreateRandom(new Vector2((float)rand.NextDouble() * 10000.0f, (float)rand.NextDouble() * 10000.0f));
}
}
public void StartShift(string levelSeed, bool loadSecondSub = true)
{
Level level = Level.CreateRandom(levelSeed);
@@ -166,8 +208,6 @@ namespace Barotrauma
if (gameMode!=null) gameMode.Start();
Items.Components.Radar.StartMarker = "Start";
Items.Components.Radar.EndMarker = "End";
if (gameMode.Mission != null) Mission.Start(Level.Loaded);
TaskManager.StartShift(level);