Faction Test 100.4.0.0

This commit is contained in:
Markus Isberg
2022-11-14 18:28:28 +02:00
parent 87426b68b2
commit c772b61fc1
412 changed files with 16984 additions and 5530 deletions
@@ -7,17 +7,13 @@ namespace Barotrauma
{
class CampaignEndScreen : Screen
{
private Video video;
private readonly CreditsPlayer creditsPlayer;
private readonly Camera cam;
public Action OnFinished;
private LocalizedString textOverlay;
private float textOverlayTimer;
private Vector2 textOverlaySize;
protected SlideshowPlayer slideshowPlayer;
public CampaignEndScreen()
{
@@ -42,13 +38,10 @@ namespace Barotrauma
public override void Select()
{
base.Select();
textOverlay = ToolBox.WrapText(TextManager.Get("campaignend1"), GameMain.GraphicsWidth / 3, GUIStyle.Font);
textOverlaySize = GUIStyle.Font.MeasureString(textOverlay);
textOverlayTimer = 0.0f;
video = Video.Load(GameMain.GraphicsDeviceManager.GraphicsDevice, GameMain.SoundManager, "Content/SplashScreens/Ending.webm");
video.Play();
if (SlideshowPrefab.Prefabs.TryGet("campaignending".ToIdentifier(), out var slideshow))
{
slideshowPlayer = new SlideshowPlayer(GUICanvas.Instance, slideshow);
}
creditsPlayer.Restart();
creditsPlayer.Visible = false;
SteamAchievementManager.UnlockAchievement("campaigncompleted".ToIdentifier(), unlockClients: true);
@@ -56,14 +49,13 @@ namespace Barotrauma
public override void Deselect()
{
video?.Dispose();
video = null;
GUI.HideCursor = false;
SoundPlayer.OverrideMusicType = Identifier.Empty;
}
public override void Update(double deltaTime)
{
slideshowPlayer?.UpdateManually((float)deltaTime);
if (creditsPlayer.Finished)
{
OnFinished?.Invoke();
@@ -73,46 +65,18 @@ namespace Barotrauma
public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch)
{
spriteBatch.Begin();
spriteBatch.Begin(SpriteSortMode.Deferred, null, GUI.SamplerState, null, GameMain.ScissorTestEnable);
graphics.Clear(Color.Black);
if (video.IsPlaying)
SoundPlayer.OverrideMusicType = "ending".ToIdentifier();
if (slideshowPlayer != null && !slideshowPlayer.Finished)
{
GUI.HideCursor = !GUI.PauseMenuOpen;
spriteBatch.Draw(video.GetTexture(), new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.White);
slideshowPlayer.DrawManually(spriteBatch);
}
else
{
SoundPlayer.OverrideMusicType = "ending".ToIdentifier();
float duration = 20.0f;
float creditsDelay = 3.0f;
if (textOverlayTimer < duration + creditsDelay)
{
float textAlpha;
float fadeInTime = 5.0f, fadeOutTime = 3.0f;
textOverlayTimer += (float)deltaTime;
if (textOverlayTimer < fadeInTime)
{
textAlpha = textOverlayTimer / fadeInTime;
}
else if (textOverlayTimer > duration - fadeOutTime)
{
textAlpha = Math.Min((duration - textOverlayTimer) / fadeOutTime, 1.0f);
}
else
{
textAlpha = 1.0f;
}
GUIStyle.Font.DrawString(spriteBatch, textOverlay, new Vector2(GameMain.GraphicsWidth, GameMain.GraphicsHeight) / 2 - textOverlaySize / 2, Color.White * textAlpha);
}
else
{
GUI.HideCursor = false;
creditsPlayer.Visible = true;
}
GUI.HideCursor = false;
creditsPlayer.Visible = true;
}
spriteBatch.End();
spriteBatch.Begin(SpriteSortMode.Deferred, null, GUI.SamplerState, null, GameMain.ScissorTestEnable);
GUI.Draw(cam, spriteBatch);
spriteBatch.End();
}