(f417b026f) Fetched: Changes for playing video tutorial from local branch
This commit is contained in:
@@ -132,7 +132,6 @@ namespace Barotrauma.Networking
|
||||
var buttonContainer = new GUILayoutGroup(HUDLayoutSettings.ToRectTransform(HUDLayoutSettings.ButtonAreaTop, inGameHUD.RectTransform),
|
||||
isHorizontal: true, childAnchor: Anchor.CenterRight)
|
||||
{
|
||||
AbsoluteSpacing = 5,
|
||||
CanBeFocused = false
|
||||
};
|
||||
|
||||
@@ -141,32 +140,16 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
OnClicked = (btn, userdata) =>
|
||||
{
|
||||
if (!permissions.HasFlag(ClientPermissions.ManageRound)) { return false; }
|
||||
if (!Submarine.MainSub.AtStartPosition && !Submarine.MainSub.AtEndPosition)
|
||||
{
|
||||
var msgBox = new GUIMessageBox("", TextManager.Get("EndRoundSubNotAtLevelEnd"),
|
||||
new string[] { TextManager.Get("Yes"), TextManager.Get("No") });
|
||||
msgBox.Buttons[0].OnClicked = (_, __) =>
|
||||
{
|
||||
GameMain.Client.RequestRoundEnd();
|
||||
return true;
|
||||
};
|
||||
msgBox.Buttons[0].OnClicked += msgBox.Close;
|
||||
msgBox.Buttons[1].OnClicked += msgBox.Close;
|
||||
}
|
||||
else
|
||||
{
|
||||
RequestRoundEnd();
|
||||
}
|
||||
if (!permissions.HasFlag(ClientPermissions.ManageRound)) return false;
|
||||
RequestRoundEnd();
|
||||
return true;
|
||||
},
|
||||
Visible = false
|
||||
};
|
||||
|
||||
EndVoteTickBox = new GUITickBox(new RectTransform(new Vector2(0.1f, 0.4f), buttonContainer.RectTransform) { MinSize = new Point(150, 0) },
|
||||
EndVoteTickBox = new GUITickBox(new RectTransform(new Vector2(0.1f, 0.6f), buttonContainer.RectTransform) { MinSize = new Point(150, 0) },
|
||||
TextManager.Get("EndRound"))
|
||||
{
|
||||
UserData = TextManager.Get("EndRound"),
|
||||
OnSelected = ToggleEndRoundVote,
|
||||
Visible = false
|
||||
};
|
||||
@@ -340,17 +323,18 @@ namespace Barotrauma.Networking
|
||||
|
||||
// Loop until we are approved
|
||||
//TODO: show the name of the server instead of IP when connecting through the server list (more streamer-friendly)
|
||||
string connectingText = TextManager.Get("Connecting");
|
||||
string connectingText = TextManager.Get("ConnectingTo").Replace("[serverip]", serverIP);
|
||||
while (!CanStart && !connectCancelled)
|
||||
{
|
||||
if (reconnectBox == null)
|
||||
{
|
||||
reconnectBox = new GUIMessageBox(connectingText, TextManager.Get("ConnectingTo").Replace("[serverip]", serverIP), new string[] { TextManager.Get("Cancel") });
|
||||
reconnectBox = new GUIMessageBox(TextManager.Get("Connecting"), connectingText, new string[] { TextManager.Get("Cancel") });
|
||||
|
||||
reconnectBox.Buttons[0].OnClicked += CancelConnect;
|
||||
reconnectBox.Buttons[0].OnClicked += reconnectBox.Close;
|
||||
}
|
||||
|
||||
reconnectBox.Header.Text = connectingText + new string('.', ((int)Timing.TotalTime % 3 + 1));
|
||||
reconnectBox.Text.Text = connectingText + new string('.', ((int)Timing.TotalTime % 3 + 1));
|
||||
|
||||
if (DateTime.Now > reqAuthTime)
|
||||
{
|
||||
@@ -637,7 +621,7 @@ namespace Barotrauma.Networking
|
||||
|
||||
if (gameStarted) SetRadioButtonColor();
|
||||
|
||||
if (ShowNetStats && client?.ServerConnection != null)
|
||||
if (ShowNetStats)
|
||||
{
|
||||
netStats.AddValue(NetStats.NetStatType.ReceivedBytes, client.ServerConnection.Statistics.ReceivedBytes);
|
||||
netStats.AddValue(NetStats.NetStatType.SentBytes, client.ServerConnection.Statistics.SentBytes);
|
||||
@@ -798,7 +782,7 @@ namespace Barotrauma.Networking
|
||||
saveFiles.Add(inc.ReadString());
|
||||
}
|
||||
|
||||
GameMain.NetLobbyScreen.CampaignSetupUI = MultiPlayerCampaign.StartCampaignSetup(serverSubmarines, saveFiles);
|
||||
GameMain.NetLobbyScreen.CampaignSetupUI = MultiPlayerCampaign.StartCampaignSetup(saveFiles);
|
||||
break;
|
||||
case ServerPacketHeader.PERMISSIONS:
|
||||
ReadPermissions(inc);
|
||||
@@ -851,8 +835,6 @@ namespace Barotrauma.Networking
|
||||
DisconnectReason disconnectReason = DisconnectReason.Unknown;
|
||||
if (splitMsg.Length > 0) Enum.TryParse(splitMsg[0], out disconnectReason);
|
||||
|
||||
DebugConsole.NewMessage("Received a disconnect message (" + disconnectMsg + ")");
|
||||
|
||||
if (disconnectReason == DisconnectReason.ServerFull)
|
||||
{
|
||||
//already waiting for a slot to free up, do nothing
|
||||
@@ -882,6 +864,14 @@ namespace Barotrauma.Networking
|
||||
waitInServerQueueBox = null;
|
||||
CoroutineManager.StopCoroutines("WaitInServerQueue");
|
||||
}
|
||||
else
|
||||
{
|
||||
//disconnected/denied for some other reason than the server being full
|
||||
// -> stop queuing and show a message box
|
||||
waitInServerQueueBox?.Close();
|
||||
waitInServerQueueBox = null;
|
||||
CoroutineManager.StopCoroutines("WaitInServerQueue");
|
||||
}
|
||||
|
||||
if (allowReconnect && disconnectReason == DisconnectReason.Unknown)
|
||||
{
|
||||
@@ -911,6 +901,25 @@ namespace Barotrauma.Networking
|
||||
DebugConsole.NewMessage("Do not attempt to reconnect (DisconnectReason doesn't allow reconnection).");
|
||||
msg = TextManager.Get("DisconnectReason." + disconnectReason.ToString());
|
||||
|
||||
if (allowReconnect && disconnectReason == DisconnectReason.Unknown)
|
||||
{
|
||||
reconnectBox = new GUIMessageBox(
|
||||
TextManager.Get("ConnectionLost"),
|
||||
TextManager.Get("ConnectionLostReconnecting"), new string[0]);
|
||||
connected = false;
|
||||
ConnectToServer(serverIP);
|
||||
}
|
||||
else
|
||||
{
|
||||
string msg = "";
|
||||
if (disconnectReason == DisconnectReason.Unknown)
|
||||
{
|
||||
msg = disconnectMsg;
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = TextManager.Get("DisconnectReason." + disconnectReason.ToString());
|
||||
|
||||
for (int i = 1; i < splitMsg.Length; i++)
|
||||
{
|
||||
msg += TextManager.GetServerMessage(splitMsg[i]);
|
||||
@@ -1048,10 +1057,9 @@ namespace Barotrauma.Networking
|
||||
|
||||
EndVoteTickBox.Selected = false;
|
||||
|
||||
int seed = inc.ReadInt32();
|
||||
string levelSeed = inc.ReadString();
|
||||
int levelEqualityCheckVal = inc.ReadInt32();
|
||||
float levelDifficulty = inc.ReadFloat();
|
||||
int seed = inc.ReadInt32();
|
||||
string levelSeed = inc.ReadString();
|
||||
float levelDifficulty = inc.ReadFloat();
|
||||
|
||||
byte losMode = inc.ReadByte();
|
||||
|
||||
@@ -1120,15 +1128,6 @@ namespace Barotrauma.Networking
|
||||
mirrorLevel: campaign.Map.CurrentLocation != campaign.Map.SelectedConnection.Locations[0]);
|
||||
}
|
||||
|
||||
if (Level.Loaded.EqualityCheckVal != levelEqualityCheckVal)
|
||||
{
|
||||
string errorMsg = "Level equality check failed. The level generated at your end doesn't match the level generated by the server (seed " + Level.Loaded.Seed + ").";
|
||||
DebugConsole.ThrowError(errorMsg, createMessageBox: true);
|
||||
GameAnalyticsManager.AddErrorEventOnce("GameClient.StartGame:LevelsDontMatch" + levelSeed, GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
|
||||
CoroutineManager.StartCoroutine(EndGame(""));
|
||||
yield return CoroutineStatus.Failure;
|
||||
}
|
||||
|
||||
if (respawnAllowed) respawnManager = new RespawnManager(this, GameMain.NetLobbyScreen.UsingShuttle ? GameMain.NetLobbyScreen.SelectedShuttle : null);
|
||||
|
||||
gameStarted = true;
|
||||
@@ -1198,8 +1197,8 @@ namespace Barotrauma.Networking
|
||||
}
|
||||
}
|
||||
|
||||
GameMain.NetLobbyScreen.UpdateSubList(GameMain.NetLobbyScreen.SubList, serverSubmarines);
|
||||
GameMain.NetLobbyScreen.UpdateSubList(GameMain.NetLobbyScreen.ShuttleList.ListBox, serverSubmarines);
|
||||
GameMain.NetLobbyScreen.UpdateSubList(GameMain.NetLobbyScreen.SubList, submarines);
|
||||
GameMain.NetLobbyScreen.UpdateSubList(GameMain.NetLobbyScreen.ShuttleList.ListBox, submarines);
|
||||
|
||||
gameStarted = inc.ReadBoolean();
|
||||
bool allowSpectating = inc.ReadBoolean();
|
||||
@@ -1392,6 +1391,9 @@ namespace Barotrauma.Networking
|
||||
case ServerNetObject.CLIENT_LIST:
|
||||
ReadClientList(inc);
|
||||
break;
|
||||
case ServerNetObject.CLIENT_LIST:
|
||||
ReadClientList(inc);
|
||||
break;
|
||||
case ServerNetObject.CHAT_MESSAGE:
|
||||
ChatMessage.ClientRead(inc);
|
||||
break;
|
||||
@@ -1715,8 +1717,6 @@ namespace Barotrauma.Networking
|
||||
|
||||
SaveUtil.LoadGame(GameMain.GameSession.SavePath, GameMain.GameSession);
|
||||
campaign.LastSaveID = campaign.PendingSaveID;
|
||||
|
||||
DebugConsole.Log("Campaign save received, save ID " + campaign.LastSaveID);
|
||||
//decrement campaign update ID so the server will send us the latest data
|
||||
//(as there may have been campaign updates after the save file was created)
|
||||
campaign.LastUpdateID--;
|
||||
@@ -1734,7 +1734,7 @@ namespace Barotrauma.Networking
|
||||
|
||||
public override void CreateEntityEvent(INetSerializable entity, object[] extraData)
|
||||
{
|
||||
if (!(entity is IClientSerializable)) throw new InvalidCastException("Entity is not IClientSerializable");
|
||||
if (!(entity is IClientSerializable)) throw new InvalidCastException("entity is not IClientSerializable");
|
||||
entityEventManager.CreateEvent(entity as IClientSerializable, extraData);
|
||||
}
|
||||
|
||||
@@ -2003,8 +2003,7 @@ namespace Barotrauma.Networking
|
||||
msg.Write(true); msg.WritePadBits();
|
||||
msg.Write(savePath);
|
||||
msg.Write(mapSeed);
|
||||
msg.Write(sub.Name);
|
||||
msg.Write(sub.MD5Hash.Hash);
|
||||
msg.Write(sub.FilePath);
|
||||
|
||||
client.SendMessage(msg, NetDeliveryMethod.ReliableUnordered);
|
||||
|
||||
@@ -2242,25 +2241,13 @@ namespace Barotrauma.Networking
|
||||
|
||||
if (EndVoteCount > 0)
|
||||
{
|
||||
if (EndVoteTickBox.Visible)
|
||||
{
|
||||
EndVoteTickBox.Text =
|
||||
(EndVoteTickBox.UserData as string) + " " + EndVoteCount + "/" + EndVoteMax;
|
||||
}
|
||||
else
|
||||
{
|
||||
string endVoteText = TextManager.Get("EndRoundVotes")
|
||||
.Replace("[votes]", EndVoteCount.ToString())
|
||||
.Replace("[max]", EndVoteMax.ToString());
|
||||
GUI.DrawString(spriteBatch, EndVoteTickBox.Rect.Center.ToVector2() - GUI.SmallFont.MeasureString(endVoteText) / 2,
|
||||
endVoteText,
|
||||
Color.White,
|
||||
font: GUI.SmallFont);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
EndVoteTickBox.Text = EndVoteTickBox.UserData as string;
|
||||
string endVoteText = TextManager.Get("EndRoundVotes")
|
||||
.Replace("[y]", EndVoteCount.ToString())
|
||||
.Replace("[n]", (EndVoteMax - EndVoteCount).ToString());
|
||||
GUI.DrawString(spriteBatch, new Vector2(GameMain.GraphicsWidth - 10.0f - GUI.SmallFont.MeasureString(endVoteText).X, 40),
|
||||
endVoteText,
|
||||
Color.White,
|
||||
font: GUI.SmallFont);
|
||||
}
|
||||
|
||||
if (respawnManager != null)
|
||||
|
||||
Reference in New Issue
Block a user