Replace mission GUI box text hack + If both teams die, they both lose

This commit is contained in:
juanjp600
2016-10-10 08:32:31 -03:00
parent b09eebc9c2
commit 0125ff0f5c
5 changed files with 9 additions and 15 deletions
@@ -164,15 +164,6 @@ namespace Barotrauma
foreach (Character character in Character.CharacterList) foreach (Character character in Character.CharacterList)
{ {
if (GameMain.NetworkMember != null && character == GameMain.NetworkMember.Character)
{
//ugly hack to switch the text in the mission popup to the team-specific description
if (GUIMessageBox.MessageBoxes.Count > 0 && GUIMessageBox.MessageBoxes.Peek().UserData as string == "missionstartmessage")
{
(GUIMessageBox.MessageBoxes.Peek() as GUIMessageBox).Text = Description;
}
}
if (character.TeamID == 1) if (character.TeamID == 1)
{ {
crews[0].Add(character); crews[0].Add(character);
@@ -209,7 +200,7 @@ namespace Barotrauma
} }
else else
{ {
if (subs[winner] != null && if (winner>=0 && subs[winner] != null &&
(winner == 0 && subs[winner].AtStartPosition) || (winner == 1 && subs[winner].AtEndPosition) && (winner == 0 && subs[winner].AtStartPosition) || (winner == 1 && subs[winner].AtEndPosition) &&
crews[winner].Any(c => !c.IsDead && c.Submarine == subs[winner])) crews[winner].Any(c => !c.IsDead && c.Submarine == subs[winner]))
{ {
@@ -220,6 +211,8 @@ namespace Barotrauma
if (teamDead[0] && teamDead[1]) if (teamDead[0] && teamDead[1])
{ {
GameMain.GameSession.CrewManager.WinningTeam = 0;
winner = -1;
if (GameMain.Server != null) GameMain.Server.EndGame(); if (GameMain.Server != null) GameMain.Server.EndGame();
} }
} }
@@ -75,6 +75,8 @@ namespace Barotrauma
isRunning = true; isRunning = true;
} }
public virtual void MsgBox() { }
public virtual void Update(float deltaTime) public virtual void Update(float deltaTime)
{ {
//if (!isRunning) return; //if (!isRunning) return;
@@ -29,10 +29,8 @@ namespace Barotrauma
mission = Mission.LoadRandom(locations, rand, param as string); mission = Mission.LoadRandom(locations, rand, param as string);
} }
public override void Start() public override void MsgBox()
{ {
base.Start();
if (mission == null) return; if (mission == null) return;
var missionMsg = new GUIMessageBox(mission.Name, mission.Description, 400, 400); var missionMsg = new GUIMessageBox(mission.Name, mission.Description, 400, 400);
@@ -170,6 +170,8 @@ namespace Barotrauma
TaskManager.StartShift(level); TaskManager.StartShift(level);
if (gameMode != null) gameMode.MsgBox();
GameMain.GameScreen.ColorFade(Color.Black, Color.TransparentBlack, 5.0f); GameMain.GameScreen.ColorFade(Color.Black, Color.TransparentBlack, 5.0f);
SoundPlayer.SwitchMusic(); SoundPlayer.SwitchMusic();
} }
@@ -951,7 +951,6 @@ namespace Barotrauma.Networking
teamClients[i].Character.TeamID = (byte)teamID; teamClients[i].Character.TeamID = (byte)teamID;
} }
//host plays in team 1
if (characterInfo != null && teamID == hostTeam) if (characterInfo != null && teamID == hostTeam)
{ {
myCharacter = Character.Create(characterInfo, assignedWayPoints[assignedWayPoints.Length - 1].WorldPosition, false, false); myCharacter = Character.Create(characterInfo, assignedWayPoints[assignedWayPoints.Length - 1].WorldPosition, false, false);