Started moving single player campaign logic to an abstract CampaignMode class to make it reusable in the eventual multiplayer campaign
This commit is contained in:
@@ -23,7 +23,7 @@ namespace Barotrauma
|
||||
private GUIListBox selectedItemList;
|
||||
private GUIListBox storeItemList;
|
||||
|
||||
private SinglePlayerMode gameMode;
|
||||
private SinglePlayerCampaign gameMode;
|
||||
|
||||
private GUIFrame previewFrame;
|
||||
|
||||
@@ -158,7 +158,7 @@ namespace Barotrauma
|
||||
{
|
||||
base.Select();
|
||||
|
||||
gameMode = GameMain.GameSession.gameMode as SinglePlayerMode;
|
||||
gameMode = GameMain.GameSession.GameMode as SinglePlayerCampaign;
|
||||
|
||||
UpdateCharacterLists();
|
||||
}
|
||||
@@ -237,7 +237,6 @@ namespace Barotrauma
|
||||
new GUITextBlock(new Rectangle(0, 100, 0, 20), "Reward: " + mission.Reward+" credits", "", locationPanel);
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 130, 0, 0), mission.Description, "", locationPanel, true);
|
||||
|
||||
}
|
||||
|
||||
startButton.Enabled = true;
|
||||
@@ -248,7 +247,7 @@ namespace Barotrauma
|
||||
private void UpdateCharacterLists()
|
||||
{
|
||||
characterList.ClearChildren();
|
||||
foreach (CharacterInfo c in CrewManager.characterInfos)
|
||||
foreach (CharacterInfo c in CrewManager.CharacterInfos)
|
||||
{
|
||||
c.CreateCharacterFrame(characterList, c.Name + " ("+c.Job.Name+") ", c);
|
||||
}
|
||||
@@ -298,7 +297,7 @@ namespace Barotrauma
|
||||
|
||||
CreateItemFrame(prefab, selectedItemList, selectedItemList.Rect.Width);
|
||||
|
||||
buyButton.Enabled = CrewManager.Money >= selectedItemCost;
|
||||
buyButton.Enabled = gameMode.Money >= selectedItemCost;
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -317,9 +316,9 @@ namespace Barotrauma
|
||||
{
|
||||
int cost = selectedItemCost;
|
||||
|
||||
if (CrewManager.Money < cost) return false;
|
||||
if (gameMode.Money < cost) return false;
|
||||
|
||||
CrewManager.Money -= cost;
|
||||
gameMode.Money -= cost;
|
||||
|
||||
for (int i = selectedItemList.children.Count-1; i>=0; i--)
|
||||
{
|
||||
@@ -363,7 +362,7 @@ namespace Barotrauma
|
||||
|
||||
public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch)
|
||||
{
|
||||
if (characterList.CountChildren != CrewManager.characterInfos.Count)
|
||||
if (characterList.CountChildren != CrewManager.CharacterInfos.Count)
|
||||
{
|
||||
UpdateCharacterLists();
|
||||
}
|
||||
@@ -457,7 +456,7 @@ namespace Barotrauma
|
||||
|
||||
private string GetMoney()
|
||||
{
|
||||
return "Money: " + ((GameMain.GameSession == null) ? "0" : string.Format(CultureInfo.InvariantCulture, "{0:N0}", CrewManager.Money)) + " credits";
|
||||
return "Money: " + ((GameMain.GameSession == null) ? "0" : string.Format(CultureInfo.InvariantCulture, "{0:N0}", gameMode.Money)) + " credits";
|
||||
}
|
||||
|
||||
private bool SelectCharacter(GUIComponent component, object selection)
|
||||
|
||||
@@ -508,8 +508,8 @@ namespace Barotrauma
|
||||
|
||||
GUI.Draw((float)deltaTime, spriteBatch, null);
|
||||
|
||||
GUI.Font.DrawString(spriteBatch, "Barotrauma v"+GameMain.Version, new Vector2(10, GameMain.GraphicsHeight-20), Color.White);
|
||||
|
||||
GUI.Font.DrawString(spriteBatch, "Barotrauma v" + GameMain.Version, new Vector2(10, GameMain.GraphicsHeight - 20), Color.White);
|
||||
|
||||
spriteBatch.End();
|
||||
}
|
||||
|
||||
@@ -542,15 +542,10 @@ namespace Barotrauma
|
||||
selectedSub = new Submarine(Path.Combine(SaveUtil.TempPath, selectedSub.Name + ".sub"), "");
|
||||
|
||||
GameMain.GameSession = new GameSession(selectedSub, saveNameBox.Text, GameModePreset.list.Find(gm => gm.Name == "Single Player"));
|
||||
(GameMain.GameSession.gameMode as SinglePlayerMode).GenerateMap(seedBox.Text);
|
||||
(GameMain.GameSession.GameMode as CampaignMode).GenerateMap(seedBox.Text);
|
||||
|
||||
GameMain.LobbyScreen.Select();
|
||||
|
||||
//new GUIMessageBox("Welcome to Barotrauma!", "Please note that the single player mode is very unfinished at the moment; "+
|
||||
//"for example, the NPCs don't have an AI yet and there are only a couple of different quests to complete. The multiplayer "+
|
||||
//"mode should be much more enjoyable to play at the moment, so my recommendation is to try out and get a hang of the game mechanics "+
|
||||
//"in the single player mode and then move on to multiplayer. Have fun!\n - Regalis, the main dev of Subsurface", 400, 350);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user