(99feac023) Unstable 0.9.704.0

This commit is contained in:
Joonas Rikkonen
2020-02-07 20:47:03 +02:00
parent 590619459b
commit 6754b9d5a2
104 changed files with 2224 additions and 1091 deletions
@@ -307,6 +307,8 @@ namespace Barotrauma.Networking
Status = FileTransferStatus.Finished,
FileSize = 0
};
Md5Hash.RemoveFromCache(directTransfer.FilePath);
OnFinished(directTransfer);
}
break;
@@ -376,6 +378,7 @@ namespace Barotrauma.Networking
{
finishedTransfers.Add(new Pair<int, double>(transferId, Timing.TotalTime));
StopTransfer(activeTransfer);
Md5Hash.RemoveFromCache(activeTransfer.FilePath);
OnFinished(activeTransfer);
}
else
@@ -364,15 +364,7 @@ namespace Barotrauma.Networking
updateInterval = new TimeSpan(0, 0, 0, 0, 150);
CoroutineManager.StartCoroutine(WaitForStartingInfo(), "WaitForStartingInfo");
}
private bool RetryConnection(GUIButton button, object obj)
{
if (clientPeer != null) { clientPeer.Close(); }
clientPeer = null;
ConnectToServer(serverEndpoint, serverName);
return true;
}
}
private bool ReturnToPreviousMenu(GUIButton button, object obj)
{
@@ -850,13 +842,14 @@ namespace Barotrauma.Networking
disconnectReason == DisconnectReason.ExcessiveDesyncOldEvent ||
disconnectReason == DisconnectReason.ExcessiveDesyncRemovedEvent ||
disconnectReason == DisconnectReason.SyncTimeout;
if (allowReconnect &&
(disconnectReason == DisconnectReason.Unknown || eventSyncError))
{
if (eventSyncError)
{
GameMain.NetLobbyScreen.Select();
GameMain.GameSession?.EndRound("");
gameStarted = false;
myCharacter = null;
}
@@ -1244,6 +1237,8 @@ namespace Barotrauma.Networking
mirrorLevel: campaign.Map.CurrentLocation != campaign.Map.SelectedConnection.Locations[0]);
}
GameMain.GameSession.Mission?.ClientReadInitial(inc);
if (GameMain.GameSession.Submarine.IsFileCorrupted)
{
DebugConsole.ThrowError($"Failed to start a round. Could not load the submarine \"{GameMain.GameSession.Submarine.Name}\".");
@@ -1635,9 +1630,9 @@ namespace Barotrauma.Networking
break;
case ServerNetObject.ENTITY_POSITION:
UInt16 id = inc.ReadUInt16();
byte msgLength = inc.ReadByte();
uint msgLength = inc.ReadVariableUInt32();
int msgEndPos = inc.BitPosition + msgLength * 8;
int msgEndPos = (int)(inc.BitPosition + msgLength * 8);
var entity = Entity.FindEntityByID(id) as IServerSerializable;
if (entity != null)
@@ -2367,9 +2362,14 @@ namespace Barotrauma.Networking
{
textBox.Deselect();
}
textBox.Text = "";
if (ChatBox.CloseAfterMessageSent)
{
ChatBox.ToggleOpen = false;
ChatBox.CloseAfterMessageSent = false;
}
return true;
}
@@ -2443,13 +2443,16 @@ namespace Barotrauma.Networking
{
msgBox.AddToGUIUpdateList();
ChatBox.GUIFrame.Flash(Color.DarkGreen, 0.5f);
ChatBox.CloseAfterMessageSent = !ChatBox.ToggleOpen;
ChatBox.ToggleOpen = true;
ChatBox.CloseAfterMessageSent = !ChatBox.ToggleOpen;
}
if (radioKeyHit)
{
msgBox.AddToGUIUpdateList();
ChatBox.GUIFrame.Flash(Color.YellowGreen, 0.5f);
ChatBox.CloseAfterMessageSent = !ChatBox.ToggleOpen;
ChatBox.ToggleOpen = true;
if (!msgBox.Text.StartsWith(ChatBox.RadioChatString))
{
@@ -195,7 +195,10 @@ namespace Barotrauma.Networking
new GUIFrame(new RectTransform(new Vector2(1.0f, 0.025f), content.RectTransform), style: null);
var serverMsg = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.3f), content.RectTransform)) { ScrollBarVisible = true };
var msgText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), serverMsg.Content.RectTransform), ServerMessage, font: GUI.SmallFont, wrap: true) { CanBeFocused = true };
var msgText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), serverMsg.Content.RectTransform), ServerMessage, font: GUI.SmallFont, wrap: true)
{
CanBeFocused = false
};
serverMsg.Content.RectTransform.SizeChanged += () => { msgText.CalculateHeightFromText(); };
msgText.RectTransform.SizeChanged += () => { serverMsg.UpdateScrollBarSize(); };
@@ -2,6 +2,7 @@
using Microsoft.Xna.Framework;
using System.Collections.Generic;
using System.Linq;
using Barotrauma.Extensions;
namespace Barotrauma
{
@@ -35,12 +36,13 @@ namespace Barotrauma
GameMain.NetLobbyScreen.Frame.FindChild("modevotes", true).Visible = value;
//gray out modes that can't be voted
foreach (GUITextBlock comp in GameMain.NetLobbyScreen.ModeList.Content.Children)
// Disable modes that cannot be voted on
foreach (var guiComponent in GameMain.NetLobbyScreen.ModeList.Content.Children)
{
comp.TextColor =
new Color(comp.TextColor.R, comp.TextColor.G, comp.TextColor.B,
!allowModeVoting || ((GameModePreset)comp.UserData).Votable ? (byte)255 : (byte)100);
if (guiComponent is GUIFrame frame)
{
frame.CanBeFocused = !allowModeVoting || ((GameModePreset) frame.UserData).Votable;
}
}
UpdateVoteTexts(null, VoteType.Mode);