(f417b026f) Fetched: Changes for playing video tutorial from local branch

This commit is contained in:
Joonas Rikkonen
2019-03-27 20:45:14 +02:00
parent e65c669eaa
commit 3f82c9a2cb
125 changed files with 1317 additions and 3166 deletions
@@ -19,6 +19,8 @@ namespace Barotrauma.Tutorials
private List<TutorialSegment> segments;
private SpriteSheetPlayer spriteSheetPlayer;
private VideoPlayer videoPlayer;
private Steering navConsole;
private Reactor reactor;
private Sonar sonar;
@@ -29,7 +31,7 @@ namespace Barotrauma.Tutorials
private bool started = false;
private string playableContentPath;
private float tutorialTimer;
private float degrading2ActivationCountdown;
@@ -82,6 +84,7 @@ namespace Barotrauma.Tutorials
base.Initialize();
spriteSheetPlayer = new SpriteSheetPlayer();
videoPlayer = new VideoPlayer();
characterTimeOnSonar = new List<Pair<Character, float>>();
for (int i = 0; i < segments.Count; i++)
@@ -210,6 +213,8 @@ namespace Barotrauma.Tutorials
started = ContentRunning = Initialized = false;
spriteSheetPlayer.Remove();
spriteSheetPlayer = null;
videoPlayer.Remove();
videoPlayer = null;
characterTimeOnSonar = null;
}
@@ -220,6 +225,10 @@ namespace Barotrauma.Tutorials
{
spriteSheetPlayer.AddToGUIUpdateList();
}
if (videoPlayer != null)
{
videoPlayer.AddToGUIUpdateList();
}
}
public override void Update(float deltaTime)
@@ -325,7 +334,7 @@ namespace Barotrauma.Tutorials
foreach (Item item in Item.ItemList)
{
if (!item.Repairables.Any() || item.ConditionPercentage > 50) continue;
if (!item.Repairables.Any() || item.Condition > 50.0f) continue;
degradedEquipmentFound = true;
break;
}
@@ -461,10 +470,18 @@ namespace Barotrauma.Tutorials
case ContentTypes.None:
break;
case ContentTypes.Video:
spriteSheetPlayer.LoadContent(playableContentPath, activeSegment.Content, activeSegment.Name, true, true, CurrentSegmentStopCallback);
string fileName = activeSegment.Content.GetAttributeString("file", "");
if (fileName != "")
{
videoPlayer.LoadContent(playableContentPath + fileName, activeSegment.Content, activeSegment.Name, true, true, CurrentSegmentStopCallback);
}
else
{
spriteSheetPlayer.LoadContent(playableContentPath, activeSegment.Content, activeSegment.Name, true, true, CurrentSegmentStopCallback);
}
break;
case ContentTypes.Text:
infoBox = CreateInfoFrame(TextManager.Get(activeSegment.Name), TextManager.GetFormatted(activeSegment.Content.GetAttributeString("tag", ""), false, args),
infoBox = CreateInfoFrame(TextManager.Get(activeSegment.Name), TextManager.Get(activeSegment.Content.GetAttributeString("tag", ""), false, args),
activeSegment.Content.GetAttributeInt("width", 300),
activeSegment.Content.GetAttributeInt("height", 80),
activeSegment.Content.GetAttributeString("anchor", "Center"), true, CurrentSegmentStopCallback);