Fade in when shift starts, fixed fadeout canceling before screen is switched to lobby
This commit is contained in:
@@ -182,9 +182,6 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
GUI.Init(Content);
|
GUI.Init(Content);
|
||||||
|
|
||||||
sw = new Stopwatch();
|
|
||||||
|
|
||||||
|
|
||||||
GUIComponent.Init(Window);
|
GUIComponent.Init(Window);
|
||||||
DebugConsole.Init(Window);
|
DebugConsole.Init(Window);
|
||||||
yield return CoroutineStatus.Running;
|
yield return CoroutineStatus.Running;
|
||||||
@@ -338,11 +335,8 @@ namespace Barotrauma
|
|||||||
//{
|
//{
|
||||||
// System.Threading.Thread.Sleep((int)((Physics.step - elapsed) * 1000.0));
|
// System.Threading.Thread.Sleep((int)((Physics.step - elapsed) * 1000.0));
|
||||||
//}
|
//}
|
||||||
sw.Restart();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Stopwatch sw;
|
|
||||||
|
|
||||||
static bool waitForKeyHit = true;
|
static bool waitForKeyHit = true;
|
||||||
public static void ShowLoading(IEnumerable<object> loader, bool waitKeyHit = true)
|
public static void ShowLoading(IEnumerable<object> loader, bool waitKeyHit = true)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ namespace Barotrauma
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
return currentMission;
|
return currentMission;
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,6 +136,8 @@ namespace Barotrauma
|
|||||||
if (gameMode!=null) gameMode.Start();
|
if (gameMode!=null) gameMode.Start();
|
||||||
|
|
||||||
TaskManager.StartShift(level);
|
TaskManager.StartShift(level);
|
||||||
|
|
||||||
|
GameMain.GameScreen.ColorFade(Color.Black, Color.TransparentBlack, 5.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EndShift(string endMessage)
|
public void EndShift(string endMessage)
|
||||||
|
|||||||
@@ -54,6 +54,14 @@ namespace Barotrauma
|
|||||||
|
|
||||||
while (timer < duration)
|
while (timer < duration)
|
||||||
{
|
{
|
||||||
|
if (Screen.Selected != GameMain.GameScreen)
|
||||||
|
{
|
||||||
|
yield return new WaitForSeconds(0.1f);
|
||||||
|
|
||||||
|
GUI.ScreenOverlayColor = Color.TransparentBlack;
|
||||||
|
yield return CoroutineStatus.Success;
|
||||||
|
}
|
||||||
|
|
||||||
cam.Zoom = Math.Max(0.2f, cam.Zoom - CoroutineManager.DeltaTime * 0.1f);
|
cam.Zoom = Math.Max(0.2f, cam.Zoom - CoroutineManager.DeltaTime * 0.1f);
|
||||||
|
|
||||||
Vector2 cameraPos = sub.Position + Submarine.HiddenSubPosition;
|
Vector2 cameraPos = sub.Position + Submarine.HiddenSubPosition;
|
||||||
@@ -73,10 +81,12 @@ namespace Barotrauma
|
|||||||
yield return CoroutineStatus.Running;
|
yield return CoroutineStatus.Running;
|
||||||
}
|
}
|
||||||
|
|
||||||
GUI.ScreenOverlayColor = Color.TransparentBlack;
|
|
||||||
|
|
||||||
Running = false;
|
Running = false;
|
||||||
|
|
||||||
|
yield return new WaitForSeconds(0.1f);
|
||||||
|
|
||||||
|
GUI.ScreenOverlayColor = Color.TransparentBlack;
|
||||||
|
|
||||||
yield return CoroutineStatus.Success;
|
yield return CoroutineStatus.Success;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -168,8 +168,6 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
base.Select();
|
base.Select();
|
||||||
|
|
||||||
GUI.ScreenOverlayColor = Color.Transparent;
|
|
||||||
|
|
||||||
gameMode = GameMain.GameSession.gameMode as SinglePlayerMode;
|
gameMode = GameMain.GameSession.gameMode as SinglePlayerMode;
|
||||||
|
|
||||||
foreach (GUIComponent component in topPanel.children)
|
foreach (GUIComponent component in topPanel.children)
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Barotrauma
|
namespace Barotrauma
|
||||||
{
|
{
|
||||||
@@ -20,8 +22,6 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (selected != null && selected!=this) selected.Deselect();
|
if (selected != null && selected!=this) selected.Deselect();
|
||||||
selected = this;
|
selected = this;
|
||||||
|
|
||||||
GUI.ScreenOverlayColor = Color.Transparent;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Update(double deltaTime)
|
public virtual void Update(double deltaTime)
|
||||||
@@ -32,5 +32,36 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ColorFade(Color from, Color to, float duration)
|
||||||
|
{
|
||||||
|
if (duration <= 0.0f) return;
|
||||||
|
|
||||||
|
CoroutineManager.StartCoroutine(UpdateColorFade(from, to, duration));
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerable<object> UpdateColorFade(Color from, Color to, float duration)
|
||||||
|
{
|
||||||
|
while (Screen.Selected != this)
|
||||||
|
{
|
||||||
|
yield return CoroutineStatus.Running;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float timer = 0.0f;
|
||||||
|
|
||||||
|
while (timer < duration)
|
||||||
|
{
|
||||||
|
GUI.ScreenOverlayColor = Color.Lerp(from, to, Math.Min(timer / duration, 1.0f));
|
||||||
|
|
||||||
|
timer += CoroutineManager.DeltaTime;
|
||||||
|
|
||||||
|
yield return CoroutineStatus.Running;
|
||||||
|
}
|
||||||
|
|
||||||
|
GUI.ScreenOverlayColor = to;
|
||||||
|
|
||||||
|
yield return CoroutineStatus.Success;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user