Unstable 0.17.5.0
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
@@ -44,5 +47,60 @@ namespace Barotrauma
|
||||
this.newGameContainer = newGameContainer;
|
||||
this.loadGameContainer = loadGameContainer;
|
||||
}
|
||||
|
||||
protected List<CampaignMode.SaveInfo> prevSaveFiles;
|
||||
protected GUIComponent CreateSaveElement(CampaignMode.SaveInfo saveInfo)
|
||||
{
|
||||
if (string.IsNullOrEmpty(saveInfo.FilePath))
|
||||
{
|
||||
DebugConsole.AddWarning("Error when updating campaign load menu: path to a save file was empty.\n" + Environment.StackTrace);
|
||||
return null;
|
||||
}
|
||||
|
||||
var saveFrame = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.1f), saveList.Content.RectTransform) { MinSize = new Point(0, 45) }, style: "ListBoxElement")
|
||||
{
|
||||
UserData = saveInfo.FilePath
|
||||
};
|
||||
|
||||
var nameText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.5f), saveFrame.RectTransform), Path.GetFileNameWithoutExtension(saveInfo.FilePath))
|
||||
{
|
||||
CanBeFocused = false
|
||||
};
|
||||
|
||||
if (saveInfo.EnabledContentPackageNames != null && saveInfo.EnabledContentPackageNames.Any())
|
||||
{
|
||||
if (!GameSession.IsCompatibleWithEnabledContentPackages(saveInfo.EnabledContentPackageNames, out LocalizedString errorMsg))
|
||||
{
|
||||
nameText.TextColor = GUIStyle.Red;
|
||||
saveFrame.ToolTip = string.Join("\n", errorMsg, TextManager.Get("campaignmode.contentpackagemismatchwarning"));
|
||||
}
|
||||
}
|
||||
|
||||
prevSaveFiles ??= new List<CampaignMode.SaveInfo>();
|
||||
prevSaveFiles.Add(saveInfo);
|
||||
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.5f), saveFrame.RectTransform, Anchor.BottomLeft),
|
||||
text: saveInfo.SubmarineName, font: GUIStyle.SmallFont)
|
||||
{
|
||||
CanBeFocused = false,
|
||||
UserData = saveInfo.FilePath
|
||||
};
|
||||
|
||||
|
||||
string saveTimeStr = string.Empty;
|
||||
if (saveInfo.SaveTime > 0)
|
||||
{
|
||||
DateTime time = ToolBox.Epoch.ToDateTime(saveInfo.SaveTime);
|
||||
saveTimeStr = time.ToString();
|
||||
}
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 1.0f), saveFrame.RectTransform),
|
||||
text: saveTimeStr, textAlignment: Alignment.Right, font: GUIStyle.SmallFont)
|
||||
{
|
||||
CanBeFocused = false,
|
||||
UserData = saveInfo.FilePath
|
||||
};
|
||||
|
||||
return saveFrame;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user