The content package a submarine was saved with is included in the submarine preview, added a warning when attempting to start a campaign using a sub with a mismatching content package
This commit is contained in:
@@ -123,7 +123,7 @@ namespace Barotrauma
|
||||
|
||||
if (PreviewImage == null)
|
||||
{
|
||||
var txtBlock = new GUITextBlock(new Rectangle(-10, 60, 256, 128), TextManager.Get("SubPreviewImageNotFound"), Color.Black * 0.5f, null, Alignment.Center, "", frame, true);
|
||||
var txtBlock = new GUITextBlock(new Rectangle(-20, 60, 256, 128), TextManager.Get("SubPreviewImageNotFound"), Color.Black * 0.5f, null, Alignment.Center, "", frame, true);
|
||||
txtBlock.OutlineColor = txtBlock.TextColor;
|
||||
}
|
||||
else
|
||||
@@ -135,16 +135,20 @@ namespace Barotrauma
|
||||
string dimensionsStr = realWorldDimensions == Vector2.Zero ?
|
||||
TextManager.Get("Unknown") :
|
||||
TextManager.Get("DimensionsFormat").Replace("[width]", ((int)(realWorldDimensions.X)).ToString()).Replace("[height]", ((int)(realWorldDimensions.Y)).ToString());
|
||||
|
||||
new GUITextBlock(new Rectangle(246, 60, 100, 20),
|
||||
TextManager.Get("ContentPackage") + ": " + (ContentPackage ?? "Unknown"),
|
||||
"", frame, GUI.SmallFont);
|
||||
|
||||
new GUITextBlock(new Rectangle(256, 60, 100, 20),
|
||||
new GUITextBlock(new Rectangle(246, 80, 100, 20),
|
||||
TextManager.Get("Dimensions") + ": " + dimensionsStr,
|
||||
"", frame, GUI.SmallFont);
|
||||
|
||||
new GUITextBlock(new Rectangle(256, 80, 100, 20),
|
||||
new GUITextBlock(new Rectangle(246, 100, 100, 20),
|
||||
TextManager.Get("RecommendedCrewSize") + ": " + (RecommendedCrewSizeMax == 0 ? TextManager.Get("Unknown") : RecommendedCrewSizeMin + " - " + RecommendedCrewSizeMax),
|
||||
"", frame, GUI.SmallFont);
|
||||
|
||||
new GUITextBlock(new Rectangle(256, 100, 100, 20),
|
||||
new GUITextBlock(new Rectangle(246, 120, 100, 20),
|
||||
TextManager.Get("RecommendedCrewExperience") + ": " + (string.IsNullOrEmpty(RecommendedCrewExperience) ? TextManager.Get("unknown") : RecommendedCrewExperience),
|
||||
"", frame, GUI.SmallFont);
|
||||
|
||||
|
||||
@@ -54,24 +54,46 @@ namespace Barotrauma
|
||||
saveNameBox.Flash(Color.Red);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Submarine selectedSub = subList.SelectedData as Submarine;
|
||||
if (selectedSub != null && selectedSub.HasTag(SubmarineTag.Shuttle))
|
||||
if (selectedSub == null) return false;
|
||||
|
||||
string savePath = SaveUtil.CreateSavePath(isMultiplayer ? SaveUtil.SaveType.Multiplayer : SaveUtil.SaveType.Singleplayer, saveNameBox.Text);
|
||||
if (selectedSub.HasTag(SubmarineTag.Shuttle) || GameMain.SelectedPackage.Name != selectedSub.ContentPackage)
|
||||
{
|
||||
var msgBox = new GUIMessageBox(TextManager.Get("ShuttleSelected"),
|
||||
TextManager.Get("ShuttleWarning"),
|
||||
new string[] { TextManager.Get("Yes"), TextManager.Get("No") });
|
||||
if (GameMain.SelectedPackage.Name != selectedSub.ContentPackage)
|
||||
{
|
||||
var msgBox = new GUIMessageBox(TextManager.Get("ContentPackageMismatch"),
|
||||
TextManager.Get("ContentPackageMismatchWarning")
|
||||
.Replace("[subcontentpackage]", selectedSub.ContentPackage)
|
||||
.Replace("[selectedcontentpackage]", GameMain.SelectedPackage.Name),
|
||||
new string[] { TextManager.Get("Yes"), TextManager.Get("No") });
|
||||
|
||||
string savePath = SaveUtil.CreateSavePath(isMultiplayer ? SaveUtil.SaveType.Multiplayer : SaveUtil.SaveType.Singleplayer, saveNameBox.Text);
|
||||
msgBox.Buttons[0].OnClicked = (button, obj) => { StartNewGame?.Invoke(selectedSub, savePath, seedBox.Text); return true; };
|
||||
msgBox.Buttons[0].OnClicked += msgBox.Close;
|
||||
msgBox.Buttons[0].OnClicked = msgBox.Close;
|
||||
msgBox.Buttons[0].OnClicked += (button, obj) =>
|
||||
{
|
||||
if (GUIMessageBox.MessageBoxes.Count == 0) StartNewGame?.Invoke(selectedSub, savePath, seedBox.Text);
|
||||
return true;
|
||||
};
|
||||
|
||||
msgBox.Buttons[1].OnClicked = msgBox.Close;
|
||||
return false;
|
||||
msgBox.Buttons[1].OnClicked = msgBox.Close;
|
||||
}
|
||||
|
||||
if (selectedSub.HasTag(SubmarineTag.Shuttle))
|
||||
{
|
||||
var msgBox = new GUIMessageBox(TextManager.Get("ShuttleSelected"),
|
||||
TextManager.Get("ShuttleWarning"),
|
||||
new string[] { TextManager.Get("Yes"), TextManager.Get("No") });
|
||||
|
||||
msgBox.Buttons[0].OnClicked = (button, obj) => { StartNewGame?.Invoke(selectedSub, savePath, seedBox.Text); return true; };
|
||||
msgBox.Buttons[0].OnClicked += msgBox.Close;
|
||||
|
||||
msgBox.Buttons[1].OnClicked = msgBox.Close;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string savePath = SaveUtil.CreateSavePath(isMultiplayer ? SaveUtil.SaveType.Multiplayer : SaveUtil.SaveType.Singleplayer, saveNameBox.Text);
|
||||
StartNewGame?.Invoke(selectedSub, savePath, seedBox.Text);
|
||||
}
|
||||
|
||||
|
||||
@@ -411,7 +411,7 @@ namespace Barotrauma
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
string savePath = nameBox.Text + ".sub";
|
||||
if (Submarine.MainSub != null)
|
||||
{
|
||||
@@ -422,6 +422,8 @@ namespace Barotrauma
|
||||
savePath = Path.Combine(Submarine.SavePath, savePath);
|
||||
}
|
||||
|
||||
Submarine.MainSub.ContentPackage = GameMain.Config.SelectedContentPackage.Name;
|
||||
|
||||
MemoryStream imgStream = new MemoryStream();
|
||||
CreateImage(256, 128, imgStream);
|
||||
|
||||
@@ -525,7 +527,6 @@ namespace Barotrauma
|
||||
crewSizeMin.MinValueInt = 1;
|
||||
crewSizeMin.MaxValueInt = 128;
|
||||
|
||||
|
||||
new GUITextBlock(new Rectangle(285, y, 10, 20), "-", "", Alignment.TopLeft, Alignment.Center, saveFrame);
|
||||
|
||||
var crewSizeMax = new GUINumberInput(new Rectangle(300, y, 50, 20), "", GUINumberInput.NumberType.Int, saveFrame);
|
||||
|
||||
@@ -129,6 +129,9 @@
|
||||
|
||||
<ShuttleSelected>Shuttle selected</ShuttleSelected>
|
||||
<ShuttleWarning>Most shuttles are not adequately equipped to deal with the dangers of the Europan depths. Are you sure you want to choose a shuttle as your vessel?</ShuttleWarning>
|
||||
|
||||
<ContentPackageMismatch>Mismatching content package</ContentPackageMismatch>
|
||||
<ContentPackageMismatchWarning>The selected submarine has been saved using the content package "[subcontentpackage]". The submarine may not be compatible with the currently selected content package "[selectedcontentpackage]". Are you sure you want to choose the submarine?</ContentPackageMismatchWarning>
|
||||
|
||||
<!-- Campaign menu -->
|
||||
<Map>Map</Map>
|
||||
|
||||
@@ -87,6 +87,8 @@ namespace Barotrauma
|
||||
|
||||
public int RecommendedCrewSizeMin = 1, RecommendedCrewSizeMax = 2;
|
||||
public string RecommendedCrewExperience;
|
||||
|
||||
public string ContentPackage;
|
||||
|
||||
//properties ----------------------------------------------------
|
||||
|
||||
@@ -284,6 +286,7 @@ namespace Barotrauma
|
||||
RecommendedCrewSizeMin = doc.Root.GetAttributeInt("recommendedcrewsizemin", 0);
|
||||
RecommendedCrewSizeMax = doc.Root.GetAttributeInt("recommendedcrewsizemax", 0);
|
||||
RecommendedCrewExperience = doc.Root.GetAttributeString("recommendedcrewexperience", "Unknown");
|
||||
ContentPackage = doc.Root.GetAttributeString("contentpackage", "Unknown");
|
||||
|
||||
#if CLIENT
|
||||
string previewImageData = doc.Root.GetAttributeString("previewimage", "");
|
||||
@@ -1198,6 +1201,7 @@ namespace Barotrauma
|
||||
element.Add(new XAttribute("recommendedcrewsizemin", RecommendedCrewSizeMin));
|
||||
element.Add(new XAttribute("recommendedcrewsizemax", RecommendedCrewSizeMax));
|
||||
element.Add(new XAttribute("recommendedcrewexperience", RecommendedCrewExperience ?? ""));
|
||||
element.Add(new XAttribute("contentpackage", ContentPackage ?? ""));
|
||||
|
||||
foreach (MapEntity e in MapEntity.mapEntityList)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user