(f8525130a) Added: Objective tracking, UI changes.
This commit is contained in:
@@ -80,7 +80,6 @@
|
|||||||
<Compile Include="$(MSBuildThisFileDirectory)Source\GUI\ParamsEditor.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Source\GUI\ParamsEditor.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Source\GUI\RectTransform.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Source\GUI\RectTransform.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Source\GUI\ShapeExtensions.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Source\GUI\ShapeExtensions.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Source\GUI\SpriteSheetPlayer.cs" />
|
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Source\GUI\UISprite.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Source\GUI\UISprite.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Source\GUI\VideoPlayer.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Source\GUI\VideoPlayer.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Source\GUI\Widget.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Source\GUI\Widget.cs" />
|
||||||
|
|||||||
@@ -1296,6 +1296,195 @@ namespace Barotrauma
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
commands.Add(new Command("refreshrect", "Updates the dimensions of the selected items to match the ones defined in the prefab. Applied only in the subeditor.", (string[] args) =>
|
||||||
|
{
|
||||||
|
//TODO: maybe do this automatically during loading when possible?
|
||||||
|
if (Screen.Selected == GameMain.SubEditorScreen)
|
||||||
|
{
|
||||||
|
if (!MapEntity.SelectedAny)
|
||||||
|
{
|
||||||
|
ThrowError("You have to select item(s) first!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (var mapEntity in MapEntity.SelectedList)
|
||||||
|
{
|
||||||
|
if (mapEntity is Item item)
|
||||||
|
{
|
||||||
|
item.Rect = new Rectangle(item.Rect.X, item.Rect.Y,
|
||||||
|
(int)(item.Prefab.sprite.size.X * item.Prefab.Scale),
|
||||||
|
(int)(item.Prefab.sprite.size.Y * item.Prefab.Scale));
|
||||||
|
}
|
||||||
|
else if (mapEntity is Structure structure)
|
||||||
|
{
|
||||||
|
if (!structure.ResizeHorizontal)
|
||||||
|
{
|
||||||
|
structure.Rect = new Rectangle(structure.Rect.X, structure.Rect.Y,
|
||||||
|
(int)structure.Prefab.ScaledSize.X,
|
||||||
|
structure.Rect.Height);
|
||||||
|
}
|
||||||
|
if (!structure.ResizeVertical)
|
||||||
|
{
|
||||||
|
structure.Rect = new Rectangle(structure.Rect.X, structure.Rect.Y,
|
||||||
|
structure.Rect.Width,
|
||||||
|
(int)structure.Prefab.ScaledSize.Y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, isCheat: false));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
GameMain.Config.SaveNewPlayerConfig();
|
||||||
|
|
||||||
|
commands.Add(new Command("loadtexts", "loadtexts [sourcefile] [destinationfile]: Loads all lines of text from a given .txt file and inserts them sequientially into the elements of an xml file. If the file paths are omitted, EnglishVanilla.txt and EnglishVanilla.xml are used.", (string[] args) =>
|
||||||
|
{
|
||||||
|
string sourcePath = args.Length > 0 ? args[0] : "Content/Texts/EnglishVanilla.txt";
|
||||||
|
string destinationPath = args.Length > 1 ? args[1] : "Content/Texts/EnglishVanilla.xml";
|
||||||
|
|
||||||
|
string[] lines;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
lines = File.ReadAllLines(sourcePath);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
ThrowError("Reading the file \"" + sourcePath + "\" failed.", e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var doc = XMLExtensions.TryLoadXml(destinationPath);
|
||||||
|
int i = 0;
|
||||||
|
foreach (XElement element in doc.Root.Elements())
|
||||||
|
{
|
||||||
|
if (i >= lines.Length)
|
||||||
|
{
|
||||||
|
ThrowError("Error while loading texts to the xml file. The xml has more elements than the number of lines in the text file.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
element.Value = lines[i];
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
doc.Save(destinationPath);
|
||||||
|
},
|
||||||
|
() =>
|
||||||
|
{
|
||||||
|
var files = TextManager.GetTextFiles().Select(f => f.Replace("\\", "/"));
|
||||||
|
return new string[][]
|
||||||
|
{
|
||||||
|
files.Where(f => Path.GetExtension(f)==".txt").ToArray(),
|
||||||
|
files.Where(f => Path.GetExtension(f)==".xml").ToArray()
|
||||||
|
};
|
||||||
|
}));
|
||||||
|
|
||||||
|
commands.Add(new Command("updatetextfile", "updatetextfile [sourcefile] [destinationfile]: Inserts all the xml elements that are only present in the source file into the destination file. Can be used to update outdated translation files more easily.", (string[] args) =>
|
||||||
|
{
|
||||||
|
if (args.Length < 2) return;
|
||||||
|
string sourcePath = args[0];
|
||||||
|
string destinationPath = args[1];
|
||||||
|
|
||||||
|
var sourceDoc = XMLExtensions.TryLoadXml(sourcePath);
|
||||||
|
var destinationDoc = XMLExtensions.TryLoadXml(destinationPath);
|
||||||
|
|
||||||
|
XElement destinationElement = destinationDoc.Root.Elements().First();
|
||||||
|
foreach (XElement element in sourceDoc.Root.Elements())
|
||||||
|
{
|
||||||
|
if (destinationDoc.Root.Element(element.Name) == null)
|
||||||
|
{
|
||||||
|
element.Value = "!!!!!!!!!!!!!" + element.Value;
|
||||||
|
destinationElement.AddAfterSelf(element);
|
||||||
|
}
|
||||||
|
XNode nextNode = destinationElement.NextNode;
|
||||||
|
while ((!(nextNode is XElement) || nextNode == element) && nextNode != null) nextNode = nextNode.NextNode;
|
||||||
|
destinationElement = nextNode as XElement;
|
||||||
|
}
|
||||||
|
destinationDoc.Save(destinationPath);
|
||||||
|
},
|
||||||
|
() =>
|
||||||
|
{
|
||||||
|
var files = TextManager.GetTextFiles().Where(f => Path.GetExtension(f) == ".xml").Select(f => f.Replace("\\", "/")).ToArray();
|
||||||
|
return new string[][]
|
||||||
|
{
|
||||||
|
files,
|
||||||
|
files
|
||||||
|
};
|
||||||
|
}));
|
||||||
|
|
||||||
|
commands.Add(new Command("dumpentitytexts", "dumpentitytexts [filepath]: gets the names and descriptions of all entity prefabs and writes them into a file along with xml tags that can be used in translation files. If the filepath is omitted, the file is written to Content/Texts/EntityTexts.txt", (string[] args) =>
|
||||||
|
{
|
||||||
|
string filePath = args.Length > 0 ? args[0] : "Content/Texts/EntityTexts.txt";
|
||||||
|
List<string> lines = new List<string>();
|
||||||
|
foreach (MapEntityPrefab me in MapEntityPrefab.List)
|
||||||
|
{
|
||||||
|
lines.Add("<EntityName." + me.Identifier + ">" + me.Name + "</" + me.Identifier + ".Name>");
|
||||||
|
lines.Add("<EntityDescription." + me.Identifier + ">" + me.Description + "</" + me.Identifier + ".Description>");
|
||||||
|
}
|
||||||
|
File.WriteAllLines(filePath, lines);
|
||||||
|
}));
|
||||||
|
#if DEBUG
|
||||||
|
commands.Add(new Command("checkduplicates", "Checks the given language for duplicate translation keys and writes to file.", (string[] args) =>
|
||||||
|
{
|
||||||
|
if (args.Length != 1) return;
|
||||||
|
TextManager.CheckForDuplicates(args[0]);
|
||||||
|
}));
|
||||||
|
|
||||||
|
commands.Add(new Command("writetocsv", "Writes the default language (English) to a .csv file.", (string[] args) =>
|
||||||
|
{
|
||||||
|
TextManager.WriteToCSV();
|
||||||
|
NPCConversation.WriteToCSV();
|
||||||
|
}));
|
||||||
|
|
||||||
|
commands.Add(new Command("csvtoxml", "csvtoxml [language] -> Converts .csv localization files in Content/NPCConversations & Content/Texts to .xml for use in-game.", (string[] args) =>
|
||||||
|
{
|
||||||
|
if (args.Length == 0) return;
|
||||||
|
LocalizationCSVtoXML.Convert(args[0]);
|
||||||
|
}));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
commands.Add(new Command("cleanbuild", "", (string[] args) =>
|
||||||
|
{
|
||||||
|
GameMain.Config.MusicVolume = 0.5f;
|
||||||
|
GameMain.Config.SoundVolume = 0.5f;
|
||||||
|
NewMessage("Music and sound volume set to 0.5", Color.Green);
|
||||||
|
|
||||||
|
commands.Add(new Command("camerasettings", "camerasettings [defaultzoom] [zoomsmoothness] [movesmoothness] [minzoom] [maxzoom]: debug command for testing camera settings. The values default to 1.1, 8.0, 8.0, 0.1 and 2.0.", (string[] args) =>
|
||||||
|
{
|
||||||
|
float defaultZoom = Screen.Selected.Cam.DefaultZoom;
|
||||||
|
if (args.Length > 0) float.TryParse(args[0], NumberStyles.Number, CultureInfo.InvariantCulture, out defaultZoom);
|
||||||
|
|
||||||
|
float zoomSmoothness = Screen.Selected.Cam.ZoomSmoothness;
|
||||||
|
if (args.Length > 1) float.TryParse(args[1], NumberStyles.Number, CultureInfo.InvariantCulture, out zoomSmoothness);
|
||||||
|
float moveSmoothness = Screen.Selected.Cam.MoveSmoothness;
|
||||||
|
if (args.Length > 2) float.TryParse(args[2], NumberStyles.Number, CultureInfo.InvariantCulture, out moveSmoothness);
|
||||||
|
|
||||||
|
float minZoom = Screen.Selected.Cam.MinZoom;
|
||||||
|
if (args.Length > 3) float.TryParse(args[3], NumberStyles.Number, CultureInfo.InvariantCulture, out minZoom);
|
||||||
|
float maxZoom = Screen.Selected.Cam.MaxZoom;
|
||||||
|
if (args.Length > 4) float.TryParse(args[4], NumberStyles.Number, CultureInfo.InvariantCulture, out maxZoom);
|
||||||
|
|
||||||
|
Screen.Selected.Cam.DefaultZoom = defaultZoom;
|
||||||
|
Screen.Selected.Cam.ZoomSmoothness = zoomSmoothness;
|
||||||
|
Screen.Selected.Cam.MoveSmoothness = moveSmoothness;
|
||||||
|
Screen.Selected.Cam.MinZoom = minZoom;
|
||||||
|
Screen.Selected.Cam.MaxZoom = maxZoom;
|
||||||
|
}));
|
||||||
|
|
||||||
|
commands.Add(new Command("waterparams", "waterparams [distortionscalex] [distortionscaley] [distortionstrengthx] [distortionstrengthy] [bluramount]: default 0.5 0.5 0.5 0.5 1", (string[] args) =>
|
||||||
|
{
|
||||||
|
float distortScaleX = 0.5f, distortScaleY = 0.5f;
|
||||||
|
float distortStrengthX = 0.5f, distortStrengthY = 0.5f;
|
||||||
|
float blurAmount = 0.0f;
|
||||||
|
if (args.Length > 0) float.TryParse(args[0], NumberStyles.Number, CultureInfo.InvariantCulture, out distortScaleX);
|
||||||
|
if (args.Length > 1) float.TryParse(args[1], NumberStyles.Number, CultureInfo.InvariantCulture, out distortScaleY);
|
||||||
|
if (args.Length > 2) float.TryParse(args[2], NumberStyles.Number, CultureInfo.InvariantCulture, out distortStrengthX);
|
||||||
|
if (args.Length > 3) float.TryParse(args[3], NumberStyles.Number, CultureInfo.InvariantCulture, out distortStrengthY);
|
||||||
|
if (args.Length > 4) float.TryParse(args[4], NumberStyles.Number, CultureInfo.InvariantCulture, out blurAmount);
|
||||||
|
WaterRenderer.DistortionScale = new Vector2(distortScaleX, distortScaleY);
|
||||||
|
WaterRenderer.DistortionStrength = new Vector2(distortStrengthX, distortStrengthY);
|
||||||
|
WaterRenderer.BlurAmount = blurAmount;
|
||||||
|
}));
|
||||||
|
|
||||||
|
|
||||||
commands.Add(new Command("refreshrect", "Updates the dimensions of the selected items to match the ones defined in the prefab. Applied only in the subeditor.", (string[] args) =>
|
commands.Add(new Command("refreshrect", "Updates the dimensions of the selected items to match the ones defined in the prefab. Applied only in the subeditor.", (string[] args) =>
|
||||||
{
|
{
|
||||||
//TODO: maybe do this automatically during loading when possible?
|
//TODO: maybe do this automatically during loading when possible?
|
||||||
|
|||||||
@@ -50,6 +50,11 @@ namespace Barotrauma
|
|||||||
get; private set;
|
get; private set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Rectangle ObjectiveArea
|
||||||
|
{
|
||||||
|
get; private set;
|
||||||
|
}
|
||||||
|
|
||||||
public static Rectangle InventoryAreaLower
|
public static Rectangle InventoryAreaLower
|
||||||
{
|
{
|
||||||
get; private set;
|
get; private set;
|
||||||
@@ -156,6 +161,11 @@ namespace Barotrauma
|
|||||||
new Rectangle(Padding, CrewArea.Y, chatBoxWidth, chatBoxHeight) :
|
new Rectangle(Padding, CrewArea.Y, chatBoxWidth, chatBoxHeight) :
|
||||||
new Rectangle(GameMain.GraphicsWidth - Padding - chatBoxWidth, CrewArea.Y, chatBoxWidth, chatBoxHeight);
|
new Rectangle(GameMain.GraphicsWidth - Padding - chatBoxWidth, CrewArea.Y, chatBoxWidth, chatBoxHeight);
|
||||||
|
|
||||||
|
int objectiveAreaWidth = (int)(250 * GUI.Scale);
|
||||||
|
int objectiveAreaHeight = (int)(40 * GUI.Scale);
|
||||||
|
int objectiveAreaOffsetY = (int)(100 * GUI.Scale);
|
||||||
|
ObjectiveArea = new Rectangle(GameMain.GraphicsWidth - Padding - objectiveAreaWidth, CrewArea.Y + crewAreaHeight + objectiveAreaOffsetY, objectiveAreaWidth, objectiveAreaHeight);
|
||||||
|
|
||||||
int lowerAreaHeight = (int)Math.Min(GameMain.GraphicsHeight * 0.25f, 280);
|
int lowerAreaHeight = (int)Math.Min(GameMain.GraphicsHeight * 0.25f, 280);
|
||||||
InventoryAreaLower = new Rectangle(Padding, GameMain.GraphicsHeight - lowerAreaHeight, GameMain.GraphicsWidth - Padding * 2, lowerAreaHeight);
|
InventoryAreaLower = new Rectangle(Padding, GameMain.GraphicsHeight - lowerAreaHeight, GameMain.GraphicsWidth - Padding * 2, lowerAreaHeight);
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
videoView = new GUICustomComponent(new RectTransform(new Point(width, height), videoFrame.RectTransform, Anchor.Center),
|
videoView = new GUICustomComponent(new RectTransform(new Point(width, height), videoFrame.RectTransform, Anchor.Center),
|
||||||
(spriteBatch, guiCustomComponent) => { DrawVideo(spriteBatch, guiCustomComponent.Rect); });
|
(spriteBatch, guiCustomComponent) => { DrawVideo(spriteBatch, guiCustomComponent.Rect); });
|
||||||
title = new GUITextBlock(new RectTransform(Point.Zero, textFrame.RectTransform, Anchor.TopCenter, Pivot.TopLeft) { AbsoluteOffset = new Point(-225, 10) }, string.Empty, font: GUI.VideoTitleFont, textColor: new Color(253, 174, 0), textAlignment: Alignment.Left);
|
title = new GUITextBlock(new RectTransform(Point.Zero, textFrame.RectTransform, Anchor.TopLeft, Pivot.TopLeft) { AbsoluteOffset = new Point(0, 10) }, string.Empty, font: GUI.VideoTitleFont, textColor: new Color(253, 174, 0), textAlignment: Alignment.Left);
|
||||||
|
|
||||||
textContent = new GUITextBlock(new RectTransform(new Vector2(1f, .8f), textFrame.RectTransform, Anchor.TopCenter, Pivot.TopCenter) { AbsoluteOffset = new Point(0, borderSize / 2 + titleHeight) }, string.Empty, font: GUI.Font, textAlignment: Alignment.TopLeft);
|
textContent = new GUITextBlock(new RectTransform(new Vector2(1f, .8f), textFrame.RectTransform, Anchor.TopCenter, Pivot.TopCenter) { AbsoluteOffset = new Point(0, borderSize / 2 + titleHeight) }, string.Empty, font: GUI.Font, textAlignment: Alignment.TopLeft);
|
||||||
|
|
||||||
@@ -214,7 +214,7 @@ namespace Barotrauma
|
|||||||
title.Text = TextManager.Get(contentId);
|
title.Text = TextManager.Get(contentId);
|
||||||
title.RectTransform.NonScaledSize += new Point(textSettings.Width, titleHeight);
|
title.RectTransform.NonScaledSize += new Point(textSettings.Width, titleHeight);
|
||||||
|
|
||||||
if (textSettings.Text != string.Empty)
|
if (!string.IsNullOrEmpty(textSettings.Text))
|
||||||
{
|
{
|
||||||
textSettings.Text = ToolBox.WrapText(textSettings.Text, textSettings.Width, GUI.Font);
|
textSettings.Text = ToolBox.WrapText(textSettings.Text, textSettings.Width, GUI.Font);
|
||||||
int wrappedHeight = textSettings.Text.Split('\n').Length * textHeight;
|
int wrappedHeight = textSettings.Text.Split('\n').Length * textHeight;
|
||||||
|
|||||||
+99
-25
@@ -4,6 +4,7 @@ using System;
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Barotrauma.Items.Components;
|
using Barotrauma.Items.Components;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
|
||||||
namespace Barotrauma.Tutorials
|
namespace Barotrauma.Tutorials
|
||||||
{
|
{
|
||||||
@@ -18,7 +19,6 @@ namespace Barotrauma.Tutorials
|
|||||||
private TutorialSegment activeSegment;
|
private TutorialSegment activeSegment;
|
||||||
private List<TutorialSegment> segments;
|
private List<TutorialSegment> segments;
|
||||||
|
|
||||||
private SpriteSheetPlayer spriteSheetPlayer;
|
|
||||||
private VideoPlayer videoPlayer;
|
private VideoPlayer videoPlayer;
|
||||||
|
|
||||||
private Steering navConsole;
|
private Steering navConsole;
|
||||||
@@ -37,6 +37,11 @@ namespace Barotrauma.Tutorials
|
|||||||
|
|
||||||
private bool disableTutorialOnDeficiencyFound = true;
|
private bool disableTutorialOnDeficiencyFound = true;
|
||||||
|
|
||||||
|
private GUIFrame holderFrame, objectiveFrame;
|
||||||
|
private bool objectivesOpen = false;
|
||||||
|
private GUITextBlock objectiveTitle, objectiveText;
|
||||||
|
private List<TutorialSegment> activeObjectives = new List<TutorialSegment>();
|
||||||
|
|
||||||
private class TutorialSegment
|
private class TutorialSegment
|
||||||
{
|
{
|
||||||
public string Id;
|
public string Id;
|
||||||
@@ -87,7 +92,6 @@ namespace Barotrauma.Tutorials
|
|||||||
Initialized = true;
|
Initialized = true;
|
||||||
|
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
spriteSheetPlayer = new SpriteSheetPlayer();
|
|
||||||
videoPlayer = new VideoPlayer();
|
videoPlayer = new VideoPlayer();
|
||||||
characterTimeOnSonar = new List<Pair<Character, float>>();
|
characterTimeOnSonar = new List<Pair<Character, float>>();
|
||||||
|
|
||||||
@@ -118,14 +122,13 @@ namespace Barotrauma.Tutorials
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PreloadVideoContent()
|
private void PreloadVideoContent() // Have to see if needed with videos
|
||||||
{
|
{
|
||||||
return;
|
/*for (int i = 0; i < segments.Count; i++)
|
||||||
for (int i = 0; i < segments.Count; i++)
|
|
||||||
{
|
{
|
||||||
if (segments[i].ContentType != ContentTypes.Video || segments[i].IsTriggered) continue;
|
if (segments[i].ContentType != ContentTypes.Video || segments[i].IsTriggered) continue;
|
||||||
spriteSheetPlayer.PreloadContent(playableContentPath, "tutorial", segments[i].Id, segments[i].VideoContent);
|
spriteSheetPlayer.PreloadContent(playableContentPath, "tutorial", segments[i].Id, segments[i].VideoContent);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SavePartiallyComplete(XElement element)
|
public void SavePartiallyComplete(XElement element)
|
||||||
@@ -216,8 +219,6 @@ namespace Barotrauma.Tutorials
|
|||||||
public void Stop()
|
public void Stop()
|
||||||
{
|
{
|
||||||
started = ContentRunning = Initialized = false;
|
started = ContentRunning = Initialized = false;
|
||||||
spriteSheetPlayer.Remove();
|
|
||||||
spriteSheetPlayer = null;
|
|
||||||
videoPlayer.Remove();
|
videoPlayer.Remove();
|
||||||
videoPlayer = null;
|
videoPlayer = null;
|
||||||
characterTimeOnSonar = null;
|
characterTimeOnSonar = null;
|
||||||
@@ -226,14 +227,14 @@ namespace Barotrauma.Tutorials
|
|||||||
public override void AddToGUIUpdateList()
|
public override void AddToGUIUpdateList()
|
||||||
{
|
{
|
||||||
base.AddToGUIUpdateList();
|
base.AddToGUIUpdateList();
|
||||||
if (spriteSheetPlayer != null)
|
|
||||||
{
|
|
||||||
spriteSheetPlayer.AddToGUIUpdateList();
|
|
||||||
}
|
|
||||||
if (videoPlayer != null)
|
if (videoPlayer != null)
|
||||||
{
|
{
|
||||||
videoPlayer.AddToGUIUpdateList();
|
videoPlayer.AddToGUIUpdateList();
|
||||||
}
|
}
|
||||||
|
if (objectiveFrame != null && activeObjectives.Count > 0)
|
||||||
|
{
|
||||||
|
objectiveFrame.AddToGUIUpdateList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update(float deltaTime)
|
public override void Update(float deltaTime)
|
||||||
@@ -250,10 +251,25 @@ namespace Barotrauma.Tutorials
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < activeObjectives.Count; i++)
|
||||||
|
{
|
||||||
|
CheckActiveObjectives(activeObjectives[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CurrentSegmentStopCallback()
|
private void CurrentSegmentStopCallback()
|
||||||
{
|
{
|
||||||
|
if (!string.IsNullOrEmpty(activeSegment.Objective))
|
||||||
|
{
|
||||||
|
if (objectiveFrame == null)
|
||||||
|
{
|
||||||
|
CreateObjectiveFrame();
|
||||||
|
}
|
||||||
|
|
||||||
|
objectiveText.Text = activeSegment.Objective;
|
||||||
|
}
|
||||||
|
|
||||||
activeSegment = null;
|
activeSegment = null;
|
||||||
ContentRunning = false;
|
ContentRunning = false;
|
||||||
}
|
}
|
||||||
@@ -305,7 +321,9 @@ namespace Barotrauma.Tutorials
|
|||||||
|
|
||||||
tutorialTimer = 30.5f;
|
tutorialTimer = 30.5f;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
TriggerTutorialSegment(index, GameMain.GameSession.EndLocation.Name);
|
||||||
|
return true;
|
||||||
case 3: // Objective: Travel ~150 meters and while sub is not flooding [Text]
|
case 3: // Objective: Travel ~150 meters and while sub is not flooding [Text]
|
||||||
if (Vector2.Distance(subStartingPosition, Submarine.MainSub.WorldPosition) < 12000f || IsFlooding())
|
if (Vector2.Distance(subStartingPosition, Submarine.MainSub.WorldPosition) < 12000f || IsFlooding())
|
||||||
{
|
{
|
||||||
@@ -382,7 +400,9 @@ namespace Barotrauma.Tutorials
|
|||||||
if (member.Vitality < member.MaxVitality && !member.IsDead)
|
if (member.Vitality < member.MaxVitality && !member.IsDead)
|
||||||
{
|
{
|
||||||
injuredFound = true;
|
injuredFound = true;
|
||||||
break;
|
TriggerTutorialSegment(index, new string[] { member.DisplayName,
|
||||||
|
(member.Info.Gender == Gender.Male) ? TextManager.Get("PronounPossessiveMale").ToLower() : TextManager.Get("PronounPossessiveFemale").ToLower() });
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -393,7 +413,11 @@ namespace Barotrauma.Tutorials
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
else
|
||||||
|
{
|
||||||
|
TriggerTutorialSegment(index, GameMain.GameSession.EndLocation.Name);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
case 11: // Approach2: Sub is docked [Text]
|
case 11: // Approach2: Sub is docked [Text]
|
||||||
if (!Submarine.MainSub.AtEndPosition || Submarine.MainSub.DockedTo.Count == 0)
|
if (!Submarine.MainSub.AtEndPosition || Submarine.MainSub.DockedTo.Count == 0)
|
||||||
{
|
{
|
||||||
@@ -406,6 +430,29 @@ namespace Barotrauma.Tutorials
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CheckActiveObjectives(TutorialSegment objective)
|
||||||
|
{
|
||||||
|
switch(objective.Id)
|
||||||
|
{
|
||||||
|
case "ReactorCommand": // Reactor up and running
|
||||||
|
|
||||||
|
break;
|
||||||
|
case "NavConsole": // traveled 100 meters
|
||||||
|
|
||||||
|
break;
|
||||||
|
case "Flood": // Hull breaches repaired
|
||||||
|
break;
|
||||||
|
case "EnemyOnSonar":
|
||||||
|
break;
|
||||||
|
case "Degrading2":
|
||||||
|
break;
|
||||||
|
case "Approach1":
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
activeObjectives.Remove(objective);
|
||||||
|
}
|
||||||
|
|
||||||
private bool HasOrder(string aiTag)
|
private bool HasOrder(string aiTag)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < crew.Count; i++)
|
for (int i = 0; i < crew.Count; i++)
|
||||||
@@ -471,22 +518,29 @@ namespace Barotrauma.Tutorials
|
|||||||
activeSegment.IsTriggered = true;
|
activeSegment.IsTriggered = true;
|
||||||
|
|
||||||
string tutorialText = TextManager.GetFormatted(activeSegment.TextContent.GetAttributeString("tag", ""), true, args);
|
string tutorialText = TextManager.GetFormatted(activeSegment.TextContent.GetAttributeString("tag", ""), true, args);
|
||||||
|
string objectiveText = string.Empty;
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(activeSegment.Objective))
|
||||||
|
{
|
||||||
|
if (args.Length == 0)
|
||||||
|
{
|
||||||
|
objectiveText = activeSegment.Objective;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
objectiveText = string.Format(activeSegment.Objective, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
activeObjectives.Add(activeSegment);
|
||||||
|
}
|
||||||
|
|
||||||
switch (activeSegment.ContentType)
|
switch (activeSegment.ContentType)
|
||||||
{
|
{
|
||||||
case ContentTypes.None:
|
case ContentTypes.None:
|
||||||
break;
|
break;
|
||||||
case ContentTypes.Video:
|
case ContentTypes.Video:
|
||||||
string fileName = activeSegment.VideoContent.GetAttributeString("file", "");
|
string fileName = "1_CommandReactor/command_reactor_video.mp4";
|
||||||
if (fileName != "")
|
videoPlayer.LoadContentWithObjective(playableContentPath + fileName, new VideoPlayer.VideoSettings(activeSegment.VideoContent), new VideoPlayer.TextSettings(activeSegment.TextContent, args), activeSegment.Id, true, objectiveText, CurrentSegmentStopCallback);
|
||||||
{
|
|
||||||
videoPlayer.LoadContentWithObjective(playableContentPath + fileName, new VideoPlayer.VideoSettings(activeSegment.VideoContent), new VideoPlayer.TextSettings(activeSegment.TextContent, args), activeSegment.Id, true, activeSegment.Objective, CurrentSegmentStopCallback);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
spriteSheetPlayer.LoadContent(playableContentPath, activeSegment.VideoContent, activeSegment.Id, true, true, CurrentSegmentStopCallback);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case ContentTypes.TextOnly:
|
case ContentTypes.TextOnly:
|
||||||
infoBox = CreateInfoFrame(TextManager.Get(activeSegment.Id), tutorialText,
|
infoBox = CreateInfoFrame(TextManager.Get(activeSegment.Id), tutorialText,
|
||||||
@@ -504,6 +558,26 @@ namespace Barotrauma.Tutorials
|
|||||||
CoroutineManager.StartCoroutine(WaitToStop()); // Completed
|
CoroutineManager.StartCoroutine(WaitToStop()); // Completed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CreateObjectiveFrame()
|
||||||
|
{
|
||||||
|
holderFrame = new GUIFrame(new RectTransform(new Point(GameMain.GraphicsWidth, GameMain.GraphicsHeight), GUI.Canvas, Anchor.Center));
|
||||||
|
objectiveFrame = new GUIFrame(HUDLayoutSettings.ToRectTransform(HUDLayoutSettings.ObjectiveArea, holderFrame.RectTransform), style: null);
|
||||||
|
objectiveTitle = new GUITextBlock(new RectTransform(new Vector2(0.8f, 0.3f), objectiveFrame.RectTransform, Anchor.TopCenter, Pivot.TopCenter), TextManager.Get("Objective"), textColor: Color.White, font: GUI.ObjectiveTitleFont, textAlignment: Alignment.BottomRight);
|
||||||
|
objectiveText = new GUITextBlock(new RectTransform(new Vector2(0.8f, 0.7f), objectiveFrame.RectTransform, Anchor.BottomCenter, Pivot.BottomCenter), "Repair Hull Breach", textColor: new Color(4, 180, 108), font: GUI.ObjectiveNameFont, textAlignment: Alignment.TopRight);
|
||||||
|
|
||||||
|
int toggleButtonWidth = (int)(30 * GUI.Scale);
|
||||||
|
var toggleButton = new GUIButton(new RectTransform(new Point(toggleButtonWidth, HUDLayoutSettings.ObjectiveArea.Height), objectiveFrame.RectTransform, Anchor.CenterRight) { AbsoluteOffset = new Point(0, -5) }, style: "UIToggleButton");
|
||||||
|
toggleButton.OnClicked += (GUIButton btn, object userdata) =>
|
||||||
|
{
|
||||||
|
objectivesOpen = !objectivesOpen;
|
||||||
|
foreach (GUIComponent child in btn.Children)
|
||||||
|
{
|
||||||
|
child.SpriteEffects = objectivesOpen ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
private IEnumerable<object> WaitToStop()
|
private IEnumerable<object> WaitToStop()
|
||||||
{
|
{
|
||||||
while (ContentRunning) yield return null;
|
while (ContentRunning) yield return null;
|
||||||
|
|||||||
@@ -1383,6 +1383,9 @@ namespace Barotrauma.Networking
|
|||||||
case ServerNetObject.CLIENT_LIST:
|
case ServerNetObject.CLIENT_LIST:
|
||||||
ReadClientList(inc);
|
ReadClientList(inc);
|
||||||
break;
|
break;
|
||||||
|
case ServerNetObject.CLIENT_LIST:
|
||||||
|
ReadClientList(inc);
|
||||||
|
break;
|
||||||
case ServerNetObject.CHAT_MESSAGE:
|
case ServerNetObject.CHAT_MESSAGE:
|
||||||
ChatMessage.ClientRead(inc);
|
ChatMessage.ClientRead(inc);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1197,32 +1197,6 @@ namespace Barotrauma
|
|||||||
return (int)Math.Ceiling(ConvertUnits.ToDisplayUnits(colliderSize) / Structure.WallSectionSize);
|
return (int)Math.Ceiling(ConvertUnits.ToDisplayUnits(colliderSize) / Structure.WallSectionSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
protected override void OnStateChanged(AIState from, AIState to)
|
|
||||||
{
|
|
||||||
latchOntoAI?.DeattachFromBody();
|
|
||||||
Character.AnimController.ReleaseStuckLimbs();
|
|
||||||
}
|
|
||||||
|
|
||||||
private int GetMinimumPassableHoleCount()
|
|
||||||
{
|
|
||||||
return (int)Math.Ceiling(ConvertUnits.ToDisplayUnits(colliderSize) / Structure.WallSectionSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
protected override void OnStateChanged(AIState from, AIState to)
|
|
||||||
{
|
|
||||||
latchOntoAI?.DeattachFromBody();
|
|
||||||
Character.AnimController.ReleaseStuckLimbs();
|
|
||||||
}
|
|
||||||
|
|
||||||
private int GetMinimumPassableHoleCount()
|
|
||||||
{
|
|
||||||
return (int)Math.Ceiling(ConvertUnits.ToDisplayUnits(colliderSize) / Structure.WallSectionSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool CanPassThroughHole(Structure wall, int sectionIndex)
|
private bool CanPassThroughHole(Structure wall, int sectionIndex)
|
||||||
{
|
{
|
||||||
int requiredHoleCount = GetMinimumPassableHoleCount();
|
int requiredHoleCount = GetMinimumPassableHoleCount();
|
||||||
|
|||||||
@@ -1047,6 +1047,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
CheckValidity();
|
CheckValidity();
|
||||||
|
|
||||||
|
CheckValidity();
|
||||||
|
|
||||||
UpdateNetPlayerPosition(deltaTime);
|
UpdateNetPlayerPosition(deltaTime);
|
||||||
CheckDistFromCollider();
|
CheckDistFromCollider();
|
||||||
UpdateCollisionCategories();
|
UpdateCollisionCategories();
|
||||||
|
|||||||
@@ -201,6 +201,9 @@ namespace Barotrauma
|
|||||||
Hull hull = Hull.FindHull(ConvertUnits.ToDisplayUnits(explosionPos), null, false);
|
Hull hull = Hull.FindHull(ConvertUnits.ToDisplayUnits(explosionPos), null, false);
|
||||||
bool underWater = hull == null || explosionPos.Y < hull.Surface;
|
bool underWater = hull == null || explosionPos.Y < hull.Surface;
|
||||||
|
|
||||||
|
Hull hull = Hull.FindHull(ConvertUnits.ToDisplayUnits(explosionPos), null, false);
|
||||||
|
bool underWater = hull == null || explosionPos.Y < hull.Surface;
|
||||||
|
|
||||||
explosionPos = ConvertUnits.ToSimUnits(explosionPos);
|
explosionPos = ConvertUnits.ToSimUnits(explosionPos);
|
||||||
|
|
||||||
Dictionary<Limb, float> distFactors = new Dictionary<Limb, float>();
|
Dictionary<Limb, float> distFactors = new Dictionary<Limb, float>();
|
||||||
|
|||||||
@@ -108,6 +108,18 @@ namespace Barotrauma
|
|||||||
private set;
|
private set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Vector2 LinearVelocity
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
private set;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float AngularVelocity
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
private set;
|
||||||
|
}
|
||||||
|
|
||||||
public readonly float Timestamp;
|
public readonly float Timestamp;
|
||||||
public readonly UInt16 ID;
|
public readonly UInt16 ID;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user