Sync sub selection
This commit is contained in:
@@ -529,34 +529,40 @@ namespace Barotrauma.Networking
|
|||||||
case ServerNetObject.SYNC_IDS:
|
case ServerNetObject.SYNC_IDS:
|
||||||
bool lobbyUpdated = inc.ReadBoolean();
|
bool lobbyUpdated = inc.ReadBoolean();
|
||||||
inc.ReadPadBits();
|
inc.ReadPadBits();
|
||||||
if (lobbyUpdated)
|
if (lobbyUpdated)
|
||||||
{
|
{
|
||||||
GameMain.NetLobbyScreen.LastUpdateID = inc.ReadUInt32();
|
GameMain.NetLobbyScreen.LastUpdateID = inc.ReadUInt32();
|
||||||
GameMain.NetLobbyScreen.ServerName = inc.ReadString();
|
GameMain.NetLobbyScreen.ServerName = inc.ReadString();
|
||||||
GameMain.NetLobbyScreen.ServerMessage = inc.ReadString();
|
GameMain.NetLobbyScreen.ServerMessage = inc.ReadString();
|
||||||
|
|
||||||
UInt16 subListCount = inc.ReadUInt16();
|
UInt16 subListCount = inc.ReadUInt16();
|
||||||
if (subListCount > 0)
|
if (subListCount > 0)
|
||||||
{
|
{
|
||||||
List<Submarine> submarines = new List<Submarine>();
|
List<Submarine> submarines = new List<Submarine>();
|
||||||
for (int i = 0; i < subListCount; i++)
|
for (int i = 0; i < subListCount; i++)
|
||||||
{
|
{
|
||||||
string subName = inc.ReadString();
|
string subName = inc.ReadString();
|
||||||
string subHash = inc.ReadString();
|
string subHash = inc.ReadString();
|
||||||
|
|
||||||
var matchingSub = Submarine.SavedSubmarines.Find(s => s.Name == subName);
|
var matchingSub = Submarine.SavedSubmarines.Find(s => s.Name == subName);
|
||||||
if (matchingSub != null)
|
if (matchingSub != null)
|
||||||
{
|
{
|
||||||
submarines.Add(matchingSub);
|
submarines.Add(matchingSub);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
submarines.Add(new Submarine(Path.Combine(Submarine.SavePath, subName), subHash, false));
|
submarines.Add(new Submarine(Path.Combine(Submarine.SavePath, subName), subHash, false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GameMain.NetLobbyScreen.UpdateSubList(GameMain.NetLobbyScreen.SubList, submarines);
|
GameMain.NetLobbyScreen.UpdateSubList(GameMain.NetLobbyScreen.SubList, submarines);
|
||||||
GameMain.NetLobbyScreen.UpdateSubList(GameMain.NetLobbyScreen.ShuttleList.ListBox, submarines);
|
GameMain.NetLobbyScreen.UpdateSubList(GameMain.NetLobbyScreen.ShuttleList.ListBox, submarines);
|
||||||
}
|
}
|
||||||
|
string selectSubName = inc.ReadString();
|
||||||
|
string selectSubHash = inc.ReadString();
|
||||||
|
GameMain.NetLobbyScreen.TrySelectSub(selectSubName, selectSubHash, GameMain.NetLobbyScreen.SubList);
|
||||||
|
string selectShuttleName = inc.ReadString();
|
||||||
|
string selectShuttleHash = inc.ReadString();
|
||||||
|
GameMain.NetLobbyScreen.TrySelectSub(selectShuttleName, selectShuttleHash, GameMain.NetLobbyScreen.ShuttleList.ListBox);
|
||||||
}
|
}
|
||||||
lastRecvChatMsgID = inc.ReadUInt32();
|
lastRecvChatMsgID = inc.ReadUInt32();
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -622,9 +622,9 @@ namespace Barotrauma.Networking
|
|||||||
outmsg.Write(GameMain.NetLobbyScreen.LastUpdateID);
|
outmsg.Write(GameMain.NetLobbyScreen.LastUpdateID);
|
||||||
outmsg.Write(GameMain.NetLobbyScreen.GetServerName());
|
outmsg.Write(GameMain.NetLobbyScreen.GetServerName());
|
||||||
outmsg.Write(GameMain.NetLobbyScreen.ServerMessage);
|
outmsg.Write(GameMain.NetLobbyScreen.ServerMessage);
|
||||||
|
var subList = GameMain.NetLobbyScreen.GetSubList();
|
||||||
if (c.lastRecvLobbyUpdate < 1)
|
if (c.lastRecvLobbyUpdate < 1)
|
||||||
{
|
{
|
||||||
var subList = GameMain.NetLobbyScreen.GetSubList();
|
|
||||||
outmsg.Write((UInt16)subList.Count);
|
outmsg.Write((UInt16)subList.Count);
|
||||||
for (int i = 0; i < subList.Count; i++)
|
for (int i = 0; i < subList.Count; i++)
|
||||||
{
|
{
|
||||||
@@ -636,6 +636,10 @@ namespace Barotrauma.Networking
|
|||||||
{
|
{
|
||||||
outmsg.Write((UInt16)0);
|
outmsg.Write((UInt16)0);
|
||||||
}
|
}
|
||||||
|
outmsg.Write((GameMain.NetLobbyScreen.SubList.SelectedData as Submarine).Name);
|
||||||
|
outmsg.Write((GameMain.NetLobbyScreen.SubList.SelectedData as Submarine).MD5Hash.ToString());
|
||||||
|
outmsg.Write((GameMain.NetLobbyScreen.ShuttleList.SelectedData as Submarine).Name);
|
||||||
|
outmsg.Write((GameMain.NetLobbyScreen.ShuttleList.SelectedData as Submarine).MD5Hash.ToString());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -812,8 +816,8 @@ namespace Barotrauma.Networking
|
|||||||
if (ban)
|
if (ban)
|
||||||
{
|
{
|
||||||
DisconnectClient(client, client.name + " has been banned from the server", "You have been banned from the server");
|
DisconnectClient(client, client.name + " has been banned from the server", "You have been banned from the server");
|
||||||
string ip = client.Connection.RemoteEndPoint.Address.ToString();
|
string ip = client.Connection.RemoteEndPoint.Address.ToString();
|
||||||
if (range) { ip = banList.ToRange(ip); }
|
if (range) { ip = banList.ToRange(ip); }
|
||||||
banList.BanPlayer(client.name, ip);
|
banList.BanPlayer(client.name, ip);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user