Option to choose mission type in mp
This commit is contained in:
@@ -50,7 +50,7 @@ namespace Barotrauma
|
||||
get { return preset; }
|
||||
}
|
||||
|
||||
public GameMode(GameModePreset preset)
|
||||
public GameMode(GameModePreset preset, object param)
|
||||
{
|
||||
this.preset = preset;
|
||||
}
|
||||
|
||||
@@ -19,19 +19,17 @@ namespace Barotrauma
|
||||
public GameModePreset(string name, Type type, bool isSinglePlayer = false)
|
||||
{
|
||||
this.Name = name;
|
||||
//Constructor = constructor;
|
||||
|
||||
|
||||
Constructor = type.GetConstructor(new Type[] { typeof(GameModePreset) });
|
||||
Constructor = type.GetConstructor(new Type[] { typeof(GameModePreset), typeof(object) });
|
||||
|
||||
IsSinglePlayer = isSinglePlayer;
|
||||
|
||||
list.Add(this);
|
||||
}
|
||||
|
||||
public GameMode Instantiate()
|
||||
public GameMode Instantiate(object param)
|
||||
{
|
||||
object[] lobject = new object[] { this };
|
||||
object[] lobject = new object[] { this, param };
|
||||
return (GameMode)Constructor.Invoke(lobject);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public MissionMode(GameModePreset preset)
|
||||
: base(preset)
|
||||
public MissionMode(GameModePreset preset, object param)
|
||||
: base(preset, param)
|
||||
{
|
||||
Location[] locations = new Location[2];
|
||||
|
||||
@@ -25,13 +25,16 @@ namespace Barotrauma
|
||||
{
|
||||
locations[i] = Location.CreateRandom(new Vector2((float)rand.NextDouble() * 10000.0f, (float)rand.NextDouble() * 10000.0f));
|
||||
}
|
||||
mission = Mission.LoadRandom(locations, rand);
|
||||
|
||||
mission = Mission.LoadRandom(locations, rand, param as string);
|
||||
}
|
||||
|
||||
public override void Start()
|
||||
{
|
||||
base.Start();
|
||||
|
||||
if (mission == null) return;
|
||||
|
||||
new GUIMessageBox(mission.Name, mission.Description, 400, 400);
|
||||
|
||||
Networking.GameServer.Log("Mission: " + mission.Name, Color.Cyan);
|
||||
|
||||
@@ -45,8 +45,8 @@ namespace Barotrauma
|
||||
get { return GameMain.GameSession.CrewManager; }
|
||||
}
|
||||
|
||||
public SinglePlayerMode(GameModePreset preset)
|
||||
: base(preset)
|
||||
public SinglePlayerMode(GameModePreset preset, object param)
|
||||
: base(preset, param)
|
||||
{
|
||||
|
||||
CargoManager = new CargoManager();
|
||||
@@ -79,7 +79,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
public SinglePlayerMode(XElement element)
|
||||
: this(GameModePreset.list.Find(gm => gm.Name == "Single Player"))
|
||||
: this(GameModePreset.list.Find(gm => gm.Name == "Single Player"), null)
|
||||
{
|
||||
string mapSeed = ToolBox.GetAttributeString(element, "mapseed", "a");
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@ namespace Barotrauma
|
||||
tutorialType.Initialize();
|
||||
}
|
||||
|
||||
public TutorialMode(GameModePreset preset)
|
||||
: base(preset)
|
||||
public TutorialMode(GameModePreset preset, object param)
|
||||
: base(preset, param)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace Barotrauma
|
||||
get { return shiftSummary; }
|
||||
}
|
||||
|
||||
public GameSession(Submarine submarine, string saveFile, GameModePreset gameModePreset = null)
|
||||
public GameSession(Submarine submarine, string saveFile, GameModePreset gameModePreset = null, string missionType="")
|
||||
{
|
||||
GameMain.GameSession = this;
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace Barotrauma
|
||||
infoButton = new GUIButton(new Rectangle(10, 10, 100, 20), "Info", GUI.Style, null);
|
||||
infoButton.OnClicked = ToggleInfoFrame;
|
||||
|
||||
if (gameModePreset!=null) gameMode = gameModePreset.Instantiate();
|
||||
if (gameModePreset!=null) gameMode = gameModePreset.Instantiate(missionType);
|
||||
this.submarine = submarine;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user