Fixed EndGame not working properly + Fixed exception when clients disconnected during a round
This commit is contained in:
@@ -50,7 +50,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public override void Select()
|
public override void Select()
|
||||||
{
|
{
|
||||||
|
base.Select();
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Submarine> subs;
|
private List<Submarine> subs;
|
||||||
|
|||||||
@@ -692,6 +692,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public void ClearInputs()
|
public void ClearInputs()
|
||||||
{
|
{
|
||||||
|
if (keys == null) return;
|
||||||
foreach (Key key in keys)
|
foreach (Key key in keys)
|
||||||
{
|
{
|
||||||
key.Hit = false;
|
key.Hit = false;
|
||||||
|
|||||||
@@ -33,10 +33,46 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public static List<ColoredText> Messages = new List<ColoredText>();
|
public static List<ColoredText> Messages = new List<ColoredText>();
|
||||||
|
|
||||||
|
private static string[] SplitCommand(string command)
|
||||||
|
{
|
||||||
|
command = command.Trim();
|
||||||
|
|
||||||
|
List<string> commands = new List<string>();
|
||||||
|
int escape = 0;
|
||||||
|
bool inQuotes = false;
|
||||||
|
string piece = "";
|
||||||
|
|
||||||
|
for (int i=0;i<command.Length;i++)
|
||||||
|
{
|
||||||
|
if (command[i] == '\\')
|
||||||
|
{
|
||||||
|
if (escape == 0) escape = 2;
|
||||||
|
else piece += '\\';
|
||||||
|
}
|
||||||
|
else if (command[i] == '"')
|
||||||
|
{
|
||||||
|
if (escape == 0) inQuotes = !inQuotes;
|
||||||
|
else piece += '"';
|
||||||
|
}
|
||||||
|
else if (command[i] == ' ' && !inQuotes)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(piece)) commands.Add(piece);
|
||||||
|
piece = "";
|
||||||
|
}
|
||||||
|
else if (escape == 0) piece += command[i];
|
||||||
|
|
||||||
|
if (escape > 0) escape--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(piece)) commands.Add(piece); //add final piece
|
||||||
|
|
||||||
|
return commands.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
public static void ExecuteCommand(string command, GameMain game)
|
public static void ExecuteCommand(string command, GameMain game)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(command)) return;
|
if (string.IsNullOrWhiteSpace(command)) return;
|
||||||
string[] commands = command.Split(' ');
|
string[] commands = SplitCommand(command);
|
||||||
|
|
||||||
if (!commands[0].ToLowerInvariant().Equals("admin"))
|
if (!commands[0].ToLowerInvariant().Equals("admin"))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -82,14 +82,12 @@ namespace Barotrauma
|
|||||||
cam.Zoom = Math.Max(0.2f, cam.Zoom - CoroutineManager.UnscaledDeltaTime * 0.1f);
|
cam.Zoom = Math.Max(0.2f, cam.Zoom - CoroutineManager.UnscaledDeltaTime * 0.1f);
|
||||||
|
|
||||||
Vector2 cameraPos = subs.First().Position + Submarine.MainSub.HiddenSubPosition;
|
Vector2 cameraPos = subs.First().Position + Submarine.MainSub.HiddenSubPosition;
|
||||||
cameraPos.Y = Math.Min(cameraPos.Y, ConvertUnits.ToDisplayUnits(Level.Loaded.ShaftBody.Position.Y) - cam.WorldView.Height/2.0f);
|
cameraPos.Y = Math.Min(cameraPos.Y, ConvertUnits.ToDisplayUnits(Level.Loaded.ShaftBody.Position.Y) - cam.WorldView.Height / 2.0f);
|
||||||
|
cam.Translate((cameraPos - cam.Position) * CoroutineManager.UnscaledDeltaTime * 10.0f);
|
||||||
#if CLIENT
|
#if CLIENT
|
||||||
GUI.ScreenOverlayColor = Color.Lerp(Color.TransparentBlack, Color.Black, timer/duration);
|
GUI.ScreenOverlayColor = Color.Lerp(Color.TransparentBlack, Color.Black, timer/duration);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
cam.Translate((cameraPos - cam.Position) * CoroutineManager.UnscaledDeltaTime*10.0f);
|
|
||||||
|
|
||||||
foreach (Submarine sub in subs)
|
foreach (Submarine sub in subs)
|
||||||
{
|
{
|
||||||
if (sub.Position == targetPos) continue;
|
if (sub.Position == targetPos) continue;
|
||||||
|
|||||||
@@ -1383,16 +1383,14 @@ namespace Barotrauma.Networking
|
|||||||
float endPreviewLength = 10.0f;
|
float endPreviewLength = 10.0f;
|
||||||
|
|
||||||
var cinematic = new TransitionCinematic(Submarine.MainSub, GameMain.GameScreen.Cam, endPreviewLength);
|
var cinematic = new TransitionCinematic(Submarine.MainSub, GameMain.GameScreen.Cam, endPreviewLength);
|
||||||
|
//float secondsLeft = endPreviewLength;
|
||||||
new TransitionCinematic(Submarine.MainSub, GameMain.GameScreen.Cam, endPreviewLength);
|
|
||||||
float secondsLeft = endPreviewLength;
|
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
secondsLeft -= CoroutineManager.UnscaledDeltaTime;
|
//secondsLeft -= CoroutineManager.UnscaledDeltaTime;
|
||||||
|
|
||||||
yield return CoroutineStatus.Running;
|
yield return CoroutineStatus.Running;
|
||||||
} while (secondsLeft > 0.0f);
|
} while (cinematic.Running);//(secondsLeft > 0.0f);
|
||||||
|
|
||||||
Submarine.Unload();
|
Submarine.Unload();
|
||||||
entityEventManager.Clear();
|
entityEventManager.Clear();
|
||||||
|
|||||||
Reference in New Issue
Block a user