Round summary screen, GUIMessageBoxes disable other UI elements, renamed quests as missions

This commit is contained in:
Regalis11
2015-12-23 22:18:02 +02:00
parent c7e7b3909f
commit b2d5704f7e
22 changed files with 357 additions and 153 deletions

View File

@@ -22,7 +22,7 @@ namespace Barotrauma
private string endMessage;
public virtual Quest Quest
public virtual Mission Mission
{
get { return null; }
}

View File

@@ -48,7 +48,7 @@ namespace Barotrauma
+ "The rest of the crew will win if they reach the end of the level or kill the traitor "
+ "before the objective is completed.";
mode = new GameModePreset("Quest", typeof(QuestMode), false);
mode = new GameModePreset("Mission", typeof(MissionMode), false);
mode.Description = "The crew must work together to complete a specific task, such as retrieving "
+ "an alien artifact or killing a creature that's terrorizing nearby outposts. The game ends "
+ "when the task is completed or everyone in the crew has died.";

View File

@@ -6,19 +6,19 @@ using System.Text;
namespace Barotrauma
{
class QuestMode : GameMode
class MissionMode : GameMode
{
Quest quest;
Mission mission;
public override Quest Quest
public override Mission Mission
{
get
{
return quest;
return mission;
}
}
public QuestMode(GameModePreset preset)
public MissionMode(GameModePreset preset)
: base(preset)
{
Location[] locations = new Location[2];
@@ -29,14 +29,14 @@ namespace Barotrauma
{
locations[i] = Location.CreateRandom(new Vector2((float)rand.NextDouble() * 10000.0f, (float)rand.NextDouble() * 10000.0f));
}
quest = Quest.LoadRandom(locations, rand);
mission = Mission.LoadRandom(locations, rand);
}
public override void Start()
{
base.Start();
new GUIMessageBox(quest.Name, quest.Description, 400, 400);
new GUIMessageBox(mission.Name, mission.Description, 400, 400);
//quest.Start(Level.Loaded);
}

View File

@@ -18,6 +18,8 @@ namespace Barotrauma
private GUIButton endShiftButton;
public readonly CargoManager CargoManager;
private ShiftSummary shiftSummary;
public Map Map;
@@ -26,11 +28,11 @@ namespace Barotrauma
private bool savedOnStart;
public override Quest Quest
public override Mission Mission
{
get
{
return Map.SelectedConnection.Quest;
return Map.SelectedConnection.Mission;
}
}
@@ -115,6 +117,8 @@ namespace Barotrauma
endTimer = 5.0f;
CrewManager.StartShift();
shiftSummary = new ShiftSummary(GameMain.GameSession);
}
public bool TryHireCharacter(HireManager hireManager, CharacterInfo characterInfo)
@@ -192,41 +196,31 @@ namespace Barotrauma
//if (endMessage != "" || this.endMessage == null) this.endMessage = endMessage;
GUIFrame summaryFrame = shiftSummary.CreateSummaryFrame();
GUIMessageBox.MessageBoxes.Enqueue(summaryFrame);
var okButton = new GUIButton(new Rectangle(0,0,100,30), "Ok", Alignment.BottomRight, GUI.Style, summaryFrame.children[0]);
okButton.OnClicked = (GUIButton button, object obj) => { GUIMessageBox.MessageBoxes.Dequeue(); return true; };
StringBuilder sb = new StringBuilder();
List<Character> casualties = CrewManager.characters.FindAll(c => c.IsDead);
if (casualties.Count == CrewManager.characters.Count)
bool success = CrewManager.characters.Any(c => !c.IsDead);
if (success)
{
sb.Append("Your entire crew has died!");
var msgBox = new GUIMessageBox("", sb.ToString(), new string[] { "Load game", "Quit" });
msgBox.Buttons[0].OnClicked += GameMain.GameSession.LoadPrevious;
msgBox.Buttons[0].OnClicked += msgBox.Close;
msgBox.Buttons[1].OnClicked = GameMain.LobbyScreen.QuitToMainMenu;
msgBox.Buttons[1].OnClicked += msgBox.Close;
}
else
{
if (casualties.Any())
{
sb.Append("Casualties: \n");
foreach (Character c in casualties)
{
sb.Append(" - " + c.Info.Name + "\n");
}
}
else
{
sb.Append("No casualties!");
}
if (Submarine.Loaded.AtEndPosition)
{
Map.MoveToNextLocation();
}
SaveUtil.SaveGame(GameMain.GameSession.SaveFile);
}
else
{
var msgBox = new GUIMessageBox("Game over", "Your entire crew has died!", new string[] { "Load game", "Quit" });
msgBox.Buttons[0].OnClicked += GameMain.GameSession.LoadPrevious;
msgBox.Buttons[0].OnClicked += msgBox.Close;
msgBox.Buttons[1].OnClicked = GameMain.LobbyScreen.QuitToMainMenu;
msgBox.Buttons[1].OnClicked += msgBox.Close;
}
CrewManager.EndShift();