Merge branch 'master' into new-netcode

Conflicts:
	Subsurface/Source/Characters/Character.cs
	Subsurface/Source/GUI/GUI.cs
	Subsurface/Source/GUI/LoadingScreen.cs
This commit is contained in:
Regalis
2017-02-13 22:04:28 +02:00
17 changed files with 137 additions and 17 deletions
+5 -2
View File
@@ -64,6 +64,8 @@ namespace Barotrauma
get { return arrow; }
}
public static bool DisableHUD;
public static void Init(ContentManager content)
{
Font = ToolBox.TryLoadFont("SpriteFont1", content);
@@ -497,8 +499,9 @@ namespace Barotrauma
DebugConsole.Draw(spriteBatch);
if (GUIComponent.MouseOn != null && !string.IsNullOrWhiteSpace(GUIComponent.MouseOn.ToolTip)) GUIComponent.MouseOn.DrawToolTip(spriteBatch);
cursor.Draw(spriteBatch, PlayerInput.LatestMousePosition);
if (!GUI.DisableHUD)
cursor.Draw(spriteBatch, PlayerInput.LatestMousePosition);
}
public static void AddToGUIUpdateList()
+65 -5
View File
@@ -1,6 +1,7 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -23,6 +24,9 @@ namespace Barotrauma
private float? loadState;
Video splashScreenVideo;
VideoPlayer videoPlayer;
public Vector2 TitleSize
{
get { return new Vector2(titleTexture.Width, titleTexture.Height); }
@@ -49,10 +53,23 @@ namespace Barotrauma
get;
set;
}
public LoadingScreen(GraphicsDevice graphics)
{
if (GameMain.Config.EnableSplashScreen)
{
try
{
splashScreenVideo = GameMain.Instance.Content.Load<Video>("utg_4");
}
catch (Exception e)
{
DebugConsole.ThrowError("Failed to load splashscreen", e);
GameMain.Config.EnableSplashScreen = false;
}
}
backgroundTexture = TextureLoader.FromFile("Content/UI/titleBackground.png");
monsterTexture = TextureLoader.FromFile("Content/UI/titleMonster.png");
titleTexture = TextureLoader.FromFile("Content/UI/titleText.png");
@@ -65,6 +82,21 @@ namespace Barotrauma
public void Draw(SpriteBatch spriteBatch, GraphicsDevice graphics, float deltaTime)
{
if (GameMain.Config.EnableSplashScreen && splashScreenVideo != null)
{
try
{
DrawSplashScreen(spriteBatch);
if (videoPlayer != null && videoPlayer.State == MediaState.Playing)
return;
}
catch (Exception e)
{
DebugConsole.ThrowError("Playing splash screen video failed", e);
GameMain.Config.EnableSplashScreen = false;
}
}
drawn = true;
graphics.SetRenderTarget(renderTarget);
@@ -139,14 +171,42 @@ namespace Barotrauma
}
/*public void Update()
private void DrawSplashScreen(SpriteBatch spriteBatch)
{
if (Hull.renderer != null)
if (videoPlayer == null)
{
Hull.renderer.ScrollWater();
videoPlayer = new VideoPlayer();
videoPlayer.Play(splashScreenVideo);
}
}*/
else
{
Texture2D videoTexture = null;
if (videoPlayer.State == MediaState.Stopped)
{
videoPlayer.Dispose();
videoPlayer = null;
splashScreenVideo.Dispose();
splashScreenVideo = null;
}
else
{
videoTexture = videoPlayer.GetTexture();
spriteBatch.Begin();
spriteBatch.Draw(videoTexture, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.White);
spriteBatch.End();
if (PlayerInput.KeyHit(Keys.Space) || PlayerInput.KeyHit(Keys.Enter) || PlayerInput.LeftButtonDown())
{
videoPlayer.Stop();
}
}
}
}
bool drawn;
public IEnumerable<object> DoLoading(IEnumerable<object> loader)
{