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

View File

@@ -164,15 +164,6 @@ namespace Barotrauma
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)
{
crews[0].Add(character);
@@ -209,7 +200,7 @@ namespace Barotrauma
}
else
{
if (subs[winner] != null &&
if (winner>=0 && subs[winner] != null &&
(winner == 0 && subs[winner].AtStartPosition) || (winner == 1 && subs[winner].AtEndPosition) &&
crews[winner].Any(c => !c.IsDead && c.Submarine == subs[winner]))
{
@@ -220,6 +211,8 @@ namespace Barotrauma
if (teamDead[0] && teamDead[1])
{
GameMain.GameSession.CrewManager.WinningTeam = 0;
winner = -1;
if (GameMain.Server != null) GameMain.Server.EndGame();
}
}

View File

@@ -75,6 +75,8 @@ namespace Barotrauma
isRunning = true;
}
public virtual void MsgBox() { }
public virtual void Update(float deltaTime)
{
//if (!isRunning) return;

View File

@@ -29,10 +29,8 @@ namespace Barotrauma
mission = Mission.LoadRandom(locations, rand, param as string);
}
public override void Start()
public override void MsgBox()
{
base.Start();
if (mission == null) return;
var missionMsg = new GUIMessageBox(mission.Name, mission.Description, 400, 400);

View File

@@ -170,6 +170,8 @@ namespace Barotrauma
TaskManager.StartShift(level);
if (gameMode != null) gameMode.MsgBox();
GameMain.GameScreen.ColorFade(Color.Black, Color.TransparentBlack, 5.0f);
SoundPlayer.SwitchMusic();
}

View File

@@ -950,8 +950,7 @@ namespace Barotrauma.Networking
teamClients[i].Character.TeamID = (byte)teamID;
}
//host plays in team 1
if (characterInfo != null && teamID == hostTeam)
{
myCharacter = Character.Create(characterInfo, assignedWayPoints[assignedWayPoints.Length - 1].WorldPosition, false, false);